armcore

package module
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 12 Imported by: 12

README

Azure Resource Manager Core Client Module for Go

PkgGoDev Build Status Code Coverage

The armcore module provides utility functions and types for Go SDK ARM client modules. These modules follow the Azure SDK Design Guidelines for Go.

Getting started

This project uses Go modules for versioning and dependency management.

The contents of this module are used by generated code. It is not intended for external use.

General documentation and examples can be found on pkg.go.dev.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Documentation

Overview

Package armcore implements various helpers for Azure Resource Manager APIs.

You do not need to explicitly import this module. It will automatically be included as a dependency for all ARM modules.

The contents of this module are used by generated code. It is not intended for external use.

Index

Constants

View Source
const (
	// LogRPRegistration entries contain information specific to the automatic registration of an RP.
	// Entries of this classification are written IFF the policy needs to take any action.
	LogRPRegistration azcore.LogClassification = "RPRegistration"
)

Variables

This section is empty.

Functions

func NewRPRegistrationPolicy

func NewRPRegistrationPolicy(cred azcore.Credential, o *RegistrationOptions) azcore.Policy

NewRPRegistrationPolicy creates a policy object configured using the specified pipeline and options. The policy controls if an unregistered resource provider should automatically be registered. See https://aka.ms/rps-not-found for more information. Pass nil to accept the default options; this is the same as passing the result from a call to DefaultRegistrationOptions().

Types

type Poller added in v0.1.1

type Poller interface {
	// Done signals if the polling operation has reached a terminal state.
	Done() bool
	// Poll sends a polling request to the service endpoint and returns the http.Response received from the endpoint or an error.
	Poll(ctx context.Context, p azcore.Pipeline) (*http.Response, error)
	// FinalResponse will perform a final GET and return the final http response for the polling operation and unmarshal the content of the payload into the respType interface that is provided.
	FinalResponse(ctx context.Context, pipeline azcore.Pipeline, respType interface{}) (*http.Response, error)
	// ResumeToken returns a token string that can be used to resume polling on a poller that has not yet reached a terminal state.
	ResumeToken() (string, error)
	// PollUntilDone will handle the entire span of the polling operation until a terminal state is reached, then return the final http response for the polling operation and unmarshal the content of the payload into the respType interface that is provided.
	PollUntilDone(ctx context.Context, frequency time.Duration, pipeline azcore.Pipeline, respType interface{}) (*http.Response, error)
}

Poller defines the methods that will be called internally in the generated code for long-running operations. NOTE: this is only meant for internal use in generated code.

func NewPoller added in v0.1.1

func NewPoller(pollerType string, finalState string, resp *azcore.Response, errorHandler methodErrorHandler) (Poller, error)

NewPoller creates a polling tracker based on the verb of the original request and returns the polling tracker implementation for the method verb or an error. NOTE: this is only meant for internal use in generated code.

func NewPollerFromResumeToken added in v0.1.1

func NewPollerFromResumeToken(pollerType string, token string, errorHandler methodErrorHandler) (Poller, error)

NewPollerFromResumeToken creates a polling tracker from a resume token string. NOTE: this is only meant for internal use in generated code.

type Provider

type Provider struct {
	// The provider ID.
	ID *string `json:"id,omitempty"`

	// The namespace of the resource provider.
	Namespace *string `json:"namespace,omitempty"`

	// The registration policy of the resource provider.
	RegistrationPolicy *string `json:"registrationPolicy,omitempty"`

	// The registration state of the resource provider.
	RegistrationState *string `json:"registrationState,omitempty"`
}

Provider - Resource provider information.

type ProviderResponse

type ProviderResponse struct {
	// Resource provider information.
	Provider *Provider

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

ProviderResponse is the response envelope for operations that return a Provider type.

type RegistrationOptions

type RegistrationOptions struct {
	// MaxAttempts is the total number of times to attempt automatic registration
	// in the event that an attempt fails.
	// The default value is 3.
	// Set to zero to disable the policy.
	MaxAttempts int

	// PollingDelay is the amount of time to sleep between polling intervals.
	// The default value is 15 seconds.
	PollingDelay time.Duration

	// PollingDuration is the amount of time to wait before abandoning polling.
	// The default valule is 5 minutes.
	PollingDuration time.Duration

	// HTTPClient sets the transport for making HTTP requests.
	// Defaults to azcore.DefaultHTTPClientTransport()
	HTTPClient azcore.Transport

	// Retry configures the built-in retry policy behavior.
	// Defaults to azcore.DefaultRetryOptions()
	Retry azcore.RetryOptions
}

RegistrationOptions configures the registration policy's behavior.

func DefaultRegistrationOptions

func DefaultRegistrationOptions() RegistrationOptions

DefaultRegistrationOptions returns an instance of RegistrationOptions initialized with default values.

Jump to

Keyboard shortcuts

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