1package devops_rdc 2 3//Licensed under the Apache License, Version 2.0 (the "License"); 4//you may not use this file except in compliance with the License. 5//You may obtain a copy of the License at 6// 7//http://www.apache.org/licenses/LICENSE-2.0 8// 9//Unless required by applicable law or agreed to in writing, software 10//distributed under the License is distributed on an "AS IS" BASIS, 11//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12//See the License for the specific language governing permissions and 13//limitations under the License. 14// 15// Code generated by Alibaba Cloud SDK Code Generator. 16// Changes may cause incorrect behavior and will be lost if the code is regenerated. 17 18import ( 19 "github.com/aliyun/alibaba-cloud-sdk-go/sdk" 20 "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth" 21 "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider" 22) 23 24// Client is the sdk client struct, each func corresponds to an OpenAPI 25type Client struct { 26 sdk.Client 27} 28 29// NewClient creates a sdk client with environment variables 30func NewClient() (client *Client, err error) { 31 client = &Client{} 32 err = client.Init() 33 return 34} 35 36// NewClientWithProvider creates a sdk client with providers 37// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md 38func NewClientWithProvider(regionId string, providers ...provider.Provider) (client *Client, err error) { 39 client = &Client{} 40 var pc provider.Provider 41 if len(providers) == 0 { 42 pc = provider.DefaultChain 43 } else { 44 pc = provider.NewProviderChain(providers) 45 } 46 err = client.InitWithProviderChain(regionId, pc) 47 return 48} 49 50// NewClientWithOptions creates a sdk client with regionId/sdkConfig/credential 51// this is the common api to create a sdk client 52func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error) { 53 client = &Client{} 54 err = client.InitWithOptions(regionId, config, credential) 55 return 56} 57 58// NewClientWithAccessKey is a shortcut to create sdk client with accesskey 59// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md 60func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error) { 61 client = &Client{} 62 err = client.InitWithAccessKey(regionId, accessKeyId, accessKeySecret) 63 return 64} 65 66// NewClientWithStsToken is a shortcut to create sdk client with sts token 67// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md 68func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error) { 69 client = &Client{} 70 err = client.InitWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken) 71 return 72} 73 74// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn 75// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md 76func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) { 77 client = &Client{} 78 err = client.InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName) 79 return 80} 81 82// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn and policy 83// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md 84func NewClientWithRamRoleArnAndPolicy(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy string) (client *Client, err error) { 85 client = &Client{} 86 err = client.InitWithRamRoleArnAndPolicy(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy) 87 return 88} 89 90// NewClientWithEcsRamRole is a shortcut to create sdk client with ecs ram role 91// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md 92func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) { 93 client = &Client{} 94 err = client.InitWithEcsRamRole(regionId, roleName) 95 return 96} 97 98// NewClientWithRsaKeyPair is a shortcut to create sdk client with rsa key pair 99// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md 100func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error) { 101 client = &Client{} 102 err = client.InitWithRsaKeyPair(regionId, publicKeyId, privateKey, sessionExpiration) 103 return 104} 105