Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
add config params
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerry-yz authored and peze committed Sep 23, 2021
1 parent ae1cf12 commit ffcca3c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ type Config struct {
// Deprecated
// credential type
Type *string `json:"type,omitempty" xml:"type,omitempty"`
// source ip
SourceIp *string `json:"sourceIp,omitempty" xml:"sourceIp,omitempty"`
// secure transport
SecureTransport *string `json:"secureTransport,omitempty" xml:"secureTransport,omitempty"`
}

func (s Config) String() string {
Expand Down Expand Up @@ -173,6 +177,16 @@ func (s *Config) SetType(v string) *Config {
return s
}

func (s *Config) SetSourceIp(v string) *Config {
s.SourceIp = &v
return s
}

func (s *Config) SetSecureTransport(v string) *Config {
s.SecureTransport = &v
return s
}

type Client struct {
Endpoint *string
RegionId *string
Expand All @@ -193,6 +207,8 @@ type Client struct {
MaxIdleConns *int
EndpointType *string
OpenPlatformEndpoint *string
SourceIp *string
SecureTransport *string
Credential credential.Credential
}

Expand Down Expand Up @@ -247,6 +263,8 @@ func (client *Client) Init(config *Config) (_err error) {
return _err
}

client.SourceIp = config.SourceIp
client.SecureTransport = config.SecureTransport
client.Network = config.Network
client.Suffix = config.Suffix
client.Endpoint = config.Endpoint
Expand Down Expand Up @@ -324,6 +342,14 @@ func (client *Client) DoRequest(action *string, protocol *string, method *string
"Version": tea.StringValue(version),
"SignatureNonce": tea.StringValue(util.GetNonce()),
}, query))
if !tea.BoolValue(util.IsUnset(client.SourceIp)) {
request_.Query["SourceIp"] = client.SourceIp
}

if !tea.BoolValue(util.IsUnset(client.SecureTransport)) {
request_.Query["SecureTransport"] = client.SecureTransport
}

// endpoint is setted in product client
request_.Headers = map[string]*string{
"x-acs-version": version,
Expand Down

0 comments on commit ffcca3c

Please sign in to comment.