From 29b014374d9dc265598fce3197dfbcbd8dd31448 Mon Sep 17 00:00:00 2001 From: Duan Jiong Date: Tue, 22 Dec 2020 14:55:51 +0800 Subject: [PATCH] add filed direcive to job and add vxnet type 2 to support vbc --- config/config.go | 8 ++++---- go.mod | 4 ++-- request/request.go | 20 +++++++++++--------- service/types.go | 5 +++-- service/vxnet.go | 4 ++-- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/config/config.go b/config/config.go index f1d6735..bc01e34 100644 --- a/config/config.go +++ b/config/config.go @@ -48,11 +48,11 @@ type Config struct { Zone string `yaml:"zone"` CredentialProxyProtocol string `yaml:"credential_proxy_protocol"` - CredentialProxyHost string `yaml:"credential_proxy_host"` - CredentialProxyPort int `yaml:"credential_proxy_port"` - CredentialProxyURI string `yaml:"credential_proxy_uri"` + CredentialProxyHost string `yaml:"credential_proxy_host"` + CredentialProxyPort int `yaml:"credential_proxy_port"` + CredentialProxyURI string `yaml:"credential_proxy_uri"` - Token string + Token string Expiration int64 Connection *http.Client diff --git a/go.mod b/go.mod index d194a0a..68b03fa 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,6 @@ require ( replace github.com/DATA-DOG/godog v0.10.0 => github.com/cucumber/godog v0.7.9 -replace github.com/golang/lint v0.0.0-20200302205851-738671d3881b => golang.org/x/lint v0.0.0-20200302205851-738671d3881b +replace github.com/golang/lint v0.0.0-20201208152925-83fdc39ff7b5 => golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 -replace golang.org/x/lint v0.0.0-20200302205851-738671d3881b => github.com/golang/lint v0.0.0-20200302205851-738671d3881b +replace golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 => github.com/golang/lint v0.0.0-20201208152925-83fdc39ff7b5 diff --git a/request/request.go b/request/request.go index c5cbbbe..2008662 100644 --- a/request/request.go +++ b/request/request.go @@ -41,25 +41,27 @@ type Request struct { // DefaultCredentialProxyHost is default credential proxy host const DefaultCredentialProxyHost = "169.254.169.254" + // DefaultCredentialProxyPort is default credential proxy port const DefaultCredentialProxyPort = 80 + // DefaultCredentialProxyProtocol is default credential proxy protocol const DefaultCredentialProxyProtocol = "http" + // DefaultCredentialProxyURI is default credential proxy URI const DefaultCredentialProxyURI = "/latest/meta-data/security-credentials" // TokenOutput is the structure of token when retrieving it type TokenOutput struct { - Jti string `json:"jti"` - Token string `json:"id_token"` - AccessKey string `json:"access_key"` + Jti string `json:"jti"` + Token string `json:"id_token"` + AccessKey string `json:"access_key"` SecretAccess string `json:"secret_key"` - Expiration int64 `json:"expiration"` - Action string `json:"action,omitempty"` - RetCode string `json:"ret_code"` + Expiration int64 `json:"expiration"` + Action string `json:"action,omitempty"` + RetCode string `json:"ret_code"` } - // New create a Request from given Operation, Input and Output. // It returns a Request. func New(o *data.Operation, i data.Input, x interface{}) (*Request, error) { @@ -207,7 +209,7 @@ func (r *Request) unpack() error { } // GetToken is used to get token from credential proxy server -func (t *TokenOutput) GetToken(credentialProxyURL string) error{ +func (t *TokenOutput) GetToken(credentialProxyURL string) error { response, err := http.Get(credentialProxyURL) if err != nil { return err @@ -267,4 +269,4 @@ func (r *Request) getCredentialProxyURL() string { credentialProxyURL := fmt.Sprintf("%s://%s:%d%s", credentialProxyProtocol, credentialProxyHost, credentialProxyPort, credentialProxyURI) return credentialProxyURL -} \ No newline at end of file +} diff --git a/service/types.go b/service/types.go index c6dd979..0732110 100644 --- a/service/types.go +++ b/service/types.go @@ -1202,6 +1202,7 @@ func (v *InstanceVxNet) Validate() error { type Job struct { CreateTime *time.Time `json:"create_time" name:"create_time" format:"ISO 8601"` + Directive *string `json:"directive" name:"directive"` JobAction *string `json:"job_action" name:"job_action"` JobID *string `json:"job_id" name:"job_id"` Owner *string `json:"owner" name:"owner"` @@ -3260,7 +3261,7 @@ type VxNet struct { VpcRouterID *string `json:"vpc_router_id" name:"vpc_router_id"` VxNetID *string `json:"vxnet_id" name:"vxnet_id"` VxNetName *string `json:"vxnet_name" name:"vxnet_name"` - // VxNetType's available values: 0, 1 + // VxNetType's available values: 0, 1, 2 VxNetType *int `json:"vxnet_type" name:"vxnet_type"` } @@ -3281,7 +3282,7 @@ func (v *VxNet) Validate() error { } if v.VxNetType != nil { - vxnetTypeValidValues := []string{"0", "1"} + vxnetTypeValidValues := []string{"0", "1", "2"} vxnetTypeParameterValue := fmt.Sprint(*v.VxNetType) vxnetTypeIsValid := false diff --git a/service/vxnet.go b/service/vxnet.go index 7fa2a3e..0a548e2 100644 --- a/service/vxnet.go +++ b/service/vxnet.go @@ -259,7 +259,7 @@ type DescribeVxNetsInput struct { Tags []*string `json:"tags" name:"tags" location:"params"` // Verbose's available values: 0, 1 Verbose *int `json:"verbose" name:"verbose" default:"0" location:"params"` - // VxNetType's available values: 0, 1 + // VxNetType's available values: 0, 1, 2 VxNetType *int `json:"vxnet_type" name:"vxnet_type" location:"params"` VxNets []*string `json:"vxnets" name:"vxnets" location:"params"` } @@ -287,7 +287,7 @@ func (v *DescribeVxNetsInput) Validate() error { } if v.VxNetType != nil { - vxnetTypeValidValues := []string{"0", "1"} + vxnetTypeValidValues := []string{"0", "1", "2"} vxnetTypeParameterValue := fmt.Sprint(*v.VxNetType) vxnetTypeIsValid := false