config

package
v3.0.25+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

View Source
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"
)
View Source
const (
	AK         = AuthenticateMode("AK")
	StsToken   = AuthenticateMode("StsToken")
	RamRoleArn = AuthenticateMode("RamRoleArn")
	EcsRamRole = AuthenticateMode("EcsRamRole")
	RsaKeyPair = AuthenticateMode("RsaKeyPair")
)
View Source
const (
	DefaultConfigProfileName = "default"
)

Variables

This section is empty.

Functions

func AccessKeyIdFlag

func AccessKeyIdFlag(fs *cli.FlagSet) *cli.Flag

func AccessKeySecretFlag

func AccessKeySecretFlag(fs *cli.FlagSet) *cli.Flag

func AddFlags

func AddFlags(fs *cli.FlagSet)

func ConfigurePathFlag

func ConfigurePathFlag(fs *cli.FlagSet) *cli.Flag

func DoHello

func DoHello(ctx *cli.Context, profile *Profile)

func GetConfigPath

func GetConfigPath() string

func GetHomePath

func GetHomePath() string

func GetLastChars

func GetLastChars(s string, lastChars int) string

func GetUserAgent

func GetUserAgent() string

func IsRegion

func IsRegion(region string) bool

func KeyPairNameFlag

func KeyPairNameFlag(fs *cli.FlagSet) *cli.Flag

func LanguageFlag

func LanguageFlag(fs *cli.FlagSet) *cli.Flag

func MigrateConfigure

func MigrateConfigure(w io.Writer, path string, config *Configuration) error

func ModeFlag

func ModeFlag(fs *cli.FlagSet) *cli.Flag

func MosaicString

func MosaicString(s string, lastChars int) string

func NewAccessKeyIdFlag

func NewAccessKeyIdFlag() *cli.Flag

func NewAccessKeySecretFlag

func NewAccessKeySecretFlag() *cli.Flag

func NewConfigureCommand

func NewConfigureCommand() *cli.Command

func NewConfigureDeleteCommand

func NewConfigureDeleteCommand() *cli.Command

func NewConfigureGetCommand

func NewConfigureGetCommand() *cli.Command

func NewConfigureListCommand

func NewConfigureListCommand() *cli.Command

func NewConfigurePathFlag

func NewConfigurePathFlag() *cli.Flag

func NewConfigureSetCommand

func NewConfigureSetCommand() *cli.Command

func NewKeyPairNameFlag

func NewKeyPairNameFlag() *cli.Flag

func NewLanguageFlag

func NewLanguageFlag() *cli.Flag

func NewModeFlag

func NewModeFlag() *cli.Flag

func NewPrivateKeyFlag

func NewPrivateKeyFlag() *cli.Flag

func NewProfileFlag

func NewProfileFlag() *cli.Flag

func NewRamRoleArnFlag

func NewRamRoleArnFlag() *cli.Flag

func NewRamRoleNameFlag

func NewRamRoleNameFlag() *cli.Flag

func NewRegionFlag

func NewRegionFlag() *cli.Flag

func NewRetryCountFlag

func NewRetryCountFlag() *cli.Flag

func NewRetryTimeoutFlag

func NewRetryTimeoutFlag() *cli.Flag

func NewRoleSessionNameFlag

func NewRoleSessionNameFlag() *cli.Flag

func NewSkipSecureVerify

func NewSkipSecureVerify() *cli.Flag

func NewStsTokenFlag

func NewStsTokenFlag() *cli.Flag

func PrivateKeyFlag

func PrivateKeyFlag(fs *cli.FlagSet) *cli.Flag

func ProfileFlag

func ProfileFlag(fs *cli.FlagSet) *cli.Flag

func RamRoleArnFlag

func RamRoleArnFlag(fs *cli.FlagSet) *cli.Flag

func RamRoleNameFlag

func RamRoleNameFlag(fs *cli.FlagSet) *cli.Flag

func ReadInput

func ReadInput(defaultValue string) string

func RegionFlag

func RegionFlag(fs *cli.FlagSet) *cli.Flag

func RetryCountFlag

func RetryCountFlag(fs *cli.FlagSet) *cli.Flag

func RetryTimeoutFlag

func RetryTimeoutFlag(fs *cli.FlagSet) *cli.Flag

func RoleSessionNameFlag

func RoleSessionNameFlag(fs *cli.FlagSet) *cli.Flag

func SaveConfiguration

func SaveConfiguration(config Configuration) error

func SetUserAgent

func SetUserAgent(agent string)

func SkipSecureVerify

func SkipSecureVerify(fs *cli.FlagSet) *cli.Flag

func StsTokenFlag

func StsTokenFlag(fs *cli.FlagSet) *cli.Flag

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 LoadCurrentProfile

func LoadCurrentProfile(w io.Writer) (Profile, error)

func LoadProfile

func LoadProfile(path string, w io.Writer, name string) (Profile, error)

func LoadProfileWithContext

func LoadProfileWithContext(ctx *cli.Context) (profile Profile, err error)

func NewProfile

func NewProfile(name string) Profile

func (*Profile) GetClient

func (cp *Profile) GetClient(ctx *cli.Context) (*sdk.Client, error)

func (*Profile) GetClientByAK

func (cp *Profile) GetClientByAK(config *sdk.Config) (*sdk.Client, error)

func (*Profile) GetClientByEcsRamRole

func (cp *Profile) GetClientByEcsRamRole(config *sdk.Config) (*sdk.Client, error)

func (*Profile) GetClientByPrivateKey

func (cp *Profile) GetClientByPrivateKey(config *sdk.Config) (*sdk.Client, error)

func (*Profile) GetClientByRoleArn

func (cp *Profile) GetClientByRoleArn(config *sdk.Config) (*sdk.Client, error)

func (*Profile) GetClientBySts

func (cp *Profile) GetClientBySts(config *sdk.Config) (*sdk.Client, error)

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)

func (*Profile) OverwriteWithFlags

func (cp *Profile) OverwriteWithFlags(ctx *cli.Context)

func (*Profile) Validate

func (cp *Profile) Validate() error

func (*Profile) ValidateAK

func (cp *Profile) ValidateAK() error

type Region

type Region struct {
	RegionId  string
	LocalName string
}

func GetRegions

func GetRegions(ctx *cli.Context, profile *Profile) ([]Region, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL