azure

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsConflictError added in v0.3.0

func IsConflictError(err error) bool

Types

type API

type API struct {
	Opts *Options
	// contains filtered or unexported fields
}

func New

func New(opts *Options) (*API, error)

New creates a new Azure client. If no publish settings file is provided or can't be parsed, an anonymous client is created.

func (*API) BlobExists added in v0.3.0

func (a *API) BlobExists(storageaccount, storagekey, container, blob string) (bool, error)

func (*API) CopyBlob added in v0.20.0

func (a *API) CopyBlob(storageaccount, storagekey, container, targetBlob, sourceBlob string) error

func (*API) CreateGalleryImage added in v0.20.0

func (a *API) CreateGalleryImage(name, resourceGroup, storageAccount, blobURI string) (string, error)

CreateGalleryImage creates an Azure Compute Gallery with 1 image version referencing the blob as the disk

func (*API) CreateImage added in v0.20.0

func (a *API) CreateImage(name, resourceGroup, blobURI string) (compute.Image, error)

CreateImage creates a managed image referencing the blob as the disk

func (*API) CreateInstance added in v0.20.0

func (a *API) CreateInstance(name, userdata, sshkey, resourceGroup, storageAccount string, network Network) (*Machine, error)

func (*API) CreateResourceGroup added in v0.20.0

func (a *API) CreateResourceGroup(prefix string) (string, error)

func (*API) CreateStorageAccount added in v0.20.0

func (a *API) CreateStorageAccount(resourceGroup string) (string, error)

func (*API) DeleteBlob added in v0.20.0

func (a *API) DeleteBlob(storageaccount, storagekey, container, blob string) error

func (*API) GC added in v0.20.0

func (a *API) GC(gracePeriod time.Duration) error

func (*API) GetBlob added in v0.20.0

func (a *API) GetBlob(storageaccount, storagekey, container, name string) (io.ReadCloser, error)

func (*API) GetConsoleOutput added in v0.20.0

func (a *API) GetConsoleOutput(name, resourceGroup, storageAccount string) ([]byte, error)

func (*API) GetIPAddresses added in v0.20.0

func (a *API) GetIPAddresses(name, publicIPName, resourceGroup string) (string, string, error)

returns PublicIP, PrivateIP, error

func (*API) GetOpts added in v0.20.0

func (a *API) GetOpts() *Options

func (*API) GetPrivateIP added in v0.20.0

func (a *API) GetPrivateIP(name, resourceGroup string) (string, error)

func (*API) GetStorageServiceKeys

func (a *API) GetStorageServiceKeys(account string) (storageservice.GetStorageServiceKeysResponse, error)

func (*API) GetStorageServiceKeysARM added in v0.20.0

func (a *API) GetStorageServiceKeysARM(account, resourceGroup string) (storage.AccountListKeysResult, error)

func (*API) ListBlobs added in v0.20.0

func (a *API) ListBlobs(storageaccount, storagekey, container string, params storage.ListBlobsParameters) ([]storage.Blob, error)

func (*API) ListResourceGroups added in v0.20.0

func (a *API) ListResourceGroups(filter string) (resources.GroupListResult, error)

func (*API) ListStorageContainers added in v0.20.0

func (a *API) ListStorageContainers(storageaccount, storagekey, prefix string) (*storage.ContainerListResponse, error)

func (*API) Locations

func (a *API) Locations() ([]string, error)

Locations returns a slice of Azure Locations which offer the Compute service, useful for replicating to all Locations.

func (*API) OSImageExists added in v0.2.1

func (a *API) OSImageExists(name string) (bool, error)

func (*API) PrepareNetworkResources added in v0.20.0

func (a *API) PrepareNetworkResources(resourceGroup string) (Network, error)

func (*API) ReplicateImage

func (a *API) ReplicateImage(image, offer, sku, version string, regions ...string) error

func (*API) SetupClients added in v0.20.0

func (a *API) SetupClients() error

func (*API) ShareImage

func (a *API) ShareImage(image, permission string) error

func (*API) SignBlob added in v0.20.0

func (a *API) SignBlob(storageaccount, storagekey, container, blob string) (string, error)

func (*API) TerminateInstance added in v0.20.0

func (a *API) TerminateInstance(machine *Machine, resourceGroup string) error

TerminateInstance deletes a VM created by CreateInstance. Public IP, NIC and OS disk are deleted automatically together with the VM.

func (*API) TerminateResourceGroup added in v0.20.0

func (a *API) TerminateResourceGroup(name string) error

func (*API) TerminateStorageContainer added in v0.20.0

func (a *API) TerminateStorageContainer(storageaccount, storagekey, name string) error

func (*API) UnreplicateImage

func (a *API) UnreplicateImage(image string) error

func (*API) UploadBlob

func (a *API) UploadBlob(storageaccount, storagekey, vhd, container, blob string, overwrite bool) error

