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
- func AccessKeyIdFlag(fs *cli.FlagSet) *cli.Flag
- func AccessKeySecretFlag(fs *cli.FlagSet) *cli.Flag
- func AddFlags(fs *cli.FlagSet)
- func AutoModeRecognition(cp *Profile)
- func ConfigurePathFlag(fs *cli.FlagSet) *cli.Flag
- func ConnectTimeoutFlag(fs *cli.FlagSet) *cli.Flag
- func DoHello(ctx *cli.Context, profile *Profile)
- func ExpiredSecondsFlag(fs *cli.FlagSet) *cli.Flag
- func GetConfigPath() string
- func GetConfigPath2() string
- func GetHomePath() string
- func GetLastChars(s string, lastChars int) string
- func InstanceFlag(fs *cli.FlagSet) *cli.Flag
- func IsRegion(region string) bool
- func KeyPairNameFlag(fs *cli.FlagSet) *cli.Flag
- func LanguageFlag(fs *cli.FlagSet) *cli.Flag
- func LocalPortFlag(fs *cli.FlagSet) *cli.Flag
- func MigrateConfigure(path string, conf *Configuration) (err 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 NewConnectTimeoutFlag() *cli.Flag
- func NewExpiredSecondsFlag() *cli.Flag
- func NewInstanceFlag() *cli.Flag
- func NewKeyPairNameFlag() *cli.Flag
- func NewLanguageFlag() *cli.Flag
- func NewLocalPortFlag() *cli.Flag
- func NewModeFlag() *cli.Flag
- func NewPortNumberUrlFlag() *cli.Flag
- func NewPrivateKeyFlag() *cli.Flag
- func NewProcessCommandFlag() *cli.Flag
- func NewProfileFlag() *cli.Flag
- func NewPublicKeyFlag() *cli.Flag
- func NewRamRoleArnFlag() *cli.Flag
- func NewRamRoleNameFlag() *cli.Flag
- func NewReadTimeoutFlag() *cli.Flag
- func NewRegionFlag() *cli.Flag
- func NewRemotePortFlag() *cli.Flag
- func NewRetryCountFlag() *cli.Flag
- func NewRoleSessionNameFlag() *cli.Flag
- func NewServiceInstanceFlag() *cli.Flag
- func NewSkipSecureVerify() *cli.Flag
- func NewStsRegionFlag() *cli.Flag
- func NewStsTokenFlag() *cli.Flag
- func NewUserNameFlag() *cli.Flag
- func NewVerboseFlag() *cli.Flag
- func NewWebsocketUrlFlag() *cli.Flag
- func PortNumberFlag(fs *cli.FlagSet) *cli.Flag
- func PrivateKeyFlag(fs *cli.FlagSet) *cli.Flag
- func ProcessCommandFlag(fs *cli.FlagSet) *cli.Flag
- func ProfileFlag(fs *cli.FlagSet) *cli.Flag
- func PublicKeyFlag(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 ReadTimeoutFlag(fs *cli.FlagSet) *cli.Flag
- func RegionFlag(fs *cli.FlagSet) *cli.Flag
- func RemotePortFlag(fs *cli.FlagSet) *cli.Flag
- func RetryCountFlag(fs *cli.FlagSet) *cli.Flag
- func RoleSessionNameFlag(fs *cli.FlagSet) *cli.Flag
- func SaveConfiguration(config *Configuration) (err error)
- func ServiceInstanceFlag(fs *cli.FlagSet) *cli.Flag
- func SkipSecureVerify(fs *cli.FlagSet) *cli.Flag
- func StsRegionFlag(fs *cli.FlagSet) *cli.Flag
- func StsTokenFlag(fs *cli.FlagSet) *cli.Flag
- func UserNameFlag(fs *cli.FlagSet) *cli.Flag
- func VerboseFlag(fs *cli.FlagSet) *cli.Flag
- func WssUrlFlag(fs *cli.FlagSet) *cli.Flag
- type AuthenticateMode
- type Configuration
- func LoadConfiguration(path string) (conf *Configuration, err error)
- func MigrateCredentials(path string) (conf *Configuration, err error)
- func MigrateLegacyConfiguration() (conf *Configuration, err error)
- func NewConfigFromBytes(bytes []byte) (conf *Configuration, err error)
- func NewConfiguration() *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) GetClientByCredentialsURI(config *sdk.Config, ctx *cli.Context) (*sdk.Client, error)
- func (cp *Profile) GetClientByEcsRamRole(config *sdk.Config) (*sdk.Client, error)
- func (cp *Profile) GetClientByExternal(config *sdk.Config, ctx *cli.Context) (*sdk.Client, error)
- func (cp *Profile) GetClientByPrivateKey(config *sdk.Config) (*sdk.Client, error)
- func (cp *Profile) GetClientByRamRoleArnWithEcs(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(client *sdk.Client) (string, string, string, error)
- func (cp *Profile) OverwriteWithFlags(ctx *cli.Context)
- func (cp *Profile) Validate() error
- func (cp *Profile) ValidateAK() error
Constants ¶
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" )
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") )
const (
DefaultConfigProfileName = "default"
)
Variables ¶
This section is empty.
Functions ¶
func AutoModeRecognition ¶
func AutoModeRecognition(cp *Profile)
func GetConfigPath ¶
func GetConfigPath() string
func GetConfigPath2 ¶
func GetConfigPath2() string
func GetHomePath ¶
func GetHomePath() string
func GetLastChars ¶
func MigrateConfigure ¶
func MigrateConfigure(path string, conf *Configuration) (err error)
func MosaicString ¶
func NewAccessKeyIdFlag ¶
func NewAccessKeySecretFlag ¶
func NewConfigureCommand ¶
func NewConfigureGetCommand ¶
func NewConfigureListCommand ¶
func NewConfigurePathFlag ¶
func NewConfigureSetCommand ¶
func NewConnectTimeoutFlag ¶
func NewExpiredSecondsFlag ¶
func NewInstanceFlag ¶
////////////////////////////////////////////////////////////////////////////////////////
func NewKeyPairNameFlag ¶
func NewLanguageFlag ¶
func NewLocalPortFlag ¶
/////////////////////////////////////////////////////////////////////////////////////////
func NewModeFlag ¶
///////////////////////////////////////////////////////////////////////////////////////// --mode {AK|StsToken|RamRoleArn|EcsRamRole|RsaKeyPair|RamRoleArnWithRoleName}
func NewPortNumberUrlFlag ¶
func NewPrivateKeyFlag ¶
func NewProcessCommandFlag ¶
func NewProfileFlag ¶
func NewPublicKeyFlag ¶
func NewRamRoleArnFlag ¶
func NewRamRoleNameFlag ¶
func NewReadTimeoutFlag ¶
func NewRegionFlag ¶
func NewRemotePortFlag ¶
func NewRetryCountFlag ¶
func NewRoleSessionNameFlag ¶
func NewServiceInstanceFlag ¶
func NewSkipSecureVerify ¶
func NewStsRegionFlag ¶
func NewStsTokenFlag ¶
func NewUserNameFlag ¶
func NewVerboseFlag ¶
func NewWebsocketUrlFlag ¶
func SaveConfiguration ¶
func SaveConfiguration(config *Configuration) (err error)
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 LoadProfileWithContext ¶
func NewProfile ¶
func (*Profile) GetClientByAK ¶
func (*Profile) GetClientByCredentialsURI ¶
func (*Profile) GetClientByEcsRamRole ¶
func (*Profile) GetClientByExternal ¶
func (*Profile) GetClientByPrivateKey ¶
func (*Profile) GetClientByRamRoleArnWithEcs ¶
func (*Profile) GetClientByRoleArn ¶
func (*Profile) GetClientBySts ¶
func (*Profile) GetParent ¶
func (cp *Profile) GetParent() *Configuration