Documentation ¶
Index ¶
- Constants
- func GetRetryAfter(resp *http.Response) time.Duration
- func IsNotFoundError(err error) bool
- func MakeResourceGroupID(subscription string, resourceGroup string) string
- func MakeResourceGroupScopeARMID(subscription string, resourceGroup string, provider string, params ...string) (string, error)
- func MakeSubscriptionID(subscription string) string
- func MakeSubscriptionScopeARMID(subscription string, provider string, params ...string) (string, error)
- func MakeTenantScopeARMID(provider string, params ...string) (string, error)
- func NewUserAgentPolicy(userAgent string) policy.Policy
- type CloudError
- type ErrorAdditionalInfo
- type ErrorResponse
- type GenericClient
- func (client *GenericClient) BeginCreateOrUpdateByID(ctx context.Context, resourceID string, apiVersion string, ...) (*PollerResponse, error)
- func (client *GenericClient) BeginDeleteByID(ctx context.Context, resourceID string, apiVersion string) (*PollerResponse, error)
- func (client *GenericClient) ClientOptions() *arm.ClientOptions
- func (client *GenericClient) Creds() azcore.TokenCredential
- func (client *GenericClient) DeleteByID(ctx context.Context, resourceID string, apiVersion string) (time.Duration, error)
- func (client *GenericClient) GetByID(ctx context.Context, resourceID string, apiVersion string, ...) (time.Duration, error)
- func (client *GenericClient) HeadByID(ctx context.Context, resourceID string, apiVersion string) (bool, time.Duration, error)
- func (client *GenericClient) SubscriptionID() string
- type GenericResource
- type PollerResponse
Constants ¶
const CreatePollerID = "GenericClient.CreateOrUpdateByID"
const DeletePollerID = "GenericClient.DeleteByID"
Variables ¶
This section is empty.
Functions ¶
func IsNotFoundError ¶
func MakeResourceGroupID ¶
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 MakeSubscriptionID ¶
MakeSubscriptionID makes an ARM ID representing a subscription. This has the format: /subscriptions/00000000-0000-0000-0000-000000000000 This is "special" because there is no provider at all
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 MakeTenantScopeARMID ¶
MakeTenantScopeARMID makes an ARM ID at the tenant scope. This has the format: /providers/<provider>/<resourceType>/<resourceName>/...
func NewUserAgentPolicy ¶
NewUserAgentPolicy creates a new policy.Policy appending the specified user agent to each request
Types ¶
type CloudError ¶
type CloudError struct {
// contains filtered or unexported fields
}
CloudError - An error response for a resource management request We have to support two different formats for the error as some services do things differently.
The ARM spec says that error details should be nested inside an `error` element. See https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-details.md#error-response-content
However, some services put the code & message at the top level instead. This is common enough that the Azure Python SDK has specific handling to promote a nested error to the top level. See https://github.com/Azure/azure-sdk-for-python/blob/9791fb5bc4cb6001768e6e1fb986b8d8f8326c43/sdk/core/azure-core/azure/core/exceptions.py#L153
func NewCloudError ¶
func NewCloudError(err error) *CloudError
NewCloudError returns a new CloudError
func NewTestCloudError ¶
func NewTestCloudError(code string, message string) *CloudError
func (CloudError) Code ¶
func (e CloudError) Code() string
Code returns the error code from the message, if present, or UnknownErrorCode if not.
func (CloudError) Details ¶
func (e CloudError) Details() []*ErrorResponse
Details returns the details of the error, if present, or an empty slice if not
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.
func (CloudError) Message ¶
func (e CloudError) Message() string
Message returns the message from the error, if present, or UnknownErrorMessage if not.
func (CloudError) Target ¶
func (e CloudError) Target() string
Target returns the target of the error, if present, or an empty string if not.
func (*CloudError) UnmarshalJSON ¶
func (e *CloudError) UnmarshalJSON(data []byte) error
func (CloudError) Unwrap ¶
func (e CloudError) Unwrap() error
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(cloudCfg cloud.Configuration, creds azcore.TokenCredential, subscriptionID string, metrics metrics.ARMClientMetrics) (*GenericClient, error)
NewGenericClient creates a new instance of GenericClient
func NewGenericClientFromHTTPClient ¶
func NewGenericClientFromHTTPClient(cloudCfg cloud.Configuration, creds azcore.TokenCredential, httpClient *http.Client, subscriptionID string, metrics metrics.ARMClientMetrics) (*GenericClient, error)
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) BeginDeleteByID ¶
func (client *GenericClient) BeginDeleteByID(ctx context.Context, resourceID string, apiVersion string) (*PollerResponse, error)
DeleteByID - Deletes a resource by ID. If the operation fails it returns the *CloudError error type.
func (*GenericClient) ClientOptions ¶
func (client *GenericClient) ClientOptions() *arm.ClientOptions
ClientOptions returns the arm.ClientOptions used by this client. These options include the HTTP pipeline. If these options are used to create a new client, it will share the configured HTTP pipeline.
func (*GenericClient) Creds ¶
func (client *GenericClient) Creds() azcore.TokenCredential
Creds returns the credentials used by this client
func (*GenericClient) DeleteByID ¶
func (client *GenericClient) DeleteByID(ctx context.Context, resourceID string, apiVersion string) (time.Duration, error)
TODO: Delete this in favor of the async-aware one above 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) SubscriptionID ¶
func (client *GenericClient) SubscriptionID() string
SubscriptionID returns the subscription the client is configured for
type GenericResource ¶
type GenericResource struct { // The kind of the resource. Kind *string `json:"kind,omitempty"` // READ-ONLY; Resource ID ID *string `json:"id,omitempty"` // READ-ONLY; Resource name Name *string `json:"name,omitempty"` // READ-ONLY; Resource type Type *string `json:"type,omitempty"` }
GenericResource is used as a response type for poller. This is a shortened version of https://github.com/Azure/azure-sdk-for-go/blob/5659d929cb5966c1296568cb33410d12e0ee06c6/sdk/resourcemanager/resources/armresources/zz_generated_models.go#L922
type PollerResponse ¶
type PollerResponse struct { // Poller contains an initialized poller. Poller *azcoreruntime.Poller[GenericResource] // 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 contains 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.