Rename accessKeyId to accessKeyID

This commit is contained in:
Xiaoyu Zhong 2020-01-06 17:48:25 +08:00
parent 1e30bbe8f9
commit 98c35cd220
3 changed files with 16 additions and 16 deletions

View File

@ -47,8 +47,8 @@ type ALIVolumes struct {
var _ Volumes = &ALIVolumes{}
func NewALIVolumes() (*ALIVolumes, error) {
accessKeyId := os.Getenv("ALIYUN_ACCESS_KEY_ID")
if accessKeyId == "" {
accessKeyID := os.Getenv("ALIYUN_ACCESS_KEY_ID")
if accessKeyID == "" {
return nil, fmt.Errorf("error initialing ALIVolumes: ALIYUN_ACCESS_KEY_ID cannot be empty")
}
accessKeySecret := os.Getenv("ALIYUN_ACCESS_KEY_SECRET")
@ -61,7 +61,7 @@ func NewALIVolumes() (*ALIVolumes, error) {
ecsEndpoint = ecs.ECSDefaultEndpoint
}
client := ecs.NewClientWithEndpoint(ecsEndpoint, accessKeyId, accessKeySecret)
client := ecs.NewClientWithEndpoint(ecsEndpoint, accessKeyID, accessKeySecret)
a := &ALIVolumes{
client: client,
}

View File

@ -84,8 +84,8 @@ func NewALICloud(region string, tags map[string]string) (ALICloud, error) {
c := &aliCloudImplementation{region: region}
accessKeyId := os.Getenv("ALIYUN_ACCESS_KEY_ID")
if accessKeyId == "" {
accessKeyID := os.Getenv("ALIYUN_ACCESS_KEY_ID")
if accessKeyID == "" {
return nil, errors.New("ALIYUN_ACCESS_KEY_ID is required")
}
accessKeySecret := os.Getenv("ALIYUN_ACCESS_KEY_SECRET")
@ -93,13 +93,13 @@ func NewALICloud(region string, tags map[string]string) (ALICloud, error) {
return nil, errors.New("ALIYUN_ACCESS_KEY_SECRET is required")
}
c.ecsClient = ecs.NewClient(accessKeyId, accessKeySecret)
c.ecsClient = ecs.NewClient(accessKeyID, accessKeySecret)
c.ecsClient.SetUserAgent(KubernetesKopsIdentity)
c.slbClient = slb.NewClient(accessKeyId, accessKeySecret)
ramclient := ram.NewClient(accessKeyId, accessKeySecret)
c.slbClient = slb.NewClient(accessKeyID, accessKeySecret)
ramclient := ram.NewClient(accessKeyID, accessKeySecret)
c.ramClient = ramclient.(*ram.RamClient)
c.essClient = ess.NewClient(accessKeyId, accessKeySecret)
c.vpcClient = ecs.NewVPCClient(accessKeyId, accessKeySecret, common.Region(region))
c.essClient = ess.NewClient(accessKeyID, accessKeySecret)
c.vpcClient = ecs.NewVPCClient(accessKeyID, accessKeySecret, common.Region(region))
c.tags = tags

View File

@ -28,7 +28,7 @@ import (
type aliyunOSSConfig struct {
region oss.Region
internal bool
accessKeyId string
accessKeyID string
accessKeySecret string
securityToken string
secure bool
@ -53,10 +53,10 @@ func NewAliOSSClient() (*oss.Client, error) {
}
if c.securityToken != "" {
return oss.NewOSSClientForAssumeRole(c.region, c.internal, c.accessKeyId, c.accessKeySecret, c.securityToken, c.secure), nil
return oss.NewOSSClientForAssumeRole(c.region, c.internal, c.accessKeyID, c.accessKeySecret, c.securityToken, c.secure), nil
}
return oss.NewOSSClient(c.region, c.internal, c.accessKeyId, c.accessKeySecret, c.secure), nil
return oss.NewOSSClient(c.region, c.internal, c.accessKeyID, c.accessKeySecret, c.secure), nil
}
func (c *aliyunOSSConfig) loadConfig() error {
@ -71,8 +71,8 @@ func (c *aliyunOSSConfig) loadConfig() error {
c.region = oss.Region(fmt.Sprintf("oss-%s", region))
}
c.accessKeyId = os.Getenv("ALIYUN_ACCESS_KEY_ID")
if c.accessKeyId != "" {
c.accessKeyID = os.Getenv("ALIYUN_ACCESS_KEY_ID")
if c.accessKeyID != "" {
c.accessKeySecret = os.Getenv("ALIYUN_ACCESS_KEY_SECRET")
if c.accessKeySecret == "" {
return fmt.Errorf("ALIYUN_ACCESS_KEY_SECRET cannot be empty")
@ -87,7 +87,7 @@ func (c *aliyunOSSConfig) loadConfig() error {
if err != nil {
return fmt.Errorf("Can't get role token: %s", err)
}
c.accessKeyId = roleAuth.AccessKeyId
c.accessKeyID = roleAuth.AccessKeyId
c.accessKeySecret = roleAuth.AccessKeySecret
c.securityToken = roleAuth.SecurityToken
}