azblob

package module
v1.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package azblob loads configuration from Azure Blob Storage.

It requires following roles to access blob from Azure Blob Storage: - Storage Blob Data Reader

Change notification

By default, it periodically polls the configuration only. It also listens to change events by register it to notifier with Cloud Event schema.

Only Microsoft.Storage.BlobCreated events trigger polling the configuration and other type of events are ignored.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blob

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

Blob is a Provider that loads configuration from Azure Blob Storage.

To create a new Blob, call New.

func New

func New(endpoint, container, blob string, opts ...Option) *Blob

New creates an Blob with the given endpoint and Option(s).

func (*Blob) Load

func (b *Blob) Load() (map[string]any, error)

func (*Blob) OnEvent added in v1.1.0

func (b *Blob) OnEvent(event messaging.CloudEvent) error

func (*Blob) Status

func (b *Blob) Status(onStatus func(bool, error))

func (*Blob) String

func (b *Blob) String() string

func (*Blob) Watch

func (b *Blob) Watch(ctx context.Context, onChange func(map[string]any)) error

type Option

type Option func(options *options)

Option configures the Blob with specific options.

func WithCredential

func WithCredential(credential azcore.TokenCredential) Option

WithCredential provides the azcore.TokenCredential for Azure authentication.

By default, it uses azidentity.DefaultAzureCredential.

func WithPollInterval

func WithPollInterval(interval time.Duration) Option

WithPollInterval provides the interval for polling the configuration.

The default interval is 1 minute.

func WithUnmarshal

func WithUnmarshal(unmarshal func([]byte, any) error) Option

WithUnmarshal provides the function used to parses the configuration. The unmarshal function must be able to unmarshal the configuration into a map[string]any.

The default function is json.Unmarshal.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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