diff --git a/go.mod b/go.mod index 5a7706cb99..47e64e60c6 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/hashicorp/errwrap v1.0.0 github.com/hashicorp/go-cleanhttp v0.5.0 github.com/hashicorp/terraform v0.12.0 - github.com/huaweicloud/golangsdk v0.0.0-20190813030825-9822f9e55bee + github.com/huaweicloud/golangsdk v0.0.0-20190815090708-6e56d01dc57e github.com/jen20/awspolicyequivalence v0.0.0-20170831201602-3d48364a137a github.com/mitchellh/go-homedir v1.0.0 github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 // indirect diff --git a/go.sum b/go.sum index 99128d3237..6120fcfe15 100644 --- a/go.sum +++ b/go.sum @@ -192,8 +192,8 @@ github.com/hashicorp/vault v0.10.4/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bA github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huaweicloud/golangsdk v0.0.0-20190813030825-9822f9e55bee h1:Pu6887UPwDRfAg/ETawgnmyqrnS+/Vxpkz+MAbwM7B0= -github.com/huaweicloud/golangsdk v0.0.0-20190813030825-9822f9e55bee/go.mod h1:WQBcHRNX9shz3928lWEvstQJtAtYI7ks6XlgtRT9Tcw= +github.com/huaweicloud/golangsdk v0.0.0-20190815090708-6e56d01dc57e h1:SUdLK5kfxsYcq+C96WS0x9JEbTy7ClEezbf+fOPKkUc= +github.com/huaweicloud/golangsdk v0.0.0-20190815090708-6e56d01dc57e/go.mod h1:WQBcHRNX9shz3928lWEvstQJtAtYI7ks6XlgtRT9Tcw= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= 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= diff --git a/vendor/github.com/huaweicloud/golangsdk/errors.go b/vendor/github.com/huaweicloud/golangsdk/errors.go index d72718f2dd..64fc66ca65 100644 --- a/vendor/github.com/huaweicloud/golangsdk/errors.go +++ b/vendor/github.com/huaweicloud/golangsdk/errors.go @@ -121,7 +121,11 @@ func (e ErrDefault403) Error() string { return "Action Forbidden" } func (e ErrDefault404) Error() string { - return "Resource not found" + e.DefaultErrString = fmt.Sprintf( + "Resource not found: [%s %s], error message: %s", + e.Method, e.URL, e.Body, + ) + return e.choseErrString() } func (e ErrDefault405) Error() string { return "Method not allowed" diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/requests.go b/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/requests.go index 9d89a53cd5..b2881b518e 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/requests.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/requests.go @@ -148,6 +148,15 @@ func Get(c *golangsdk.ServiceClient, id string) (r GetResult) { return } +// GetCert retrieves a particular cluster certificate based on its unique ID. +func GetCert(c *golangsdk.ServiceClient, id string) (r GetCertResult) { + _, r.Err = c.Get(certificateURL(c, id), &r.Body, &golangsdk.RequestOpts{ + OkCodes: []int{200}, + MoreHeaders: RequestOpts.MoreHeaders, JSONBody: nil, + }) + return +} + // UpdateOpts contains all the values needed to update a new cluster type UpdateOpts struct { Spec UpdateSpec `json:"spec" required:"true"` diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/results.go b/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/results.go index 530dc4cbd9..5f7ef05d9c 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/results.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/results.go @@ -123,6 +123,63 @@ type Endpoints struct { ExternalOTC string `json:"external_otc"` } +type Certificate struct { + //API type, fixed value Config + Kind string `json:"kind"` + //API version, fixed value v1 + ApiVersion string `json:"apiVersion"` + //Cluster list + Clusters []CertClusters `json:"clusters"` + //User list + Users []CertUsers `json:"users"` + //Context list + Contexts []CertContexts `json:"contexts"` + //The current context + CurrentContext string `json:"current-context"` +} + +type CertClusters struct { + //Cluster name + Name string `json:"name"` + //Cluster information + Cluster CertCluster `json:"cluster"` +} + +type CertCluster struct { + //Server IP address + Server string `json:"server"` + //Certificate data + CertAuthorityData string `json:"certificate-authority-data"` +} + +type CertUsers struct { + //User name + Name string `json:"name"` + //Cluster information + User CertUser `json:"user"` +} + +type CertUser struct { + //Client certificate + ClientCertData string `json:"client-certificate-data"` + //Client key data + ClientKeyData string `json:"client-key-data"` +} + +type CertContexts struct { + //Context name + Name string `json:"name"` + //Context information + Context CertContext `json:"context"` +} + +type CertContext struct { + //Cluster name + Cluster string `json:"cluster"` + //User name + User string `json:"user"` +} + // UnmarshalJSON helps to unmarshal Status fields into needed values. //OTC and Huawei have different data types and child fields for `endpoints` field in Cluster Status. //This function handles the unmarshal for both @@ -215,3 +272,14 @@ type DeleteResult struct { type ListResult struct { commonResult } + +type GetCertResult struct { + golangsdk.Result +} + +// Extract is a function that accepts a result and extracts a cluster. +func (r GetCertResult) Extract() (*Certificate, error) { + var s Certificate + err := r.ExtractInto(&s) + return &s, err +} diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/urls.go b/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/urls.go index 3d483e90ec..af2c00c437 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/urls.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/urls.go @@ -4,6 +4,7 @@ import "github.com/huaweicloud/golangsdk" const ( rootPath = "clusters" + certPath = "clustercert" ) func rootURL(client *golangsdk.ServiceClient) string { @@ -13,3 +14,7 @@ func rootURL(client *golangsdk.ServiceClient) string { func resourceURL(c *golangsdk.ServiceClient, id string) string { return c.ServiceURL(rootPath, id) } + +func certificateURL(c *golangsdk.ServiceClient, id string) string { + return c.ServiceURL(rootPath, id, certPath) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 34a8c58b11..ef6972f9ec 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -178,7 +178,7 @@ github.com/hashicorp/terraform/svchost/auth github.com/hashicorp/terraform-config-inspect/tfconfig # github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb github.com/hashicorp/yamux -# github.com/huaweicloud/golangsdk v0.0.0-20190813030825-9822f9e55bee +# github.com/huaweicloud/golangsdk v0.0.0-20190815090708-6e56d01dc57e github.com/huaweicloud/golangsdk github.com/huaweicloud/golangsdk/openstack github.com/huaweicloud/golangsdk/openstack/antiddos/v1/antiddos