api

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: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCaller

func NewCaller(opts ...*CallerOptions) sacloud.APICaller

NewCaller 指定のオプションでsacloud.APICallerを構築して返す

func NewCallerWithDefaults added in v2.32.0

func NewCallerWithDefaults(opts *CallerOptions) (sacloud.APICaller, error)

NewCallerWithDefaults 指定のオプション+環境変数/プロファイルを用いてsacloud.APICallerを構築して返す

DefaultOption()で得られる*CallerOptionsにoptsをマージしてからNewCallerが呼ばれる

func SetupFakeDefaults added in v2.18.1

func SetupFakeDefaults()

Types

type CallerOptions

type CallerOptions struct {
	AccessToken       string
	AccessTokenSecret string

	APIRootURL     string
	DefaultZone    string
	Zones          []string
	AcceptLanguage string

	HTTPClient *http.Client

	HTTPRequestTimeout   int
	HTTPRequestRateLimit int

	RetryMax     int
	RetryWaitMax int
	RetryWaitMin int

	UserAgent string

	TraceAPI             bool
	TraceHTTP            bool
	OpenTelemetry        bool
	OpenTelemetryOptions []otel.Option

	FakeMode      bool
	FakeStorePath string
}

CallerOptions sacloud.APICallerを作成する際のオプション

func DefaultOption added in v2.32.0

func DefaultOption() (*CallerOptions, error)

DefaultOption 環境変数、プロファイルからCallerOptionsを組み立てて返す

プロファイルは環境変数`SAKURACLOUD_PROFILE`または`USACLOUD_PROFILE`でプロファイル名が指定されていればそちらを優先し、 未指定の場合は通常のプロファイル処理(~/.usacloud/currentファイルから読み込み)される。 同じ項目を複数箇所で指定していた場合、環境変数->プロファイルの順で上書きされたものが返される

func DefaultOptionWithProfile added in v2.32.0

func DefaultOptionWithProfile(profileName string) (*CallerOptions, error)

DefaultOptionWithProfile 環境変数、プロファイルからCallerOptionsを組み立てて返す

プロファイルは引数を優先し、空の場合は環境変数`SAKURACLOUD_PROFILE`または`USACLOUD_PROFILE`が利用され、 それも空の場合は通常のプロファイル処理(~/.usacloud/currentファイルから読み込み)される。 同じ項目を複数箇所で指定していた場合、環境変数->プロファイルの順で上書きされたものが返される

func MergeOptions added in v2.32.0

func MergeOptions(opts ...*CallerOptions) *CallerOptions

MergeOptions 指定のCallerOptionsの非ゼロ値フィールドをoのコピーにマージして返す

func OptionsFromEnv added in v2.32.0

func OptionsFromEnv() *CallerOptions

OptionsFromEnv 環境変数からCallerOptionsを組み立てて返す

func OptionsFromProfile added in v2.32.0

func OptionsFromProfile(profileName string) (*CallerOptions, error)

OptionsFromProfile 指定のプロファイルからCallerOptionsを組み立てて返す プロファイル名に空文字が指定された場合はカレントプロファイルが利用される

Jump to

Keyboard shortcuts

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