config

package
v0.21.9 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: Apache-2.0 Imports: 2 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Region is the region of backend service
	// See also <https://docs.ucloud.cn/api/summary/regionlist> ...
	Region string `default:""`

	// Zone is the zone of backend service
	// See also <https://docs.ucloud.cn/api/summary/regionlist> ...
	Zone string `default:""`

	// ProjectId is the unique identify of project, used for organize resources,
	// Most of resources should belong to a project.
	// Sub-Account must have an project id.
	// See also <https://docs.ucloud.cn/api/summary/get_project_list> ...
	ProjectId string `default:""`

	// BaseUrl is the url of backend api
	// See also <doc link> ...
	BaseUrl string `default:"https://api.ucloud.cn"`

	// UserAgent is an attribute for sdk client, used for distinguish who is using sdk.
	// See also https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent
	// It will be appended to the end of sdk user-agent.
	// eg. "Terraform/0.10.1" -> "GO/1.9.1 GO-SDK/0.1.0 Terraform/0.10.1"
	// NOTE: it will conflict with the User-Agent of HTTPHeaders
	UserAgent string `default:""`

	// Timeout is timeout for every request.
	Timeout time.Duration `default:"30s"`

	// MaxRetries is the number of max retry times.
	// Set MaxRetries more than 0 to enable auto-retry for network and service availability problem
	// if auto-retry is enabled, it will enable default retry policy using exponential backoff.
	MaxRetries int `default:"0"`

	// LogLevel is equal to logrus level,
	// if logLevel not be set, use INFO level as default.
	LogLevel log.Level `default:"log.InfoLevel"`
	// contains filtered or unexported fields
}

Config is the config of ucloud sdk, use for setting up client

func NewConfig

func NewConfig() Config

NewConfig will return a new client config with default options.

func (*Config) GetActionLevel

func (c *Config) GetActionLevel(action string) log.Level

GetActionLevel will return the log level of action

func (*Config) SetActionLevel

func (c *Config) SetActionLevel(action string, level log.Level)

SetActionLevel will return the log level of action

Jump to

Keyboard shortcuts

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