profile

package
v2.32.3 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// DirectoryNameEnv プロファイルの格納先を指定する環境変数
	DirectoryNameEnv = "SAKURACLOUD_PROFILE_DIR"
	// DirectoryNameEnvOld プロファイルの格納先を指定する環境変数(後方互換)
	DirectoryNameEnvOld = "USACLOUD_PROFILE_DIR"
	// DefaultProfileName デフォルトのプロファイル名
	DefaultProfileName = "default"

	// EnableAPITraceWord TraceModeに設定する、APIトレースを有効化するためのキーワード
	EnableAPITraceWord = "api"

	// EnableHTTPTraceWord TraceModeに設定する、HTTPトレースを有効化するためのキーワード
	EnableHTTPTraceWord = "http"
)

Variables

This section is empty.

Functions

func ConfigDir added in v2.9.0

func ConfigDir() (string, error)

ConfigDir プロファイルを格納するディレクトリのフルパス

func ConfigFilePath

func ConfigFilePath(profileName string) (string, error)

ConfigFilePath 指定のプロファイル名のコンフィグファイルパスを取得

func CurrentName

func CurrentName() (string, error)

CurrentName カレントプロファイル名

func EnableAPITrace added in v2.32.0

func EnableAPITrace(strTraceMode string) bool

func EnableHTTPTrace added in v2.32.0

func EnableHTTPTrace(strTraceMode string) bool

func List

func List() ([]string, error)

List プロファイル名の一覧を返す

func Load

func Load(profileName string, configValue interface{}) error

Load 指定のプロファイル名からロードする

configValueには*profile.ConfigValue(派生)への参照を渡す

指定したプロファイル名に対応するコンフィグファイルが存在しない場合はエラーを返す ただしデフォルトのプロファイル名の場合はファイルが存在しなくてもエラーにしない

func Remove

func Remove(profileName string) error

Remove 指定のプロファイルのコンフィグを削除する

プロファイルディレクトリが空になる場合はディレクトリも合わせて削除する Currentプロファイルが削除された場合はCurrentをデフォルトに設定する

func Save

func Save(profileName string, val interface{}) error

Save プロファイルコンフィグを保存

func SetCurrentName

func SetCurrentName(profileName string) error

SetCurrentName カレントプロファイル名を設定する

func ValidateName

func ValidateName(profileName string, invalidRunes ...rune) error

ValidateName プロファイル名が有効か検証

Types

type ConfigValue

type ConfigValue struct {
	// AccessToken アクセストークン
	AccessToken string
	// AccessTokenSecret アクセスシークレット
	AccessTokenSecret string

	// Zone デフォルトゾーン
	Zone string
	// Zones 利用可能なゾーン
	Zones []string

	// UserAgent ユーザーエージェント
	UserAgent string `json:",omitempty"`
	// AcceptLanguage リクエスト時のAccept-Languageヘッダ
	AcceptLanguage string

	// RetryMax 423/503時のリトライ回数
	RetryMax int
	// RetryMin 423/503時のリトライ間隔(最小) 単位:秒
	RetryWaitMin int
	// RetryMax 423/503時のリトライ間隔(最大) 単位:秒
	RetryWaitMax int

	// StatePollingTimeout StatePollWaiterでのタイムアウト 単位:秒
	StatePollingTimeout int
	// StatePollingInterval StatePollWaiterでのポーリング間隔 単位:秒
	StatePollingInterval int

	// HTTPRequestTimeout APIリクエスト時のHTTPタイムアウト 単位:秒
	HTTPRequestTimeout int
	// HTTPRequestRateLimit APIリクエスト時の1秒あたりのリクエスト上限数
	HTTPRequestRateLimit int

	// APIRootURL APIのルートURL
	APIRootURL string

	// DefaultZone グローバルリソースAPIを呼ぶ際に指定するゾーン
	DefaultZone string

	// TraceMode トレースモード
	TraceMode string
	// FakeMode フェイクモード有効化
	FakeMode bool
	// FakeStorePath フェイクモードでのファイルストアパス
	FakeStorePath string
}

ConfigValue プロファイル コンフィグ

func (*ConfigValue) EnableAPITrace added in v2.8.8

func (o *ConfigValue) EnableAPITrace() bool

func (*ConfigValue) EnableHTTPTrace added in v2.8.8

func (o *ConfigValue) EnableHTTPTrace() bool

Jump to

Keyboard shortcuts

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