Skip to content

Commit

Permalink
Merge pull request Huawei#10 from tuotuobukaixin/master
Browse files Browse the repository at this point in the history
update new endpoint
  • Loading branch information
zzhaoy authored Mar 28, 2018
2 parents 4a057f0 + 6651b92 commit 523e7e2
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
8 changes: 4 additions & 4 deletions com/client/ecsClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
func (client *Client) CreateCloudServer(createCloudServerReq ecsModules.CreateCloudServerReq) ecsModules.CreateCloudServerResp {
createCloudServerResp := ecsModules.CreateCloudServerResp{}

client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/cloudservers"
client.RequestParam.Url = "https://ecs." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/cloudservers"
client.RequestParam.Method = modules.HTTP_POST
client.RequestParam.RequestContentType = modules.ApplicationJson
client.RequestParam.BodyContent = createCloudServerReq.GetBodyContent()
Expand All @@ -48,7 +48,7 @@ func (client *Client) CreateCloudServer(createCloudServerReq ecsModules.CreateCl
func (client *Client) DeleteCloudServer(deleteCloudServerReq ecsModules.DeleteCloudServerReq) ecsModules.DeleteCloudServerResp {
deleteCloudServerResp := ecsModules.DeleteCloudServerResp{}

client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/cloudservers/delete"
client.RequestParam.Url = "https://ecs." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/cloudservers/delete"
client.RequestParam.Method = modules.HTTP_POST
client.RequestParam.RequestContentType = modules.ApplicationJson
client.RequestParam.BodyContent = deleteCloudServerReq.GetBodyContent()
Expand All @@ -71,7 +71,7 @@ func (client *Client) DeleteCloudServer(deleteCloudServerReq ecsModules.DeleteCl
func (client *Client) ShowEcsJob(job_id string) ecsModules.ShowEcsJobResp {
showEcsJobResp := ecsModules.ShowEcsJobResp{}

client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/jobs/" + job_id
client.RequestParam.Url = "https://ecs." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/jobs/" + job_id
client.RequestParam.Method = modules.HTTP_GET
client.RequestParam.RequestContentType = modules.ApplicationJson
client.RequestParam.BodyContent = ""
Expand All @@ -94,7 +94,7 @@ func (client *Client) ShowEcsJob(job_id string) ecsModules.ShowEcsJobResp {
func (client *Client) ListCloudServerFlavorsExt() ecsModules.ListCloudServerFlavorsExtResp {
listCloudServerFlavorsExtResp := ecsModules.ListCloudServerFlavorsExtResp{}

client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/cloudservers/flavors"
client.RequestParam.Url = "https://ecs." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/cloudservers/flavors"
client.RequestParam.Method = modules.HTTP_GET
client.RequestParam.RequestContentType = modules.ApplicationJson
client.RequestParam.BodyContent = ""
Expand Down
2 changes: 1 addition & 1 deletion com/client/imsClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
*/
func (client *Client) ListCloudImages(listCloudImagesReqEx *imsModules.ListCloudImagesReqEx) *imsModules.ListCloudImagesResp {
ListCloudImagesResp := &imsModules.ListCloudImagesResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v2/cloudimages" + listCloudImagesReqEx.GetAbsolutePath()
client.RequestParam.Url = "https://ims." + client.RequestParam.Endpoint + "/v2/cloudimages" + listCloudImagesReqEx.GetAbsolutePath()
client.RequestParam.Method = "GET"
client.RequestParam.BodyContent = ""

Expand Down
6 changes: 3 additions & 3 deletions com/client/neutronClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
*/
func (client *Client) CreateSecurityGroupRule(createSecurityGroupRuleReq *neutronModules.CreateSecurityGroupRuleReq) *neutronModules.CreateSecurityGroupRuleResp {
CreateSecurityGroupRuleResp := &neutronModules.CreateSecurityGroupRuleResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v2.0/security-group-rules"
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v2.0/security-group-rules"

client.RequestParam.Method = "POST"
client.RequestParam.BodyContent = createSecurityGroupRuleReq.GetBodyContent()
Expand Down Expand Up @@ -65,7 +65,7 @@ func (client *Client) CreateSecurityGroupRule(createSecurityGroupRuleReq *neutro
*/
func (client *Client) ShowSecurityGroupRule(rules_security_groups_id string) *neutronModules.ShowSecurityGroupRuleResp {
ShowSecurityGroupRuleResp := &neutronModules.ShowSecurityGroupRuleResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v2.0/security-group-rules/" + rules_security_groups_id
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v2.0/security-group-rules/" + rules_security_groups_id

client.RequestParam.Method = "GET"
client.RequestParam.BodyContent = ""
Expand Down Expand Up @@ -98,7 +98,7 @@ func (client *Client) ShowSecurityGroupRule(rules_security_groups_id string) *ne
*/
func (client *Client) DeleteSecurityGroupRule(rules_security_groups_id string) *neutronModules.DeleteSecurityGroupRuleResp {
DeleteSecurityGroupRuleResp := &neutronModules.DeleteSecurityGroupRuleResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v2.0/security-group-rules/" + rules_security_groups_id
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v2.0/security-group-rules/" + rules_security_groups_id

client.RequestParam.Method = "DELETE"
client.RequestParam.BodyContent = ""
Expand Down
16 changes: 8 additions & 8 deletions com/client/novaClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
func (client *Client) ListInterfaces(server_id string) novaModules.ListInterfacesResp {
listInterfacesResp := novaModules.ListInterfacesResp{}

client.RequestParam.Url = client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/servers/" + server_id + "/os-interface"
client.RequestParam.Url = "https://ecs." + client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/servers/" + server_id + "/os-interface"
client.RequestParam.Method = modules.HTTP_GET
client.RequestParam.RequestContentType = modules.ApplicationJson
client.RequestParam.BodyContent = ""
Expand All @@ -49,7 +49,7 @@ func (client *Client) ListInterfaces(server_id string) novaModules.ListInterface
func (client *Client) CreateKeypair(createKeypairReq novaModules.CreateKeypairReq) novaModules.CreateKeypairResp {
createKeypairResp := novaModules.CreateKeypairResp{}

client.RequestParam.Url = client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/os-keypairs"
client.RequestParam.Url = "https://ecs." + client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/os-keypairs"
client.RequestParam.Method = modules.HTTP_POST
client.RequestParam.RequestContentType = modules.ApplicationJson
client.RequestParam.BodyContent = createKeypairReq.GetBodyContent()
Expand All @@ -72,7 +72,7 @@ func (client *Client) CreateKeypair(createKeypairReq novaModules.CreateKeypairRe
func (client *Client) DeleteKeyPair(keypair_name string) novaModules.DeleteKeyPairResp {
deleteKeyPairResp := novaModules.DeleteKeyPairResp{}

client.RequestParam.Url = client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/os-keypairs/" + keypair_name
client.RequestParam.Url = "https://ecs." + client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/os-keypairs/" + keypair_name
client.RequestParam.Method = modules.HTTP_DELETE
client.RequestParam.RequestContentType = modules.ApplicationJson
client.RequestParam.BodyContent = ""
Expand All @@ -94,7 +94,7 @@ func (client *Client) DeleteKeyPair(keypair_name string) novaModules.DeleteKeyPa
func (client *Client) StartServer(server_id string) novaModules.StartServerResp {
startServer := novaModules.StartServerResp{}

client.RequestParam.Url = client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/servers/" + server_id + "/action"
client.RequestParam.Url = "https://ecs." + client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/servers/" + server_id + "/action"
client.RequestParam.Method = modules.HTTP_POST
client.RequestParam.RequestContentType = modules.ApplicationJson
client.RequestParam.BodyContent = "{ \"os-start\": {} }"
Expand All @@ -116,7 +116,7 @@ func (client *Client) StartServer(server_id string) novaModules.StartServerResp
func (client *Client) StopServer(server_id string) novaModules.StopServerResp {
stopServer := novaModules.StopServerResp{}

client.RequestParam.Url = client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/servers/" + server_id + "/action"
client.RequestParam.Url = "https://ecs." + client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/servers/" + server_id + "/action"
client.RequestParam.Method = modules.HTTP_POST
client.RequestParam.RequestContentType = modules.ApplicationJson
client.RequestParam.BodyContent = "{ \"os-stop\": {} }"
Expand All @@ -138,7 +138,7 @@ func (client *Client) StopServer(server_id string) novaModules.StopServerResp {
func (client *Client) RebootServer(server_id, rebootType string) novaModules.RebootServerResp {
rebootServer := novaModules.RebootServerResp{}

client.RequestParam.Url = client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/servers/" + server_id + "/action"
client.RequestParam.Url = "https://ecs." + client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/servers/" + server_id + "/action"
client.RequestParam.Method = modules.HTTP_POST
client.RequestParam.RequestContentType = modules.ApplicationJson
bodyMap := make(map[string]map[string]string)
Expand Down Expand Up @@ -166,7 +166,7 @@ func (client *Client) RebootServer(server_id, rebootType string) novaModules.Reb
func (client *Client) DeleteAnServer(server_id string) novaModules.DeleteAnServerResp {
deleteAnServerResp := novaModules.DeleteAnServerResp{}

client.RequestParam.Url = client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/servers/" + server_id
client.RequestParam.Url = "https://ecs." + client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/servers/" + server_id
client.RequestParam.Method = modules.HTTP_DELETE
client.RequestParam.RequestContentType = modules.ApplicationJson
client.RequestParam.BodyContent = ""
Expand All @@ -192,7 +192,7 @@ func (client *Client) ShowServer(server_id string) novaModules.ShowServerResp {
showServerResp.Server.NumaOpts = -1
showServerResp.Server.Progress = -1

client.RequestParam.Url = client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/servers/" + server_id
client.RequestParam.Url = "https://ecs." + client.RequestParam.Endpoint + "/v2/" + client.TenantID + "/servers/" + server_id
client.RequestParam.Method = modules.HTTP_GET
client.RequestParam.RequestContentType = modules.ApplicationJson
client.RequestParam.BodyContent = ""
Expand Down
28 changes: 14 additions & 14 deletions com/client/vpcClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
*/
func (client *Client) DeleteVpc(vpc_id string) *vpcModules.DeleteVpcResp {
DeleteVpcResp := &vpcModules.DeleteVpcResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/vpcs/" + vpc_id
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/vpcs/" + vpc_id

client.RequestParam.Method = "DELETE"
client.RequestParam.BodyContent = ""
Expand Down Expand Up @@ -60,7 +60,7 @@ func (client *Client) DeleteVpc(vpc_id string) *vpcModules.DeleteVpcResp {
*/
func (client *Client) CreateVpc(createVpcReq vpcModules.CreateVpcReq) *vpcModules.CreateVpcResp {
CreateVpcResp := &vpcModules.CreateVpcResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/vpcs"
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/vpcs"
client.RequestParam.Method = "POST"
client.RequestParam.BodyContent = createVpcReq.GetBodyContent()

Expand Down Expand Up @@ -90,7 +90,7 @@ func (client *Client) CreateVpc(createVpcReq vpcModules.CreateVpcReq) *vpcModule
*/
func (client *Client) ShowVpc(vpc_id string) *vpcModules.ShowVpcResp {
ShowVpcResp := &vpcModules.ShowVpcResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/vpcs/" + vpc_id
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/vpcs/" + vpc_id

client.RequestParam.Method = "GET"
client.RequestParam.BodyContent = ""
Expand Down Expand Up @@ -122,7 +122,7 @@ func (client *Client) ShowVpc(vpc_id string) *vpcModules.ShowVpcResp {
*/
func (client *Client) CreateSubnet(createSubnetReq *vpcModules.CreateSubnetReq) *vpcModules.CreateSubnetResp {
CreateSubnetResp := &vpcModules.CreateSubnetResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/subnets"
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/subnets"

client.RequestParam.Method = "POST"
client.RequestParam.BodyContent = createSubnetReq.GetBodyContent()
Expand Down Expand Up @@ -153,7 +153,7 @@ func (client *Client) CreateSubnet(createSubnetReq *vpcModules.CreateSubnetReq)
*/
func (client *Client) ShowSubnet(subnet_id string) *vpcModules.ShowSubnetResp {
ShowSubnetResp := &vpcModules.ShowSubnetResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/subnets/" + subnet_id
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/subnets/" + subnet_id

client.RequestParam.BodyContent = ""
client.RequestParam.Method = "GET"
Expand All @@ -177,7 +177,7 @@ func (client *Client) ShowSubnet(subnet_id string) *vpcModules.ShowSubnetResp {

func (client *Client) ListSubnets(limit int, marker, vpc_id string) *vpcModules.ListSubnetsResp {
ListSubnetsResp := &vpcModules.ListSubnetsResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/subnets" + "?limit=" + fmt.Sprintf("%d", limit) + "&marker=" + marker + "&vpc_id=" + vpc_id
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/subnets" + "?limit=" + fmt.Sprintf("%d", limit) + "&marker=" + marker + "&vpc_id=" + vpc_id

client.RequestParam.BodyContent = ""
client.RequestParam.Method = "GET"
Expand Down Expand Up @@ -209,7 +209,7 @@ func (client *Client) ListSubnets(limit int, marker, vpc_id string) *vpcModules.
*/
func (client *Client) DeleteSubnet(vpc_id, subnet_id string) *vpcModules.DeleteSubnetResp {
DeleteSubnetResp := &vpcModules.DeleteSubnetResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/vpcs/" + vpc_id + "/subnets/" + subnet_id
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/vpcs/" + vpc_id + "/subnets/" + subnet_id

client.RequestParam.BodyContent = ""
client.RequestParam.Method = "DELETE"
Expand Down Expand Up @@ -239,7 +239,7 @@ func (client *Client) DeleteSubnet(vpc_id, subnet_id string) *vpcModules.DeleteS
*/
func (client *Client) UpdateBandwidth(bandwidth_id string, updateBandwidthReq *vpcModules.UpdateBandwidthReq) *vpcModules.UpdateBandwidthResp {
UpdateBandwidthResp := &vpcModules.UpdateBandwidthResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/bandwidths/" + bandwidth_id
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/bandwidths/" + bandwidth_id

client.RequestParam.BodyContent = updateBandwidthReq.GetBodyContent()
client.RequestParam.Method = "PUT"
Expand Down Expand Up @@ -275,7 +275,7 @@ func (client *Client) UpdateBandwidth(bandwidth_id string, updateBandwidthReq *v
*/
func (client *Client) ListBandwidths(limit int, marker string) *vpcModules.ListBandwidthsResp {
ListBandwidthsResp := &vpcModules.ListBandwidthsResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/bandwidths" + "?limit=" + fmt.Sprintf("%d", limit) + "&marker=" + marker
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/bandwidths" + "?limit=" + fmt.Sprintf("%d", limit) + "&marker=" + marker

client.RequestParam.Method = "GET"
client.RequestParam.BodyContent = ""
Expand Down Expand Up @@ -307,7 +307,7 @@ func (client *Client) ListBandwidths(limit int, marker string) *vpcModules.ListB
*/
func (client *Client) CreateSecurityGroup(createSecurityGroupReq *vpcModules.CreateSecurityGroupReq) *vpcModules.CreateSecurityGroupResp {
CreateSecurityGroupResp := &vpcModules.CreateSecurityGroupResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/security-groups"
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/security-groups"

client.RequestParam.Method = "POST"
client.RequestParam.BodyContent = createSecurityGroupReq.GetBodyContent()
Expand Down Expand Up @@ -345,7 +345,7 @@ func (client *Client) CreateSecurityGroup(createSecurityGroupReq *vpcModules.Cre
*/
func (client *Client) ListSecurityGroups(limit int, marker, vpc_id string) *vpcModules.ListSecurityGroupsResp {
ListSecurityGroupsResp := &vpcModules.ListSecurityGroupsResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/security-groups" + "?limit=" + fmt.Sprintf("%d", limit) + "&marker=" + marker + "&vpc_id=" + vpc_id
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/security-groups" + "?limit=" + fmt.Sprintf("%d", limit) + "&marker=" + marker + "&vpc_id=" + vpc_id

client.RequestParam.Method = "GET"
client.RequestParam.BodyContent = ""
Expand Down Expand Up @@ -377,7 +377,7 @@ func (client *Client) ListSecurityGroups(limit int, marker, vpc_id string) *vpcM
*/
func (client *Client) CreatePublicIp(createPublicipReq *vpcModules.CreatePublicIpReq) *vpcModules.CreatePublicIpResp {
CreatePublicIpResp := &vpcModules.CreatePublicIpResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/publicips"
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/publicips"

client.RequestParam.Method = "POST"
client.RequestParam.BodyContent = createPublicipReq.GetBodyContent()
Expand Down Expand Up @@ -413,7 +413,7 @@ func (client *Client) CreatePublicIp(createPublicipReq *vpcModules.CreatePublicI
*/
func (client *Client) UpdatePublicIp(publicip_id string, updatePublicIpReq *vpcModules.UpdatePublicIpReq) *vpcModules.UpdatePublicIpResp {
UpdatePublicIpResp := &vpcModules.UpdatePublicIpResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/publicips/" + publicip_id
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/publicips/" + publicip_id

client.RequestParam.Method = "PUT"
client.RequestParam.BodyContent = updatePublicIpReq.GetBodyContent()
Expand Down Expand Up @@ -445,7 +445,7 @@ func (client *Client) UpdatePublicIp(publicip_id string, updatePublicIpReq *vpcM
*/
func (client *Client) DeletePublicIp(publicip_id string) *vpcModules.DeletePublicIpResp {
DeletePublicIpResp := &vpcModules.DeletePublicIpResp{}
client.RequestParam.Url = client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/publicips/" + publicip_id
client.RequestParam.Url = "https://vpc." + client.RequestParam.Endpoint + "/v1/" + client.TenantID + "/publicips/" + publicip_id

client.RequestParam.Method = "DELETE"
client.RequestParam.BodyContent = ""
Expand Down
4 changes: 2 additions & 2 deletions otc/ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"io"
"io/ioutil"
_ "os"
_ "strings"
"strings"
"time"

_ "github.com/huawei/DockerMachineDriver4OTC/otcgo/ecs"
Expand Down Expand Up @@ -264,7 +264,7 @@ func generateId() string {
func (d *Driver) initClient() *client.Client {
var clientConf modules.ClientConfiguration

clientConf.Endpoint = d.ServiceEndpoint
clientConf.Endpoint = strings.Split(d.ServiceEndpoint, "https://ecs.")[1]
clientConf.ServiceName = serviceName
clientConf.Region = d.Region

Expand Down

0 comments on commit 523e7e2

Please sign in to comment.