genericarmclient

package
v2.0.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRetryAfter

func GetRetryAfter(resp *http.Response) time.Duration

func IsNotFoundError

func IsNotFoundError(err error) bool

func MakeResourceGroupID

func MakeResourceGroupID(subscription string, resourceGroup string) string

MakeResourceGroupID makes an ARM ID representing a resource group. This has the format: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/<rgName> This is "special" because there is no provider at all - but that is what creating/getting a resourceGroup expects.

func MakeResourceGroupScopeARMID

func MakeResourceGroupScopeARMID(subscription string, resourceGroup string, provider string, params ...string) (string, error)

MakeResourceGroupScopeARMID makes an ARM ID at the resource group scope. This has the format: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/<rgName>/providers/<provider>/<resourceType>/<resourceName>/...

func MakeSubscriptionScopeARMID

func MakeSubscriptionScopeARMID(subscription string, provider string, params ...string) (string, error)

MakeSubscriptionScopeARMID makes an ARM ID at the subscription scope. This has the format: /subscriptions/00000000-0000-0000-0000-000000000000/providers/<provider>/<resourceType>/<resourceName>/...

func NewUserAgentPolicy

func NewUserAgentPolicy(userAgent string) policy.Policy

NewUserAgentPolicy creates a new policy.Policy appending the specified user agent to each request

Types

type CloudError

type CloudError struct {

	// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response
	// format.)
	InnerError *ErrorResponse `json:"error,omitempty"`
	// contains filtered or unexported fields
}

CloudError - An error response for a resource management request. Implements the error and azcore.HTTPResponse interfaces.

func (CloudError) Error

func (e CloudError) Error() string

Error implements the error interface for type CloudError. The contents of the error text are not contractual and subject to change.

type ErrorAdditionalInfo

type ErrorAdditionalInfo struct {
	// READ-ONLY; The additional info.
	Info map[string]interface{} `json:"info,omitempty" azure:"ro"`

	// READ-ONLY; The additional info type.
	Type *string `json:"type,omitempty" azure:"ro"`
}

ErrorAdditionalInfo - The resource management error additional info.

type ErrorResponse

type ErrorResponse struct {
	// READ-ONLY; The error additional info.
	AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"`

	// READ-ONLY; The error code.
	Code *string `json:"code,omitempty" azure:"ro"`

	// READ-ONLY; The error details.
	Details []*ErrorResponse `json:"details,omitempty" azure:"ro"`

	// READ-ONLY; The error message.
	Message *string `json:"message,omitempty" azure:"ro"`

	// READ-ONLY; The error target.
	Target *string `json:"target,omitempty" azure:"ro"`
}

ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations.

type GenericClient

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

func NewGenericClient

func NewGenericClient(endpoint arm.Endpoint, creds azcore.TokenCredential, subscriptionID string) *GenericClient

NewGenericClient creates a new instance of GenericClient

func NewGenericClientFromHTTPClient

func NewGenericClientFromHTTPClient(endpoint arm.Endpoint, creds azcore.TokenCredential, httpClient *http.Client, subscriptionID string) *GenericClient

NewGenericClientFromHTTPClient creates a new instance of GenericClient from the provided connection.

func (*GenericClient) BeginCreateOrUpdateByID

func (client *GenericClient) BeginCreateOrUpdateByID(ctx context.Context, resourceID string, apiVersion string, resource interface{}) (*PollerResponse, error)

func (*GenericClient) DeleteByID

func (client *GenericClient) DeleteByID(ctx context.Context, resourceID string, apiVersion string) (time.Duration, error)

DeleteByID - Deletes a resource by ID. If the operation fails it returns the *CloudError error type.

func (*GenericClient) GetByID

func (client *GenericClient) GetByID(ctx context.Context, resourceID string, apiVersion string, resource interface{}) (time.Duration, error)

GetByID - Gets a resource by ID. If the operation fails it returns the *CloudError error type.

func (*GenericClient) HeadByID

func (client *GenericClient) HeadByID(ctx context.Context, resourceID string, apiVersion string) (bool, time.Duration, error)

func (*GenericClient) SubscriptionID

func (client *GenericClient) SubscriptionID() string

SubscriptionID returns the subscription the client is configured for

type PollerResponse

type PollerResponse struct {
	// Poller contains an initialized poller.
	Poller *azcore.Poller

	// ID is the ID of the poller (not the ID of the resource). This is used to prevent another kind of poller from
	// being resumed with this pollers URL (which would cause deserialization issues and other problems).
	ID string

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response
}

PollerResponse is the response from issuing a PUT to Azure. It containers a poller (for polling the long-running operation URL) and a RawResponse containing the raw HTTP response.

func (*PollerResponse) Resume

func (l *PollerResponse) Resume(ctx context.Context, client *GenericClient, token string) error

Resume rehydrates a ResourcesCreateOrUpdateByIDPollerResponse from the provided client and resume token.

Jump to

Keyboard shortcuts

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