config

package
v0.0.0-...-028f1de Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

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 (c) 2009-present, Alibaba Cloud All rights reserved.

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 (c) 2009-present, Alibaba Cloud All rights reserved.

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 (c) 2009-present, Alibaba Cloud All rights reserved.

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 (c) 2009-present, Alibaba Cloud All rights reserved.

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 (c) 2009-present, Alibaba Cloud All rights reserved.

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 (c) 2009-present, Alibaba Cloud All rights reserved.

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 (c) 2009-present, Alibaba Cloud All rights reserved.

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 (c) 2009-present, Alibaba Cloud All rights reserved.

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 (c) 2009-present, Alibaba Cloud All rights reserved.

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"
	InstanceFlagName        = "instance"
	VerboseFlagName         = "verbose"
	PortNumberFlagName      = "port"
	WssUrlFlagName          = "wss-url"
	ModeFlagName            = "mode"
	LocalPortFlagName       = "local-port"
	RemotePortFlagName      = "remote-port"
	AccessKeyIdFlagName     = "access-key-id"
	AccessKeySecretFlagName = "access-key-secret"
	StsTokenFlagName        = "sts-token"
	StsRegionFlagName       = "sts-region"
	RamRoleNameFlagName     = "ram-role-name"
	RamRoleArnFlagName      = "ram-role-arn"
	RoleSessionNameFlagName = "role-session-name"
	PrivateKeyFlagName      = "private-key"
	KeyPairNameFlagName     = "key-pair-name"
	RegionFlagName          = "region"
	LanguageFlagName        = "language"
	ReadTimeoutFlagName     = "read-timeout"
	ConnectTimeoutFlagName  = "connect-timeout"
	RetryCountFlagName      = "retry-count"
	SkipSecureVerifyName    = "skip-secure-verify"
	ConfigurePathFlagName   = "config-path"
	ExpiredSecondsFlagName  = "expired-seconds"
	ProcessCommandFlagName  = "process-command"
	ServiceInstanceFlagName = "service-instance"
	PublicKeyFlagName       = "public-key"
	UserNameFlagName        = "user-name"
)
View Source
const (
	AK                = AuthenticateMode("AK")
	StsToken          = AuthenticateMode("StsToken")
	RamRoleArn        = AuthenticateMode("RamRoleArn")
	EcsRamRole        = AuthenticateMode("EcsRamRole")
	RsaKeyPair        = AuthenticateMode("RsaKeyPair")
	RamRoleArnWithEcs = AuthenticateMode("RamRoleArnWithRoleName")
	External          = AuthenticateMode("External")
	CredentialsURI    = AuthenticateMode("CredentialsURI")
)
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 AutoModeRecognition

func AutoModeRecognition(cp *Profile)

func ConfigurePathFlag

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

func ConnectTimeoutFlag

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

func DoHello

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

func ExpiredSecondsFlag

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

func GetConfigPath

func GetConfigPath() string

func GetConfigPath2

func GetConfigPath2() string

func GetHomePath

func GetHomePath() string

func GetLastChars

func GetLastChars(s string, lastChars int) string

func InstanceFlag

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

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 LocalPortFlag

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

func MigrateConfigure

func MigrateConfigure(path string, conf *Configuration) (err 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 NewConnectTimeoutFlag

func NewConnectTimeoutFlag() *cli.Flag

func NewExpiredSecondsFlag

func NewExpiredSecondsFlag() *cli.Flag

func NewInstanceFlag

func NewInstanceFlag() *cli.Flag

////////////////////////////////////////////////////////////////////////////////////////

func NewKeyPairNameFlag

func NewKeyPairNameFlag() *cli.Flag

func NewLanguageFlag

func NewLanguageFlag() *cli.Flag

func NewLocalPortFlag

func NewLocalPortFlag() *cli.Flag

/////////////////////////////////////////////////////////////////////////////////////////

func NewModeFlag

func NewModeFlag() *cli.Flag

///////////////////////////////////////////////////////////////////////////////////////// --mode {AK|StsToken|RamRoleArn|EcsRamRole|RsaKeyPair|RamRoleArnWithRoleName}

func NewPortNumberUrlFlag

func NewPortNumberUrlFlag() *cli.Flag

func NewPrivateKeyFlag

func NewPrivateKeyFlag() *cli.Flag

func NewProcessCommandFlag

func NewProcessCommandFlag() *cli.Flag

func NewProfileFlag

func NewProfileFlag() *cli.Flag

func NewPublicKeyFlag

func NewPublicKeyFlag() *cli.Flag

func NewRamRoleArnFlag

func NewRamRoleArnFlag() *cli.Flag

func NewRamRoleNameFlag

func NewRamRoleNameFlag() *cli.Flag

func NewReadTimeoutFlag

func NewReadTimeoutFlag() *cli.Flag

func NewRegionFlag

func NewRegionFlag() *cli.Flag

func NewRemotePortFlag

func NewRemotePortFlag() *cli.Flag

func NewRetryCountFlag

func NewRetryCountFlag() *cli.Flag

func NewRoleSessionNameFlag

func NewRoleSessionNameFlag() *cli.Flag

func NewServiceInstanceFlag

func NewServiceInstanceFlag() *cli.Flag

func NewSkipSecureVerify

func NewSkipSecureVerify() *cli.Flag

func NewStsRegionFlag

func NewStsRegionFlag() *cli.Flag

func NewStsTokenFlag

func NewStsTokenFlag() *cli.Flag

func NewUserNameFlag

func NewUserNameFlag() *cli.Flag

func NewVerboseFlag

func NewVerboseFlag() *cli.Flag

func NewWebsocketUrlFlag

func NewWebsocketUrlFlag() *cli.Flag

func PortNumberFlag

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

func PrivateKeyFlag

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

func ProcessCommandFlag

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

func ProfileFlag

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

func PublicKeyFlag

func PublicKeyFlag(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 ReadTimeoutFlag

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

func RegionFlag

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

func RemotePortFlag

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

func RetryCountFlag

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

func RoleSessionNameFlag

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

func SaveConfiguration

func SaveConfiguration(config *Configuration) (err error)

func ServiceInstanceFlag

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

func SkipSecureVerify

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

func StsRegionFlag

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

func StsTokenFlag

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

func UserNameFlag

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

func VerboseFlag

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

func WssUrlFlag

func WssUrlFlag(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) (conf *Configuration, err error)

func MigrateCredentials

func MigrateCredentials(path string) (conf *Configuration, err error)

func MigrateLegacyConfiguration

func MigrateLegacyConfiguration() (conf *Configuration, err error)

func NewConfigFromBytes

func NewConfigFromBytes(bytes []byte) (conf *Configuration, err 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"`
	StsRegion       string           `json:"sts_region"`
	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"`
	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"`
	// contains filtered or unexported fields
}

func LoadCurrentProfile

func LoadCurrentProfile() (Profile, error)

func LoadProfile

func LoadProfile(path string, 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) GetClientByCredentialsURI

func (cp *Profile) GetClientByCredentialsURI(config *sdk.Config, ctx *cli.Context) (*sdk.Client, error)

func (*Profile) GetClientByEcsRamRole

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

func (*Profile) GetClientByExternal

func (cp *Profile) GetClientByExternal(config *sdk.Config, ctx *cli.Context) (*sdk.Client, error)

func (*Profile) GetClientByPrivateKey

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

func (*Profile) GetClientByRamRoleArnWithEcs

func (cp *Profile) GetClientByRamRoleArnWithEcs(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(client *sdk.Client) (string, string, string, 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

Jump to

Keyboard shortcuts

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