diff --git a/go.mod b/go.mod index c21bfd94be..d213981905 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ require ( github.com/hashicorp/errwrap v1.0.0 github.com/hashicorp/go-cleanhttp v0.5.1 github.com/hashicorp/terraform-plugin-sdk v1.0.0 - github.com/huaweicloud/golangsdk v0.0.0-20200328014419-a05ff47ddef2 + github.com/huaweicloud/golangsdk v0.0.0-20200401094148-31fa13f7c58c github.com/jen20/awspolicyequivalence v0.0.0-20170831201602-3d48364a137a github.com/mitchellh/go-homedir v1.1.0 github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa // indirect diff --git a/go.sum b/go.sum index eb04d0bf95..3c813dc978 100644 --- a/go.sum +++ b/go.sum @@ -121,10 +121,8 @@ github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKe github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huaweicloud/golangsdk v0.0.0-20200323070305-98b64a3f37ba h1:eTQZkCooySmxShTy8boiZ69ueUNNNRxBWjt9T35sp8c= -github.com/huaweicloud/golangsdk v0.0.0-20200323070305-98b64a3f37ba/go.mod h1:WQBcHRNX9shz3928lWEvstQJtAtYI7ks6XlgtRT9Tcw= -github.com/huaweicloud/golangsdk v0.0.0-20200328014419-a05ff47ddef2 h1:DYqiW7KEFU0tZlhn2/yQIPlXxjdf72bDM7xqdoFzFgE= -github.com/huaweicloud/golangsdk v0.0.0-20200328014419-a05ff47ddef2/go.mod h1:WQBcHRNX9shz3928lWEvstQJtAtYI7ks6XlgtRT9Tcw= +github.com/huaweicloud/golangsdk v0.0.0-20200401094148-31fa13f7c58c h1:bzJdiQ+UuJ2/91iSsv+cFfVrLdwETLkawm1ZxE9yYT4= +github.com/huaweicloud/golangsdk v0.0.0-20200401094148-31fa13f7c58c/go.mod h1:WQBcHRNX9shz3928lWEvstQJtAtYI7ks6XlgtRT9Tcw= github.com/jen20/awspolicyequivalence v0.0.0-20170831201602-3d48364a137a h1:FyS/ubzBR5xJlnJGRTwe7GUHpJOR4ukYK3y+LFNffuA= github.com/jen20/awspolicyequivalence v0.0.0-20170831201602-3d48364a137a/go.mod h1:uoIMjNxUfXi48Ci40IXkPRbghZ1vbti6v9LCbNqRgHY= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= diff --git a/huaweicloud/resource_huaweicloud_nat_snat_rule_v2.go b/huaweicloud/resource_huaweicloud_nat_snat_rule_v2.go index 451488fa19..ededa75bbb 100644 --- a/huaweicloud/resource_huaweicloud_nat_snat_rule_v2.go +++ b/huaweicloud/resource_huaweicloud_nat_snat_rule_v2.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/huaweicloud/golangsdk" - "github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/snatrules" + "github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/hw_snatrules" ) func resourceNatSnatRuleV2() *schema.Resource { @@ -57,14 +57,14 @@ func resourceNatSnatRuleV2Create(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("Error creating HuaweiCloud nat client: %s", err) } - createOpts := &snatrules.CreateOpts{ + createOpts := &hw_snatrules.CreateOpts{ NatGatewayID: d.Get("nat_gateway_id").(string), NetworkID: d.Get("network_id").(string), FloatingIPID: d.Get("floating_ip_id").(string), } log.Printf("[DEBUG] Create Options: %#v", createOpts) - snatRule, err := snatrules.Create(natV2Client, createOpts).Extract() + snatRule, err := hw_snatrules.Create(natV2Client, createOpts).Extract() if err != nil { return fmt.Errorf("Error creatting Snat Rule: %s", err) } @@ -96,7 +96,7 @@ func resourceNatSnatRuleV2Read(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Error creating HuaweiCloud nat client: %s", err) } - snatRule, err := snatrules.Get(natV2Client, d.Id()).Extract() + snatRule, err := hw_snatrules.Get(natV2Client, d.Id()).Extract() if err != nil { return CheckDeleted(d, err, "Snat Rule") } @@ -137,7 +137,7 @@ func resourceNatSnatRuleV2Delete(d *schema.ResourceData, meta interface{}) error func waitForSnatRuleActive(natV2Client *golangsdk.ServiceClient, nId string) resource.StateRefreshFunc { return func() (interface{}, string, error) { - n, err := snatrules.Get(natV2Client, nId).Extract() + n, err := hw_snatrules.Get(natV2Client, nId).Extract() if err != nil { return nil, "", err } @@ -155,7 +155,7 @@ func waitForSnatRuleDelete(natV2Client *golangsdk.ServiceClient, nId string) res return func() (interface{}, string, error) { log.Printf("[DEBUG] Attempting to delete HuaweiCloud Snat Rule %s.\n", nId) - n, err := snatrules.Get(natV2Client, nId).Extract() + n, err := hw_snatrules.Get(natV2Client, nId).Extract() if err != nil { if _, ok := err.(golangsdk.ErrDefault404); ok { log.Printf("[DEBUG] Successfully deleted HuaweiCloud Snat Rule %s", nId) @@ -164,7 +164,7 @@ func waitForSnatRuleDelete(natV2Client *golangsdk.ServiceClient, nId string) res return n, "ACTIVE", err } - err = snatrules.Delete(natV2Client, nId).ExtractErr() + err = hw_snatrules.Delete(natV2Client, nId).ExtractErr() if err != nil { if _, ok := err.(golangsdk.ErrDefault404); ok { log.Printf("[DEBUG] Successfully deleted HuaweiCloud Snat Rule %s", nId) diff --git a/huaweicloud/resource_huaweicloud_nat_snat_rule_v2_test.go b/huaweicloud/resource_huaweicloud_nat_snat_rule_v2_test.go index 07638c34aa..5ac2424ed3 100644 --- a/huaweicloud/resource_huaweicloud_nat_snat_rule_v2_test.go +++ b/huaweicloud/resource_huaweicloud_nat_snat_rule_v2_test.go @@ -7,9 +7,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/hw_snatrules" "github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/layer3/floatingips" "github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/layer3/routers" - "github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/snatrules" "github.com/huaweicloud/golangsdk/openstack/networking/v2/networks" "github.com/huaweicloud/golangsdk/openstack/networking/v2/subnets" ) @@ -53,7 +53,7 @@ func testAccCheckNatV2SnatRuleDestroy(s *terraform.State) error { continue } - _, err := snatrules.Get(natClient, rs.Primary.ID).Extract() + _, err := hw_snatrules.Get(natClient, rs.Primary.ID).Extract() if err == nil { return fmt.Errorf("Snat rule still exists") } @@ -79,7 +79,7 @@ func testAccCheckNatV2SnatRuleExists(n string) resource.TestCheckFunc { return fmt.Errorf("Error creating HuaweiCloud nat client: %s", err) } - found, err := snatrules.Get(natClient, rs.Primary.ID).Extract() + found, err := hw_snatrules.Get(natClient, rs.Primary.ID).Extract() if err != nil { return err } diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/snatrules/requests.go b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/hw_snatrules/requests.go similarity index 98% rename from vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/snatrules/requests.go rename to vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/hw_snatrules/requests.go index b25d9f7645..5471254678 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/snatrules/requests.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/hw_snatrules/requests.go @@ -1,4 +1,4 @@ -package snatrules +package hw_snatrules import ( "github.com/huaweicloud/golangsdk" diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/snatrules/results.go b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/hw_snatrules/results.go similarity index 94% rename from vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/snatrules/results.go rename to vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/hw_snatrules/results.go index 70ff957a3d..fff8a3678a 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/snatrules/results.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/hw_snatrules/results.go @@ -1,4 +1,4 @@ -package snatrules +package hw_snatrules import ( "github.com/huaweicloud/golangsdk" @@ -15,7 +15,7 @@ type SnatRule struct { Status string `json:"status"` AdminStateUp bool `json:"admin_state_up"` Cidr string `json:"cidr"` - SourceType string `json:"source_type"` + SourceType int `json:"source_type"` } // GetResult is a return struct of get method diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/snatrules/urls.go b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/hw_snatrules/urls.go similarity index 92% rename from vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/snatrules/urls.go rename to vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/hw_snatrules/urls.go index 82a0a4c96f..8cc6bb2aca 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/snatrules/urls.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/hw_snatrules/urls.go @@ -1,4 +1,4 @@ -package snatrules +package hw_snatrules import "github.com/huaweicloud/golangsdk" diff --git a/vendor/modules.txt b/vendor/modules.txt index 7e4ba7c4f0..29f0f69931 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -177,7 +177,7 @@ github.com/hashicorp/terraform-plugin-sdk/internal/svchost github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth # github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d github.com/hashicorp/yamux -# github.com/huaweicloud/golangsdk v0.0.0-20200328014419-a05ff47ddef2 +# github.com/huaweicloud/golangsdk v0.0.0-20200401094148-31fa13f7c58c github.com/huaweicloud/golangsdk github.com/huaweicloud/golangsdk/openstack github.com/huaweicloud/golangsdk/openstack/antiddos/v1/antiddos @@ -256,6 +256,7 @@ github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/fwaas_v2/fir github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/fwaas_v2/policies github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/fwaas_v2/routerinsertion github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/fwaas_v2/rules +github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/hw_snatrules github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/layer3/floatingips github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/layer3/routers github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/certificates @@ -269,7 +270,6 @@ github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/natgateways github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/provider github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/security/groups github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/security/rules -github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/snatrules github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/vpnaas/endpointgroups github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/vpnaas/ikepolicies github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/vpnaas/ipsecpolicies