Skip to content

Commit

Permalink
Merge pull request #175 from duanjiong/job
Browse files Browse the repository at this point in the history
add filed direcive to job
  • Loading branch information
huyujie authored Dec 31, 2020
2 parents 353983f + 29b0143 commit 68a2166
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
8 changes: 4 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 11 additions & 9 deletions request/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -267,4 +269,4 @@ func (r *Request) getCredentialProxyURL() string {
credentialProxyURL := fmt.Sprintf("%s://%s:%d%s", credentialProxyProtocol, credentialProxyHost, credentialProxyPort, credentialProxyURI)

return credentialProxyURL
}
}
5 changes: 3 additions & 2 deletions service/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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"`
}

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions service/vxnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 68a2166

Please sign in to comment.