opentelekomcloud / gophertelekomcloud

GopherTelekomCloud is an OpenTelekomCloud clouds Go SDK
Apache License 2.0
19 stars 9 forks source link

Service Client for VPC Service #626

Closed zeljkobekcic closed 5 months ago

zeljkobekcic commented 5 months ago

Hello,

is there a way to access the VPC service with the library? We could not find any and we had therefore to resort this solution.

vpcClient, err := openstack.NewVpcEpV1(c.providerClient, opts)
vpcClient.Endpoint = strings.Replace(vpcClient.Endpoint, "vpcep", "vpc", 1)
vpcClient.Endpoint = strings.Replace(vpcClient.Endpoint, fmt.Sprintf("%s/", projectId), "", 1)
vpcClient.ResourceBase = vpcClient.Endpoint

This can be found here: https://github.com/iits-consulting/otc-prometheus-exporter/blob/5c3a1e780f869b39e4e22d1a0423472b54bb3a51/internal/otc_wrapper.go#L242

I saw in the gophertelekomcloud@v0.8.0/openstack/client.go similar clients are created sometimes.

Thank you in advance.

artem-lifshits commented 5 months ago

Hello @zeljkobekcic you can use openstack.NewNetworkV1 to initiate vpc v1 client.

zeljkobekcic commented 5 months ago

Thank you very much, I will take a look into.