armclient

package
v0.0.0-...-d88c8b5 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package armclient implements the client for ARM.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 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 NormalizeAzureRegion

func NormalizeAzureRegion(name string) string

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

Types

type Client

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

Client implements ARM client Interface.

func New

func New(authorizer autorest.Authorizer, baseURI, userAgent, apiVersion, clientRegion string, clientBackoff *retry.Backoff) *Client

New creates a ARM client

func (*Client) CloseResponse

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

CloseResponse closes a response

func (*Client) DeleteResource

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

DeleteResource deletes a resource by resource ID

func (*Client) DeleteResourceAsync

func (c *Client) DeleteResourceAsync(ctx context.Context, resourceID, ifMatch string) (*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, expand string) (*http.Response, *retry.Error)

GetResource get a resource by resource ID

func (*Client) GetResourceWithDecorators

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

GetResourceWithDecorators get a resource with decorators by resource ID

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{}) (*http.Response, *retry.Error)

PatchResource patches a resource by resource ID

func (*Client) PostResource

func (c *Client) PostResource(ctx context.Context, resourceID, action string, parameters 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{}) (*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{}) (*azure.Future, *retry.Error)

PutResourceAsync puts a resource by resource ID in async mode

func (*Client) PutResourceWithDecorators

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

PutResourceWithDecorators puts a resource by resource ID

func (*Client) PutResources

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

PutResources puts a list of resources from resources map[resourceID]parameters. Those resources sync requests are sequential while async requests are concurrent. It's especially useful when the ARM API doesn't support concurrent requests.

func (*Client) Send

func (c *Client) Send(ctx context.Context, request *http.Request) (*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, asyncOperationName 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) (*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{}) (*http.Response, *retry.Error)

	// PutResources puts a list of resources from resources map[resourceID]parameters.
	// Those resources sync requests are sequential while async requests are concurrent. It 's especially
	// useful when the ARM API doesn't support concurrent requests.
	PutResources(ctx context.Context, resources map[string]interface{}) map[string]*PutResourcesResponse

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

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

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

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

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

	//GetResourceWithDecorators get a resource with decorators by resource ID
	GetResourceWithDecorators(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{}) (*http.Response, *retry.Error)

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

	// DeleteResourceAsync delete a resource by resource ID and returns a future representing the async result
	DeleteResourceAsync(ctx context.Context, resourceID, ifMatch string) (*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 the following command to generate the mock client: mockgen -source=$GOPATH/src/k8s.io/kubernetes/staging/src/k8s.io/legacy-cloud-providers/azure/clients/armclient/interface.go -package=mockarmclient Interface > $GOPATH/src/k8s.io/kubernetes/staging/src/k8s.io/legacy-cloud-providers/azure/clients/armclient/mockarmclient/interface.go

type PutResourcesResponse

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

PutResourcesResponse defines the response for PutResources.

Jump to

Keyboard shortcuts

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