Documentation ¶
Overview ¶
Package armcore provides connections and utilities for Go SDK ARM client modules.
All Azure Resource Manager clients require a Connection, which is simply a combination of the desired ARM endpoint and a pipeline for handling HTTP requests and responses.
To access the Azure public cloud, use the NewDefaultConnection() constructor with the required token credential. Module azidentity provides several methods for obtaining token credentials.
cred, _ := azidentity.NewDefaultAzureCredential(nil) con := armcore.NewDefaultConnection(cred, nil)
When accessing clouds other than the Azure public cloud, use the NewConnection() constructor with the required ARM endpoint and token credential. The most common case is connecting to an Azure sovereign cloud or Azure Stack instance.
NewDefaultConnection() and NewConnection() are configured with the same pipeline thus have the same pipeline configuration options. Use the NewConnectionWithPipeline() constructor to create a connection that uses a custom azcore.Pipeline. Note that any custom pipeline will require at minimum an authentication policy obtained from a token credential in order to authenticate with ARM. See the implementation of NewConnection() for how to obtain a credential's authentication policy.
Index ¶
Constants ¶
const ( // AzureChina is the Azure Resourece Manager China cloud endpoint. AzureChina = "https://management.chinacloudapi.cn/" // AzureGermany is the Azure Resourece Manager Germany cloud endpoint. AzureGermany = "https://management.microsoftazure.de/" // AzureGovernment is the Azure Resourece Manager US government cloud endpoint. AzureGovernment = "https://management.usgovcloudapi.net/" // AzurePublicCloud is the Azure Resourece Manager public cloud endpoint. AzurePublicCloud = "https://management.azure.com/" )
const ( // UserAgent is the string to be used in the user agent string when making requests. UserAgent = "armcore/" + Version // Version is the semantic version (see http://semver.org) of this module. Version = "v0.7.0" )
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(endpoint string, cred azcore.Credential, o *RegistrationOptions) azcore.Policy
NewRPRegistrationPolicy creates a policy object configured using the specified endpoint, credentials 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 a zero-value options.
Types ¶
type Connection ¶ added in v0.3.5
type Connection struct {
// contains filtered or unexported fields
}
Connection is a connection to an Azure Resource Manager endpoint. It contains the base ARM endpoint and a pipeline for making requests.
func NewConnection ¶ added in v0.3.5
func NewConnection(endpoint string, cred azcore.TokenCredential, options *ConnectionOptions) *Connection
NewConnection creates an instance of the Connection type with the specified endpoint. Use this when connecting to clouds other than the Azure public cloud (stack/sovereign clouds). Pass nil to accept the default options; this is the same as passing a zero-value options.
func NewDefaultConnection ¶ added in v0.3.5
func NewDefaultConnection(cred azcore.TokenCredential, options *ConnectionOptions) *Connection
NewDefaultConnection creates an instance of the Connection type using the AzurePublicCloud. Pass nil to accept the default options; this is the same as passing a zero-value options.
func (*Connection) Endpoint ¶ added in v0.3.5
func (c *Connection) Endpoint() string
Endpoint returns the connection's ARM endpoint.
func (*Connection) Pipeline ¶ added in v0.4.0
func (c *Connection) Pipeline() azcore.Pipeline
Pipeline returns the connection's pipeline.
type ConnectionOptions ¶ added in v0.3.5
type ConnectionOptions struct { // HTTPClient sets the transport for making HTTP requests. HTTPClient azcore.Transport // Retry configures the built-in retry policy behavior. Retry azcore.RetryOptions // Telemetry configures the built-in telemetry policy behavior. Telemetry azcore.TelemetryOptions // Logging configures the built-in logging policy behavior. Logging azcore.LogOptions // DisableRPRegistration disables the auto-RP registration policy. // The default value is false. DisableRPRegistration bool // PerCallPolicies contains custom policies to inject into the pipeline. // Each policy is executed once per request. PerCallPolicies []azcore.Policy // PerRetryPolicies contains custom policies to inject into the pipeline. // Each policy is executed once per request, and for each retry request. PerRetryPolicies []azcore.Policy }
ConnectionOptions contains configuration settings for the connection's pipeline. All zero-value fields will be initialized with their default values.
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.
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 a value less than zero to disable the policy. MaxAttempts int // PollingDelay is the amount of time to sleep between polling intervals. // The default value is 15 seconds. // A value less than zero means no delay between polling intervals (not recommended). PollingDelay time.Duration // PollingDuration is the amount of time to wait before abandoning polling. // The default valule is 5 minutes. // NOTE: Setting this to a small value might cause the policy to prematurely fail. PollingDuration time.Duration // HTTPClient sets the transport for making HTTP requests. HTTPClient azcore.Transport // Retry configures the built-in retry policy behavior. Retry azcore.RetryOptions // Telemetry configures the built-in telemetry policy behavior. Telemetry azcore.TelemetryOptions // Logging configures the built-in logging policy behavior. Logging azcore.LogOptions }
RegistrationOptions configures the registration policy's behavior. All zero-value fields will be initialized with their default values.