azure

package
v0.0.0-...-dea60c0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceManagedMySQL   = ResourceType("Microsoft.DBforMySQL/servers")
	ResourceVirtualMachine = ResourceType("Microsoft.Compute/virtualMachines")
)
View Source
const (
	PollerInterval = time.Second * 10
)

Variables

View Source
var (
	ErrUnsupportedType = errors.New("unsupported type specified")
)

Functions

func ExecuteOperation

func ExecuteOperation[T any](
	ctx context.Context,
	resource *Resource,
	wait bool,
	poller func(context.Context, *Resource) (*runtime.Poller[T], error),
) error

Types

type Config

type Config struct {
	AuthType       string `env-required:"true" json:"auth_type" env:"AZURE_AUTH_TYPE"`
	SubscriptionId string `env-required:"true" json:"subscription_id" env:"AZURE_SUBSCRIPTION_ID"`
}

type Interface

type Interface interface {
	List(ctx context.Context, resourceType ResourceType, resourceGroup string) ([]*Resource, error)
	Shutdown(ctx context.Context, resource *Resource, wait bool) error
	Startup(ctx context.Context, resource *Resource, wait bool) error
}

func NewClient

func NewClient(cred azcore.TokenCredential, cfg *Config) (Interface, error)

func NewForConfig

func NewForConfig(cfg *Config) (Interface, error)

func NewForDefaultAuth

func NewForDefaultAuth(cfg *Config) (Interface, error)

func NewForMsiAuth

func NewForMsiAuth(cfg *Config) (Interface, error)

type Resource

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

func List

func List[T any, TResource any](
	ctx context.Context,
	pager *runtime.Pager[T],
	values func(pager T) []*TResource,
	create func(*TResource) *Resource,
) (ret []*Resource, err error)

func NewResource

func NewResource(rawId string) *Resource

func (Resource) GetName

func (r Resource) GetName() string

func (Resource) GetResourceGroup

func (r Resource) GetResourceGroup() string

func (Resource) GetType

func (r Resource) GetType() ResourceType

func (Resource) String

func (r Resource) String() string

type ResourceType

type ResourceType string

func From

Jump to

Keyboard shortcuts

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