setting

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SettingForbidden is the status code returned when a setting is forbidden.
	SettingForbidden = 403
	// SettingNotFound is the status code returned when a setting is not found.
	SettingNotFound = 404
)

Variables

View Source
var (
	// ErrParseConnectionString is returned when a connection string cannot be parsed.
	ErrParseConnectionString = errors.New("failed to parse connection string")
)

Functions

This section is empty.

Types

type AccessKey added in v0.17.0

type AccessKey struct {
	ID     string
	Secret string
}

AccessKey contains the id and secret for access key authentication.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client contains methods to call the Azure App Config REST API and base settings for handling the requests.

func NewClient

func NewClient(appConfiguration string, cred auth.Credential, options ...ClientOption) (*Client, error)

NewClient creates and returns a new *Client.

func NewClientWithAccessKey added in v0.17.0

func NewClientWithAccessKey(appConfiguration string, key AccessKey, options ...ClientOption) (*Client, error)

NewClientWithAccessKey creates and returns a new *Client with the provided access key.

func NewClientWithConnectionString added in v0.17.0

func NewClientWithConnectionString(connectionString string, options ...ClientOption) (*Client, error)

NewClientWithConnectionString creates and returns a new *Client with the provided connection string.

func (*Client) Get

func (c *Client) Get(ctx context.Context, key string, options ...Option) (Setting, error)

Get a setting.

func (*Client) GetSettings

func (c *Client) GetSettings(ctx context.Context, keys []string, options ...Option) (map[string]Setting, error)

GetSettings get settings (key-values) by keys.

type ClientOption

type ClientOption func(c *Client)

ClientOption is a function that sets options to *Client.

func WithCloud added in v0.14.0

func WithCloud(c cloud.Cloud) ClientOption

WithCloud sets the Azure cloud for setting retrieval.

func WithConcurrency

func WithConcurrency(n int) ClientOption

WithConcurrency sets the concurrency for setting retrieval.

func WithRetryPolicy added in v0.12.0

func WithRetryPolicy(r httpr.RetryPolicy) ClientOption

WithRetryPolicy sets the retry policy for setting retrieval.

func WithTimeout

func WithTimeout(d time.Duration) ClientOption

WithTimeout sets timeout for setting retreival.

type Option

type Option func(o *Options)

Option is a function that sets options for client operations.

func WithLabel

func WithLabel(label string) Option

WithLabel sets label on the on a setting request.

func WithLabels added in v0.16.0

func WithLabels(labels map[string]string) Option

WithLabels sets labels on the setting requests based on the provided map. The key of the map should be the setting name, and the value should be the label.

type Options

type Options struct {
	Labels map[string]string
	Label  string
}

Options for client operations.

type Setting

type Setting struct {
	ContentType string `json:"content_type"`
	Value       string `json:"value"`
	Label       string `json:"label"`
}

Setting represents a setting as returned from the App Config REST API.

func (Setting) GetValue

func (s Setting) GetValue() string

GetValue returns the Value of the Setting.

Jump to

Keyboard shortcuts

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