setting

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// 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 WithClientLabel added in v0.21.0

func WithClientLabel(label string) ClientOption

WithClientLabel sets label on the setting client.

func WithClientLabels added in v0.21.0

func WithClientLabels(labels map[string]string) ClientOption

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

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 WithHTTPClient added in v0.22.0

func WithHTTPClient(client request.Client) ClientOption

WithHTTPClient sets the HTTP client 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 retrieval.

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 setting request. Overrides the label set on the client.

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. Overrides the labels set on the client.

type Options

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

Options for client operations.

type Secret added in v0.19.0

type Secret = secret.Secret

Secret represents a secret as returned from the Key Vault REST API.

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.

Jump to

Keyboard shortcuts

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