Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions openstack/client_extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,11 @@ func NewElasticLoadBalancer(client *golangsdk.ProviderClient, eo golangsdk.Endpo
return sc, err
}

//NewVpcServiceV1 creates the a ServiceClient that may be used to access the v1
//vpc service which is a service of public ip management of huawei cloud
func NewVpcServiceV1(client *golangsdk.ProviderClient, eo golangsdk.EndpointOpts) (*golangsdk.ServiceClient, error) {
// NewNetworkV1 creates a ServiceClient that may be used with the v1 network
// package.
func NewNetworkV1(client *golangsdk.ProviderClient, eo golangsdk.EndpointOpts) (*golangsdk.ServiceClient, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'd better bring this into correspondence with other VPC resource e.g. https://github.com/gator1/gophercloud/blob/master/openstack/client.go#L330:6

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, as we agreed to place all such resources under networking/v1 and the endpoint type is named 'network', so seems the client name here is better?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client name looks good to me, there are some difference of ResourceBase. how to deal with project id here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not all resources require a project id with the endpoint, we should just let themselves deal with it in their urls.go like https://github.com/huaweicloud/golangsdk/blob/master/openstack/vpc/v1/eips/urls.go#L9

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

sc, err := initClientOpts(client, eo, "network")
sc.ResourceBase = sc.Endpoint + "v1/"
return sc, err
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package bandwidths
import "github.com/huaweicloud/golangsdk"

const resourcePath = "bandwidths"
const apiVersion = "v1"

func resourceURL(client *golangsdk.ServiceClient, id string) string {
return client.ServiceURL(apiVersion, client.ProjectID, resourcePath, id)
return client.ServiceURL(client.ProjectID, resourcePath, id)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ package eips
import "github.com/huaweicloud/golangsdk"

const resourcePath = "publicips"
const apiVersion = "v1"

func rootURL(client *golangsdk.ServiceClient) string {
return client.ServiceURL(apiVersion, client.ProjectID, resourcePath)
return client.ServiceURL(client.ProjectID, resourcePath)
}

func resourceURL(client *golangsdk.ServiceClient, id string) string {
return client.ServiceURL(apiVersion, client.ProjectID, resourcePath, id)
return client.ServiceURL(client.ProjectID, resourcePath, id)
}