config

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// JWT platform token
	// Required: false
	// Example: "qwqwdfwv68979we0q9bfv7e9sbvd89798qrwv97ff"
	Token string `json:"token" yaml:"token"`

	// Application (client) identifier for authorization
	// in the cloud platform controller in oauth2 mode.
	// Required: true
	// Example: "ewqfrvea7s890avw804389qwguf234h0otfi3w4eiu"
	AppID string `json:"appId" yaml:"appId" validate:"required"`

	// Application (client) secret code for authorization
	// in the cloud platform controller in oauth2 mode.
	// Example: "frvet09rvesfis0c9erv9fsov0vsdfi09ovds0f"
	AppSecret string `json:"appSecret" yaml:"appSecret" validate:"required"`

	// Platform authentication service address
	// Required: true
	// Example: "https://sso.digitalenergy.online"
	SSOURL string `json:"ssoUrl" yaml:"ssoUrl" validate:"url"`

	// The address of the platform on which the actions are planned
	// Required: true
	// Example: "https://mr4.digitalenergy.online"
	DecortURL string `json:"decortUrl" yaml:"decortUrl" validate:"url"`

	// Amount platform request attempts
	// Default value: 5
	// Required: false
	Retries uint64 `json:"retries" yaml:"retries"`

	// Skip verify
	// Required: false
	SSLSkipVerify bool `json:"sslSkipVerify" yaml:"sslSkipVerify"`

	// HTTP client timeout, unlimited if left empty
	// Required: false
	Timeout Duration `json:"timeout" yaml:"timeout"`
}

Configuration for creating request to platform

func ParseConfigJSON added in v1.3.0

func ParseConfigJSON(path string) (Config, error)

ParseConfigJSON parses Config from specified JSON-formatted file.

func ParseConfigYAML added in v1.3.0

func ParseConfigYAML(path string) (Config, error)

ParseConfigYAML parses Config from specified YAML-formatted file.

func (*Config) SetTimeout added in v1.4.4

func (c *Config) SetTimeout(dur time.Duration)

SetTimeout is used to set HTTP client timeout.

type Duration added in v1.4.4

type Duration time.Duration

Duration is a wrapper around time.Duration (used for better user experience)

func (*Duration) Get added in v1.4.4

func (d *Duration) Get() time.Duration

func (*Duration) UnmarshalJSON added in v1.4.4

func (d *Duration) UnmarshalJSON(b []byte) error

func (*Duration) UnmarshalYAML added in v1.4.4

func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error

type LegacyConfig

type LegacyConfig struct {
	// ServiceAccount username
	// Required: true
	// Example : "osh_mikoev"
	Username string `json:"username" yaml:"username" validate:"required"`

	// ServiceAccount password
	// Required: true
	// Example: "[1o>hYkjnJr)HI78q7t&#%8Lm"
	Password string `json:"password" yaml:"password" validate:"required"`

	// Platform token
	// Required: false
	// Example: "158e76424b0d4810b6086hgbhj928fc4a6bc06e"
	Token string `json:"token" yaml:"token"`

	// Address of the platform on which the actions are planned
	// Required: true
	// Example: "https://mr4.digitalenergy.online"
	DecortURL string `json:"decortUrl" yaml:"decortUrl" validate:"url"`

	// Amount platform request attempts
	// Default value: 5
	// Required: false
	Retries uint64 `json:"retries" yaml:"retries"`

	// Skip verify
	// Required: false
	SSLSkipVerify bool `json:"sslSkipVerify" yaml:"sslSkipVerify"`

	// HTTP client timeout, unlimited if left empty
	// Required: false
	Timeout Duration `json:"timeout" yaml:"timeout"`
}

Legacy client configuration

func ParseLegacyConfigJSON added in v1.3.0

func ParseLegacyConfigJSON(path string) (LegacyConfig, error)

ParseLegacyConfigJSON parses LegacyConfig from specified JSON-formatted file.

func ParseLegacyConfigYAML added in v1.3.0

func ParseLegacyConfigYAML(path string) (LegacyConfig, error)

ParseLegacyConfigYAML parses LegacyConfig from specified YAML-formatted file.

func (*LegacyConfig) SetTimeout added in v1.4.4

func (c *LegacyConfig) SetTimeout(dur time.Duration)

SetTimeout is used to set HTTP client timeout.

Jump to

Keyboard shortcuts

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