azappconfig

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 11 Imported by: 9

README

Azure App Configuration Client Module for Go

Azure App Configuration is a managed service that helps developers centralize their application and feature settings simply and securely. It allows you to create and manage application configuration settings and retrieve their revisions from a specific point in time.

Source code | Package (pkg.go.dev) | Product documentation

Getting started

Install the module

Install azappconfig with go get:

go get github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig
Prerequisites
  • An Azure subscription
  • A supported Go version (the Azure SDK supports the two most recent Go releases)
  • A Configuration store. If you need to create one, see the App Configuration documentation for instructions on doing so in the Azure Portal or with the Azure CLI.
Authentication

Azure App Configuration supports authenticating with Azure Active Directory and connection strings. To authenticate with Azure Active Directory, use the azappconfig.NewClient constructor and to authenticate with a connection string, use the azappconfig.NewClientFromConnectionString constructor. For simplicity, the examples demonstrate authenticating with a connection string.

See the azidentity documentation for more information about possible Azure Active Directory credential types.

Key concepts

A Setting is the fundamental resource within a Configuration Store. In its simplest form, it is a key and a value. However, there are additional properties such as the modifiable content type and tags fields that allow the value to be interpreted or associated in different ways.

The Label property of a Setting provides a way to separate Settings into different dimensions. These dimensions are user defined and can take any form. Some common examples of dimensions to use for a label include regions, semantic versions, or environments. Many applications have a required set of configuration keys that have varying values as the application exists across different dimensions.

For example, MaxRequests may be 100 in "NorthAmerica" and 200 in "WestEurope". By creating a Setting named MaxRequests with a label of "NorthAmerica" and another, only with a different value, with a "WestEurope" label, an application can seamlessly retrieve Settings as it runs in these two dimensions.

Examples

Examples for various scenarios can be found on pkg.go.dev or in the example*_test.go files in our GitHub repo for azappconfig.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Impressions

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddSettingOptions

type AddSettingOptions struct {
	// Configuration setting content type.
	ContentType *string

	// Configuration setting label.
	Label *string
}

AddSettingOptions contains the optional parameters for the AddSetting method.

type AddSettingResponse

type AddSettingResponse struct {
	Setting

	// SyncToken contains the value returned in the Sync-Token header.
	SyncToken SyncToken
}

AddSettingResponse contains the response from AddSetting method.

type ArchiveSnapshotOptions added in v1.1.0

type ArchiveSnapshotOptions struct {
	// Used to perform an operation only if the targeted resource's etag matches the value provided.
	IfMatch *azcore.ETag

	// Used to perform an operation only if the targeted resource's etag does not match the value provided.
	IfNoneMatch *azcore.ETag
}

ArchiveSnapshotOptions contains the optional parameters for the ArchiveSnapshot method.

type ArchiveSnapshotResponse added in v1.1.0

type ArchiveSnapshotResponse struct {
	Snapshot

	// Link contains the information returned from the Link header response.
	Link *string

	// SyncToken contains the information returned from the Sync-Token header response.
	SyncToken SyncToken
}

ArchiveSnapshotResponse contains the response from the ArchiveSnapshot method.

type BeginCreateSnapshotOptions added in v1.1.0

type BeginCreateSnapshotOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string

	// The composition type describes how the key-values within the snapshot are composed. The 'key' composition type ensures
	// there are no two key-values containing the same key. The 'key_label' composition
	// type ensures there are no two key-values containing the same key and label.
	CompositionType *CompositionType

	// The amount of time, in seconds, that a snapshot will remain in the archived state before expiring. This property is only
	// writable during the creation of a snapshot. If not specified, the default
	// lifetime of key-value revisions will be used.
	RetentionPeriod *int64

	// The tags of the snapshot.
	Tags map[string]*string
}

BeginCreateSnapshotOptions contains the optional parameters for the BeginCreateSnapshot method.

type Client

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

Client is the struct for interacting with an Azure App Configuration instance.

func NewClient

func NewClient(endpoint string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error)

NewClient returns a pointer to a Client object affinitized to an endpoint.

Example
package main

import (
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig"
)

