armclient

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 25 Imported by: 25

Documentation

Overview

Package armclient implements the client for ARM.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoDumpRequest added in v1.24.2

func DoDumpRequest(v klog.Level) autorest.SendDecorator

func DoHackRegionalRetryForGET added in v1.1.24

func DoHackRegionalRetryForGET(c *Client) autorest.SendDecorator

DoHackRegionalRetryForGET checks if GET request returns empty response and retries regional server or returns error.

func GetChildResourceID

func GetChildResourceID(subscriptionID, resourceGroupName, resourceType, resourceName, childResourceType, childResourceName string) string

GetChildResourceID gets Azure child resource ID

func GetChildResourcesListID

func GetChildResourcesListID(subscriptionID, resourceGroupName, resourceType, resourceName, childResourceType string) string

GetChildResourcesListID gets Azure child resources list ID

func GetProviderResourceID

func GetProviderResourceID(subscriptionID, providerNamespace string) string

GetProviderResourceID gets Azure RP resource ID

func GetProviderResourcesListID

func GetProviderResourcesListID(subscriptionID string) string

GetProviderResourcesListID gets Azure RP resources list ID

func GetResourceID

func GetResourceID(subscriptionID, resourceGroupName, resourceType, resourceName string) string

GetResourceID gets Azure resource ID

func GetResourceListID added in v1.0.19

func GetResourceListID(subscriptionID, resourceGroupName, resourceType string) string

GetResourceListID gets Azure resource list ID

func GetUserAgent

func GetUserAgent(client autorest.Client) string

GetUserAgent gets the autorest client with a user agent that includes "kubernetes" and the full kubernetes git version string example: Azure-SDK-for-Go/7.0.1 arm-network/2016-09-01; kubernetes-cloudprovider/v1.17.0;

func NewErrorCounterSendDecorator added in v1.24.2

func NewErrorCounterSendDecorator(mc *metrics.MetricContext) autorest.SendDecorator

func NewRateLimitSendDecorater added in v1.24.2

func NewRateLimitSendDecorater(ratelimiter flowcontrol.RateLimiter, mc *metrics.MetricContext) autorest.SendDecorator

func NewThrottledSendDecorater added in v1.24.2

func NewThrottledSendDecorater(mc *metrics.MetricContext) autorest.SendDecorator

func NormalizeAzureRegion

func NormalizeAzureRegion(name string) string

NormalizeAzureRegion returns a normalized Azure region with white spaces removed and converted to lower case

func WithMetricsSendDecoratorWrapper added in v1.24.2

func WithMetricsSendDecoratorWrapper(prefix, request, resourceGroup, subscriptionID, source string, factory func(mc *metrics.MetricContext) []autorest.SendDecorator) autorest.SendDecorator

Types

type Client

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

Client implements ARM client Interface.

func New

func New(authorizer autorest.Authorizer, clientConfig azureclients.ClientConfig, baseURI, apiVersion string, sendDecoraters ...autorest.SendDecorator) *Client

New creates a ARM client

func (*Client) CloseResponse

func (c *Client) CloseResponse(_ context.Context, response *http.Response)

CloseResponse closes a response

func (*Client) DeleteResource

func (c *Client) DeleteResource(ctx context.Context, resourceID string, _ ...autorest.PrepareDecorator) *retry.Error

DeleteResource deletes a resource by resource ID

func (*Client) DeleteResourceAsync

func (c *Client) DeleteResourceAsync(ctx context.Context, resourceID string, decorators ...autorest.PrepareDecorator) (*azure.Future, *retry.Error)

DeleteResourceAsync delete a resource by resource ID and returns a future representing the async result

func (*Client) GetResource

func (c *Client) GetResource(ctx context.Context, resourceID string, decorators ...autorest.PrepareDecorator) (*http.Response, *retry.Error)

GetResourceWithDecorators get a resource with decorators by resource ID

func (*Client) GetResourceWithExpandAPIVersionQuery added in v1.0.22

func (c *Client) GetResourceWithExpandAPIVersionQuery(ctx context.Context, resourceID, expand, apiVersion string) (*http.Response, *retry.Error)

GetResourceWithExpandAPIVersionQuery get a resource by resource ID with expand and API version.

func (*Client) GetResourceWithExpandQuery added in v1.0.18

func (c *Client) GetResourceWithExpandQuery(ctx context.Context, resourceID, expand string) (*http.Response, *retry.Error)

GetResourceWithExpandQuery get a resource by resource ID with expand

