Documentation ¶
Overview ¶
Copyright 1999-2019 Alibaba Group Holding Limited
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 1999-2019 Alibaba Group Holding Limited ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 1999-2019 Alibaba Group Holding Limited ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 1999-2019 Alibaba Group Holding Limited ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 1999-2019 Alibaba Group Holding Limited ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 1999-2019 Alibaba Group Holding Limited ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 1999-2019 Alibaba Group Holding Limited ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 1999-2019 Alibaba Group Holding Limited ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 1999-2019 Alibaba Group Holding Limited ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 1999-2019 Alibaba Group Holding Limited ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 1999-2019 Alibaba Group Holding Limited ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func AccessKeyIdFlag(fs *cli.FlagSet) *cli.Flag
- func AccessKeySecretFlag(fs *cli.FlagSet) *cli.Flag
- func AddFlags(fs *cli.FlagSet)
- func ConfigurePathFlag(fs *cli.FlagSet) *cli.Flag
- func DoHello(ctx *cli.Context, profile *Profile)
- func GetConfigPath() string
- func GetHomePath() string
- func GetLastChars(s string, lastChars int) string
- func GetUserAgent() string
- func IsRegion(region string) bool
- func KeyPairNameFlag(fs *cli.FlagSet) *cli.Flag
- func LanguageFlag(fs *cli.FlagSet) *cli.Flag
- func MigrateConfigure(w io.Writer, path string, config *Configuration) error
- func ModeFlag(fs *cli.FlagSet) *cli.Flag
- func MosaicString(s string, lastChars int) string
- func NewAccessKeyIdFlag() *cli.Flag
- func NewAccessKeySecretFlag() *cli.Flag
- func NewConfigureCommand() *cli.Command
- func NewConfigureDeleteCommand() *cli.Command
- func NewConfigureGetCommand() *cli.Command
- func NewConfigureListCommand() *cli.Command
- func NewConfigurePathFlag() *cli.Flag
- func NewConfigureSetCommand() *cli.Command
- func NewKeyPairNameFlag() *cli.Flag
- func NewLanguageFlag() *cli.Flag
- func NewModeFlag() *cli.Flag
- func NewPrivateKeyFlag() *cli.Flag
- func NewProfileFlag() *cli.Flag
- func NewRamRoleArnFlag() *cli.Flag
- func NewRamRoleNameFlag() *cli.Flag
- func NewRegionFlag() *cli.Flag
- func NewRetryCountFlag() *cli.Flag
- func NewRetryTimeoutFlag() *cli.Flag
- func NewRoleSessionNameFlag() *cli.Flag
- func NewSkipSecureVerify() *cli.Flag
- func NewStsTokenFlag() *cli.Flag
- func PrivateKeyFlag(fs *cli.FlagSet) *cli.Flag
- func ProfileFlag(fs *cli.FlagSet) *cli.Flag
- func RamRoleArnFlag(fs *cli.FlagSet) *cli.Flag
- func RamRoleNameFlag(fs *cli.FlagSet) *cli.Flag
- func ReadInput(defaultValue string) string
- func RegionFlag(fs *cli.FlagSet) *cli.Flag
- func RetryCountFlag(fs *cli.FlagSet) *cli.Flag
- func RetryTimeoutFlag(fs *cli.FlagSet) *cli.Flag
- func RoleSessionNameFlag(fs *cli.FlagSet) *cli.Flag
- func SaveConfiguration(config Configuration) error
- func SetUserAgent(agent string)
- func SkipSecureVerify(fs *cli.FlagSet) *cli.Flag
- func StsTokenFlag(fs *cli.FlagSet) *cli.Flag
- type AuthenticateMode
- type Configuration
- type Profile
- func (cp *Profile) GetClient(ctx *cli.Context) (*sdk.Client, error)
- func (cp *Profile) GetClientByAK(config *sdk.Config) (*sdk.Client, error)
- func (cp *Profile) GetClientByEcsRamRole(config *sdk.Config) (*sdk.Client, error)
- func (cp *Profile) GetClientByPrivateKey(config *sdk.Config) (*sdk.Client, error)
- func (cp *Profile) GetClientByRoleArn(config *sdk.Config) (*sdk.Client, error)
- func (cp *Profile) GetClientBySts(config *sdk.Config) (*sdk.Client, error)
- func (cp *Profile) GetParent() *Configuration
- func (cp *Profile) GetSessionCredential() (*signers.SessionCredential, error)
- func (cp *Profile) GetSessionCredentialByEcsRamRole() (*signers.SessionCredential, error)
- func (cp *Profile) GetSessionCredentialByRoleArn() (*signers.SessionCredential, error)
- func (cp *Profile) OverwriteWithFlags(ctx *cli.Context)
- func (cp *Profile) Validate() error
- func (cp *Profile) ValidateAK() error
- type Region
Constants ¶
const ( ProfileFlagName = "profile" ModeFlagName = "mode" AccessKeyIdFlagName = "access-key-id" AccessKeySecretFlagName = "access-key-secret" StsTokenFlagName = "sts-token" RamRoleNameFlagName = "ram-role-name" RamRoleArnFlagName = "ram-role-arn" RoleSessionNameFlagName = "role-session-name" PrivateKeyFlagName = "private-key" KeyPairNameFlagName = "key-pair-name" RegionFlagName = "region" LanguageFlagName = "language" RetryTimeoutFlagName = "retry-timeout" RetryCountFlagName = "retry-count" SkipSecureVerifyName = "skip-secure-verify" ConfigurePathFlagName = "config-path" )
const ( AK = AuthenticateMode("AK") StsToken = AuthenticateMode("StsToken") RamRoleArn = AuthenticateMode("RamRoleArn") EcsRamRole = AuthenticateMode("EcsRamRole") RsaKeyPair = AuthenticateMode("RsaKeyPair") )
const (
DefaultConfigProfileName = "default"
)
Variables ¶
This section is empty.
Functions ¶
func GetConfigPath ¶
func GetConfigPath() string
func GetHomePath ¶
func GetHomePath() string
func GetLastChars ¶
func GetUserAgent ¶
func GetUserAgent() string
func MigrateConfigure ¶
func MigrateConfigure(w io.Writer, path string, config *Configuration) error
func MosaicString ¶
func NewAccessKeyIdFlag ¶
func NewAccessKeySecretFlag ¶
func NewConfigureCommand ¶
func NewConfigureGetCommand ¶
func NewConfigureListCommand ¶
func NewConfigurePathFlag ¶
func NewConfigureSetCommand ¶
func NewKeyPairNameFlag ¶
func NewLanguageFlag ¶
func NewModeFlag ¶
func NewPrivateKeyFlag ¶
func NewProfileFlag ¶
func NewRamRoleArnFlag ¶
func NewRamRoleNameFlag ¶
func NewRegionFlag ¶
func NewRetryCountFlag ¶
func NewRetryTimeoutFlag ¶
func NewRoleSessionNameFlag ¶
func NewSkipSecureVerify ¶
func NewStsTokenFlag ¶
func SaveConfiguration ¶
func SaveConfiguration(config Configuration) error
func SetUserAgent ¶
func SetUserAgent(agent string)
Types ¶
type AuthenticateMode ¶
type AuthenticateMode string
type Configuration ¶
type Configuration struct { CurrentProfile string `json:"current"` Profiles []Profile `json:"profiles"` MetaPath string `json:"meta_path"` }
func LoadConfiguration ¶
func LoadConfiguration(path string, w io.Writer) (Configuration, error)
func MigrateCredentials ¶
func MigrateCredentials(path string) (Configuration, error)
func MigrateLegacyConfiguration ¶
func MigrateLegacyConfiguration(w io.Writer) *Configuration
func NewConfigFromBytes ¶
func NewConfigFromBytes(bytes []byte) (Configuration, error)
func NewConfiguration ¶
func NewConfiguration() Configuration
func (*Configuration) GetCurrentProfile ¶
func (c *Configuration) GetCurrentProfile(ctx *cli.Context) Profile
func (*Configuration) GetProfile ¶
func (c *Configuration) GetProfile(pn string) (Profile, bool)
func (*Configuration) NewProfile ¶
func (c *Configuration) NewProfile(pn string) Profile
func (*Configuration) PutProfile ¶
func (c *Configuration) PutProfile(profile Profile)
type Profile ¶
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"` RamRoleName string `json:"ram_role_name"` RamRoleArn string `json:"ram_role_arn"` RoleSessionName string `json:"ram_session_name"` 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"` RetryTimeout int `json:"retry_timeout"` RetryCount int `json:"retry_count"` // contains filtered or unexported fields }
func LoadProfileWithContext ¶
func NewProfile ¶
func (*Profile) GetClientByAK ¶
func (*Profile) GetClientByEcsRamRole ¶
func (*Profile) GetClientByPrivateKey ¶
func (*Profile) GetClientByRoleArn ¶
func (*Profile) GetClientBySts ¶
func (*Profile) GetParent ¶
func (cp *Profile) GetParent() *Configuration
func (*Profile) GetSessionCredential ¶
func (cp *Profile) GetSessionCredential() (*signers.SessionCredential, error)
func (*Profile) GetSessionCredentialByEcsRamRole ¶
func (cp *Profile) GetSessionCredentialByEcsRamRole() (*signers.SessionCredential, error)
func (*Profile) GetSessionCredentialByRoleArn ¶
func (cp *Profile) GetSessionCredentialByRoleArn() (*signers.SessionCredential, error)