func main() {
	credential, err := azidentity.NewDefaultAzureCredential(nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	client, err := azappconfig.NewClient("https://my-app-config.azconfig.io", credential, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	_ = client // ignore

}
Output:

func NewClientFromConnectionString

func NewClientFromConnectionString(connectionString string, options *ClientOptions) (*Client, error)

NewClientFromConnectionString parses the connection string and returns a pointer to a Client object.

Example
package main

import (
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig"
)

func main() {
	connectionString := os.Getenv("APPCONFIGURATION_CONNECTION_STRING")
	if connectionString == "" {
		return
	}

	client, err := azappconfig.NewClientFromConnectionString(connectionString, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	_ = client // ignore

}
Output:

func (*Client) AddSetting

func (c *Client) AddSetting(ctx context.Context, key string, value *string, options *AddSettingOptions) (AddSettingResponse, error)

AddSetting creates a configuration setting only if the setting does not already exist in the configuration store.

  • ctx controls the lifetime of the HTTP operation
  • key is the name of the setting to create
  • value is the value for the setting. pass nil if the setting doesn't have a value
  • options contains the optional values. can be nil
Example
package main

import (
	"context"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig"
)

func main() {
	connectionString := os.Getenv("APPCONFIGURATION_CONNECTION_STRING")
	if connectionString == "" {
		return
	}

	client, err := azappconfig.NewClientFromConnectionString(connectionString, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	// Create configuration setting
	resp, err := client.AddSetting(context.TODO(), "example-key", to.Ptr("example-value"), &azappconfig.AddSettingOptions{
		Label: to.Ptr("example-label"),
	})

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	_ = resp // TODO: do something with resp

}
Output:

func (*Client) ArchiveSnapshot added in v1.1.0

func (c *Client) ArchiveSnapshot(ctx context.Context, snapshotName string, options *ArchiveSnapshotOptions) (ArchiveSnapshotResponse, error)

ArchiveSnapshot archives a snapshot

- snapshotName - The name of the snapshot to archive. - options - ArchiveSnapshotOptions contains the optional parameters to archive a snapshot

Example
package main

import (
	"context"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig"
)

func main() {
	connectionString := os.Getenv("APPCONFIGURATION_CONNECTION_STRING")
	if connectionString == "" {
		return
	}

	client, err := azappconfig.NewClientFromConnectionString(connectionString, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	snapshotName := "existing-snapshot-example"

	_, err = client.ArchiveSnapshot(context.TODO(), snapshotName, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}
}
Output:

func (*Client) BeginCreateSnapshot added in v1.1.0

func (c *Client) BeginCreateSnapshot(ctx context.Context, snapshotName string, settingFilter []SettingFilter, options *BeginCreateSnapshotOptions) (*runtime.Poller[CreateSnapshotResponse], error)

BeginCreateSnapshot creates a snapshot of the configuration store.

- snapshotName - The name of the snapshot to create. - settingFilter - The filters to apply on the key-values. - options - BeginCreateSnapshotOptions contains the optional parameters to create a Snapshot

Example
package main

import (
	"context"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig"
)

func main() {
	connectionString := os.Getenv("APPCONFIGURATION_CONNECTION_STRING")
	if connectionString == "" {
		return
	}

	client, err := azappconfig.NewClientFromConnectionString(connectionString, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	snapshotName := "example-snapshot"

	filter := []azappconfig.SettingFilter{
		{
			// TODO: Update the following line with your application specific filter logic
			KeyFilter:   to.Ptr("*"),
			LabelFilter: to.Ptr("*"),
		},
	}

	_, err = client.BeginCreateSnapshot(context.TODO(), snapshotName, filter, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}
}
Output:

func (*Client) DeleteSetting

func (c *Client) DeleteSetting(ctx context.Context, key string, options *DeleteSettingOptions) (DeleteSettingResponse, error)

DeleteSetting deletes a configuration setting from the configuration store.

Example
package main

import (
	"context"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig"
)

func main() {
	connectionString := os.Getenv("APPCONFIGURATION_CONNECTION_STRING")
	if connectionString == "" {
		return
	}

	client, err := azappconfig.NewClientFromConnectionString(connectionString, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	// Delete configuration setting
	resp, err := client.DeleteSetting(context.TODO(), "example-key", &azappconfig.DeleteSettingOptions{
		Label: to.Ptr("example-label"),
	})

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	_ = resp // TODO: do something with resp

}
Output:

func (*Client) GetSetting

func (c *Client) GetSetting(ctx context.Context, key string, options *GetSettingOptions) (GetSettingResponse, error)

GetSetting retrieves an existing configuration setting from the configuration store.

Example
package main

import (
	"context"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig"
)

func main() {
	connectionString := os.Getenv("APPCONFIGURATION_CONNECTION_STRING")
	if connectionString == "" {
		return
	}

	client, err := azappconfig.NewClientFromConnectionString(connectionString, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	// Get configuration setting
	resp, err := client.GetSetting(context.TODO(), "example-key", &azappconfig.GetSettingOptions{
		Label: to.Ptr("example-label"),
	})

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	_ = resp // TODO: do something with resp

}
Output:

func (*Client) GetSnapshot added in v1.1.0

func (c *Client) GetSnapshot(ctx context.Context, snapshotName string, options *GetSnapshotOptions) (GetSnapshotResponse, error)

GetSnapshot gets a snapshot

- snapshotName - The name of the snapshot to get. - options - GetSnapshotOptions contains the optional parameters to get a snapshot

Example
package main

import (
	"context"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig"
)

func main() {
	connectionString := os.Getenv("APPCONFIGURATION_CONNECTION_STRING")
	if connectionString == "" {
		return
	}

	client, err := azappconfig.NewClientFromConnectionString(connectionString, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	snapshotName := "snapshot-example"

	snapshot, err := client.GetSnapshot(context.TODO(), snapshotName, nil)

	if err != nil {
		// TODO: Update the following line with your application specific error handling logic
	}

	_ = snapshot // TODO: do something with snapshot
}
Output:

func (*Client) NewListRevisionsPager

func (c *Client) NewListRevisionsPager(selector SettingSelector, options *ListRevisionsOptions) *runtime.Pager[ListRevisionsPageResponse]

NewListRevisionsPager creates a pager that retrieves the revisions of one or more configuration setting entities that match the specified setting selector.

Example
package main

import (
	"context"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig"
)

func main() {
	connectionString := os.Getenv("APPCONFIGURATION_CONNECTION_STRING")
	if connectionString == "" {
		return
	}

	client, err := azappconfig.NewClientFromConnectionString(connectionString, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	pager := client.NewListRevisionsPager(azappconfig.SettingSelector{
		KeyFilter:   to.Ptr("*"),
		LabelFilter: to.Ptr("*"),
		Fields:      azappconfig.AllSettingFields(),
	}, nil)

	for pager.More() {
		page, err := pager.NextPage(context.TODO())

		if err != nil {
			//  TODO: Update the following line with your application specific error handling logic
			log.Fatalf("ERROR: %s", err)
		}

		for _, setting := range page.Settings {
			// each page contains all of the returned settings revisions that match the provided [SettingSelector]

			_ = setting // ignore
		}
	}

}
Output:

func (*Client) NewListSettingsForSnapshotPager added in v1.1.0

func (c *Client) NewListSettingsForSnapshotPager(snapshotName string, options *ListSettingsForSnapshotOptions) *runtime.Pager[ListSettingsForSnapshotResponse]

NewListSettingsForSnapshotPager

- snapshotName - The name of the snapshot to list configuration settings for - options - ListSettingsForSnapshotOptions contains the optional parameters to retrieve Snapshot configuration settings

Example
package main

import (
	"context"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig"
)

func main() {
	connectionString := os.Getenv("APPCONFIGURATION_CONNECTION_STRING")
	if connectionString == "" {
		return
	}

	client, err := azappconfig.NewClientFromConnectionString(connectionString, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	snapshotName := "existing-snapshot-example"

	snapshotPager := client.NewListSettingsForSnapshotPager(snapshotName, nil)

	for snapshotPager.More() {
		snapshotPage, err := snapshotPager.NextPage(context.TODO())

		if err != nil {
			//  TODO: Update the following line with your application specific error handling logic
			log.Fatalf("ERROR: %s", err)
		}

		for _, setting := range snapshotPage.Settings {
			// TODO: implement your application specific logic here
			_ = setting
		}
	}
}
Output:

func (*Client) NewListSettingsPager added in v0.4.1

func (c *Client) NewListSettingsPager(selector SettingSelector, options *ListSettingsOptions) *runtime.Pager[ListSettingsPageResponse]

NewListSettingsPager creates a pager that retrieves setting entities that match the specified setting selector.

func (*Client) NewListSnapshotsPager added in v1.1.0

func (c *Client) NewListSnapshotsPager(options *ListSnapshotsOptions) *runtime.Pager[ListSnapshotsResponse]

NewListSnapshotsPager - Gets a list of key-value snapshots.

  • options - NewListSnapshotsPagerOptions contains the optional parameters to retrieve a snapshot method.
Example
package main

import (
	"context"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig"
)

func main() {
	connectionString := os.Getenv("APPCONFIGURATION_CONNECTION_STRING")
	if connectionString == "" {
		return
	}

	client, err := azappconfig.NewClientFromConnectionString(connectionString, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	snapshotPager := client.NewListSnapshotsPager(nil)

	for snapshotPager.More() {
		snapshotPage, err := snapshotPager.NextPage(context.TODO())

		if err != nil {
			//  TODO: Update the following line with your application specific error handling logic
			log.Fatalf("ERROR: %s", err)
		}

		for _, snapshot := range snapshotPage.Snapshots {
			// TODO: implement your application specific logic here
			_ = snapshot
		}
	}
}
Output:

func (*Client) RecoverSnapshot added in v1.1.0

func (c *Client) RecoverSnapshot(ctx context.Context, snapshotName string, options *RecoverSnapshotOptions) (RecoverSnapshotResponse, error)

RecoverSnapshot recovers a snapshot

- snapshotName - The name of the snapshot to recover. - options - RecoverSnapshotOptions contains the optional parameters to recover a snapshot

Example
package main

import (
	"context"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig"
)

func main() {
	connectionString := os.Getenv("APPCONFIGURATION_CONNECTION_STRING")
	if connectionString == "" {
		return
	}

	client, err := azappconfig.NewClientFromConnectionString(connectionString, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	snapshotName := "existing-snapshot-example"

	_, err = client.RecoverSnapshot(context.TODO(), snapshotName, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}
}
Output:

func (*Client) SetReadOnly

func (c *Client) SetReadOnly(ctx context.Context, key string, isReadOnly bool, options *SetReadOnlyOptions) (SetReadOnlyResponse, error)

SetReadOnly sets an existing configuration setting to read only or read write state in the configuration store.

Example
package main

import (
	"context"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig"
)

func main() {
	connectionString := os.Getenv("APPCONFIGURATION_CONNECTION_STRING")
	if connectionString == "" {
		return
	}

	client, err := azappconfig.NewClientFromConnectionString(connectionString, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	// Set configuration setting read only
	resp, err := client.SetReadOnly(context.TODO(), "example-key", true, &azappconfig.SetReadOnlyOptions{
		Label: to.Ptr("example-label"),
	})

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	_ = resp // TODO: do something with resp

	// Remove read only status
	resp, err = client.SetReadOnly(context.TODO(), "example-key", false, &azappconfig.SetReadOnlyOptions{
		Label: to.Ptr("example-label"),
	})

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	_ = resp // TODO: do something with resp

}
Output:

func (*Client) SetSetting

func (c *Client) SetSetting(ctx context.Context, key string, value *string, options *SetSettingOptions) (SetSettingResponse, error)

SetSetting creates a configuration setting if it doesn't exist or overwrites the existing setting in the configuration store.

  • ctx controls the lifetime of the HTTP operation
  • key is the name of the setting to create
  • value is the value for the setting. pass nil if the setting doesn't have a value
  • options contains the optional values. can be nil
Example
package main

import (
	"context"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig"
)

func main() {
	connectionString := os.Getenv("APPCONFIGURATION_CONNECTION_STRING")
	if connectionString == "" {
		return
	}

	client, err := azappconfig.NewClientFromConnectionString(connectionString, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	// Set configuration setting
	resp, err := client.SetSetting(context.TODO(), "example-key", to.Ptr("example-new-value"), &azappconfig.SetSettingOptions{
		Label: to.Ptr("example-label"),
	})

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	_ = resp // TODO: do something with resp

}
Output:

func (*Client) SetSyncToken added in v0.6.0

func (c *Client) SetSyncToken(syncToken SyncToken) error

SetSyncToken is used to set a sync token from an external source. SyncTokens are required to be in the format "<id>=<value>;sn=<sn>". Multiple SyncTokens must be comma delimited.

type ClientOptions

type ClientOptions struct {
	azcore.ClientOptions
}

ClientOptions are the configurable options on a Client.

type CompositionType added in v1.1.0

type CompositionType = generated.CompositionType

CompositionType is the composition of filters used to create a snapshot.

const (
	// Snapshot is composed with a Key filter
	CompositionTypeKey CompositionType = generated.CompositionTypeKey

	// Snapshot is composed with a Key and Label filter
	CompositionTypeKeyLabel CompositionType = generated.CompositionTypeKeyLabel
)

type CreateSnapshotResponse added in v1.1.0

type CreateSnapshotResponse struct {
	// Read-Only information about the snapshot retrieved from a Create Snapshot operation.
	Snapshot
}

CreateSnapshotResponse contains the response from the BeginCreateSnapshot method.

type DeleteSettingOptions

type DeleteSettingOptions struct {
	// Configuration setting label.
	Label *string

	// If set, and the configuration setting exists in the configuration store,
	// delete the setting if the passed-in ETag is the same as the setting's ETag in the configuration store.
	//
	// This has IfMatch semantics.
	OnlyIfUnchanged *azcore.ETag
}

DeleteSettingOptions contains the optional parameters for the DeleteSetting method.

type DeleteSettingResponse

type DeleteSettingResponse struct {
	Setting

	// SyncToken contains the value returned in the Sync-Token header.
	SyncToken SyncToken
}

DeleteSettingResponse contains the response from DeleteSetting method.

type GetSettingOptions

type GetSettingOptions struct {
	// The setting will be retrieved exactly as it existed at the provided time.
	AcceptDateTime *time.Time

	// Configuration setting label.
	Label *string

	// If set, only retrieve the setting from the configuration store if setting has changed
	// since the client last retrieved it with the ETag provided.
	//
	// This has IfNoneMatch semantics.
	OnlyIfChanged *azcore.ETag
}

GetSettingOptions contains the optional parameters for the GetSetting method.

type GetSettingResponse

type GetSettingResponse struct {
	Setting

	// Contains the timestamp of when the configuration setting was last modified.
	LastModified *time.Time

	// SyncToken contains the value returned in the Sync-Token header.
	SyncToken SyncToken
}

GetSettingResponse contains the configuration setting retrieved by GetSetting method.

type GetSnapshotOptions added in v1.1.0

type GetSnapshotOptions struct {
	// Used to perform an operation only if the targeted resource's etag matches the value provided.
	IfMatch *azcore.ETag

	// Used to perform an operation only if the targeted resource's etag does not match the value provided.
	IfNoneMatch *azcore.ETag

	// Used to select what fields are present in the returned resource(s).
	Select []SnapshotFields
}

GetSnapshotOptions contains the optional parameters for the GetSnapshot method.

type GetSnapshotResponse added in v1.1.0

type GetSnapshotResponse struct {
	// Snapshot object in GetSnapshot Response
	Snapshot

	// Link contains the information returned from the Link header response.
	Link *string

	// SyncToken contains the information returned from the Sync-Token header response.
	SyncToken SyncToken
}

GetSnapshotResponse contains the response from the GetSnapshot method.

type ListRevisionsOptions

type ListRevisionsOptions struct {
}

ListRevisionsOptions contains the optional parameters for the NewListRevisionsPager method.

type ListRevisionsPageResponse added in v0.6.0

type ListRevisionsPageResponse struct {
	// Contains the configuration setting revisions that match the setting selector provided.
	Settings []Setting

	// SyncToken contains the value returned in the Sync-Token header.
	SyncToken SyncToken
}

ListRevisionsPageResponse contains the response from the NewListRevisionsPager method.

type ListSettingsForSnapshotOptions added in v1.1.0

type ListSettingsForSnapshotOptions struct {
	// Requests the server to respond with the state of the resource at the specified time.
	AcceptDatetime *string

	// Instructs the server to return elements that appear after the element referred to by the specified token.
	After *string

	// Used to perform an operation only if the targeted resource's etag matches the value provided.
	IfMatch *azcore.ETag

	// Used to perform an operation only if the targeted resource's etag does not match the value provided.
	IfNoneMatch *azcore.ETag

	// Used to select what fields are present in the returned resource(s).
	Select []SettingFields

	// A filter used to match Keys
	Key string

	// A filter used to match Labels
	Label string
}

ListSettingsForSnapshotOptions contains the optional parameters for the NewListSettingsForSnapshotPager method.

type ListSettingsForSnapshotResponse added in v1.1.0

type ListSettingsForSnapshotResponse struct {
	// Contains the configuration settings returned that match the setting selector provided.
	Settings []Setting

	// SyncToken contains the value returned in the Sync-Token header.
	SyncToken SyncToken
}

ListSettingsForSnapshotResponse contains the response from the ListConfigurationSettingsForSnapshot method.

type ListSettingsOptions added in v0.4.1

type ListSettingsOptions struct {
}

ListSettingsOptions contains the optional parameters for the NewListSettingsPager method.

type ListSettingsPageResponse added in v0.6.0

type ListSettingsPageResponse struct {
	// Contains the configuration settings that match the setting selector provided.
	Settings []Setting

	// SyncToken contains the value returned in the Sync-Token header.
	SyncToken SyncToken
}

ListSettingsPageResponse contains the response from the NewListSettingsPager method.

type ListSnapshotsOptions added in v1.1.0

type ListSnapshotsOptions struct {
	// Instructs the server to return elements that appear after the element referred to by the specified token.
	After *string

	// A filter for the name of the returned snapshots.
	Name *string

	// Used to select what fields are present in the returned resource(s).
	Select []SnapshotFields

	// Used to filter returned snapshots by their status property.
	Status []SnapshotStatus
}

ListSnapshotsOptions contains the optional parameters for the ListSnapshotsPager method.

type ListSnapshotsResponse added in v1.1.0

type ListSnapshotsResponse struct {
	// Contains the configuration settings returned that match the setting selector provided.
	Snapshots []Snapshot

	// SyncToken contains the value returned in the Sync-Token header.
	SyncToken SyncToken
}

ListSnapshotsResponse contains the response from the NewGetSnapshotsPager method.

type RecoverSnapshotOptions added in v1.1.0

type RecoverSnapshotOptions struct {
	// Used to perform an operation only if the targeted resource's etag matches the value provided.
	IfMatch *azcore.ETag

	// Used to perform an operation only if the targeted resource's etag does not match the value provided.
	IfNoneMatch *azcore.ETag
}

RecoverSnapshotOptions contains the optional parameters for the RecoverSnapshot method.

type RecoverSnapshotResponse added in v1.1.0

type RecoverSnapshotResponse struct {
	Snapshot

	// Link contains the information returned from the Link header response.
	Link *string

	// SyncToken contains the information returned from the Sync-Token header response.
	SyncToken SyncToken
}

RecoverSnapshotResponse contains the response from the RecoverSnapshot method.

type RestoreSnapshotOptions added in v1.1.0

type RestoreSnapshotOptions struct {
	// Used to perform an operation only if the targeted resource's etag matches the value provided.
	IfMatch *azcore.ETag

	// Used to perform an operation only if the targeted resource's etag does not match the value provided.
	IfNoneMatch *azcore.ETag
}

RestoreSnapshotOptions contains the optional parameters for the RestoreSnapshot method.

type SetReadOnlyOptions

type SetReadOnlyOptions struct {
	// Configuration setting label.
	Label *string

	// If set, and the configuration setting exists in the configuration store, update the setting
	// if the passed-in configuration setting ETag is the same version as the one in the configuration store.
	//
	// This has IfMatch semantics.
	OnlyIfUnchanged *azcore.ETag
}

SetReadOnlyOptions contains the optional parameters for the SetReadOnly method.

type SetReadOnlyResponse

type SetReadOnlyResponse struct {
	Setting

	// SyncToken contains the value returned in the Sync-Token header.
	SyncToken SyncToken
}

SetReadOnlyResponse contains the response from SetReadOnly method.

type SetSettingOptions

type SetSettingOptions struct {
	// Configuration setting content type.
	ContentType *string

	// Configuration setting label.
	Label *string

	// If set, and the configuration setting exists in the configuration store, overwrite the setting
	// if the passed-in ETag is the same version as the one in the configuration store.
	//
	// This has IfMatch semantics.
	OnlyIfUnchanged *azcore.ETag
}

SetSettingOptions contains the optional parameters for the SetSetting method.

type SetSettingResponse

type SetSettingResponse struct {
	Setting

	// SyncToken contains the value returned in the Sync-Token header.
	SyncToken SyncToken
}

SetSettingResponse contains the response from SetSetting method.

type Setting

type Setting struct {
	// The primary identifier of the configuration setting.
	// A Key is used together with a Label to uniquely identify a configuration setting.
	Key *string

	// The configuration setting's value.
	Value *string

	// A value used to group configuration settings.
	// A Label is used together with a Key to uniquely identify a configuration setting.
	Label *string

	// The content type of the configuration setting's value.
	// Providing a proper content-type can enable transformations of values when they are retrieved by applications.
	ContentType *string

	// An ETag indicating the state of a configuration setting within a configuration store.
	ETag *azcore.ETag

	// A dictionary of tags used to assign additional properties to a configuration setting.
	// These can be used to indicate how a configuration setting may be applied.
	Tags map[string]string

	// The last time a modifying operation was performed on the given configuration setting.
	LastModified *time.Time

	// A value indicating whether the configuration setting is read only.
	// A read only configuration setting may not be modified until it is made writable.
	IsReadOnly *bool
}

Setting is a setting, defined by a unique combination of a Key and Label.

type SettingFields

type SettingFields = generated.SettingFields

SettingFields are fields to retrieve from a configuration setting.

const (
	// The primary identifier of a configuration setting.
	SettingFieldsKey SettingFields = generated.SettingFieldsKey

	// A label used to group configuration settings.
	SettingFieldsLabel SettingFields = generated.SettingFieldsLabel

	// The value of the configuration setting.
	SettingFieldsValue SettingFields = generated.SettingFieldsValue

	// The content type of the configuration setting's value.
	SettingFieldsContentType SettingFields = generated.SettingFieldsContentType

	// An ETag indicating the version of a configuration setting within a configuration store.
	SettingFieldsETag SettingFields = generated.SettingFieldsEtag

	// The last time a modifying operation was performed on the given configuration setting.
	SettingFieldsLastModified SettingFields = generated.SettingFieldsLastModified

	// A value indicating whether the configuration setting is read-only.
	SettingFieldsIsReadOnly SettingFields = generated.SettingFieldsLocked

	// A list of tags that can help identify what a configuration setting may be applicable for.
	SettingFieldsTags SettingFields = generated.SettingFieldsTags
)

func AllSettingFields

func AllSettingFields() []SettingFields

AllSettingFields returns a collection of all setting fields to use in SettingSelector.

type SettingFilter added in v1.1.0

type SettingFilter struct {
	// Key filter that will be used to select a set of configuration setting entities.
	KeyFilter *string

	// Label filter that will be used to select a set of configuration setting entities.
	LabelFilter *string
}

SettingFilter to select configuration setting entities.

type SettingSelector

type SettingSelector struct {
	// Key filter that will be used to select a set of configuration setting entities.
	KeyFilter *string

	// Label filter that will be used to select a set of configuration setting entities.
	LabelFilter *string

	// Indicates the point in time in the revision history of the selected configuration setting entities to retrieve.
	// If set, all properties of the configuration setting entities in the returned group will be exactly what they were at this time.
	AcceptDateTime *time.Time

	// The fields of the configuration setting to retrieve for each setting in the retrieved group.
	Fields []SettingFields
}

SettingSelector is a set of options that allows selecting a filtered set of configuration setting entities from the configuration store, and optionally allows indicating which fields of each setting to retrieve.

type Snapshot added in v1.1.0

type Snapshot struct {
	// REQUIRED; A list of filters used to filter the key-values included in the snapshot.
	Filters []SettingFilter `json:"filters"`

	// The composition type describes how the key-values within the snapshot are composed. The 'key' composition type ensures
	// there are no two key-values containing the same key. The 'key_label' composition
	// type ensures there are no two key-values containing the same key and label.
	CompositionType *CompositionType `json:"composition_type,omitempty"`

	// The amount of time, in seconds, that a snapshot will remain in the archived state before expiring. This property is only
	// writable during the creation of a snapshot. If not specified, the default
	// lifetime of key-value revisions will be used.
	RetentionPeriod *int64 `json:"retention_period"`

	// The tags of the snapshot.
	Tags map[string]*string `json:"tags,omitempty"`

	// READ-ONLY; The time that the snapshot was created.
	Created *time.Time `json:"created"`

	// READ-ONLY; A value representing the current state of the snapshot.
	ETag *azcore.ETag `json:"etag"`

	// READ-ONLY; The time that the snapshot will expire.
	Expires *time.Time `json:"expires,omitempty"`

	// READ-ONLY; The amount of key-values in the snapshot.
	ItemsCount *int64 `json:"items_count"`

	// READ-ONLY; The name of the snapshot.
	Name *string `json:"name"`

	// READ-ONLY; The size in bytes of the snapshot.
	Size *int64 `json:"size"`

	// READ-ONLY; The current status of the snapshot.
	Status *SnapshotStatus `json:"status"`
}

Snapshot contains the snapshot information returned from a Get Snapshot Request

type SnapshotFields added in v1.1.0

type SnapshotFields = generated.SnapshotFields

SnapshotFields are fields to retrieve from a snapshot.

const (
	//The composition type of a snapshot.
	SnapshotFieldsCompositionType SnapshotFields = generated.SnapshotFieldsCompositionType

	// The time when the snapshot was created.
	SnapshotFieldsCreated SnapshotFields = generated.SnapshotFieldsCreated

	// An ETag indicating the version of a snapshot.
	SnapshotFieldsETag SnapshotFields = generated.SnapshotFieldsETag

	// The time when the snapshot will expire once archived.
	SnapshotFieldsExpires SnapshotFields = generated.SnapshotFieldsExpires

	// A list of filters used to generate the snapshot.
	SnapshotFieldsFilters SnapshotFields = generated.SnapshotFieldsFilters

	// The number of items in the snapshot.
	SnapshotFieldsItemsCount SnapshotFields = generated.SnapshotFieldsItemsCount

	// The primary identifier of a snapshot.
	SnapshotFieldsName SnapshotFields = generated.SnapshotFieldsName

	// Retention period in seconds of the snapshot upon archiving.
	SnapshotFieldsRetentionPeriod SnapshotFields = generated.SnapshotFieldsRetentionPeriod

	// Size of the snapshot.
	SnapshotFieldsSize SnapshotFields = generated.SnapshotFieldsSize

	// Status of the snapshot.
	SnapshotFieldsStatus SnapshotFields = generated.SnapshotFieldsStatus

	// A list of tags on the snapshot.
	SnapshotFieldsTags SnapshotFields = generated.SnapshotFieldsTags
)

type SnapshotStatus added in v1.1.0

type SnapshotStatus = generated.SnapshotStatus

SnapshotStatus contains the current status of the snapshot

const (
	// Snapshot is archived state.
	SnapshotStatusArchived SnapshotStatus = generated.SnapshotStatusArchived

	// Snapshot is in failing state.
	SnapshotStatusFailed SnapshotStatus = generated.SnapshotStatusFailed

	// Snapshot is in provisioning state.
	SnapshotStatusProvisioning SnapshotStatus = generated.SnapshotStatusProvisioning

	// Snapshot is in ready state.
	SnapshotStatusReady SnapshotStatus = generated.SnapshotStatusReady
)

type SyncToken added in v0.6.0

type SyncToken = exported.SyncToken

SyncToken contains data used in the Sync-Token header. See Azure App Configuration documentation for more information on sync tokens.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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