package temporal

import "github.com/Azure/azure-sdk-for-go/sdk/internal/temporal"

Index

Types

type AcquireResource

type AcquireResource[TResource, TState any] func(state TState) (newResource TResource, newExpiration time.Time, err error)

AcquireResource abstracts a method for refreshing a temporal resource.

type Resource

type Resource[TResource, TState any] struct {
	// contains filtered or unexported fields
}

Resource is a temporal resource (usually a credential) that requires periodic refreshing.

func NewResource

func NewResource[TResource, TState any](ar AcquireResource[TResource, TState]) *Resource[TResource, TState]

NewResource creates a new Resource that uses the specified AcquireResource for refreshing.

func (*Resource[TResource, TState]) Expire

func (er *Resource[TResource, TState]) Expire()

Expire marks the resource as expired, ensuring it's refreshed on the next call to Get().

func (*Resource[TResource, TState]) Get

func (er *Resource[TResource, TState]) Get(state TState) (TResource, error)

Get returns the underlying resource. If the resource is fresh, no refresh is performed.

Source Files

resource.go

Version
v1.4.0
Published
Oct 17, 2023
Platform
darwin/amd64
Imports
2 packages
Last checked
1 hour ago

Tools for package owners.