Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is LoadBalancer.ListListeners a missing method? #69

Open
jbcintra opened this issue Jul 29, 2021 · 6 comments
Open

Is LoadBalancer.ListListeners a missing method? #69

jbcintra opened this issue Jul 29, 2021 · 6 comments
Labels
Load Balancing Issue pertains to the Load Balancing service

Comments

@jbcintra
Copy link

I'm just pulling lower content out of the Load Balancers to make it easier to then query & report, rather than having to traverse the complex JSON output of the object.

There is a ListListenerRules method with required parameters "LoadBalancerId" and "ListenerName", but there is no method to "ListListeners" (presumably by LoadBalancerId?

In C# I'm able to enumerate LoadBalancers, then process the Listeners property collection, just for most child objects there is an explicit method, rather than routing via the LB object.

I've looked in the CLI and it is the same setup, so not an API reference missed.

@github-anurag
Copy link
Member

Hi @jbcintra
Thanks for bringing this up. We will ask the Load Balancer team if they have an alternative API to do this otherwise we can raise an issue with them.

@github-anurag github-anurag added the Load Balancing Issue pertains to the Load Balancing service label Jul 29, 2021
@jbcintra
Copy link
Author

Hi @github-anurag , I've got code working for it, loading ListLoadBalancers, then enumerating them and their Listener properties, just it stood out as a possible gap whilst working through the child elements.

@github-anurag
Copy link
Member

@jbcintra
You can perhaps first use GetLoadBalancer with the Load Balancer OCID and then use the response object to get the Listener by its name from the dictionary of its Listeners. An example would be:-

using System;
using System.Threading.Tasks;
using Oci.LoadbalancerService;
using Oci.LoadbalancerService.Models;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Loadbalancer
{
    public class GetLoadBalancerExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
            var getLoadBalancerRequest = new Oci.LoadbalancerService.Requests.GetLoadBalancerRequest
            {
                LoadBalancerId = "ocid1.test.oc1..<unique_ID>EXAMPLE-loadBalancerId-Value",
            };

            // Create a default authentication provider that uses the DEFAULT
            // profile in the configuration file.
            // Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
            var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
            try
            {
                // Create a service client and send the request.
                using (var client = new LoadBalancerClient(provider, new ClientConfiguration()))
                {
                    var response = await client.GetLoadBalancer(getLoadBalancerRequest);
                    // Retrieve value from the response.
                    Listener listener = response.LoadBalancer.Listeners["listener_name"];
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"GetLoadBalancer Failed with {e.Message}");
                throw e;
            }
        }

    }
}

@jbcintra
Copy link
Author

Hi @github-anurag , I'm doing exactly that, but it stood out as a gap having I've implemented the following...

ListLoadBalancers(string compartmentId)
ListCertificates(string loadBalancerId)
ListBackendSets(string loadBalancerId)
ListBackends(string loadBalancerId, string backendSetName)
ListHostnames(string loadBalancerId)
ListListenerRules(string loadBalancerId, string listenerName) <-- nothing to load listeners here, other than from LB properties
ListListeners(string loadBalancerId)
ListLoadBalancerHealths(string compartmentId)
ListPathRouteSets(string loadBalancerId)
ListPolicies(string compartmentId)
ListProtocols(string compartmentId)
ListRoutingPolicies(string loadBalancerId)
ListRuleSets(string loadBalancerId)
ListShapes()
ListSSLCipherSuites(string loadBalancerId)

@KartikShrikantHegde
Copy link

KartikShrikantHegde commented May 19, 2023

Hi @jbcintra , I wanted to provide an update on this ticket. Load Balancer eng does not have plans or a roadmap for creating a list Listeners method for now. Their suggestion is to follow the current method you are using i.e to query the listener objects with getLoadBalancer method. I will keep the ticket open though.

@jbcintra
Copy link
Author

Hi @KartikShrikantHegde , thanks for that. It just stood out when working through all the APIs to audit. Happy for it to be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Load Balancing Issue pertains to the Load Balancing service
Projects
None yet
Development

No branches or pull requests

3 participants