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 ( // 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 the result from a call to DefaultRegistrationOptions().
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).
func NewConnectionWithPipeline ¶ added in v0.3.5
func NewConnectionWithPipeline(endpoint string, p azcore.Pipeline) *Connection
NewConnectionWithPipeline creates an instance of the Connection type with the specified endpoint and pipeline. Use this when a custom pipeline is required.
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.
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 // RegisterRPOptions configures the built-in RP registration policy behavior. RegisterRPOptions RegistrationOptions }
ConnectionOptions contains configuration settings for the connection's pipeline. Call DefaultConnectionOptions() to create an instance populated with default values.
func DefaultConnectionOptions ¶ added in v0.3.5
func DefaultConnectionOptions() ConnectionOptions
DefaultConnectionOptions creates a ConnectionOptions type initialized with 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 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. Call DefaultRegistrationOptions() to create an instance populated with default values.
func DefaultRegistrationOptions ¶
func DefaultRegistrationOptions() RegistrationOptions
DefaultRegistrationOptions returns an instance of RegistrationOptions initialized with default values.