diff --git a/config/configure_get_test.go b/config/configure_get_test.go index 46944ca68..6152a1a52 100644 --- a/config/configure_get_test.go +++ b/config/configure_get_test.go @@ -88,7 +88,7 @@ func TestDoConfigureGet(t *testing.T) { ctx.Flags().Get("profile").SetAssigned(true) ctx.Flags().Get("profile").SetValue("default") doConfigureGet(ctx, []string{}) - assert.Equal(t, "{\n\t\"name\": \"default\",\n\t\"mode\": \"AK\",\n\t\"access_key_id\": \"default_aliyun_access_key_id\",\n\t\"access_key_secret\": \"default_aliyun_access_key_secret\",\n\t\"sts_token\": \"\",\n\t\"sts_region\": \"\",\n\t\"ram_role_name\": \"\",\n\t\"ram_role_arn\": \"\",\n\t\"ram_session_name\": \"\",\n\t\"source_profile\": \"\",\n\t\"private_key\": \"\",\n\t\"key_pair_name\": \"\",\n\t\"expired_seconds\": 0,\n\t\"verified\": \"\",\n\t\"region_id\": \"\",\n\t\"output_format\": \"json\",\n\t\"language\": \"\",\n\t\"site\": \"\",\n\t\"retry_timeout\": 0,\n\t\"connect_timeout\": 0,\n\t\"retry_count\": 0,\n\t\"process_command\": \"\",\n\t\"credentials_uri\": \"\",\n\t\"oidc_provider_arn\": \"\",\n\t\"oidc_token_file\": \"\"\n}\n\n", w.String()) + assert.Equal(t, "{\n\t\"name\": \"default\",\n\t\"mode\": \"AK\",\n\t\"access_key_id\": \"default_aliyun_access_key_id\",\n\t\"access_key_secret\": \"default_aliyun_access_key_secret\",\n\t\"output_format\": \"json\"\n}\n\n", w.String()) //testcase 5 hookLoadConfiguration = func(fn func(path string) (*Configuration, error)) func(path string) (*Configuration, error) { diff --git a/config/profile.go b/config/profile.go index 9b0b49ba2..20525aad8 100644 --- a/config/profile.go +++ b/config/profile.go @@ -50,29 +50,29 @@ const ( type Profile struct { Name string `json:"name"` Mode AuthenticateMode `json:"mode"` - AccessKeyId string `json:"access_key_id"` - AccessKeySecret string `json:"access_key_secret"` - StsToken string `json:"sts_token"` - StsRegion string `json:"sts_region"` - RamRoleName string `json:"ram_role_name"` - RamRoleArn string `json:"ram_role_arn"` - RoleSessionName string `json:"ram_session_name"` - SourceProfile string `json:"source_profile"` - PrivateKey string `json:"private_key"` - KeyPairName string `json:"key_pair_name"` - ExpiredSeconds int `json:"expired_seconds"` - Verified string `json:"verified"` - RegionId string `json:"region_id"` - OutputFormat string `json:"output_format"` - Language string `json:"language"` - Site string `json:"site"` - ReadTimeout int `json:"retry_timeout"` - ConnectTimeout int `json:"connect_timeout"` - RetryCount int `json:"retry_count"` - ProcessCommand string `json:"process_command"` - CredentialsURI string `json:"credentials_uri"` - OIDCProviderARN string `json:"oidc_provider_arn"` - OIDCTokenFile string `json:"oidc_token_file"` + AccessKeyId string `json:"access_key_id,omitempty"` + AccessKeySecret string `json:"access_key_secret,omitempty"` + StsToken string `json:"sts_token,omitempty"` + StsRegion string `json:"sts_region,omitempty"` + RamRoleName string `json:"ram_role_name,omitempty"` + RamRoleArn string `json:"ram_role_arn,omitempty"` + RoleSessionName string `json:"ram_session_name,omitempty"` + SourceProfile string `json:"source_profile,omitempty"` + PrivateKey string `json:"private_key,omitempty"` + KeyPairName string `json:"key_pair_name,omitempty"` + ExpiredSeconds int `json:"expired_seconds,omitempty"` + Verified string `json:"verified,omitempty"` + RegionId string `json:"region_id,omitempty"` + OutputFormat string `json:"output_format,omitempty"` + Language string `json:"language,omitempty"` + Site string `json:"site,omitempty"` + ReadTimeout int `json:"retry_timeout,omitempty"` + ConnectTimeout int `json:"connect_timeout,omitempty"` + RetryCount int `json:"retry_count,omitempty"` + ProcessCommand string `json:"process_command,omitempty"` + CredentialsURI string `json:"credentials_uri,omitempty"` + OIDCProviderARN string `json:"oidc_provider_arn,omitempty"` + OIDCTokenFile string `json:"oidc_token_file,omitempty"` parent *Configuration //`json:"-"` }