UploadBlob uploads vhd to the given storage account, container, and blob name.

It returns BlobExistsError if the blob exists and overwrite is not true.

func (*API) UrlOfBlob added in v0.3.0

func (a *API) UrlOfBlob(account, container, blob string) *url.URL

type BlobExistsError added in v0.2.1

type BlobExistsError string

func (BlobExistsError) Error added in v0.2.1

func (be BlobExistsError) Error() string

type Machine added in v0.20.0

type Machine struct {
	ID               string
	PublicIPAddress  string
	PrivateIPAddress string
	InterfaceName    string
	PublicIPName     string
}

type Network added in v0.20.0

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

type OSImage

type OSImage struct {
	XMLName           xml.Name `xml:"http://schemas.microsoft.com/windowsazure OSImage"`
	Category          string   `xml:",omitempty"` // Public || Private || MSDN
	Label             string   `xml:",omitempty"` // Specifies an identifier for the image.
	MediaLink         string   `xml:",omitempty"` // Specifies the location of the vhd file for the image. The storage account where the vhd is located must be associated with the specified subscription.
	Name              string   // Specifies the name of the operating system image. This is the name that is used when creating one or more virtual machines using the image.
	OS                string   // Linux || Windows
	Eula              string   `xml:",omitempty"` // Specifies the End User License Agreement that is associated with the image. The value for this element is a string, but it is recommended that the value be a URL that points to a EULA.
	Description       string   `xml:",omitempty"` // Specifies the description of the image.
	ImageFamily       string   `xml:",omitempty"` // Specifies a value that can be used to group images.
	PublishedDate     string   `xml:",omitempty"` // Specifies the date when the image was added to the image repository.
	ShowInGui         bool     // Specifies whether the image should appear in the image gallery.
	PrivacyURI        string   `xml:"PrivacyUri,omitempty"`   // Specifies the URI that points to a document that contains the privacy policy related to the image.
	IconURI           string   `xml:"IconUri,omitempty"`      // Specifies the Uri to the icon that is displayed for the image in the Management Portal.
	RecommendedVMSize string   `xml:",omitempty"`             // Specifies the size to use for the virtual machine that is created from the image.
	SmallIconURI      string   `xml:"SmallIconUri,omitempty"` // Specifies the URI to the small icon that is displayed when the image is presented in the Microsoft Azure Management Portal.
	Language          string   `xml:",omitempty"`             // Specifies the language of the image.

	LogicalSizeInGB   float64 `xml:",omitempty"` //Specifies the size, in GB, of the image.
	Location          string  `xml:",omitempty"` // The geo-location in which this media is located. The Location value is derived from storage account that contains the blob in which the media is located. If the storage account belongs to an affinity group the value is NULL.
	AffinityGroup     string  `xml:",omitempty"` // Specifies the affinity in which the media is located. The AffinityGroup value is derived from storage account that contains the blob in which the media is located. If the storage account does not belong to an affinity group the value is NULL and the element is not displayed in the response. This value is NULL for platform images.
	IsPremium         string  `xml:",omitempty"` // Indicates whether the image contains software or associated services that will incur charges above the core price for the virtual machine. For additional details, see the PricingDetailLink element.
	PublisherName     string  `xml:",omitempty"` // The name of the publisher of the image. All user images have a publisher name of User.
	PricingDetailLink string  `xml:",omitempty"` // Specifies a URL for an image with IsPremium set to true, which contains the pricing details for a virtual machine that is created from the image.
}

OSImage struct for https://msdn.microsoft.com/en-us/library/azure/jj157192.aspx call.

XXX: the field ordering is important!

type Options

type Options struct {
	*platform.Options

	AzureProfile      string
	AzureAuthLocation string
	AzureSubscription string

	BlobURL          string
	ImageFile        string
	DiskURI          string
	Publisher        string
	Offer            string
	Sku              string
	Version          string
	Size             string
	Location         string
	HyperVGeneration string
	VnetSubnetName   string
	UseGallery       bool
	UsePrivateIPs    bool

	SubscriptionName string
	SubscriptionID   string

	// Azure API endpoint. If unset, the Azure SDK default will be used.
	ManagementURL         string
	ManagementCertificate []byte

	// Azure Storage API endpoint suffix. If unset, the Azure SDK default will be used.
	StorageEndpointSuffix string
	// UseUserData can be use to enable custom data only or user-data only.
	UseUserData bool
}

type ReplicationInput

type ReplicationInput struct {
	XMLName         xml.Name `xml:"http://schemas.microsoft.com/windowsazure ReplicationInput"`
	TargetLocations []string `xml:"TargetLocations>Region"`
	Offer           string   `xml:"ComputeImageAttributes>Offer"`
	Sku             string   `xml:"ComputeImageAttributes>Sku"`
	Version         string   `xml:"ComputeImageAttributes>Version"`
}

Jump to

Keyboard shortcuts

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