azure-sdk-for-go: github.com/Azure/azure-sdk-for-go/services/classic/management Index | Files | Directories

package management

import "github.com/Azure/azure-sdk-for-go/services/classic/management"

Package management provides the main API client to construct other clients and make requests to the Microsoft Azure Service Management REST API.

Index

Package Files

client.go errors.go http.go operations.go publishSettings.go util.go

Constants

const (
    DefaultAzureManagementURL    = "https://management.core.windows.net"
    DefaultOperationPollInterval = time.Second * 30
    DefaultAPIVersion            = "2014-10-01"
)

Variables

var (
    DefaultUserAgent = userAgent()
)
var (
    // ErrOperationCancelled from WaitForOperation when the polling loop is
    // cancelled through signaling the channel.
    ErrOperationCancelled = errors.New("Polling for operation status cancelled")
)

func IsResourceNotFoundError Uses

func IsResourceNotFoundError(err error) bool

IsResourceNotFoundError returns true if the provided error is an AzureError reporting that a given resource has not been found.

type AzureError Uses

type AzureError struct {
    Code    string
    Message string
}

AzureError represents an error returned by the management API. It has an error code (for example, ResourceNotFound) and a descriptive message.

func (AzureError) Error Uses

func (e AzureError) Error() string

Error implements the error interface for the AzureError type.

type Client Uses

type Client interface {
    // SendAzureGetRequest sends a request to the management API using the HTTP GET method
    // and returns the response body or an error.
    SendAzureGetRequest(url string) ([]byte, error)

    // SendAzurePostRequest sends a request to the management API using the HTTP POST method
    // and returns the request ID or an error.
    SendAzurePostRequest(url string, data []byte) (OperationID, error)

    // SendAzurePostRequestWithReturnedResponse sends a request to the management API using
    // the HTTP POST method and returns the response body or an error.
    SendAzurePostRequestWithReturnedResponse(url string, data []byte) ([]byte, error)

    // SendAzurePutRequest sends a request to the management API using the HTTP PUT method
    // and returns the request ID or an error. The content type can be specified, however
    // if an empty string is passed, the default of "application/xml" will be used.
    SendAzurePutRequest(url, contentType string, data []byte) (OperationID, error)

    // SendAzureDeleteRequest sends a request to the management API using the HTTP DELETE method
    // and returns the request ID or an error.
    SendAzureDeleteRequest(url string) (OperationID, error)

    // GetOperationStatus gets the status of operation with given Operation ID.
    // WaitForOperation utility method can be used for polling for operation status.
    GetOperationStatus(operationID OperationID) (GetOperationStatusResponse, error)

    // WaitForOperation polls the Azure API for given operation ID indefinitely
    // until the operation is completed with either success or failure.
    // It is meant to be used for waiting for the result of the methods that
    // return an OperationID value (meaning a long running operation has started).
    //
    // Cancellation of the polling loop (for instance, timing out) is done through
    // cancel channel. If the user does not want to cancel, a nil chan can be provided.
    // To cancel the method, it is recommended to close the channel provided to this
    // method.
    //
    // If the operation was not successful or cancelling is signaled, an error
    // is returned.
    WaitForOperation(operationID OperationID, cancel chan struct{}) error
}

Client is the base Azure Service Management API client instance that can be used to construct client instances for various services.

func ClientFromPublishSettingsData Uses

func ClientFromPublishSettingsData(settingsData []byte, subscriptionID string) (client Client, err error)

ClientFromPublishSettingsData unmarshalls the contents of a publish settings file from https://manage.windowsazure.com/publishsettings. If subscriptionID is left empty, the first subscription in the file is used.

func ClientFromPublishSettingsDataWithConfig Uses

func ClientFromPublishSettingsDataWithConfig(data []byte, subscriptionID string, config ClientConfig) (client Client, err error)

ClientFromPublishSettingsDataWithConfig unmarshalls the contents of a publish settings file from https://manage.windowsazure.com/publishsettings. If subscriptionID is left empty, the first subscription in the string is used.

func ClientFromPublishSettingsFile Uses

func ClientFromPublishSettingsFile(filePath, subscriptionID string) (client Client, err error)

ClientFromPublishSettingsFile reads a publish settings file downloaded from https://manage.windowsazure.com/publishsettings. If subscriptionID is left empty, the first subscription in the file is used.

func ClientFromPublishSettingsFileWithConfig Uses

func ClientFromPublishSettingsFileWithConfig(filePath, subscriptionID string, config ClientConfig) (client Client, err error)

ClientFromPublishSettingsFileWithConfig reads a publish settings file downloaded from https://manage.windowsazure.com/publishsettings. If subscriptionID is left empty, the first subscription in the file is used.

func NewAnonymousClient Uses

func NewAnonymousClient() Client

NewAnonymousClient creates a new azure.Client with no credentials set.

func NewClient Uses

func NewClient(subscriptionID string, managementCert []byte) (Client, error)

NewClient creates a new Client using the given subscription ID and management certificate.

func NewClientFromConfig Uses

func NewClientFromConfig(subscriptionID string, managementCert []byte, config ClientConfig) (Client, error)

NewClientFromConfig creates a new Client using a given ClientConfig.

type ClientConfig Uses

type ClientConfig struct {
    ManagementURL         string
    OperationPollInterval time.Duration
    UserAgent             string
    APIVersion            string
}

ClientConfig provides a configuration for use by a Client.

func DefaultConfig Uses

func DefaultConfig() ClientConfig

DefaultConfig returns the default client configuration used to construct a client. This value can be used to make modifications on the default API configuration.

type GetOperationStatusResponse Uses

type GetOperationStatusResponse struct {
    XMLName        xml.Name `xml:"http://schemas.microsoft.com/windowsazure Operation"`
    ID             string
    Status         OperationStatus
    HTTPStatusCode string
    Error          *AzureError
}

GetOperationStatusResponse represents an in-flight operation. Use client.GetOperationStatus() to get the operation given the operation ID, or use WaitForOperation() to poll and wait until the operation has completed. See https://msdn.microsoft.com/en-us/library/azure/ee460783.aspx

type OperationID Uses

type OperationID string

OperationID is assigned by Azure API and can be used to look up the status of an operation

type OperationStatus Uses

type OperationStatus string

OperationStatus describes the states an Microsoft Azure Service Management operation an be in.

const (
    OperationStatusInProgress OperationStatus = "InProgress"
    OperationStatusSucceeded  OperationStatus = "Succeeded"
    OperationStatusFailed     OperationStatus = "Failed"
)

List of states an operation can be reported as

Directories

PathSynopsis
affinitygroup
hostedservicePackage hostedservice provides a client for Hosted Services.
locationPackage location provides a client for Locations.
networksecuritygroupPackage networksecuritygroup provides a client for Network Security Groups.
osimagePackage osimage provides a client for Operating System Images.
sql
storageservicePackage storageservice provides a client for Storage Services.
testutilsPackage testutils contains some test utilities for the Azure SDK
virtualmachinePackage virtualmachine provides a client for Virtual Machines.
virtualmachinediskPackage virtualmachinedisk provides a client for Virtual Machine Disks.
virtualmachineimagePackage virtualmachineimage provides a client for Virtual Machine Images.
virtualnetworkPackage virtualnetwork provides a client for Virtual Networks.
vmutilsPackage vmutils provides convenience methods for creating Virtual Machine Role configurations.

Package management imports 13 packages (graph) and is imported by 53 packages. Updated 2019-10-11. Refresh now. Tools for package owners.