oracle-cloud-infrastructureoci-go-sdk

How to list fast connect names and not the providers names in OCI using GO SDK?


I am trying to list fastconnect names that are available for my VCN. The problem with ListFastConnectProviderServices is that it lists the names of providers rather than the names of created FastConnects services.

Here is my current code:-

func checkFastConnect(compId string) {
    provider := common.DefaultConfigProvider()
    client, err := core.NewVirtualNetworkClientWithConfigurationProvider(provider)
    helpers.FatalIfError(err)
    request := core.ListFastConnectProviderServicesRequest{
        CompartmentId: &compId,
    }
    resp, err := client.ListFastConnectProviderServices(context.Background(), request)
    helpers.FatalIfError(err)
    fmt.Println(resp)
}

Can someone please point me to correct API call or some reference where I can get FastConnects services that I created rather than providers name?

Thanks


Solution

  • Found answer to my own query. Actually the correct API is ListVirtualCircuitsRequest:-

    func checkFastConnect(compId string) {
        provider := common.DefaultConfigProvider()
        client, err := core.NewVirtualNetworkClientWithConfigurationProvider(provider)
        helpers.FatalIfError(err)
        request := core.ListVirtualCircuitsRequest{
            CompartmentId: &compId,
        }
        resp, err := client.ListVirtualCircuits(context.Background(), request)
        helpers.FatalIfError(err)
        fmt.Println(resp)
    }