如何在OCI中使用GO SDK列出快速连接名称而不是提供商名称?

huangapple go评论83阅读模式
英文:

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

问题

我正在尝试列出我的VCN可用的FastConnect名称。ListFastConnectProviderServices的问题在于它列出的是提供商的名称,而不是已创建的FastConnect服务的名称。

以下是我的当前代码:-

  1. func checkFastConnect(compId string) {
  2. provider := common.DefaultConfigProvider()
  3. client, err := core.NewVirtualNetworkClientWithConfigurationProvider(provider)
  4. helpers.FatalIfError(err)
  5. request := core.ListFastConnectProviderServicesRequest{
  6. CompartmentId: &compId,
  7. }
  8. resp, err := client.ListFastConnectProviderServices(context.Background(), request)
  9. helpers.FatalIfError(err)
  10. fmt.Println(resp)
  11. }

请问是否有人可以指导我正确的API调用方式或提供一些参考资料,以获取我创建的FastConnect服务的名称,而不是提供商的名称?

谢谢。

英文:

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:-

  1. func checkFastConnect(compId string) {
  2. provider := common.DefaultConfigProvider()
  3. client, err := core.NewVirtualNetworkClientWithConfigurationProvider(provider)
  4. helpers.FatalIfError(err)
  5. request := core.ListFastConnectProviderServicesRequest{
  6. CompartmentId: &compId,
  7. }
  8. resp, err := client.ListFastConnectProviderServices(context.Background(), request)
  9. helpers.FatalIfError(err)
  10. fmt.Println(resp)
  11. }

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

答案1

得分: 2

我找到了答案来回应我的问题。实际上,正确的 API 是 ListVirtualCircuitsRequest

  1. func checkFastConnect(compId string) {
  2. provider := common.DefaultConfigProvider()
  3. client, err := core.NewVirtualNetworkClientWithConfigurationProvider(provider)
  4. helpers.FatalIfError(err)
  5. request := core.ListVirtualCircuitsRequest{
  6. CompartmentId: &compId,
  7. }
  8. resp, err := client.ListVirtualCircuits(context.Background(), request)
  9. helpers.FatalIfError(err)
  10. fmt.Println(resp)
  11. }
英文:

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

  1. func checkFastConnect(compId string) {
  2. provider := common.DefaultConfigProvider()
  3. client, err := core.NewVirtualNetworkClientWithConfigurationProvider(provider)
  4. helpers.FatalIfError(err)
  5. request := core.ListVirtualCircuitsRequest{
  6. CompartmentId: &compId,
  7. }
  8. resp, err := client.ListVirtualCircuits(context.Background(), request)
  9. helpers.FatalIfError(err)
  10. fmt.Println(resp)
  11. }

huangapple
  • 本文由 发表于 2023年6月15日 13:46:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76479440.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定