func (*Client) GetResourceWithQueries added in v1.25.0

func (c *Client) GetResourceWithQueries(ctx context.Context, resourceID string, queries map[string]interface{}) (*http.Response, *retry.Error)

GetResourceWithQueries get a resource by resource ID with queries.

func (*Client) HeadResource

func (c *Client) HeadResource(ctx context.Context, resourceID string) (*http.Response, *retry.Error)

HeadResource heads a resource by resource ID

func (*Client) PatchResource

func (c *Client) PatchResource(ctx context.Context, resourceID string, parameters interface{}, decorators ...autorest.PrepareDecorator) (*http.Response, *retry.Error)

PatchResource patches a resource by resource ID

func (*Client) PatchResourceAsync added in v1.0.16

func (c *Client) PatchResourceAsync(ctx context.Context, resourceID string, parameters interface{}, decorators ...autorest.PrepareDecorator) (*azure.Future, *retry.Error)

PatchResourceAsync patches a resource by resource ID asynchronously

func (*Client) PostResource

func (c *Client) PostResource(ctx context.Context, resourceID, action string, parameters interface{}, queryParameters map[string]interface{}) (*http.Response, *retry.Error)

PostResource posts a resource by resource ID

func (*Client) PrepareDeleteRequest

func (c *Client) PrepareDeleteRequest(ctx context.Context, decorators ...autorest.PrepareDecorator) (*http.Request, error)

PrepareDeleteRequest preparse delete request

func (*Client) PrepareGetRequest

func (c *Client) PrepareGetRequest(ctx context.Context, decorators ...autorest.PrepareDecorator) (*http.Request, error)

PrepareGetRequest prepares get request

func (*Client) PrepareHeadRequest

func (c *Client) PrepareHeadRequest(ctx context.Context, decorators ...autorest.PrepareDecorator) (*http.Request, error)

PrepareHeadRequest prepares head request

func (*Client) PreparePatchRequest

func (c *Client) PreparePatchRequest(ctx context.Context, decorators ...autorest.PrepareDecorator) (*http.Request, error)

PreparePatchRequest prepares patch request

func (*Client) PreparePostRequest

func (c *Client) PreparePostRequest(ctx context.Context, decorators ...autorest.PrepareDecorator) (*http.Request, error)

PreparePostRequest prepares post request

func (*Client) PreparePutRequest

func (c *Client) PreparePutRequest(ctx context.Context, decorators ...autorest.PrepareDecorator) (*http.Request, error)

PreparePutRequest prepares put request

func (*Client) PutResource

func (c *Client) PutResource(ctx context.Context, resourceID string, parameters interface{}, decorators ...autorest.PrepareDecorator) (*http.Response, *retry.Error)

PutResource puts a resource by resource ID

func (*Client) PutResourceAsync

func (c *Client) PutResourceAsync(ctx context.Context, resourceID string, parameters interface{}, decorators ...autorest.PrepareDecorator) (*azure.Future, *retry.Error)

PutResourceAsync puts a resource by resource ID in async mode

func (*Client) PutResourcesInBatches added in v1.0.8

func (c *Client) PutResourcesInBatches(ctx context.Context, resources map[string]interface{}, batchSize int) map[string]*PutResourcesResponse

PutResourcesInBatches is similar with PutResources, but it sends sync request concurrently in batches.

func (*Client) Send

func (c *Client) Send(_ context.Context, request *http.Request, decorators ...autorest.SendDecorator) (*http.Response, *retry.Error)

Send sends a http request to ARM service with possible retry to regional ARM endpoint.

func (*Client) SendAsync

func (c *Client) SendAsync(ctx context.Context, request *http.Request) (*azure.Future, *http.Response, *retry.Error)

SendAsync send a request and return a future object representing the async result as well as the origin http response

func (*Client) WaitForAsyncOperationCompletion

func (c *Client) WaitForAsyncOperationCompletion(ctx context.Context, future *azure.Future, asyncOperationName string) error

WaitForAsyncOperationCompletion waits for an operation completion

func (*Client) WaitForAsyncOperationResult

func (c *Client) WaitForAsyncOperationResult(ctx context.Context, future *azure.Future, _ string) (*http.Response, error)

WaitForAsyncOperationResult waits for an operation result.

type Interface

type Interface interface {
	// Send sends a http request to ARM service with possible retry to regional ARM endpoint.
	Send(ctx context.Context, request *http.Request, decorators ...autorest.SendDecorator) (*http.Response, *retry.Error)

	// PreparePutRequest prepares put request
	PreparePutRequest(ctx context.Context, decorators ...autorest.PrepareDecorator) (*http.Request, error)

	// PreparePostRequest prepares post request
	PreparePostRequest(ctx context.Context, decorators ...autorest.PrepareDecorator) (*http.Request, error)

	// PrepareGetRequest prepares get request
	PrepareGetRequest(ctx context.Context, decorators ...autorest.PrepareDecorator) (*http.Request, error)

	// PrepareDeleteRequest preparse delete request
	PrepareDeleteRequest(ctx context.Context, decorators ...autorest.PrepareDecorator) (*http.Request, error)

	// PrepareHeadRequest prepares head request
	PrepareHeadRequest(ctx context.Context, decorators ...autorest.PrepareDecorator) (*http.Request, error)

	// WaitForAsyncOperationCompletion waits for an operation completion
	WaitForAsyncOperationCompletion(ctx context.Context, future *azure.Future, asyncOperationName string) error

	// WaitForAsyncOperationResult waits for an operation result.
	WaitForAsyncOperationResult(ctx context.Context, future *azure.Future, asyncOperationName string) (*http.Response, error)

	// SendAsync send a request and return a future object representing the async result as well as the origin http response
	SendAsync(ctx context.Context, request *http.Request) (*azure.Future, *http.Response, *retry.Error)

	// PutResource puts a resource by resource ID
	PutResource(ctx context.Context, resourceID string, parameters interface{}, decorators ...autorest.PrepareDecorator) (*http.Response, *retry.Error)

	// PutResourceAsync puts a resource by resource ID in async mode
	PutResourceAsync(ctx context.Context, resourceID string, parameters interface{}, decorators ...autorest.PrepareDecorator) (*azure.Future, *retry.Error)

	// PutResourcesInBatches is similar with PutResources, but it sends sync request concurrently in batches.
	PutResourcesInBatches(ctx context.Context, resources map[string]interface{}, batchSize int) map[string]*PutResourcesResponse

	// PatchResource patches a resource by resource ID
	PatchResource(ctx context.Context, resourceID string, parameters interface{}, decorators ...autorest.PrepareDecorator) (*http.Response, *retry.Error)

	// PatchResourceAsync patches a resource by resource ID asynchronously
	PatchResourceAsync(ctx context.Context, resourceID string, parameters interface{}, decorators ...autorest.PrepareDecorator) (*azure.Future, *retry.Error)

	// HeadResource heads a resource by resource ID
	HeadResource(ctx context.Context, resourceID string) (*http.Response, *retry.Error)

	// GetResourceWithExpandQuery get a resource by resource ID with expand
	GetResourceWithExpandQuery(ctx context.Context, resourceID, expand string) (*http.Response, *retry.Error)

	// GetResourceWithExpandAPIVersionQuery get a resource by resource ID with expand and API version.
	GetResourceWithExpandAPIVersionQuery(ctx context.Context, resourceID, expand, apiVersion string) (*http.Response, *retry.Error)

	// GetResourceWithQueries get a resource by resource ID with queries.
	GetResourceWithQueries(ctx context.Context, resourceID string, queries map[string]interface{}) (*http.Response, *retry.Error)

	// GetResource get a resource with decorators by resource ID
	GetResource(ctx context.Context, resourceID string, decorators ...autorest.PrepareDecorator) (*http.Response, *retry.Error)

	// PostResource posts a resource by resource ID
	PostResource(ctx context.Context, resourceID, action string, parameters interface{}, queryParameters map[string]interface{}) (*http.Response, *retry.Error)

	// DeleteResource deletes a resource by resource ID
	DeleteResource(ctx context.Context, resourceID string, decorators ...autorest.PrepareDecorator) *retry.Error

	// DeleteResourceAsync delete a resource by resource ID and returns a future representing the async result
	DeleteResourceAsync(ctx context.Context, resourceID string, decorators ...autorest.PrepareDecorator) (*azure.Future, *retry.Error)

	// CloseResponse closes a response
	CloseResponse(ctx context.Context, response *http.Response)
}

Interface is the client interface for ARM. Don't forget to run "hack/update-mock-clients.sh" command to generate the mock client.

type PutResourcesResponse

type PutResourcesResponse struct {
	Response *http.Response
	Error    *retry.Error
}

PutResourcesResponse defines the response for PutResources.

Directories

Path Synopsis
Package mockarmclient implements the mock client for ARM.
Package mockarmclient implements the mock client for ARM.

Jump to

Keyboard shortcuts

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