Merge pull request #7778 from amydutta/master
Publish Managed Images to Azure Shared Image Gallery (same Subscription)
This commit is contained in:
commit
1eef03c36b
|
@ -35,12 +35,13 @@ type Artifact struct {
|
||||||
ManagedImageId string
|
ManagedImageId string
|
||||||
ManagedImageOSDiskSnapshotName string
|
ManagedImageOSDiskSnapshotName string
|
||||||
ManagedImageDataDiskSnapshotPrefix string
|
ManagedImageDataDiskSnapshotPrefix string
|
||||||
|
ManagedImageSharedImageGalleryId string
|
||||||
|
|
||||||
// Additional Disks
|
// Additional Disks
|
||||||
AdditionalDisks *[]AdditionalDiskArtifact
|
AdditionalDisks *[]AdditionalDiskArtifact
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewManagedImageArtifact(osType, resourceGroup, name, location, id, osDiskSnapshotName, dataDiskSnapshotPrefix string) (*Artifact, error) {
|
func NewManagedImageArtifact(osType, resourceGroup, name, location, id, osDiskSnapshotName, dataDiskSnapshotPrefix, destinationSharedImageGalleryId string) (*Artifact, error) {
|
||||||
return &Artifact{
|
return &Artifact{
|
||||||
ManagedImageResourceGroupName: resourceGroup,
|
ManagedImageResourceGroupName: resourceGroup,
|
||||||
ManagedImageName: name,
|
ManagedImageName: name,
|
||||||
|
@ -49,6 +50,7 @@ func NewManagedImageArtifact(osType, resourceGroup, name, location, id, osDiskSn
|
||||||
OSType: osType,
|
OSType: osType,
|
||||||
ManagedImageOSDiskSnapshotName: osDiskSnapshotName,
|
ManagedImageOSDiskSnapshotName: osDiskSnapshotName,
|
||||||
ManagedImageDataDiskSnapshotPrefix: dataDiskSnapshotPrefix,
|
ManagedImageDataDiskSnapshotPrefix: dataDiskSnapshotPrefix,
|
||||||
|
ManagedImageSharedImageGalleryId: destinationSharedImageGalleryId,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,6 +170,9 @@ func (a *Artifact) String() string {
|
||||||
if a.ManagedImageDataDiskSnapshotPrefix != "" {
|
if a.ManagedImageDataDiskSnapshotPrefix != "" {
|
||||||
buf.WriteString(fmt.Sprintf("ManagedImageDataDiskSnapshotPrefix: %s\n", a.ManagedImageDataDiskSnapshotPrefix))
|
buf.WriteString(fmt.Sprintf("ManagedImageDataDiskSnapshotPrefix: %s\n", a.ManagedImageDataDiskSnapshotPrefix))
|
||||||
}
|
}
|
||||||
|
if a.ManagedImageSharedImageGalleryId != "" {
|
||||||
|
buf.WriteString(fmt.Sprintf("ManagedImageSharedImageGalleryId: %s\n", a.ManagedImageSharedImageGalleryId))
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
buf.WriteString(fmt.Sprintf("StorageAccountLocation: %s\n", a.StorageAccountLocation))
|
buf.WriteString(fmt.Sprintf("StorageAccountLocation: %s\n", a.StorageAccountLocation))
|
||||||
buf.WriteString(fmt.Sprintf("OSDiskUri: %s\n", a.OSDiskUri))
|
buf.WriteString(fmt.Sprintf("OSDiskUri: %s\n", a.OSDiskUri))
|
||||||
|
|
|
@ -42,7 +42,7 @@ func TestArtifactIdVHD(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestArtifactIDManagedImage(t *testing.T) {
|
func TestArtifactIDManagedImage(t *testing.T) {
|
||||||
artifact, err := NewManagedImageArtifact("Linux", "fakeResourceGroup", "fakeName", "fakeLocation", "fakeID", "fakeOsDiskSnapshotName", "fakeDataDiskSnapshotPrefix")
|
artifact, err := NewManagedImageArtifact("Linux", "fakeResourceGroup", "fakeName", "fakeLocation", "fakeID", "fakeOsDiskSnapshotName", "fakeDataDiskSnapshotPrefix", "fakeSharedImageGalleryId")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("err=%s", err)
|
t.Fatalf("err=%s", err)
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ ManagedImageId: fakeID
|
||||||
ManagedImageLocation: fakeLocation
|
ManagedImageLocation: fakeLocation
|
||||||
ManagedImageOSDiskSnapshotName: fakeOsDiskSnapshotName
|
ManagedImageOSDiskSnapshotName: fakeOsDiskSnapshotName
|
||||||
ManagedImageDataDiskSnapshotPrefix: fakeDataDiskSnapshotPrefix
|
ManagedImageDataDiskSnapshotPrefix: fakeDataDiskSnapshotPrefix
|
||||||
|
ManagedImageSharedImageGalleryId: fakeSharedImageGalleryId
|
||||||
`
|
`
|
||||||
|
|
||||||
result := artifact.String()
|
result := artifact.String()
|
||||||
|
@ -65,7 +66,7 @@ ManagedImageDataDiskSnapshotPrefix: fakeDataDiskSnapshotPrefix
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestArtifactIDManagedImageWithoutOSDiskSnapshotName(t *testing.T) {
|
func TestArtifactIDManagedImageWithoutOSDiskSnapshotName(t *testing.T) {
|
||||||
artifact, err := NewManagedImageArtifact("Linux", "fakeResourceGroup", "fakeName", "fakeLocation", "fakeID", "", "fakeDataDiskSnapshotPrefix")
|
artifact, err := NewManagedImageArtifact("Linux", "fakeResourceGroup", "fakeName", "fakeLocation", "fakeID", "", "fakeDataDiskSnapshotPrefix", "fakeSharedImageGalleryId")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("err=%s", err)
|
t.Fatalf("err=%s", err)
|
||||||
}
|
}
|
||||||
|
@ -78,6 +79,7 @@ ManagedImageName: fakeName
|
||||||
ManagedImageId: fakeID
|
ManagedImageId: fakeID
|
||||||
ManagedImageLocation: fakeLocation
|
ManagedImageLocation: fakeLocation
|
||||||
ManagedImageDataDiskSnapshotPrefix: fakeDataDiskSnapshotPrefix
|
ManagedImageDataDiskSnapshotPrefix: fakeDataDiskSnapshotPrefix
|
||||||
|
ManagedImageSharedImageGalleryId: fakeSharedImageGalleryId
|
||||||
`
|
`
|
||||||
|
|
||||||
result := artifact.String()
|
result := artifact.String()
|
||||||
|
@ -87,7 +89,7 @@ ManagedImageDataDiskSnapshotPrefix: fakeDataDiskSnapshotPrefix
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestArtifactIDManagedImageWithoutDataDiskSnapshotPrefix(t *testing.T) {
|
func TestArtifactIDManagedImageWithoutDataDiskSnapshotPrefix(t *testing.T) {
|
||||||
artifact, err := NewManagedImageArtifact("Linux", "fakeResourceGroup", "fakeName", "fakeLocation", "fakeID", "fakeOsDiskSnapshotName", "")
|
artifact, err := NewManagedImageArtifact("Linux", "fakeResourceGroup", "fakeName", "fakeLocation", "fakeID", "fakeOsDiskSnapshotName", "", "fakeSharedImageGalleryId")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("err=%s", err)
|
t.Fatalf("err=%s", err)
|
||||||
}
|
}
|
||||||
|
@ -100,6 +102,30 @@ ManagedImageName: fakeName
|
||||||
ManagedImageId: fakeID
|
ManagedImageId: fakeID
|
||||||
ManagedImageLocation: fakeLocation
|
ManagedImageLocation: fakeLocation
|
||||||
ManagedImageOSDiskSnapshotName: fakeOsDiskSnapshotName
|
ManagedImageOSDiskSnapshotName: fakeOsDiskSnapshotName
|
||||||
|
ManagedImageSharedImageGalleryId: fakeSharedImageGalleryId
|
||||||
|
`
|
||||||
|
|
||||||
|
result := artifact.String()
|
||||||
|
if result != expected {
|
||||||
|
t.Fatalf("bad: %s", result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestArtifactIDManagedImageWithoutSharedImageGalleryId(t *testing.T) {
|
||||||
|
artifact, err := NewManagedImageArtifact("Linux", "fakeResourceGroup", "fakeName", "fakeLocation", "fakeID", "fakeOsDiskSnapshotName", "fakeDataDiskSnapshotPrefix", "")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("err=%s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
expected := `Azure.ResourceManagement.VMImage:
|
||||||
|
|
||||||
|
OSType: Linux
|
||||||
|
ManagedImageResourceGroupName: fakeResourceGroup
|
||||||
|
ManagedImageName: fakeName
|
||||||
|
ManagedImageId: fakeID
|
||||||
|
ManagedImageLocation: fakeLocation
|
||||||
|
ManagedImageOSDiskSnapshotName: fakeOsDiskSnapshotName
|
||||||
|
ManagedImageDataDiskSnapshotPrefix: fakeDataDiskSnapshotPrefix
|
||||||
`
|
`
|
||||||
|
|
||||||
result := artifact.String()
|
result := artifact.String()
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
|
newCompute "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute"
|
||||||
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network"
|
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network"
|
||||||
"github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources"
|
"github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources"
|
||||||
armStorage "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage"
|
armStorage "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage"
|
||||||
|
@ -41,6 +42,8 @@ type AzureClient struct {
|
||||||
armStorage.AccountsClient
|
armStorage.AccountsClient
|
||||||
compute.DisksClient
|
compute.DisksClient
|
||||||
compute.SnapshotsClient
|
compute.SnapshotsClient
|
||||||
|
newCompute.GalleryImageVersionsClient
|
||||||
|
newCompute.GalleryImagesClient
|
||||||
|
|
||||||
InspectorMaxLength int
|
InspectorMaxLength int
|
||||||
Template *CaptureTemplate
|
Template *CaptureTemplate
|
||||||
|
@ -202,6 +205,18 @@ func NewAzureClient(subscriptionID, resourceGroupName, storageAccountName string
|
||||||
azureClient.AccountsClient.ResponseInspector = byConcatDecorators(byInspecting(maxlen), errorCapture(azureClient))
|
azureClient.AccountsClient.ResponseInspector = byConcatDecorators(byInspecting(maxlen), errorCapture(azureClient))
|
||||||
azureClient.AccountsClient.UserAgent = fmt.Sprintf("%s %s", useragent.String(), azureClient.AccountsClient.UserAgent)
|
azureClient.AccountsClient.UserAgent = fmt.Sprintf("%s %s", useragent.String(), azureClient.AccountsClient.UserAgent)
|
||||||
|
|
||||||
|
azureClient.GalleryImageVersionsClient = newCompute.NewGalleryImageVersionsClientWithBaseURI(cloud.ResourceManagerEndpoint, subscriptionID)
|
||||||
|
azureClient.GalleryImageVersionsClient.Authorizer = autorest.NewBearerAuthorizer(servicePrincipalToken)
|
||||||
|
azureClient.GalleryImageVersionsClient.RequestInspector = withInspection(maxlen)
|
||||||
|
azureClient.GalleryImageVersionsClient.ResponseInspector = byConcatDecorators(byInspecting(maxlen), errorCapture(azureClient))
|
||||||
|
azureClient.GalleryImageVersionsClient.UserAgent = fmt.Sprintf("%s %s", useragent.String(), azureClient.GalleryImageVersionsClient.UserAgent)
|
||||||
|
|
||||||
|
azureClient.GalleryImagesClient = newCompute.NewGalleryImagesClientWithBaseURI(cloud.ResourceManagerEndpoint, subscriptionID)
|
||||||
|
azureClient.GalleryImagesClient.Authorizer = autorest.NewBearerAuthorizer(servicePrincipalToken)
|
||||||
|
azureClient.GalleryImagesClient.RequestInspector = withInspection(maxlen)
|
||||||
|
azureClient.GalleryImagesClient.ResponseInspector = byConcatDecorators(byInspecting(maxlen), errorCapture(azureClient))
|
||||||
|
azureClient.GalleryImagesClient.UserAgent = fmt.Sprintf("%s %s", useragent.String(), azureClient.GalleryImagesClient.UserAgent)
|
||||||
|
|
||||||
keyVaultURL, err := url.Parse(cloud.KeyVaultEndpoint)
|
keyVaultURL, err := url.Parse(cloud.KeyVaultEndpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -177,6 +177,31 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
|
|
||||||
deploymentName := b.stateBag.Get(constants.ArmDeploymentName).(string)
|
deploymentName := b.stateBag.Get(constants.ArmDeploymentName).(string)
|
||||||
|
|
||||||
|
// For Managed Images, validate that Shared Gallery Image exists before publishing to SIG
|
||||||
|
if b.config.isManagedImage() && b.config.SharedGalleryDestination.SigDestinationGalleryName != "" {
|
||||||
|
_, err = azureClient.GalleryImagesClient.Get(ctx, b.config.SharedGalleryDestination.SigDestinationResourceGroup, b.config.SharedGalleryDestination.SigDestinationGalleryName, b.config.SharedGalleryDestination.SigDestinationImageName)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("the Shared Gallery Image to which to publish the managed image version to does not exist in the resource group %s", b.config.SharedGalleryDestination.SigDestinationResourceGroup)
|
||||||
|
}
|
||||||
|
// SIG requires that replication regions include the region in which the Managed Image resides
|
||||||
|
managedImageLocation := normalizeAzureRegion(b.stateBag.Get(constants.ArmLocation).(string))
|
||||||
|
foundMandatoryReplicationRegion := false
|
||||||
|
var normalizedReplicationRegions []string
|
||||||
|
for _, region := range b.config.SharedGalleryDestination.SigDestinationReplicationRegions {
|
||||||
|
// change region to lower-case and strip spaces
|
||||||
|
normalizedRegion := normalizeAzureRegion(region)
|
||||||
|
normalizedReplicationRegions = append(normalizedReplicationRegions, normalizedRegion)
|
||||||
|
if strings.EqualFold(normalizedRegion, managedImageLocation) {
|
||||||
|
foundMandatoryReplicationRegion = true
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if foundMandatoryReplicationRegion == false {
|
||||||
|
b.config.SharedGalleryDestination.SigDestinationReplicationRegions = append(normalizedReplicationRegions, managedImageLocation)
|
||||||
|
}
|
||||||
|
b.stateBag.Put(constants.ArmManagedImageSharedGalleryReplicationRegions, b.config.SharedGalleryDestination.SigDestinationReplicationRegions)
|
||||||
|
}
|
||||||
|
|
||||||
if b.config.OSType == constants.Target_Linux {
|
if b.config.OSType == constants.Target_Linux {
|
||||||
steps = []multistep.Step{
|
steps = []multistep.Step{
|
||||||
NewStepCreateResourceGroup(azureClient, ui),
|
NewStepCreateResourceGroup(azureClient, ui),
|
||||||
|
@ -198,6 +223,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
NewStepSnapshotOSDisk(azureClient, ui, b.config),
|
NewStepSnapshotOSDisk(azureClient, ui, b.config),
|
||||||
NewStepSnapshotDataDisks(azureClient, ui, b.config),
|
NewStepSnapshotDataDisks(azureClient, ui, b.config),
|
||||||
NewStepCaptureImage(azureClient, ui),
|
NewStepCaptureImage(azureClient, ui),
|
||||||
|
NewStepPublishToSharedImageGallery(azureClient, ui, b.config),
|
||||||
NewStepDeleteResourceGroup(azureClient, ui),
|
NewStepDeleteResourceGroup(azureClient, ui),
|
||||||
NewStepDeleteOSDisk(azureClient, ui),
|
NewStepDeleteOSDisk(azureClient, ui),
|
||||||
NewStepDeleteAdditionalDisks(azureClient, ui),
|
NewStepDeleteAdditionalDisks(azureClient, ui),
|
||||||
|
@ -236,6 +262,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
NewStepSnapshotOSDisk(azureClient, ui, b.config),
|
NewStepSnapshotOSDisk(azureClient, ui, b.config),
|
||||||
NewStepSnapshotDataDisks(azureClient, ui, b.config),
|
NewStepSnapshotDataDisks(azureClient, ui, b.config),
|
||||||
NewStepCaptureImage(azureClient, ui),
|
NewStepCaptureImage(azureClient, ui),
|
||||||
|
NewStepPublishToSharedImageGallery(azureClient, ui, b.config),
|
||||||
NewStepDeleteResourceGroup(azureClient, ui),
|
NewStepDeleteResourceGroup(azureClient, ui),
|
||||||
NewStepDeleteOSDisk(azureClient, ui),
|
NewStepDeleteOSDisk(azureClient, ui),
|
||||||
NewStepDeleteAdditionalDisks(azureClient, ui),
|
NewStepDeleteAdditionalDisks(azureClient, ui),
|
||||||
|
@ -275,7 +302,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
|
|
||||||
if b.config.isManagedImage() {
|
if b.config.isManagedImage() {
|
||||||
managedImageID := fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/images/%s", b.config.SubscriptionID, b.config.ManagedImageResourceGroupName, b.config.ManagedImageName)
|
managedImageID := fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/images/%s", b.config.SubscriptionID, b.config.ManagedImageResourceGroupName, b.config.ManagedImageName)
|
||||||
return NewManagedImageArtifact(b.config.OSType, b.config.ManagedImageResourceGroupName, b.config.ManagedImageName, b.config.manageImageLocation, managedImageID, b.config.ManagedImageOSDiskSnapshotName, b.config.ManagedImageDataDiskSnapshotPrefix)
|
return NewManagedImageArtifact(b.config.OSType, b.config.ManagedImageResourceGroupName, b.config.ManagedImageName, b.config.manageImageLocation, managedImageID, b.config.ManagedImageOSDiskSnapshotName, b.config.ManagedImageDataDiskSnapshotPrefix, b.stateBag.Get(constants.ArmManagedImageSharedGalleryId).(string))
|
||||||
} else if template, ok := b.stateBag.GetOk(constants.ArmCaptureTemplate); ok {
|
} else if template, ok := b.stateBag.GetOk(constants.ArmCaptureTemplate); ok {
|
||||||
return NewArtifact(
|
return NewArtifact(
|
||||||
template.(*CaptureTemplate),
|
template.(*CaptureTemplate),
|
||||||
|
@ -369,6 +396,13 @@ func (b *Builder) configureStateBag(stateBag multistep.StateBag) {
|
||||||
stateBag.Put(constants.ArmManagedImageOSDiskSnapshotName, b.config.ManagedImageOSDiskSnapshotName)
|
stateBag.Put(constants.ArmManagedImageOSDiskSnapshotName, b.config.ManagedImageOSDiskSnapshotName)
|
||||||
stateBag.Put(constants.ArmManagedImageDataDiskSnapshotPrefix, b.config.ManagedImageDataDiskSnapshotPrefix)
|
stateBag.Put(constants.ArmManagedImageDataDiskSnapshotPrefix, b.config.ManagedImageDataDiskSnapshotPrefix)
|
||||||
stateBag.Put(constants.ArmAsyncResourceGroupDelete, b.config.AsyncResourceGroupDelete)
|
stateBag.Put(constants.ArmAsyncResourceGroupDelete, b.config.AsyncResourceGroupDelete)
|
||||||
|
if b.config.isManagedImage() && b.config.SharedGalleryDestination.SigDestinationGalleryName != "" {
|
||||||
|
stateBag.Put(constants.ArmManagedImageSigPublishResourceGroup, b.config.SharedGalleryDestination.SigDestinationResourceGroup)
|
||||||
|
stateBag.Put(constants.ArmManagedImageSharedGalleryName, b.config.SharedGalleryDestination.SigDestinationGalleryName)
|
||||||
|
stateBag.Put(constants.ArmManagedImageSharedGalleryImageName, b.config.SharedGalleryDestination.SigDestinationImageName)
|
||||||
|
stateBag.Put(constants.ArmManagedImageSharedGalleryImageVersion, b.config.SharedGalleryDestination.SigDestinationImageVersion)
|
||||||
|
stateBag.Put(constants.ArmManagedImageSubscription, b.config.SubscriptionID)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parameters that are only known at runtime after querying Azure.
|
// Parameters that are only known at runtime after querying Azure.
|
||||||
|
@ -404,3 +438,7 @@ func getObjectIdFromToken(ui packer.Ui, token *adal.ServicePrincipalToken) strin
|
||||||
return claims["oid"].(string)
|
return claims["oid"].(string)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func normalizeAzureRegion(name string) string {
|
||||||
|
return strings.ToLower(strings.Replace(name, " ", "", -1))
|
||||||
|
}
|
||||||
|
|
|
@ -73,6 +73,14 @@ type SharedImageGallery struct {
|
||||||
ImageVersion string `mapstructure:"image_version"`
|
ImageVersion string `mapstructure:"image_version"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SharedImageGalleryDestination struct {
|
||||||
|
SigDestinationResourceGroup string `mapstructure:"resource_group"`
|
||||||
|
SigDestinationGalleryName string `mapstructure:"gallery_name"`
|
||||||
|
SigDestinationImageName string `mapstructure:"image_name"`
|
||||||
|
SigDestinationImageVersion string `mapstructure:"image_version"`
|
||||||
|
SigDestinationReplicationRegions []string `mapstructure:"replication_regions"`
|
||||||
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
common.PackerConfig `mapstructure:",squash"`
|
common.PackerConfig `mapstructure:",squash"`
|
||||||
|
|
||||||
|
@ -86,6 +94,9 @@ type Config struct {
|
||||||
// Shared Gallery
|
// Shared Gallery
|
||||||
SharedGallery SharedImageGallery `mapstructure:"shared_image_gallery"`
|
SharedGallery SharedImageGallery `mapstructure:"shared_image_gallery"`
|
||||||
|
|
||||||
|
// Shared Gallery Destination
|
||||||
|
SharedGalleryDestination SharedImageGalleryDestination `mapstructure:"shared_image_gallery_destination"`
|
||||||
|
|
||||||
// Compute
|
// Compute
|
||||||
ImagePublisher string `mapstructure:"image_publisher"`
|
ImagePublisher string `mapstructure:"image_publisher"`
|
||||||
ImageOffer string `mapstructure:"image_offer"`
|
ImageOffer string `mapstructure:"image_offer"`
|
||||||
|
@ -559,16 +570,16 @@ func assertRequiredParametersSet(c *Config, errs *packer.MultiError) {
|
||||||
}
|
}
|
||||||
} else if c.ImageUrl == "" && c.ImagePublisher == "" {
|
} else if c.ImageUrl == "" && c.ImagePublisher == "" {
|
||||||
if c.CustomManagedImageResourceGroupName == "" {
|
if c.CustomManagedImageResourceGroupName == "" {
|
||||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("An custom_managed_image_resource_group_name must be specified"))
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A custom_managed_image_resource_group_name must be specified"))
|
||||||
}
|
}
|
||||||
if c.CustomManagedImageName == "" {
|
if c.CustomManagedImageName == "" {
|
||||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A custom_managed_image_name must be specified"))
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A custom_managed_image_name must be specified"))
|
||||||
}
|
}
|
||||||
if c.ManagedImageResourceGroupName == "" {
|
if c.ManagedImageResourceGroupName == "" {
|
||||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("An managed_image_resource_group_name must be specified"))
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A managed_image_resource_group_name must be specified"))
|
||||||
}
|
}
|
||||||
if c.ManagedImageName == "" {
|
if c.ManagedImageName == "" {
|
||||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("An managed_image_name must be specified"))
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A managed_image_name must be specified"))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if c.ImagePublisher != "" || c.ImageOffer != "" || c.ImageSku != "" || c.ImageVersion != "" {
|
if c.ImagePublisher != "" || c.ImageOffer != "" || c.ImageSku != "" || c.ImageVersion != "" {
|
||||||
|
@ -623,6 +634,21 @@ func assertRequiredParametersSet(c *Config, errs *packer.MultiError) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c.ManagedImageName != "" && c.ManagedImageResourceGroupName != "" && c.SharedGalleryDestination.SigDestinationGalleryName != "" {
|
||||||
|
if c.SharedGalleryDestination.SigDestinationResourceGroup == "" {
|
||||||
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A resource_group must be specified for shared_image_gallery_destination"))
|
||||||
|
}
|
||||||
|
if c.SharedGalleryDestination.SigDestinationImageName == "" {
|
||||||
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("An image_name must be specified for shared_image_gallery_destination"))
|
||||||
|
}
|
||||||
|
if c.SharedGalleryDestination.SigDestinationImageVersion == "" {
|
||||||
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("An image_version must be specified for shared_image_gallery_destination"))
|
||||||
|
}
|
||||||
|
if len(c.SharedGalleryDestination.SigDestinationReplicationRegions) == 0 {
|
||||||
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A list of replication_regions must be specified for shared_image_gallery_destination"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if c.ManagedImageOSDiskSnapshotName != "" {
|
if c.ManagedImageOSDiskSnapshotName != "" {
|
||||||
if ok, err := assertManagedImageOSDiskSnapshotName(c.ManagedImageOSDiskSnapshotName, "managed_image_os_disk_snapshot_name"); !ok {
|
if ok, err := assertManagedImageOSDiskSnapshotName(c.ManagedImageOSDiskSnapshotName, "managed_image_os_disk_snapshot_name"); !ok {
|
||||||
errs = packer.MultiErrorAppend(errs, err)
|
errs = packer.MultiErrorAppend(errs, err)
|
||||||
|
|
|
@ -0,0 +1,125 @@
|
||||||
|
package arm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute"
|
||||||
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
|
"github.com/hashicorp/packer/packer"
|
||||||
|
)
|
||||||
|
|
||||||
|
type StepPublishToSharedImageGallery struct {
|
||||||
|
client *AzureClient
|
||||||
|
publish func(ctx context.Context, mdiID, miSigPubRg, miSIGalleryName, miSGImageName, miSGImageVersion string, miSigReplicationRegions []string, location string, tags map[string]*string) (string, error)
|
||||||
|
say func(message string)
|
||||||
|
error func(e error)
|
||||||
|
toSIG func() bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewStepPublishToSharedImageGallery(client *AzureClient, ui packer.Ui, config *Config) *StepPublishToSharedImageGallery {
|
||||||
|
var step = &StepPublishToSharedImageGallery{
|
||||||
|
client: client,
|
||||||
|
say: func(message string) {
|
||||||
|
ui.Say(message)
|
||||||
|
},
|
||||||
|
error: func(e error) {
|
||||||
|
ui.Error(e.Error())
|
||||||
|
},
|
||||||
|
toSIG: func() bool {
|
||||||
|
return config.isManagedImage() && config.SharedGalleryDestination.SigDestinationGalleryName != ""
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
step.publish = step.publishToSig
|
||||||
|
return step
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *StepPublishToSharedImageGallery) publishToSig(ctx context.Context, mdiID string, miSigPubRg string, miSIGalleryName string, miSGImageName string, miSGImageVersion string, miSigReplicationRegions []string, location string, tags map[string]*string) (string, error) {
|
||||||
|
|
||||||
|
replicationRegions := make([]compute.TargetRegion, len(miSigReplicationRegions))
|
||||||
|
for i, v := range miSigReplicationRegions {
|
||||||
|
regionName := v
|
||||||
|
replicationRegions[i] = compute.TargetRegion{Name: ®ionName}
|
||||||
|
}
|
||||||
|
|
||||||
|
galleryImageVersion := compute.GalleryImageVersion{
|
||||||
|
Location: &location,
|
||||||
|
Tags: tags,
|
||||||
|
GalleryImageVersionProperties: &compute.GalleryImageVersionProperties{
|
||||||
|
PublishingProfile: &compute.GalleryImageVersionPublishingProfile{
|
||||||
|
Source: &compute.GalleryArtifactSource{
|
||||||
|
ManagedImage: &compute.ManagedArtifact{
|
||||||
|
ID: &mdiID,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
TargetRegions: &replicationRegions,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
f, err := s.client.GalleryImageVersionsClient.CreateOrUpdate(ctx, miSigPubRg, miSIGalleryName, miSGImageName, miSGImageVersion, galleryImageVersion)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
s.say(s.client.LastError.Error())
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = f.WaitForCompletionRef(ctx, s.client.GalleryImageVersionsClient.Client)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
s.say(s.client.LastError.Error())
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
createdSGImageVersion, err := f.Result(s.client.GalleryImageVersionsClient)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
s.say(s.client.LastError.Error())
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
s.say(fmt.Sprintf(" -> Shared Gallery Image Version ID : '%s'", *(createdSGImageVersion.ID)))
|
||||||
|
return *(createdSGImageVersion.ID), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *StepPublishToSharedImageGallery) Run(ctx context.Context, stateBag multistep.StateBag) multistep.StepAction {
|
||||||
|
if !s.toSIG() {
|
||||||
|
return multistep.ActionContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
s.say("Publishing to Shared Image Gallery ...")
|
||||||
|
|
||||||
|
var miSigPubRg = stateBag.Get(constants.ArmManagedImageSigPublishResourceGroup).(string)
|
||||||
|
var miSIGalleryName = stateBag.Get(constants.ArmManagedImageSharedGalleryName).(string)
|
||||||
|
var miSGImageName = stateBag.Get(constants.ArmManagedImageSharedGalleryImageName).(string)
|
||||||
|
var miSGImageVersion = stateBag.Get(constants.ArmManagedImageSharedGalleryImageVersion).(string)
|
||||||
|
var location = stateBag.Get(constants.ArmLocation).(string)
|
||||||
|
var tags = stateBag.Get(constants.ArmTags).(map[string]*string)
|
||||||
|
var miSigReplicationRegions = stateBag.Get(constants.ArmManagedImageSharedGalleryReplicationRegions).([]string)
|
||||||
|
var targetManagedImageResourceGroupName = stateBag.Get(constants.ArmManagedImageResourceGroupName).(string)
|
||||||
|
var targetManagedImageName = stateBag.Get(constants.ArmManagedImageName).(string)
|
||||||
|
var managedImageSubscription = stateBag.Get(constants.ArmManagedImageSubscription).(string)
|
||||||
|
var mdiID = fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/images/%s", managedImageSubscription, targetManagedImageResourceGroupName, targetManagedImageName)
|
||||||
|
|
||||||
|
s.say(fmt.Sprintf(" -> MDI ID used for SIG publish : '%s'", mdiID))
|
||||||
|
s.say(fmt.Sprintf(" -> SIG publish resource group : '%s'", miSigPubRg))
|
||||||
|
s.say(fmt.Sprintf(" -> SIG gallery name : '%s'", miSIGalleryName))
|
||||||
|
s.say(fmt.Sprintf(" -> SIG image name : '%s'", miSGImageName))
|
||||||
|
s.say(fmt.Sprintf(" -> SIG image version : '%s'", miSGImageVersion))
|
||||||
|
s.say(fmt.Sprintf(" -> SIG replication regions : '%v'", miSigReplicationRegions))
|
||||||
|
createdGalleryImageVersionID, err := s.publish(ctx, mdiID, miSigPubRg, miSIGalleryName, miSGImageName, miSGImageVersion, miSigReplicationRegions, location, tags)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
stateBag.Put(constants.Error, err)
|
||||||
|
s.error(err)
|
||||||
|
|
||||||
|
return multistep.ActionHalt
|
||||||
|
}
|
||||||
|
|
||||||
|
stateBag.Put(constants.ArmManagedImageSharedGalleryId, createdGalleryImageVersionID)
|
||||||
|
return multistep.ActionContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*StepPublishToSharedImageGallery) Cleanup(multistep.StateBag) {
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
package arm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestStepPublishToSharedImageGalleryShouldNotPublishForVhd(t *testing.T) {
|
||||||
|
var testSubject = &StepPublishToSharedImageGallery{
|
||||||
|
publish: func(context.Context, string, string, string, string, string, []string, string, map[string]*string) (string, error) {
|
||||||
|
return "test", nil
|
||||||
|
},
|
||||||
|
say: func(message string) {},
|
||||||
|
error: func(e error) {},
|
||||||
|
toSIG: func() bool { return false },
|
||||||
|
}
|
||||||
|
|
||||||
|
stateBag := createTestStateBagStepPublishToSharedImageGalleryForVhd()
|
||||||
|
var result = testSubject.Run(context.Background(), stateBag)
|
||||||
|
if result != multistep.ActionContinue {
|
||||||
|
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, ok := stateBag.GetOk(constants.Error); ok == true {
|
||||||
|
t.Fatalf("Expected the step to not set stateBag['%s'], but it was.", constants.Error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStepPublishToSharedImageGalleryShouldPublishForManagedImageWithSig(t *testing.T) {
|
||||||
|
var testSubject = &StepPublishToSharedImageGallery{
|
||||||
|
publish: func(context.Context, string, string, string, string, string, []string, string, map[string]*string) (string, error) {
|
||||||
|
return "", nil
|
||||||
|
},
|
||||||
|
say: func(message string) {},
|
||||||
|
error: func(e error) {},
|
||||||
|
toSIG: func() bool { return true },
|
||||||
|
}
|
||||||
|
|
||||||
|
stateBag := createTestStateBagStepPublishToSharedImageGallery()
|
||||||
|
var result = testSubject.Run(context.Background(), stateBag)
|
||||||
|
if result != multistep.ActionContinue {
|
||||||
|
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, ok := stateBag.GetOk(constants.Error); ok == true {
|
||||||
|
t.Fatalf("Expected the step to not set stateBag['%s'], but it was.", constants.Error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func createTestStateBagStepPublishToSharedImageGallery() multistep.StateBag {
|
||||||
|
stateBag := new(multistep.BasicStateBag)
|
||||||
|
|
||||||
|
stateBag.Put(constants.ArmManagedImageSigPublishResourceGroup, "Unit Test: ManagedImageSigPublishResourceGroup")
|
||||||
|
stateBag.Put(constants.ArmManagedImageSharedGalleryName, "Unit Test: ManagedImageSharedGalleryName")
|
||||||
|
stateBag.Put(constants.ArmManagedImageSharedGalleryImageName, "Unit Test: ManagedImageSharedGalleryImageName")
|
||||||
|
stateBag.Put(constants.ArmManagedImageSharedGalleryImageVersion, "Unit Test: ManagedImageSharedGalleryImageVersion")
|
||||||
|
stateBag.Put(constants.ArmLocation, "Unit Test: Location")
|
||||||
|
value := "Unit Test: Tags"
|
||||||
|
tags := map[string]*string{
|
||||||
|
"tag01": &value,
|
||||||
|
}
|
||||||
|
stateBag.Put(constants.ArmTags, tags)
|
||||||
|
stateBag.Put(constants.ArmManagedImageSharedGalleryReplicationRegions, []string{"ManagedImageSharedGalleryReplicationRegionA", "ManagedImageSharedGalleryReplicationRegionB"})
|
||||||
|
stateBag.Put(constants.ArmManagedImageResourceGroupName, "Unit Test: ManagedImageResourceGroupName")
|
||||||
|
stateBag.Put(constants.ArmManagedImageName, "Unit Test: ManagedImageName")
|
||||||
|
stateBag.Put(constants.ArmManagedImageSubscription, "Unit Test: ManagedImageSubscription")
|
||||||
|
|
||||||
|
return stateBag
|
||||||
|
}
|
||||||
|
|
||||||
|
func createTestStateBagStepPublishToSharedImageGalleryForVhd() multistep.StateBag {
|
||||||
|
stateBag := new(multistep.BasicStateBag)
|
||||||
|
|
||||||
|
stateBag.Put(constants.ArmLocation, "Unit Test: Location")
|
||||||
|
value := "Unit Test: Tags"
|
||||||
|
tags := map[string]*string{
|
||||||
|
"tag01": &value,
|
||||||
|
}
|
||||||
|
stateBag.Put(constants.ArmTags, tags)
|
||||||
|
|
||||||
|
return stateBag
|
||||||
|
}
|
|
@ -30,11 +30,18 @@ const (
|
||||||
ArmVirtualMachineCaptureParameters string = "arm.VirtualMachineCaptureParameters"
|
ArmVirtualMachineCaptureParameters string = "arm.VirtualMachineCaptureParameters"
|
||||||
ArmIsExistingResourceGroup string = "arm.IsExistingResourceGroup"
|
ArmIsExistingResourceGroup string = "arm.IsExistingResourceGroup"
|
||||||
|
|
||||||
ArmIsManagedImage string = "arm.IsManagedImage"
|
ArmIsManagedImage string = "arm.IsManagedImage"
|
||||||
ArmManagedImageResourceGroupName string = "arm.ManagedImageResourceGroupName"
|
ArmManagedImageResourceGroupName string = "arm.ManagedImageResourceGroupName"
|
||||||
ArmManagedImageLocation string = "arm.ManagedImageLocation"
|
ArmManagedImageLocation string = "arm.ManagedImageLocation"
|
||||||
ArmManagedImageName string = "arm.ManagedImageName"
|
ArmManagedImageName string = "arm.ManagedImageName"
|
||||||
ArmAsyncResourceGroupDelete string = "arm.AsyncResourceGroupDelete"
|
ArmManagedImageSigPublishResourceGroup string = "arm.ManagedImageSigPublishResourceGroup"
|
||||||
ArmManagedImageOSDiskSnapshotName string = "arm.ManagedImageOSDiskSnapshotName"
|
ArmManagedImageSharedGalleryName string = "arm.ManagedImageSharedGalleryName"
|
||||||
ArmManagedImageDataDiskSnapshotPrefix string = "arm.ManagedImageDataDiskSnapshotPrefix"
|
ArmManagedImageSharedGalleryImageName string = "arm.ManagedImageSharedGalleryImageName"
|
||||||
|
ArmManagedImageSharedGalleryImageVersion string = "arm.ManagedImageSharedGalleryImageVersion"
|
||||||
|
ArmManagedImageSharedGalleryReplicationRegions string = "arm.ManagedImageSharedGalleryReplicationRegions"
|
||||||
|
ArmManagedImageSharedGalleryId string = "arm.ArmManagedImageSharedGalleryId"
|
||||||
|
ArmManagedImageSubscription string = "arm.ArmManagedImageSubscription"
|
||||||
|
ArmAsyncResourceGroupDelete string = "arm.AsyncResourceGroupDelete"
|
||||||
|
ArmManagedImageOSDiskSnapshotName string = "arm.ManagedImageOSDiskSnapshotName"
|
||||||
|
ArmManagedImageDataDiskSnapshotPrefix string = "arm.ManagedImageDataDiskSnapshotPrefix"
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
{
|
||||||
|
"variables": {
|
||||||
|
"client_id": "{{env `ARM_CLIENT_ID`}}",
|
||||||
|
"client_secret": "{{env `ARM_CLIENT_SECRET`}}",
|
||||||
|
"subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}",
|
||||||
|
"tenant_id": "{{env `ARM_TENANT_ID`}}"
|
||||||
|
},
|
||||||
|
"builders": [{
|
||||||
|
"type": "azure-arm",
|
||||||
|
|
||||||
|
"client_id": "{{user `client_id`}}",
|
||||||
|
"client_secret": "{{user `client_secret`}}",
|
||||||
|
"tenant_id": "{{user `tenant_id`}}",
|
||||||
|
"subscription_id": "{{user `subscription_id`}}",
|
||||||
|
|
||||||
|
"os_type": "Linux",
|
||||||
|
"image_publisher": "Canonical",
|
||||||
|
"image_offer": "UbuntuServer",
|
||||||
|
"image_sku": "16.04-LTS",
|
||||||
|
|
||||||
|
"location": "West Central US",
|
||||||
|
"vm_size": "Standard_DS2_v2",
|
||||||
|
|
||||||
|
"managed_image_resource_group_name": "PackerSigRGManagedImageRG",
|
||||||
|
"managed_image_name": "demo-image-sig-packer",
|
||||||
|
"shared_image_gallery_destination": {
|
||||||
|
"resource_group": "PackerSigPublishRG",
|
||||||
|
"gallery_name": "PackerSigGallery",
|
||||||
|
"image_name": "PackerSigImageDefinition",
|
||||||
|
"image_version": "1.0.0",
|
||||||
|
"replication_regions": ["South Central US"]
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
"provisioners": [{
|
||||||
|
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
|
||||||
|
"inline": [
|
||||||
|
"apt-get update",
|
||||||
|
"apt-get upgrade -y",
|
||||||
|
|
||||||
|
"/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"
|
||||||
|
],
|
||||||
|
"inline_shebang": "/bin/sh -x",
|
||||||
|
"type": "shell"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
655
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/availabilitysets.go
generated
vendored
Normal file
655
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/availabilitysets.go
generated
vendored
Normal file
|
@ -0,0 +1,655 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AvailabilitySetsClient is the compute Client
|
||||||
|
type AvailabilitySetsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAvailabilitySetsClient creates an instance of the AvailabilitySetsClient client.
|
||||||
|
func NewAvailabilitySetsClient(subscriptionID string) AvailabilitySetsClient {
|
||||||
|
return NewAvailabilitySetsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAvailabilitySetsClientWithBaseURI creates an instance of the AvailabilitySetsClient client.
|
||||||
|
func NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string) AvailabilitySetsClient {
|
||||||
|
return AvailabilitySetsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate create or update an availability set.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// availabilitySetName - the name of the availability set.
|
||||||
|
// parameters - parameters supplied to the Create Availability Set operation.
|
||||||
|
func (client AvailabilitySetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySet) (result AvailabilitySet, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.CreateOrUpdate")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, availabilitySetName, parameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client AvailabilitySetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySet) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client AvailabilitySetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client AvailabilitySetsClient) CreateOrUpdateResponder(resp *http.Response) (result AvailabilitySet, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete delete an availability set.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// availabilitySetName - the name of the availability set.
|
||||||
|
func (client AvailabilitySetsClient) Delete(ctx context.Context, resourceGroupName string, availabilitySetName string) (result autorest.Response, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.Delete")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response != nil {
|
||||||
|
sc = result.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, availabilitySetName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = resp
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client AvailabilitySetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, availabilitySetName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client AvailabilitySetsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client AvailabilitySetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get retrieves information about an availability set.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// availabilitySetName - the name of the availability set.
|
||||||
|
func (client AvailabilitySetsClient) Get(ctx context.Context, resourceGroupName string, availabilitySetName string) (result AvailabilitySet, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.Get")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, availabilitySetName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client AvailabilitySetsClient) GetPreparer(ctx context.Context, resourceGroupName string, availabilitySetName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client AvailabilitySetsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client AvailabilitySetsClient) GetResponder(resp *http.Response) (result AvailabilitySet, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List lists all availability sets in a resource group.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
func (client AvailabilitySetsClient) List(ctx context.Context, resourceGroupName string) (result AvailabilitySetListResultPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.aslr.Response.Response != nil {
|
||||||
|
sc = result.aslr.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx, resourceGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.aslr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.aslr, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client AvailabilitySetsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client AvailabilitySetsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client AvailabilitySetsClient) ListResponder(resp *http.Response) (result AvailabilitySetListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listNextResults retrieves the next set of results, if any.
|
||||||
|
func (client AvailabilitySetsClient) listNextResults(ctx context.Context, lastResults AvailabilitySetListResult) (result AvailabilitySetListResult, err error) {
|
||||||
|
req, err := lastResults.availabilitySetListResultPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client AvailabilitySetsClient) ListComplete(ctx context.Context, resourceGroupName string) (result AvailabilitySetListResultIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.List(ctx, resourceGroupName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListAvailableSizes lists all available virtual machine sizes that can be used to create a new virtual machine in an
|
||||||
|
// existing availability set.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// availabilitySetName - the name of the availability set.
|
||||||
|
func (client AvailabilitySetsClient) ListAvailableSizes(ctx context.Context, resourceGroupName string, availabilitySetName string) (result VirtualMachineSizeListResult, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.ListAvailableSizes")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.ListAvailableSizesPreparer(ctx, resourceGroupName, availabilitySetName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListAvailableSizesSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ListAvailableSizesResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListAvailableSizesPreparer prepares the ListAvailableSizes request.
|
||||||
|
func (client AvailabilitySetsClient) ListAvailableSizesPreparer(ctx context.Context, resourceGroupName string, availabilitySetName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client AvailabilitySetsClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client AvailabilitySetsClient) ListAvailableSizesResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListBySubscription lists all availability sets in a subscription.
|
||||||
|
func (client AvailabilitySetsClient) ListBySubscription(ctx context.Context) (result AvailabilitySetListResultPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.ListBySubscription")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.aslr.Response.Response != nil {
|
||||||
|
sc = result.aslr.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listBySubscriptionNextResults
|
||||||
|
req, err := client.ListBySubscriptionPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListBySubscription", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListBySubscriptionSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.aslr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListBySubscription", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.aslr, err = client.ListBySubscriptionResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListBySubscription", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListBySubscriptionPreparer prepares the ListBySubscription request.
|
||||||
|
func (client AvailabilitySetsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListBySubscriptionSender sends the ListBySubscription request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client AvailabilitySetsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client AvailabilitySetsClient) ListBySubscriptionResponder(resp *http.Response) (result AvailabilitySetListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listBySubscriptionNextResults retrieves the next set of results, if any.
|
||||||
|
func (client AvailabilitySetsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AvailabilitySetListResult) (result AvailabilitySetListResult, err error) {
|
||||||
|
req, err := lastResults.availabilitySetListResultPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListBySubscriptionSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListBySubscriptionResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client AvailabilitySetsClient) ListBySubscriptionComplete(ctx context.Context) (result AvailabilitySetListResultIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.ListBySubscription")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.ListBySubscription(ctx)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update update an availability set.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// availabilitySetName - the name of the availability set.
|
||||||
|
// parameters - parameters supplied to the Update Availability Set operation.
|
||||||
|
func (client AvailabilitySetsClient) Update(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate) (result AvailabilitySet, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetsClient.Update")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.UpdatePreparer(ctx, resourceGroupName, availabilitySetName, parameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Update", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.UpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Update", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.UpdateResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Update", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatePreparer prepares the Update request.
|
||||||
|
func (client AvailabilitySetsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPatch(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateSender sends the Update request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client AvailabilitySetsClient) UpdateSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateResponder handles the response to the Update request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client AvailabilitySetsClient) UpdateResponder(resp *http.Response) (result AvailabilitySet, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
51
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/client.go
generated
vendored
Normal file
51
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/client.go
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
// Package compute implements the Azure ARM Compute service API version .
|
||||||
|
//
|
||||||
|
// Compute Client
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// DefaultBaseURI is the default URI used for the service Compute
|
||||||
|
DefaultBaseURI = "https://management.azure.com"
|
||||||
|
)
|
||||||
|
|
||||||
|
// BaseClient is the base client for Compute.
|
||||||
|
type BaseClient struct {
|
||||||
|
autorest.Client
|
||||||
|
BaseURI string
|
||||||
|
SubscriptionID string
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates an instance of the BaseClient client.
|
||||||
|
func New(subscriptionID string) BaseClient {
|
||||||
|
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewWithBaseURI creates an instance of the BaseClient client.
|
||||||
|
func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient {
|
||||||
|
return BaseClient{
|
||||||
|
Client: autorest.NewClientWithUserAgent(UserAgent()),
|
||||||
|
BaseURI: baseURI,
|
||||||
|
SubscriptionID: subscriptionID,
|
||||||
|
}
|
||||||
|
}
|
538
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/containerservices.go
generated
vendored
Normal file
538
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/containerservices.go
generated
vendored
Normal file
|
@ -0,0 +1,538 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ContainerServicesClient is the compute Client
|
||||||
|
type ContainerServicesClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewContainerServicesClient creates an instance of the ContainerServicesClient client.
|
||||||
|
func NewContainerServicesClient(subscriptionID string) ContainerServicesClient {
|
||||||
|
return NewContainerServicesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewContainerServicesClientWithBaseURI creates an instance of the ContainerServicesClient client.
|
||||||
|
func NewContainerServicesClientWithBaseURI(baseURI string, subscriptionID string) ContainerServicesClient {
|
||||||
|
return ContainerServicesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate creates or updates a container service with the specified configuration of orchestrator, masters, and
|
||||||
|
// agents.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// containerServiceName - the name of the container service in the specified subscription and resource group.
|
||||||
|
// parameters - parameters supplied to the Create or Update a Container Service operation.
|
||||||
|
func (client ContainerServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, containerServiceName string, parameters ContainerService) (result ContainerServicesCreateOrUpdateFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.CreateOrUpdate")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: parameters,
|
||||||
|
Constraints: []validation.Constraint{{Target: "parameters.ContainerServiceProperties", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.CustomProfile", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.CustomProfile.Orchestrator", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.ServicePrincipalProfile", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.ServicePrincipalProfile.ClientID", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.ServicePrincipalProfile.Secret", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
}},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.MasterProfile", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.MasterProfile.DNSPrefix", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.AgentPoolProfiles", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.WindowsProfile", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.WindowsProfile.AdminUsername", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.WindowsProfile.AdminUsername", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$`, Chain: nil}}},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.WindowsProfile.AdminPassword", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
}},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.LinuxProfile", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.LinuxProfile.AdminUsername", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.LinuxProfile.AdminUsername", Name: validation.Pattern, Rule: `^[a-z][a-z0-9_-]*$`, Chain: nil}}},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.LinuxProfile.SSH", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.LinuxProfile.SSH.PublicKeys", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||||
|
}},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.DiagnosticsProfile", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.DiagnosticsProfile.VMDiagnostics", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.DiagnosticsProfile.VMDiagnostics.Enabled", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||||
|
}},
|
||||||
|
}}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.ContainerServicesClient", "CreateOrUpdate", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, containerServiceName, parameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client ContainerServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, containerServiceName string, parameters ContainerService) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"containerServiceName": autorest.Encode("path", containerServiceName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-01-31"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ContainerServicesClient) CreateOrUpdateSender(req *http.Request) (future ContainerServicesCreateOrUpdateFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ContainerServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ContainerService, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete deletes the specified container service in the specified subscription and resource group. The operation does
|
||||||
|
// not delete other resources created as part of creating a container service, including storage accounts, VMs, and
|
||||||
|
// availability sets. All the other resources created with the container service are part of the same resource group
|
||||||
|
// and can be deleted individually.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// containerServiceName - the name of the container service in the specified subscription and resource group.
|
||||||
|
func (client ContainerServicesClient) Delete(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerServicesDeleteFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.Delete")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, containerServiceName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client ContainerServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, containerServiceName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"containerServiceName": autorest.Encode("path", containerServiceName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-01-31"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ContainerServicesClient) DeleteSender(req *http.Request) (future ContainerServicesDeleteFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ContainerServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets the properties of the specified container service in the specified subscription and resource group. The
|
||||||
|
// operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters
|
||||||
|
// and agents.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// containerServiceName - the name of the container service in the specified subscription and resource group.
|
||||||
|
func (client ContainerServicesClient) Get(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerService, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.Get")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, containerServiceName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client ContainerServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, containerServiceName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"containerServiceName": autorest.Encode("path", containerServiceName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-01-31"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ContainerServicesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ContainerServicesClient) GetResponder(resp *http.Response) (result ContainerService, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets a list of container services in the specified subscription. The operation returns properties of each
|
||||||
|
// container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents.
|
||||||
|
func (client ContainerServicesClient) List(ctx context.Context) (result ContainerServiceListResultPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.cslr.Response.Response != nil {
|
||||||
|
sc = result.cslr.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.cslr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.cslr, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client ContainerServicesClient) ListPreparer(ctx context.Context) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-01-31"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ContainerServicesClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ContainerServicesClient) ListResponder(resp *http.Response) (result ContainerServiceListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listNextResults retrieves the next set of results, if any.
|
||||||
|
func (client ContainerServicesClient) listNextResults(ctx context.Context, lastResults ContainerServiceListResult) (result ContainerServiceListResult, err error) {
|
||||||
|
req, err := lastResults.containerServiceListResultPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ContainerServicesClient) ListComplete(ctx context.Context) (result ContainerServiceListResultIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.List(ctx)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroup gets a list of container services in the specified subscription and resource group. The
|
||||||
|
// operation returns properties of each container service including state, orchestrator, number of masters and agents,
|
||||||
|
// and FQDNs of masters and agents.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
func (client ContainerServicesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ContainerServiceListResultPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.ListByResourceGroup")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.cslr.Response.Response != nil {
|
||||||
|
sc = result.cslr.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listByResourceGroupNextResults
|
||||||
|
req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.cslr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.cslr, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||||
|
func (client ContainerServicesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-01-31"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ContainerServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ContainerServicesClient) ListByResourceGroupResponder(resp *http.Response) (result ContainerServiceListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listByResourceGroupNextResults retrieves the next set of results, if any.
|
||||||
|
func (client ContainerServicesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ContainerServiceListResult) (result ContainerServiceListResult, err error) {
|
||||||
|
req, err := lastResults.containerServiceListResultPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ContainerServicesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ContainerServiceListResultIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.ListByResourceGroup")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
|
||||||
|
return
|
||||||
|
}
|
766
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/disks.go
generated
vendored
Normal file
766
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/disks.go
generated
vendored
Normal file
|
@ -0,0 +1,766 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DisksClient is the compute Client
|
||||||
|
type DisksClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDisksClient creates an instance of the DisksClient client.
|
||||||
|
func NewDisksClient(subscriptionID string) DisksClient {
|
||||||
|
return NewDisksClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDisksClientWithBaseURI creates an instance of the DisksClient client.
|
||||||
|
func NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClient {
|
||||||
|
return DisksClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate creates or updates a disk.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// diskName - the name of the managed disk that is being created. The name can't be changed after the disk is
|
||||||
|
// created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80
|
||||||
|
// characters.
|
||||||
|
// disk - disk object supplied in the body of the Put disk operation.
|
||||||
|
func (client DisksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk Disk) (result DisksCreateOrUpdateFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.CreateOrUpdate")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: disk,
|
||||||
|
Constraints: []validation.Constraint{{Target: "disk.DiskProperties", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "disk.DiskProperties.CreationData", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "disk.DiskProperties.CreationData.ImageReference", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "disk.DiskProperties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||||
|
}},
|
||||||
|
{Target: "disk.DiskProperties.EncryptionSettingsCollection", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "disk.DiskProperties.EncryptionSettingsCollection.Enabled", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||||
|
}}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.DisksClient", "CreateOrUpdate", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, diskName, disk)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client DisksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, diskName string, disk Disk) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"diskName": autorest.Encode("path", diskName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
disk.ManagedBy = nil
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters),
|
||||||
|
autorest.WithJSON(disk),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) CreateOrUpdateSender(req *http.Request) (future DisksCreateOrUpdateFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client DisksClient) CreateOrUpdateResponder(resp *http.Response) (result Disk, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete deletes a disk.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// diskName - the name of the managed disk that is being created. The name can't be changed after the disk is
|
||||||
|
// created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80
|
||||||
|
// characters.
|
||||||
|
func (client DisksClient) Delete(ctx context.Context, resourceGroupName string, diskName string) (result DisksDeleteFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.Delete")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, diskName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client DisksClient) DeletePreparer(ctx context.Context, resourceGroupName string, diskName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"diskName": autorest.Encode("path", diskName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) DeleteSender(req *http.Request) (future DisksDeleteFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client DisksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets information about a disk.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// diskName - the name of the managed disk that is being created. The name can't be changed after the disk is
|
||||||
|
// created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80
|
||||||
|
// characters.
|
||||||
|
func (client DisksClient) Get(ctx context.Context, resourceGroupName string, diskName string) (result Disk, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.Get")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, diskName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client DisksClient) GetPreparer(ctx context.Context, resourceGroupName string, diskName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"diskName": autorest.Encode("path", diskName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client DisksClient) GetResponder(resp *http.Response) (result Disk, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantAccess grants access to a disk.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// diskName - the name of the managed disk that is being created. The name can't be changed after the disk is
|
||||||
|
// created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80
|
||||||
|
// characters.
|
||||||
|
// grantAccessData - access data object supplied in the body of the get disk access operation.
|
||||||
|
func (client DisksClient) GrantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData) (result DisksGrantAccessFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.GrantAccess")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: grantAccessData,
|
||||||
|
Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.DisksClient", "GrantAccess", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.GrantAccessPreparer(ctx, resourceGroupName, diskName, grantAccessData)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "GrantAccess", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GrantAccessSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "GrantAccess", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantAccessPreparer prepares the GrantAccess request.
|
||||||
|
func (client DisksClient) GrantAccessPreparer(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"diskName": autorest.Encode("path", diskName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", pathParameters),
|
||||||
|
autorest.WithJSON(grantAccessData),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantAccessSender sends the GrantAccess request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) GrantAccessSender(req *http.Request) (future DisksGrantAccessFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantAccessResponder handles the response to the GrantAccess request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client DisksClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List lists all the disks under a subscription.
|
||||||
|
func (client DisksClient) List(ctx context.Context) (result DiskListPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.dl.Response.Response != nil {
|
||||||
|
sc = result.dl.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.dl.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.dl, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client DisksClient) ListPreparer(ctx context.Context) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client DisksClient) ListResponder(resp *http.Response) (result DiskList, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listNextResults retrieves the next set of results, if any.
|
||||||
|
func (client DisksClient) listNextResults(ctx context.Context, lastResults DiskList) (result DiskList, err error) {
|
||||||
|
req, err := lastResults.diskListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client DisksClient) ListComplete(ctx context.Context) (result DiskListIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.List(ctx)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroup lists all the disks under a resource group.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
func (client DisksClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DiskListPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.ListByResourceGroup")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.dl.Response.Response != nil {
|
||||||
|
sc = result.dl.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listByResourceGroupNextResults
|
||||||
|
req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.dl.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.dl, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||||
|
func (client DisksClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client DisksClient) ListByResourceGroupResponder(resp *http.Response) (result DiskList, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listByResourceGroupNextResults retrieves the next set of results, if any.
|
||||||
|
func (client DisksClient) listByResourceGroupNextResults(ctx context.Context, lastResults DiskList) (result DiskList, err error) {
|
||||||
|
req, err := lastResults.diskListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client DisksClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DiskListIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.ListByResourceGroup")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokeAccess revokes access to a disk.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// diskName - the name of the managed disk that is being created. The name can't be changed after the disk is
|
||||||
|
// created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80
|
||||||
|
// characters.
|
||||||
|
func (client DisksClient) RevokeAccess(ctx context.Context, resourceGroupName string, diskName string) (result DisksRevokeAccessFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.RevokeAccess")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, diskName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "RevokeAccess", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.RevokeAccessSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "RevokeAccess", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokeAccessPreparer prepares the RevokeAccess request.
|
||||||
|
func (client DisksClient) RevokeAccessPreparer(ctx context.Context, resourceGroupName string, diskName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"diskName": autorest.Encode("path", diskName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokeAccessSender sends the RevokeAccess request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) RevokeAccessSender(req *http.Request) (future DisksRevokeAccessFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokeAccessResponder handles the response to the RevokeAccess request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client DisksClient) RevokeAccessResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update updates (patches) a disk.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// diskName - the name of the managed disk that is being created. The name can't be changed after the disk is
|
||||||
|
// created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80
|
||||||
|
// characters.
|
||||||
|
// disk - disk object supplied in the body of the Patch disk operation.
|
||||||
|
func (client DisksClient) Update(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate) (result DisksUpdateFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.Update")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.UpdatePreparer(ctx, resourceGroupName, diskName, disk)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "Update", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.UpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "Update", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatePreparer prepares the Update request.
|
||||||
|
func (client DisksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"diskName": autorest.Encode("path", diskName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPatch(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters),
|
||||||
|
autorest.WithJSON(disk),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateSender sends the Update request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) UpdateSender(req *http.Request) (future DisksUpdateFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateResponder handles the response to the Update request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client DisksClient) UpdateResponder(resp *http.Response) (result Disk, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
498
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/galleries.go
generated
vendored
Normal file
498
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/galleries.go
generated
vendored
Normal file
|
@ -0,0 +1,498 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GalleriesClient is the compute Client
|
||||||
|
type GalleriesClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGalleriesClient creates an instance of the GalleriesClient client.
|
||||||
|
func NewGalleriesClient(subscriptionID string) GalleriesClient {
|
||||||
|
return NewGalleriesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGalleriesClientWithBaseURI creates an instance of the GalleriesClient client.
|
||||||
|
func NewGalleriesClientWithBaseURI(baseURI string, subscriptionID string) GalleriesClient {
|
||||||
|
return GalleriesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate create or update a Shared Image Gallery.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// galleryName - the name of the Shared Image Gallery. The allowed characters are alphabets and numbers with
|
||||||
|
// dots and periods allowed in the middle. The maximum length is 80 characters.
|
||||||
|
// gallery - parameters supplied to the create or update Shared Image Gallery operation.
|
||||||
|
func (client GalleriesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery) (result GalleriesCreateOrUpdateFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleriesClient.CreateOrUpdate")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, galleryName, gallery)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client GalleriesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"galleryName": autorest.Encode("path", galleryName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", pathParameters),
|
||||||
|
autorest.WithJSON(gallery),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client GalleriesClient) CreateOrUpdateSender(req *http.Request) (future GalleriesCreateOrUpdateFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client GalleriesClient) CreateOrUpdateResponder(resp *http.Response) (result Gallery, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete delete a Shared Image Gallery.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// galleryName - the name of the Shared Image Gallery to be deleted.
|
||||||
|
func (client GalleriesClient) Delete(ctx context.Context, resourceGroupName string, galleryName string) (result GalleriesDeleteFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleriesClient.Delete")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, galleryName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client GalleriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, galleryName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"galleryName": autorest.Encode("path", galleryName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client GalleriesClient) DeleteSender(req *http.Request) (future GalleriesDeleteFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client GalleriesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get retrieves information about a Shared Image Gallery.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// galleryName - the name of the Shared Image Gallery.
|
||||||
|
func (client GalleriesClient) Get(ctx context.Context, resourceGroupName string, galleryName string) (result Gallery, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleriesClient.Get")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, galleryName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client GalleriesClient) GetPreparer(ctx context.Context, resourceGroupName string, galleryName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"galleryName": autorest.Encode("path", galleryName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client GalleriesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client GalleriesClient) GetResponder(resp *http.Response) (result Gallery, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List list galleries under a subscription.
|
||||||
|
func (client GalleriesClient) List(ctx context.Context) (result GalleryListPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleriesClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.gl.Response.Response != nil {
|
||||||
|
sc = result.gl.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.gl.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.gl, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client GalleriesClient) ListPreparer(ctx context.Context) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client GalleriesClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client GalleriesClient) ListResponder(resp *http.Response) (result GalleryList, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listNextResults retrieves the next set of results, if any.
|
||||||
|
func (client GalleriesClient) listNextResults(ctx context.Context, lastResults GalleryList) (result GalleryList, err error) {
|
||||||
|
req, err := lastResults.galleryListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.GalleriesClient", "listNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.GalleriesClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client GalleriesClient) ListComplete(ctx context.Context) (result GalleryListIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleriesClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.List(ctx)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroup list galleries under a resource group.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
func (client GalleriesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result GalleryListPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleriesClient.ListByResourceGroup")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.gl.Response.Response != nil {
|
||||||
|
sc = result.gl.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listByResourceGroupNextResults
|
||||||
|
req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.gl.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.gl, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||||
|
func (client GalleriesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client GalleriesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client GalleriesClient) ListByResourceGroupResponder(resp *http.Response) (result GalleryList, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listByResourceGroupNextResults retrieves the next set of results, if any.
|
||||||
|
func (client GalleriesClient) listByResourceGroupNextResults(ctx context.Context, lastResults GalleryList) (result GalleryList, err error) {
|
||||||
|
req, err := lastResults.galleryListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.GalleriesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.GalleriesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client GalleriesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result GalleryListIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleriesClient.ListByResourceGroup")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
|
||||||
|
return
|
||||||
|
}
|
410
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/galleryimages.go
generated
vendored
Normal file
410
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/galleryimages.go
generated
vendored
Normal file
|
@ -0,0 +1,410 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GalleryImagesClient is the compute Client
|
||||||
|
type GalleryImagesClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGalleryImagesClient creates an instance of the GalleryImagesClient client.
|
||||||
|
func NewGalleryImagesClient(subscriptionID string) GalleryImagesClient {
|
||||||
|
return NewGalleryImagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGalleryImagesClientWithBaseURI creates an instance of the GalleryImagesClient client.
|
||||||
|
func NewGalleryImagesClientWithBaseURI(baseURI string, subscriptionID string) GalleryImagesClient {
|
||||||
|
return GalleryImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate create or update a gallery Image Definition.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// galleryName - the name of the Shared Image Gallery in which the Image Definition is to be created.
|
||||||
|
// galleryImageName - the name of the gallery Image Definition to be created or updated. The allowed characters
|
||||||
|
// are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80
|
||||||
|
// characters.
|
||||||
|
// galleryImage - parameters supplied to the create or update gallery image operation.
|
||||||
|
func (client GalleryImagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage) (result GalleryImagesCreateOrUpdateFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.CreateOrUpdate")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: galleryImage,
|
||||||
|
Constraints: []validation.Constraint{{Target: "galleryImage.GalleryImageProperties", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "galleryImage.GalleryImageProperties.Identifier", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "galleryImage.GalleryImageProperties.Identifier.Publisher", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
{Target: "galleryImage.GalleryImageProperties.Identifier.Offer", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
{Target: "galleryImage.GalleryImageProperties.Identifier.Sku", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
}},
|
||||||
|
}}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.GalleryImagesClient", "CreateOrUpdate", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, galleryName, galleryImageName, galleryImage)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client GalleryImagesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"galleryImageName": autorest.Encode("path", galleryImageName),
|
||||||
|
"galleryName": autorest.Encode("path", galleryName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", pathParameters),
|
||||||
|
autorest.WithJSON(galleryImage),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client GalleryImagesClient) CreateOrUpdateSender(req *http.Request) (future GalleryImagesCreateOrUpdateFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client GalleryImagesClient) CreateOrUpdateResponder(resp *http.Response) (result GalleryImage, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete delete a gallery image.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// galleryName - the name of the Shared Image Gallery in which the Image Definition is to be deleted.
|
||||||
|
// galleryImageName - the name of the gallery Image Definition to be deleted.
|
||||||
|
func (client GalleryImagesClient) Delete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (result GalleryImagesDeleteFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.Delete")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, galleryName, galleryImageName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client GalleryImagesClient) DeletePreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"galleryImageName": autorest.Encode("path", galleryImageName),
|
||||||
|
"galleryName": autorest.Encode("path", galleryName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client GalleryImagesClient) DeleteSender(req *http.Request) (future GalleryImagesDeleteFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client GalleryImagesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get retrieves information about a gallery Image Definition.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// galleryName - the name of the Shared Image Gallery from which the Image Definitions are to be retrieved.
|
||||||
|
// galleryImageName - the name of the gallery Image Definition to be retrieved.
|
||||||
|
func (client GalleryImagesClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (result GalleryImage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.Get")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, galleryName, galleryImageName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client GalleryImagesClient) GetPreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"galleryImageName": autorest.Encode("path", galleryImageName),
|
||||||
|
"galleryName": autorest.Encode("path", galleryName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client GalleryImagesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client GalleryImagesClient) GetResponder(resp *http.Response) (result GalleryImage, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByGallery list gallery Image Definitions in a gallery.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// galleryName - the name of the Shared Image Gallery from which Image Definitions are to be listed.
|
||||||
|
func (client GalleryImagesClient) ListByGallery(ctx context.Context, resourceGroupName string, galleryName string) (result GalleryImageListPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.ListByGallery")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.gil.Response.Response != nil {
|
||||||
|
sc = result.gil.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listByGalleryNextResults
|
||||||
|
req, err := client.ListByGalleryPreparer(ctx, resourceGroupName, galleryName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "ListByGallery", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListByGallerySender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.gil.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "ListByGallery", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.gil, err = client.ListByGalleryResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "ListByGallery", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByGalleryPreparer prepares the ListByGallery request.
|
||||||
|
func (client GalleryImagesClient) ListByGalleryPreparer(ctx context.Context, resourceGroupName string, galleryName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"galleryName": autorest.Encode("path", galleryName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByGallerySender sends the ListByGallery request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client GalleryImagesClient) ListByGallerySender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByGalleryResponder handles the response to the ListByGallery request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client GalleryImagesClient) ListByGalleryResponder(resp *http.Response) (result GalleryImageList, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listByGalleryNextResults retrieves the next set of results, if any.
|
||||||
|
func (client GalleryImagesClient) listByGalleryNextResults(ctx context.Context, lastResults GalleryImageList) (result GalleryImageList, err error) {
|
||||||
|
req, err := lastResults.galleryImageListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "listByGalleryNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListByGallerySender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "listByGalleryNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListByGalleryResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "listByGalleryNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByGalleryComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client GalleryImagesClient) ListByGalleryComplete(ctx context.Context, resourceGroupName string, galleryName string) (result GalleryImageListIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.ListByGallery")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.ListByGallery(ctx, resourceGroupName, galleryName)
|
||||||
|
return
|
||||||
|
}
|
418
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/galleryimageversions.go
generated
vendored
Normal file
418
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/galleryimageversions.go
generated
vendored
Normal file
|
@ -0,0 +1,418 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GalleryImageVersionsClient is the compute Client
|
||||||
|
type GalleryImageVersionsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGalleryImageVersionsClient creates an instance of the GalleryImageVersionsClient client.
|
||||||
|
func NewGalleryImageVersionsClient(subscriptionID string) GalleryImageVersionsClient {
|
||||||
|
return NewGalleryImageVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGalleryImageVersionsClientWithBaseURI creates an instance of the GalleryImageVersionsClient client.
|
||||||
|
func NewGalleryImageVersionsClientWithBaseURI(baseURI string, subscriptionID string) GalleryImageVersionsClient {
|
||||||
|
return GalleryImageVersionsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate create or update a gallery Image Version.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// galleryName - the name of the Shared Image Gallery in which the Image Definition resides.
|
||||||
|
// galleryImageName - the name of the gallery Image Definition in which the Image Version is to be created.
|
||||||
|
// galleryImageVersionName - the name of the gallery Image Version to be created. Needs to follow semantic
|
||||||
|
// version name pattern: The allowed characters are digit and period. Digits must be within the range of a
|
||||||
|
// 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>
|
||||||
|
// galleryImageVersion - parameters supplied to the create or update gallery Image Version operation.
|
||||||
|
func (client GalleryImageVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion) (result GalleryImageVersionsCreateOrUpdateFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageVersionsClient.CreateOrUpdate")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: galleryImageVersion,
|
||||||
|
Constraints: []validation.Constraint{{Target: "galleryImageVersion.GalleryImageVersionProperties", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "galleryImageVersion.GalleryImageVersionProperties.PublishingProfile", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.GalleryImageVersionsClient", "CreateOrUpdate", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client GalleryImageVersionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"galleryImageName": autorest.Encode("path", galleryImageName),
|
||||||
|
"galleryImageVersionName": autorest.Encode("path", galleryImageVersionName),
|
||||||
|
"galleryName": autorest.Encode("path", galleryName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", pathParameters),
|
||||||
|
autorest.WithJSON(galleryImageVersion),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client GalleryImageVersionsClient) CreateOrUpdateSender(req *http.Request) (future GalleryImageVersionsCreateOrUpdateFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client GalleryImageVersionsClient) CreateOrUpdateResponder(resp *http.Response) (result GalleryImageVersion, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete delete a gallery Image Version.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// galleryName - the name of the Shared Image Gallery in which the Image Definition resides.
|
||||||
|
// galleryImageName - the name of the gallery Image Definition in which the Image Version resides.
|
||||||
|
// galleryImageVersionName - the name of the gallery Image Version to be deleted.
|
||||||
|
func (client GalleryImageVersionsClient) Delete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string) (result GalleryImageVersionsDeleteFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageVersionsClient.Delete")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client GalleryImageVersionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"galleryImageName": autorest.Encode("path", galleryImageName),
|
||||||
|
"galleryImageVersionName": autorest.Encode("path", galleryImageVersionName),
|
||||||
|
"galleryName": autorest.Encode("path", galleryName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client GalleryImageVersionsClient) DeleteSender(req *http.Request) (future GalleryImageVersionsDeleteFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client GalleryImageVersionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get retrieves information about a gallery Image Version.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// galleryName - the name of the Shared Image Gallery in which the Image Definition resides.
|
||||||
|
// galleryImageName - the name of the gallery Image Definition in which the Image Version resides.
|
||||||
|
// galleryImageVersionName - the name of the gallery Image Version to be retrieved.
|
||||||
|
// expand - the expand expression to apply on the operation.
|
||||||
|
func (client GalleryImageVersionsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, expand ReplicationStatusTypes) (result GalleryImageVersion, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageVersionsClient.Get")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, expand)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client GalleryImageVersionsClient) GetPreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, expand ReplicationStatusTypes) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"galleryImageName": autorest.Encode("path", galleryImageName),
|
||||||
|
"galleryImageVersionName": autorest.Encode("path", galleryImageVersionName),
|
||||||
|
"galleryName": autorest.Encode("path", galleryName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
if len(string(expand)) > 0 {
|
||||||
|
queryParameters["$expand"] = autorest.Encode("query", expand)
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client GalleryImageVersionsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client GalleryImageVersionsClient) GetResponder(resp *http.Response) (result GalleryImageVersion, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByGalleryImage list gallery Image Versions in a gallery Image Definition.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// galleryName - the name of the Shared Image Gallery in which the Image Definition resides.
|
||||||
|
// galleryImageName - the name of the Shared Image Gallery Image Definition from which the Image Versions are
|
||||||
|
// to be listed.
|
||||||
|
func (client GalleryImageVersionsClient) ListByGalleryImage(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (result GalleryImageVersionListPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageVersionsClient.ListByGalleryImage")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.givl.Response.Response != nil {
|
||||||
|
sc = result.givl.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listByGalleryImageNextResults
|
||||||
|
req, err := client.ListByGalleryImagePreparer(ctx, resourceGroupName, galleryName, galleryImageName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "ListByGalleryImage", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListByGalleryImageSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.givl.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "ListByGalleryImage", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.givl, err = client.ListByGalleryImageResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "ListByGalleryImage", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByGalleryImagePreparer prepares the ListByGalleryImage request.
|
||||||
|
func (client GalleryImageVersionsClient) ListByGalleryImagePreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"galleryImageName": autorest.Encode("path", galleryImageName),
|
||||||
|
"galleryName": autorest.Encode("path", galleryName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByGalleryImageSender sends the ListByGalleryImage request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client GalleryImageVersionsClient) ListByGalleryImageSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByGalleryImageResponder handles the response to the ListByGalleryImage request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client GalleryImageVersionsClient) ListByGalleryImageResponder(resp *http.Response) (result GalleryImageVersionList, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listByGalleryImageNextResults retrieves the next set of results, if any.
|
||||||
|
func (client GalleryImageVersionsClient) listByGalleryImageNextResults(ctx context.Context, lastResults GalleryImageVersionList) (result GalleryImageVersionList, err error) {
|
||||||
|
req, err := lastResults.galleryImageVersionListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "listByGalleryImageNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListByGalleryImageSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "listByGalleryImageNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListByGalleryImageResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "listByGalleryImageNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByGalleryImageComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client GalleryImageVersionsClient) ListByGalleryImageComplete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (result GalleryImageVersionListIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageVersionsClient.ListByGalleryImage")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.ListByGalleryImage(ctx, resourceGroupName, galleryName, galleryImageName)
|
||||||
|
return
|
||||||
|
}
|
582
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/images.go
generated
vendored
Normal file
582
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/images.go
generated
vendored
Normal file
|
@ -0,0 +1,582 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ImagesClient is the compute Client
|
||||||
|
type ImagesClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewImagesClient creates an instance of the ImagesClient client.
|
||||||
|
func NewImagesClient(subscriptionID string) ImagesClient {
|
||||||
|
return NewImagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewImagesClientWithBaseURI creates an instance of the ImagesClient client.
|
||||||
|
func NewImagesClientWithBaseURI(baseURI string, subscriptionID string) ImagesClient {
|
||||||
|
return ImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate create or update an image.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// imageName - the name of the image.
|
||||||
|
// parameters - parameters supplied to the Create Image operation.
|
||||||
|
func (client ImagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image) (result ImagesCreateOrUpdateFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.CreateOrUpdate")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, imageName, parameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client ImagesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, imageName string, parameters Image) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"imageName": autorest.Encode("path", imageName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ImagesClient) CreateOrUpdateSender(req *http.Request) (future ImagesCreateOrUpdateFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ImagesClient) CreateOrUpdateResponder(resp *http.Response) (result Image, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete deletes an Image.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// imageName - the name of the image.
|
||||||
|
func (client ImagesClient) Delete(ctx context.Context, resourceGroupName string, imageName string) (result ImagesDeleteFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.Delete")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, imageName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client ImagesClient) DeletePreparer(ctx context.Context, resourceGroupName string, imageName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"imageName": autorest.Encode("path", imageName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ImagesClient) DeleteSender(req *http.Request) (future ImagesDeleteFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ImagesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets an image.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// imageName - the name of the image.
|
||||||
|
// expand - the expand expression to apply on the operation.
|
||||||
|
func (client ImagesClient) Get(ctx context.Context, resourceGroupName string, imageName string, expand string) (result Image, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.Get")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, imageName, expand)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client ImagesClient) GetPreparer(ctx context.Context, resourceGroupName string, imageName string, expand string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"imageName": autorest.Encode("path", imageName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
if len(expand) > 0 {
|
||||||
|
queryParameters["$expand"] = autorest.Encode("query", expand)
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ImagesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ImagesClient) GetResponder(resp *http.Response) (result Image, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets the list of Images in the subscription. Use nextLink property in the response to get the next page of
|
||||||
|
// Images. Do this till nextLink is null to fetch all the Images.
|
||||||
|
func (client ImagesClient) List(ctx context.Context) (result ImageListResultPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.ilr.Response.Response != nil {
|
||||||
|
sc = result.ilr.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.ilr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.ilr, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client ImagesClient) ListPreparer(ctx context.Context) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ImagesClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ImagesClient) ListResponder(resp *http.Response) (result ImageListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listNextResults retrieves the next set of results, if any.
|
||||||
|
func (client ImagesClient) listNextResults(ctx context.Context, lastResults ImageListResult) (result ImageListResult, err error) {
|
||||||
|
req, err := lastResults.imageListResultPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ImagesClient) ListComplete(ctx context.Context) (result ImageListResultIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.List(ctx)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroup gets the list of images under a resource group.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
func (client ImagesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ImageListResultPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.ListByResourceGroup")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.ilr.Response.Response != nil {
|
||||||
|
sc = result.ilr.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listByResourceGroupNextResults
|
||||||
|
req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.ilr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.ilr, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||||
|
func (client ImagesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ImagesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ImagesClient) ListByResourceGroupResponder(resp *http.Response) (result ImageListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listByResourceGroupNextResults retrieves the next set of results, if any.
|
||||||
|
func (client ImagesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ImageListResult) (result ImageListResult, err error) {
|
||||||
|
req, err := lastResults.imageListResultPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ImagesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ImageListResultIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.ListByResourceGroup")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update update an image.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// imageName - the name of the image.
|
||||||
|
// parameters - parameters supplied to the Update Image operation.
|
||||||
|
func (client ImagesClient) Update(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate) (result ImagesUpdateFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ImagesClient.Update")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.UpdatePreparer(ctx, resourceGroupName, imageName, parameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Update", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.UpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Update", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatePreparer prepares the Update request.
|
||||||
|
func (client ImagesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"imageName": autorest.Encode("path", imageName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPatch(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateSender sends the Update request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ImagesClient) UpdateSender(req *http.Request) (future ImagesUpdateFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateResponder handles the response to the Update request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ImagesClient) UpdateResponder(resp *http.Response) (result Image, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
212
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/loganalytics.go
generated
vendored
Normal file
212
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/loganalytics.go
generated
vendored
Normal file
|
@ -0,0 +1,212 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// LogAnalyticsClient is the compute Client
|
||||||
|
type LogAnalyticsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewLogAnalyticsClient creates an instance of the LogAnalyticsClient client.
|
||||||
|
func NewLogAnalyticsClient(subscriptionID string) LogAnalyticsClient {
|
||||||
|
return NewLogAnalyticsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewLogAnalyticsClientWithBaseURI creates an instance of the LogAnalyticsClient client.
|
||||||
|
func NewLogAnalyticsClientWithBaseURI(baseURI string, subscriptionID string) LogAnalyticsClient {
|
||||||
|
return LogAnalyticsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportRequestRateByInterval export logs that show Api requests made by this subscription in the given time window to
|
||||||
|
// show throttling activities.
|
||||||
|
// Parameters:
|
||||||
|
// parameters - parameters supplied to the LogAnalytics getRequestRateByInterval Api.
|
||||||
|
// location - the location upon which virtual-machine-sizes is queried.
|
||||||
|
func (client LogAnalyticsClient) ExportRequestRateByInterval(ctx context.Context, parameters RequestRateByIntervalInput, location string) (result LogAnalyticsExportRequestRateByIntervalFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.ExportRequestRateByInterval")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: location,
|
||||||
|
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.LogAnalyticsClient", "ExportRequestRateByInterval", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.ExportRequestRateByIntervalPreparer(ctx, parameters, location)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportRequestRateByInterval", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ExportRequestRateByIntervalSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportRequestRateByInterval", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportRequestRateByIntervalPreparer prepares the ExportRequestRateByInterval request.
|
||||||
|
func (client LogAnalyticsClient) ExportRequestRateByIntervalPreparer(ctx context.Context, parameters RequestRateByIntervalInput, location string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportRequestRateByIntervalSender sends the ExportRequestRateByInterval request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client LogAnalyticsClient) ExportRequestRateByIntervalSender(req *http.Request) (future LogAnalyticsExportRequestRateByIntervalFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportRequestRateByIntervalResponder handles the response to the ExportRequestRateByInterval request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client LogAnalyticsClient) ExportRequestRateByIntervalResponder(resp *http.Response) (result LogAnalyticsOperationResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportThrottledRequests export logs that show total throttled Api requests for this subscription in the given time
|
||||||
|
// window.
|
||||||
|
// Parameters:
|
||||||
|
// parameters - parameters supplied to the LogAnalytics getThrottledRequests Api.
|
||||||
|
// location - the location upon which virtual-machine-sizes is queried.
|
||||||
|
func (client LogAnalyticsClient) ExportThrottledRequests(ctx context.Context, parameters ThrottledRequestsInput, location string) (result LogAnalyticsExportThrottledRequestsFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.ExportThrottledRequests")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: location,
|
||||||
|
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.LogAnalyticsClient", "ExportThrottledRequests", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.ExportThrottledRequestsPreparer(ctx, parameters, location)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportThrottledRequests", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ExportThrottledRequestsSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportThrottledRequests", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportThrottledRequestsPreparer prepares the ExportThrottledRequests request.
|
||||||
|
func (client LogAnalyticsClient) ExportThrottledRequestsPreparer(ctx context.Context, parameters ThrottledRequestsInput, location string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportThrottledRequestsSender sends the ExportThrottledRequests request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client LogAnalyticsClient) ExportThrottledRequestsSender(req *http.Request) (future LogAnalyticsExportThrottledRequestsFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportThrottledRequestsResponder handles the response to the ExportThrottledRequests request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client LogAnalyticsClient) ExportThrottledRequestsResponder(resp *http.Response) (result LogAnalyticsOperationResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
10910
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/models.go
generated
vendored
Normal file
10910
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/models.go
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
109
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/operations.go
generated
vendored
Normal file
109
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/operations.go
generated
vendored
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OperationsClient is the compute Client
|
||||||
|
type OperationsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOperationsClient creates an instance of the OperationsClient client.
|
||||||
|
func NewOperationsClient(subscriptionID string) OperationsClient {
|
||||||
|
return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client.
|
||||||
|
func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient {
|
||||||
|
return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets a list of compute operations.
|
||||||
|
func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.ListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.OperationsClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.OperationsClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.OperationsClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) {
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPath("/providers/Microsoft.Compute/operations"),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
577
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/proximityplacementgroups.go
generated
vendored
Normal file
577
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/proximityplacementgroups.go
generated
vendored
Normal file
|
@ -0,0 +1,577 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ProximityPlacementGroupsClient is the compute Client
|
||||||
|
type ProximityPlacementGroupsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewProximityPlacementGroupsClient creates an instance of the ProximityPlacementGroupsClient client.
|
||||||
|
func NewProximityPlacementGroupsClient(subscriptionID string) ProximityPlacementGroupsClient {
|
||||||
|
return NewProximityPlacementGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewProximityPlacementGroupsClientWithBaseURI creates an instance of the ProximityPlacementGroupsClient client.
|
||||||
|
func NewProximityPlacementGroupsClientWithBaseURI(baseURI string, subscriptionID string) ProximityPlacementGroupsClient {
|
||||||
|
return ProximityPlacementGroupsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate create or update a proximity placement group.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// proximityPlacementGroupName - the name of the proximity placement group.
|
||||||
|
// parameters - parameters supplied to the Create Proximity Placement Group operation.
|
||||||
|
func (client ProximityPlacementGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroup) (result ProximityPlacementGroup, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.CreateOrUpdate")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, proximityPlacementGroupName, parameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client ProximityPlacementGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroup) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"proximityPlacementGroupName": autorest.Encode("path", proximityPlacementGroupName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ProximityPlacementGroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ProximityPlacementGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ProximityPlacementGroup, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete delete a proximity placement group.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// proximityPlacementGroupName - the name of the proximity placement group.
|
||||||
|
func (client ProximityPlacementGroupsClient) Delete(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string) (result autorest.Response, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.Delete")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response != nil {
|
||||||
|
sc = result.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, proximityPlacementGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = resp
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Delete", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Delete", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client ProximityPlacementGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"proximityPlacementGroupName": autorest.Encode("path", proximityPlacementGroupName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ProximityPlacementGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ProximityPlacementGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get retrieves information about a proximity placement group .
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// proximityPlacementGroupName - the name of the proximity placement group.
|
||||||
|
func (client ProximityPlacementGroupsClient) Get(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string) (result ProximityPlacementGroup, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.Get")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, proximityPlacementGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client ProximityPlacementGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"proximityPlacementGroupName": autorest.Encode("path", proximityPlacementGroupName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ProximityPlacementGroupsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ProximityPlacementGroupsClient) GetResponder(resp *http.Response) (result ProximityPlacementGroup, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroup lists all proximity placement groups in a resource group.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
func (client ProximityPlacementGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ProximityPlacementGroupListResultPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.ListByResourceGroup")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.ppglr.Response.Response != nil {
|
||||||
|
sc = result.ppglr.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listByResourceGroupNextResults
|
||||||
|
req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.ppglr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.ppglr, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||||
|
func (client ProximityPlacementGroupsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ProximityPlacementGroupsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ProximityPlacementGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ProximityPlacementGroupListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listByResourceGroupNextResults retrieves the next set of results, if any.
|
||||||
|
func (client ProximityPlacementGroupsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ProximityPlacementGroupListResult) (result ProximityPlacementGroupListResult, err error) {
|
||||||
|
req, err := lastResults.proximityPlacementGroupListResultPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ProximityPlacementGroupsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ProximityPlacementGroupListResultIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.ListByResourceGroup")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListBySubscription lists all proximity placement groups in a subscription.
|
||||||
|
func (client ProximityPlacementGroupsClient) ListBySubscription(ctx context.Context) (result ProximityPlacementGroupListResultPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.ListBySubscription")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.ppglr.Response.Response != nil {
|
||||||
|
sc = result.ppglr.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listBySubscriptionNextResults
|
||||||
|
req, err := client.ListBySubscriptionPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListBySubscription", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListBySubscriptionSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.ppglr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListBySubscription", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.ppglr, err = client.ListBySubscriptionResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListBySubscription", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListBySubscriptionPreparer prepares the ListBySubscription request.
|
||||||
|
func (client ProximityPlacementGroupsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListBySubscriptionSender sends the ListBySubscription request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ProximityPlacementGroupsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ProximityPlacementGroupsClient) ListBySubscriptionResponder(resp *http.Response) (result ProximityPlacementGroupListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listBySubscriptionNextResults retrieves the next set of results, if any.
|
||||||
|
func (client ProximityPlacementGroupsClient) listBySubscriptionNextResults(ctx context.Context, lastResults ProximityPlacementGroupListResult) (result ProximityPlacementGroupListResult, err error) {
|
||||||
|
req, err := lastResults.proximityPlacementGroupListResultPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListBySubscriptionSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListBySubscriptionResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ProximityPlacementGroupsClient) ListBySubscriptionComplete(ctx context.Context) (result ProximityPlacementGroupListResultIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.ListBySubscription")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.ListBySubscription(ctx)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update update a proximity placement group.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// proximityPlacementGroupName - the name of the proximity placement group.
|
||||||
|
// parameters - parameters supplied to the Update Proximity Placement Group operation.
|
||||||
|
func (client ProximityPlacementGroupsClient) Update(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroupUpdate) (result ProximityPlacementGroup, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ProximityPlacementGroupsClient.Update")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.UpdatePreparer(ctx, resourceGroupName, proximityPlacementGroupName, parameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Update", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.UpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Update", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.UpdateResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Update", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatePreparer prepares the Update request.
|
||||||
|
func (client ProximityPlacementGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroupUpdate) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"proximityPlacementGroupName": autorest.Encode("path", proximityPlacementGroupName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPatch(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateSender sends the Update request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ProximityPlacementGroupsClient) UpdateSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateResponder handles the response to the Update request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ProximityPlacementGroupsClient) UpdateResponder(resp *http.Response) (result ProximityPlacementGroup, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
151
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/resourceskus.go
generated
vendored
Normal file
151
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/resourceskus.go
generated
vendored
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ResourceSkusClient is the compute Client
|
||||||
|
type ResourceSkusClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewResourceSkusClient creates an instance of the ResourceSkusClient client.
|
||||||
|
func NewResourceSkusClient(subscriptionID string) ResourceSkusClient {
|
||||||
|
return NewResourceSkusClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewResourceSkusClientWithBaseURI creates an instance of the ResourceSkusClient client.
|
||||||
|
func NewResourceSkusClientWithBaseURI(baseURI string, subscriptionID string) ResourceSkusClient {
|
||||||
|
return ResourceSkusClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets the list of Microsoft.Compute SKUs available for your Subscription.
|
||||||
|
func (client ResourceSkusClient) List(ctx context.Context) (result ResourceSkusResultPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.rsr.Response.Response != nil {
|
||||||
|
sc = result.rsr.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.rsr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.rsr, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client ResourceSkusClient) ListPreparer(ctx context.Context) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ResourceSkusClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ResourceSkusClient) ListResponder(resp *http.Response) (result ResourceSkusResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listNextResults retrieves the next set of results, if any.
|
||||||
|
func (client ResourceSkusClient) listNextResults(ctx context.Context, lastResults ResourceSkusResult) (result ResourceSkusResult, err error) {
|
||||||
|
req, err := lastResults.resourceSkusResultPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "listNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ResourceSkusClient) ListComplete(ctx context.Context) (result ResourceSkusResultIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.List(ctx)
|
||||||
|
return
|
||||||
|
}
|
760
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/snapshots.go
generated
vendored
Normal file
760
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/snapshots.go
generated
vendored
Normal file
|
@ -0,0 +1,760 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SnapshotsClient is the compute Client
|
||||||
|
type SnapshotsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewSnapshotsClient creates an instance of the SnapshotsClient client.
|
||||||
|
func NewSnapshotsClient(subscriptionID string) SnapshotsClient {
|
||||||
|
return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient client.
|
||||||
|
func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient {
|
||||||
|
return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate creates or updates a snapshot.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot
|
||||||
|
// is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
|
||||||
|
// snapshot - snapshot object supplied in the body of the Put disk operation.
|
||||||
|
func (client SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot) (result SnapshotsCreateOrUpdateFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.CreateOrUpdate")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: snapshot,
|
||||||
|
Constraints: []validation.Constraint{{Target: "snapshot.SnapshotProperties", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "snapshot.SnapshotProperties.CreationData", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "snapshot.SnapshotProperties.CreationData.ImageReference", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "snapshot.SnapshotProperties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||||
|
}},
|
||||||
|
{Target: "snapshot.SnapshotProperties.EncryptionSettingsCollection", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "snapshot.SnapshotProperties.EncryptionSettingsCollection.Enabled", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||||
|
}}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.SnapshotsClient", "CreateOrUpdate", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, snapshotName, snapshot)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client SnapshotsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"snapshotName": autorest.Encode("path", snapshotName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
snapshot.ManagedBy = nil
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters),
|
||||||
|
autorest.WithJSON(snapshot),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) CreateOrUpdateSender(req *http.Request) (future SnapshotsCreateOrUpdateFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (result Snapshot, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete deletes a snapshot.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot
|
||||||
|
// is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
|
||||||
|
func (client SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, snapshotName string) (result SnapshotsDeleteFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Delete")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, snapshotName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, snapshotName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"snapshotName": autorest.Encode("path", snapshotName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) DeleteSender(req *http.Request) (future SnapshotsDeleteFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets information about a snapshot.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot
|
||||||
|
// is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
|
||||||
|
func (client SnapshotsClient) Get(ctx context.Context, resourceGroupName string, snapshotName string) (result Snapshot, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Get")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, snapshotName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, snapshotName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"snapshotName": autorest.Encode("path", snapshotName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantAccess grants access to a snapshot.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot
|
||||||
|
// is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
|
||||||
|
// grantAccessData - access data object supplied in the body of the get snapshot access operation.
|
||||||
|
func (client SnapshotsClient) GrantAccess(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData) (result SnapshotsGrantAccessFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.GrantAccess")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: grantAccessData,
|
||||||
|
Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.SnapshotsClient", "GrantAccess", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.GrantAccessPreparer(ctx, resourceGroupName, snapshotName, grantAccessData)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "GrantAccess", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GrantAccessSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "GrantAccess", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantAccessPreparer prepares the GrantAccess request.
|
||||||
|
func (client SnapshotsClient) GrantAccessPreparer(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"snapshotName": autorest.Encode("path", snapshotName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", pathParameters),
|
||||||
|
autorest.WithJSON(grantAccessData),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantAccessSender sends the GrantAccess request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) GrantAccessSender(req *http.Request) (future SnapshotsGrantAccessFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantAccessResponder handles the response to the GrantAccess request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client SnapshotsClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List lists snapshots under a subscription.
|
||||||
|
func (client SnapshotsClient) List(ctx context.Context) (result SnapshotListPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.sl.Response.Response != nil {
|
||||||
|
sc = result.sl.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.sl.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.sl, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client SnapshotsClient) ListPreparer(ctx context.Context) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotList, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listNextResults retrieves the next set of results, if any.
|
||||||
|
func (client SnapshotsClient) listNextResults(ctx context.Context, lastResults SnapshotList) (result SnapshotList, err error) {
|
||||||
|
req, err := lastResults.snapshotListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client SnapshotsClient) ListComplete(ctx context.Context) (result SnapshotListIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.List(ctx)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroup lists snapshots under a resource group.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
func (client SnapshotsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SnapshotListPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.ListByResourceGroup")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.sl.Response.Response != nil {
|
||||||
|
sc = result.sl.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listByResourceGroupNextResults
|
||||||
|
req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.sl.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.sl, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||||
|
func (client SnapshotsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client SnapshotsClient) ListByResourceGroupResponder(resp *http.Response) (result SnapshotList, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listByResourceGroupNextResults retrieves the next set of results, if any.
|
||||||
|
func (client SnapshotsClient) listByResourceGroupNextResults(ctx context.Context, lastResults SnapshotList) (result SnapshotList, err error) {
|
||||||
|
req, err := lastResults.snapshotListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SnapshotListIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.ListByResourceGroup")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokeAccess revokes access to a snapshot.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot
|
||||||
|
// is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
|
||||||
|
func (client SnapshotsClient) RevokeAccess(ctx context.Context, resourceGroupName string, snapshotName string) (result SnapshotsRevokeAccessFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.RevokeAccess")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, snapshotName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "RevokeAccess", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.RevokeAccessSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "RevokeAccess", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokeAccessPreparer prepares the RevokeAccess request.
|
||||||
|
func (client SnapshotsClient) RevokeAccessPreparer(ctx context.Context, resourceGroupName string, snapshotName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"snapshotName": autorest.Encode("path", snapshotName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokeAccessSender sends the RevokeAccess request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) RevokeAccessSender(req *http.Request) (future SnapshotsRevokeAccessFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokeAccessResponder handles the response to the RevokeAccess request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client SnapshotsClient) RevokeAccessResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update updates (patches) a snapshot.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot
|
||||||
|
// is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
|
||||||
|
// snapshot - snapshot object supplied in the body of the Patch snapshot operation.
|
||||||
|
func (client SnapshotsClient) Update(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate) (result SnapshotsUpdateFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Update")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.UpdatePreparer(ctx, resourceGroupName, snapshotName, snapshot)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Update", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.UpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Update", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatePreparer prepares the Update request.
|
||||||
|
func (client SnapshotsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"snapshotName": autorest.Encode("path", snapshotName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-09-30"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPatch(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters),
|
||||||
|
autorest.WithJSON(snapshot),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateSender sends the Update request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) UpdateSender(req *http.Request) (future SnapshotsUpdateFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateResponder handles the response to the Update request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client SnapshotsClient) UpdateResponder(resp *http.Response) (result Snapshot, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
162
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/usage.go
generated
vendored
Normal file
162
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/usage.go
generated
vendored
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UsageClient is the compute Client
|
||||||
|
type UsageClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewUsageClient creates an instance of the UsageClient client.
|
||||||
|
func NewUsageClient(subscriptionID string) UsageClient {
|
||||||
|
return NewUsageClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewUsageClientWithBaseURI creates an instance of the UsageClient client.
|
||||||
|
func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClient {
|
||||||
|
return UsageClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets, for the specified location, the current compute resource usage information as well as the limits for
|
||||||
|
// compute resources under the subscription.
|
||||||
|
// Parameters:
|
||||||
|
// location - the location for which resource usage is queried.
|
||||||
|
func (client UsageClient) List(ctx context.Context, location string) (result ListUsagesResultPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/UsageClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.lur.Response.Response != nil {
|
||||||
|
sc = result.lur.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: location,
|
||||||
|
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.UsageClient", "List", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx, location)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.lur.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.lur, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client UsageClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client UsageClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client UsageClient) ListResponder(resp *http.Response) (result ListUsagesResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listNextResults retrieves the next set of results, if any.
|
||||||
|
func (client UsageClient) listNextResults(ctx context.Context, lastResults ListUsagesResult) (result ListUsagesResult, err error) {
|
||||||
|
req, err := lastResults.listUsagesResultPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client UsageClient) ListComplete(ctx context.Context, location string) (result ListUsagesResultIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/UsageClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.List(ctx, location)
|
||||||
|
return
|
||||||
|
}
|
30
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/version.go
generated
vendored
Normal file
30
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/version.go
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
import "github.com/Azure/azure-sdk-for-go/version"
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
// UserAgent returns the UserAgent string to use when sending http.Requests.
|
||||||
|
func UserAgent() string {
|
||||||
|
return "Azure-SDK-For-Go/" + version.Number + " compute/2019-03-01"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Version returns the semantic version (see http://semver.org) of the client.
|
||||||
|
func Version() string {
|
||||||
|
return version.Number
|
||||||
|
}
|
283
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineextensionimages.go
generated
vendored
Normal file
283
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineextensionimages.go
generated
vendored
Normal file
|
@ -0,0 +1,283 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// VirtualMachineExtensionImagesClient is the compute Client
|
||||||
|
type VirtualMachineExtensionImagesClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineExtensionImagesClient creates an instance of the VirtualMachineExtensionImagesClient client.
|
||||||
|
func NewVirtualMachineExtensionImagesClient(subscriptionID string) VirtualMachineExtensionImagesClient {
|
||||||
|
return NewVirtualMachineExtensionImagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineExtensionImagesClientWithBaseURI creates an instance of the VirtualMachineExtensionImagesClient
|
||||||
|
// client.
|
||||||
|
func NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionImagesClient {
|
||||||
|
return VirtualMachineExtensionImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets a virtual machine extension image.
|
||||||
|
// Parameters:
|
||||||
|
// location - the name of a supported Azure region.
|
||||||
|
func (client VirtualMachineExtensionImagesClient) Get(ctx context.Context, location string, publisherName string, typeParameter string, version string) (result VirtualMachineExtensionImage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionImagesClient.Get")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.GetPreparer(ctx, location, publisherName, typeParameter, version)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client VirtualMachineExtensionImagesClient) GetPreparer(ctx context.Context, location string, publisherName string, typeParameter string, version string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"publisherName": autorest.Encode("path", publisherName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"type": autorest.Encode("path", typeParameter),
|
||||||
|
"version": autorest.Encode("path", version),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineExtensionImagesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineExtensionImagesClient) GetResponder(resp *http.Response) (result VirtualMachineExtensionImage, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListTypes gets a list of virtual machine extension image types.
|
||||||
|
// Parameters:
|
||||||
|
// location - the name of a supported Azure region.
|
||||||
|
func (client VirtualMachineExtensionImagesClient) ListTypes(ctx context.Context, location string, publisherName string) (result ListVirtualMachineExtensionImage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionImagesClient.ListTypes")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.ListTypesPreparer(ctx, location, publisherName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListTypesSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ListTypesResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListTypesPreparer prepares the ListTypes request.
|
||||||
|
func (client VirtualMachineExtensionImagesClient) ListTypesPreparer(ctx context.Context, location string, publisherName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"publisherName": autorest.Encode("path", publisherName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListTypesSender sends the ListTypes request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineExtensionImagesClient) ListTypesSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListTypesResponder handles the response to the ListTypes request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineExtensionImagesClient) ListTypesResponder(resp *http.Response) (result ListVirtualMachineExtensionImage, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result.Value),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListVersions gets a list of virtual machine extension image versions.
|
||||||
|
// Parameters:
|
||||||
|
// location - the name of a supported Azure region.
|
||||||
|
// filter - the filter to apply on the operation.
|
||||||
|
func (client VirtualMachineExtensionImagesClient) ListVersions(ctx context.Context, location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (result ListVirtualMachineExtensionImage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionImagesClient.ListVersions")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.ListVersionsPreparer(ctx, location, publisherName, typeParameter, filter, top, orderby)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListVersionsSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ListVersionsResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListVersionsPreparer prepares the ListVersions request.
|
||||||
|
func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(ctx context.Context, location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"publisherName": autorest.Encode("path", publisherName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"type": autorest.Encode("path", typeParameter),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
if len(filter) > 0 {
|
||||||
|
queryParameters["$filter"] = autorest.Encode("query", filter)
|
||||||
|
}
|
||||||
|
if top != nil {
|
||||||
|
queryParameters["$top"] = autorest.Encode("query", *top)
|
||||||
|
}
|
||||||
|
if len(orderby) > 0 {
|
||||||
|
queryParameters["$orderby"] = autorest.Encode("query", orderby)
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListVersionsSender sends the ListVersions request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineExtensionImagesClient) ListVersionsSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListVersionsResponder handles the response to the ListVersions request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineExtensionImagesClient) ListVersionsResponder(resp *http.Response) (result ListVirtualMachineExtensionImage, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result.Value),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
447
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineextensions.go
generated
vendored
Normal file
447
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineextensions.go
generated
vendored
Normal file
|
@ -0,0 +1,447 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// VirtualMachineExtensionsClient is the compute Client
|
||||||
|
type VirtualMachineExtensionsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineExtensionsClient creates an instance of the VirtualMachineExtensionsClient client.
|
||||||
|
func NewVirtualMachineExtensionsClient(subscriptionID string) VirtualMachineExtensionsClient {
|
||||||
|
return NewVirtualMachineExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineExtensionsClientWithBaseURI creates an instance of the VirtualMachineExtensionsClient client.
|
||||||
|
func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionsClient {
|
||||||
|
return VirtualMachineExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate the operation to create or update the extension.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// VMName - the name of the virtual machine where the extension should be created or updated.
|
||||||
|
// VMExtensionName - the name of the virtual machine extension.
|
||||||
|
// extensionParameters - parameters supplied to the Create Virtual Machine Extension operation.
|
||||||
|
func (client VirtualMachineExtensionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension) (result VirtualMachineExtensionsCreateOrUpdateFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionsClient.CreateOrUpdate")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMName, VMExtensionName, extensionParameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmExtensionName": autorest.Encode("path", VMExtensionName),
|
||||||
|
"vmName": autorest.Encode("path", VMName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
|
||||||
|
autorest.WithJSON(extensionParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineExtensionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachineExtensionsCreateOrUpdateFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineExtensionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineExtension, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete the operation to delete the extension.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// VMName - the name of the virtual machine where the extension should be deleted.
|
||||||
|
// VMExtensionName - the name of the virtual machine extension.
|
||||||
|
func (client VirtualMachineExtensionsClient) Delete(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string) (result VirtualMachineExtensionsDeleteFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionsClient.Delete")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, VMName, VMExtensionName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client VirtualMachineExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmExtensionName": autorest.Encode("path", VMExtensionName),
|
||||||
|
"vmName": autorest.Encode("path", VMName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineExtensionsClient) DeleteSender(req *http.Request) (future VirtualMachineExtensionsDeleteFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the operation to get the extension.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// VMName - the name of the virtual machine containing the extension.
|
||||||
|
// VMExtensionName - the name of the virtual machine extension.
|
||||||
|
// expand - the expand expression to apply on the operation.
|
||||||
|
func (client VirtualMachineExtensionsClient) Get(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, expand string) (result VirtualMachineExtension, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionsClient.Get")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, VMName, VMExtensionName, expand)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client VirtualMachineExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, expand string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmExtensionName": autorest.Encode("path", VMExtensionName),
|
||||||
|
"vmName": autorest.Encode("path", VMName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
if len(expand) > 0 {
|
||||||
|
queryParameters["$expand"] = autorest.Encode("query", expand)
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineExtensionsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineExtensionsClient) GetResponder(resp *http.Response) (result VirtualMachineExtension, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List the operation to get all extensions of a Virtual Machine.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// VMName - the name of the virtual machine containing the extension.
|
||||||
|
// expand - the expand expression to apply on the operation.
|
||||||
|
func (client VirtualMachineExtensionsClient) List(ctx context.Context, resourceGroupName string, VMName string, expand string) (result VirtualMachineExtensionsListResult, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionsClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.ListPreparer(ctx, resourceGroupName, VMName, expand)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client VirtualMachineExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, VMName string, expand string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmName": autorest.Encode("path", VMName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
if len(expand) > 0 {
|
||||||
|
queryParameters["$expand"] = autorest.Encode("query", expand)
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineExtensionsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineExtensionsClient) ListResponder(resp *http.Response) (result VirtualMachineExtensionsListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the operation to update the extension.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// VMName - the name of the virtual machine where the extension should be updated.
|
||||||
|
// VMExtensionName - the name of the virtual machine extension.
|
||||||
|
// extensionParameters - parameters supplied to the Update Virtual Machine Extension operation.
|
||||||
|
func (client VirtualMachineExtensionsClient) Update(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtensionUpdate) (result VirtualMachineExtensionsUpdateFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineExtensionsClient.Update")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.UpdatePreparer(ctx, resourceGroupName, VMName, VMExtensionName, extensionParameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Update", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.UpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Update", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatePreparer prepares the Update request.
|
||||||
|
func (client VirtualMachineExtensionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtensionUpdate) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmExtensionName": autorest.Encode("path", VMExtensionName),
|
||||||
|
"vmName": autorest.Encode("path", VMName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPatch(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
|
||||||
|
autorest.WithJSON(extensionParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateSender sends the Update request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineExtensionsClient) UpdateSender(req *http.Request) (future VirtualMachineExtensionsUpdateFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateResponder handles the response to the Update request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineExtensionsClient) UpdateResponder(resp *http.Response) (result VirtualMachineExtension, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
446
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineimages.go
generated
vendored
Normal file
446
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineimages.go
generated
vendored
Normal file
|
@ -0,0 +1,446 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// VirtualMachineImagesClient is the compute Client
|
||||||
|
type VirtualMachineImagesClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineImagesClient creates an instance of the VirtualMachineImagesClient client.
|
||||||
|
func NewVirtualMachineImagesClient(subscriptionID string) VirtualMachineImagesClient {
|
||||||
|
return NewVirtualMachineImagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineImagesClientWithBaseURI creates an instance of the VirtualMachineImagesClient client.
|
||||||
|
func NewVirtualMachineImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineImagesClient {
|
||||||
|
return VirtualMachineImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets a virtual machine image.
|
||||||
|
// Parameters:
|
||||||
|
// location - the name of a supported Azure region.
|
||||||
|
// publisherName - a valid image publisher.
|
||||||
|
// offer - a valid image publisher offer.
|
||||||
|
// skus - a valid image SKU.
|
||||||
|
// version - a valid image SKU version.
|
||||||
|
func (client VirtualMachineImagesClient) Get(ctx context.Context, location string, publisherName string, offer string, skus string, version string) (result VirtualMachineImage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImagesClient.Get")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.GetPreparer(ctx, location, publisherName, offer, skus, version)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client VirtualMachineImagesClient) GetPreparer(ctx context.Context, location string, publisherName string, offer string, skus string, version string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"offer": autorest.Encode("path", offer),
|
||||||
|
"publisherName": autorest.Encode("path", publisherName),
|
||||||
|
"skus": autorest.Encode("path", skus),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"version": autorest.Encode("path", version),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineImagesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineImagesClient) GetResponder(resp *http.Response) (result VirtualMachineImage, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
|
||||||
|
// Parameters:
|
||||||
|
// location - the name of a supported Azure region.
|
||||||
|
// publisherName - a valid image publisher.
|
||||||
|
// offer - a valid image publisher offer.
|
||||||
|
// skus - a valid image SKU.
|
||||||
|
// filter - the filter to apply on the operation.
|
||||||
|
func (client VirtualMachineImagesClient) List(ctx context.Context, location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (result ListVirtualMachineImageResource, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImagesClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.ListPreparer(ctx, location, publisherName, offer, skus, filter, top, orderby)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client VirtualMachineImagesClient) ListPreparer(ctx context.Context, location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"offer": autorest.Encode("path", offer),
|
||||||
|
"publisherName": autorest.Encode("path", publisherName),
|
||||||
|
"skus": autorest.Encode("path", skus),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
if len(filter) > 0 {
|
||||||
|
queryParameters["$filter"] = autorest.Encode("query", filter)
|
||||||
|
}
|
||||||
|
if top != nil {
|
||||||
|
queryParameters["$top"] = autorest.Encode("query", *top)
|
||||||
|
}
|
||||||
|
if len(orderby) > 0 {
|
||||||
|
queryParameters["$orderby"] = autorest.Encode("query", orderby)
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineImagesClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineImagesClient) ListResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result.Value),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListOffers gets a list of virtual machine image offers for the specified location and publisher.
|
||||||
|
// Parameters:
|
||||||
|
// location - the name of a supported Azure region.
|
||||||
|
// publisherName - a valid image publisher.
|
||||||
|
func (client VirtualMachineImagesClient) ListOffers(ctx context.Context, location string, publisherName string) (result ListVirtualMachineImageResource, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImagesClient.ListOffers")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.ListOffersPreparer(ctx, location, publisherName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListOffersSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ListOffersResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListOffersPreparer prepares the ListOffers request.
|
||||||
|
func (client VirtualMachineImagesClient) ListOffersPreparer(ctx context.Context, location string, publisherName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"publisherName": autorest.Encode("path", publisherName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListOffersSender sends the ListOffers request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineImagesClient) ListOffersSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListOffersResponder handles the response to the ListOffers request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineImagesClient) ListOffersResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result.Value),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPublishers gets a list of virtual machine image publishers for the specified Azure location.
|
||||||
|
// Parameters:
|
||||||
|
// location - the name of a supported Azure region.
|
||||||
|
func (client VirtualMachineImagesClient) ListPublishers(ctx context.Context, location string) (result ListVirtualMachineImageResource, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImagesClient.ListPublishers")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.ListPublishersPreparer(ctx, location)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListPublishersSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ListPublishersResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPublishersPreparer prepares the ListPublishers request.
|
||||||
|
func (client VirtualMachineImagesClient) ListPublishersPreparer(ctx context.Context, location string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPublishersSender sends the ListPublishers request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineImagesClient) ListPublishersSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPublishersResponder handles the response to the ListPublishers request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineImagesClient) ListPublishersResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result.Value),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSkus gets a list of virtual machine image SKUs for the specified location, publisher, and offer.
|
||||||
|
// Parameters:
|
||||||
|
// location - the name of a supported Azure region.
|
||||||
|
// publisherName - a valid image publisher.
|
||||||
|
// offer - a valid image publisher offer.
|
||||||
|
func (client VirtualMachineImagesClient) ListSkus(ctx context.Context, location string, publisherName string, offer string) (result ListVirtualMachineImageResource, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImagesClient.ListSkus")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.ListSkusPreparer(ctx, location, publisherName, offer)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSkusSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ListSkusResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSkusPreparer prepares the ListSkus request.
|
||||||
|
func (client VirtualMachineImagesClient) ListSkusPreparer(ctx context.Context, location string, publisherName string, offer string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"offer": autorest.Encode("path", offer),
|
||||||
|
"publisherName": autorest.Encode("path", publisherName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSkusSender sends the ListSkus request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineImagesClient) ListSkusSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSkusResponder handles the response to the ListSkus request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineImagesClient) ListSkusResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result.Value),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
244
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineruncommands.go
generated
vendored
Normal file
244
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachineruncommands.go
generated
vendored
Normal file
|
@ -0,0 +1,244 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// VirtualMachineRunCommandsClient is the compute Client
|
||||||
|
type VirtualMachineRunCommandsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineRunCommandsClient creates an instance of the VirtualMachineRunCommandsClient client.
|
||||||
|
func NewVirtualMachineRunCommandsClient(subscriptionID string) VirtualMachineRunCommandsClient {
|
||||||
|
return NewVirtualMachineRunCommandsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineRunCommandsClientWithBaseURI creates an instance of the VirtualMachineRunCommandsClient client.
|
||||||
|
func NewVirtualMachineRunCommandsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineRunCommandsClient {
|
||||||
|
return VirtualMachineRunCommandsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets specific run command for a subscription in a location.
|
||||||
|
// Parameters:
|
||||||
|
// location - the location upon which run commands is queried.
|
||||||
|
// commandID - the command id.
|
||||||
|
func (client VirtualMachineRunCommandsClient) Get(ctx context.Context, location string, commandID string) (result RunCommandDocument, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineRunCommandsClient.Get")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: location,
|
||||||
|
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.VirtualMachineRunCommandsClient", "Get", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.GetPreparer(ctx, location, commandID)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client VirtualMachineRunCommandsClient) GetPreparer(ctx context.Context, location string, commandID string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"commandId": autorest.Encode("path", commandID),
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineRunCommandsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineRunCommandsClient) GetResponder(resp *http.Response) (result RunCommandDocument, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List lists all available run commands for a subscription in a location.
|
||||||
|
// Parameters:
|
||||||
|
// location - the location upon which run commands is queried.
|
||||||
|
func (client VirtualMachineRunCommandsClient) List(ctx context.Context, location string) (result RunCommandListResultPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineRunCommandsClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.rclr.Response.Response != nil {
|
||||||
|
sc = result.rclr.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: location,
|
||||||
|
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.VirtualMachineRunCommandsClient", "List", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx, location)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.rclr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.rclr, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client VirtualMachineRunCommandsClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineRunCommandsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineRunCommandsClient) ListResponder(resp *http.Response) (result RunCommandListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listNextResults retrieves the next set of results, if any.
|
||||||
|
func (client VirtualMachineRunCommandsClient) listNextResults(ctx context.Context, lastResults RunCommandListResult) (result RunCommandListResult, err error) {
|
||||||
|
req, err := lastResults.runCommandListResultPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "listNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client VirtualMachineRunCommandsClient) ListComplete(ctx context.Context, location string) (result RunCommandListResultIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineRunCommandsClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.List(ctx, location)
|
||||||
|
return
|
||||||
|
}
|
1755
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachines.go
generated
vendored
Normal file
1755
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachines.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
400
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesetextensions.go
generated
vendored
Normal file
400
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesetextensions.go
generated
vendored
Normal file
|
@ -0,0 +1,400 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// VirtualMachineScaleSetExtensionsClient is the compute Client
|
||||||
|
type VirtualMachineScaleSetExtensionsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineScaleSetExtensionsClient creates an instance of the VirtualMachineScaleSetExtensionsClient client.
|
||||||
|
func NewVirtualMachineScaleSetExtensionsClient(subscriptionID string) VirtualMachineScaleSetExtensionsClient {
|
||||||
|
return NewVirtualMachineScaleSetExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineScaleSetExtensionsClientWithBaseURI creates an instance of the
|
||||||
|
// VirtualMachineScaleSetExtensionsClient client.
|
||||||
|
func NewVirtualMachineScaleSetExtensionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetExtensionsClient {
|
||||||
|
return VirtualMachineScaleSetExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate the operation to create or update an extension.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// VMScaleSetName - the name of the VM scale set where the extension should be create or updated.
|
||||||
|
// vmssExtensionName - the name of the VM scale set extension.
|
||||||
|
// extensionParameters - parameters supplied to the Create VM scale set Extension operation.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension) (result VirtualMachineScaleSetExtensionsCreateOrUpdateFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetExtensionsClient.CreateOrUpdate")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName, extensionParameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
||||||
|
"vmssExtensionName": autorest.Encode("path", vmssExtensionName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", pathParameters),
|
||||||
|
autorest.WithJSON(extensionParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachineScaleSetExtensionsCreateOrUpdateFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineScaleSetExtension, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete the operation to delete the extension.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// VMScaleSetName - the name of the VM scale set where the extension should be deleted.
|
||||||
|
// vmssExtensionName - the name of the VM scale set extension.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string) (result VirtualMachineScaleSetExtensionsDeleteFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetExtensionsClient.Delete")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
||||||
|
"vmssExtensionName": autorest.Encode("path", vmssExtensionName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) DeleteSender(req *http.Request) (future VirtualMachineScaleSetExtensionsDeleteFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the operation to get the extension.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// VMScaleSetName - the name of the VM scale set containing the extension.
|
||||||
|
// vmssExtensionName - the name of the VM scale set extension.
|
||||||
|
// expand - the expand expression to apply on the operation.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, expand string) (result VirtualMachineScaleSetExtension, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetExtensionsClient.Get")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName, expand)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, expand string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
||||||
|
"vmssExtensionName": autorest.Encode("path", vmssExtensionName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
if len(expand) > 0 {
|
||||||
|
queryParameters["$expand"] = autorest.Encode("query", expand)
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSetExtension, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets a list of all extensions in a VM scale set.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// VMScaleSetName - the name of the VM scale set containing the extension.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) List(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetExtensionListResultPage, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetExtensionsClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.vmsselr.Response.Response != nil {
|
||||||
|
sc = result.vmsselr.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx, resourceGroupName, VMScaleSetName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.vmsselr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.vmsselr, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetExtensionListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listNextResults retrieves the next set of results, if any.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) listNextResults(ctx context.Context, lastResults VirtualMachineScaleSetExtensionListResult) (result VirtualMachineScaleSetExtensionListResult, err error) {
|
||||||
|
req, err := lastResults.virtualMachineScaleSetExtensionListResultPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "listNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) ListComplete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetExtensionListResultIterator, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetExtensionsClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response().Response.Response != nil {
|
||||||
|
sc = result.page.Response().Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
result.page, err = client.List(ctx, resourceGroupName, VMScaleSetName)
|
||||||
|
return
|
||||||
|
}
|
351
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesetrollingupgrades.go
generated
vendored
Normal file
351
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesetrollingupgrades.go
generated
vendored
Normal file
|
@ -0,0 +1,351 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// VirtualMachineScaleSetRollingUpgradesClient is the compute Client
|
||||||
|
type VirtualMachineScaleSetRollingUpgradesClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineScaleSetRollingUpgradesClient creates an instance of the
|
||||||
|
// VirtualMachineScaleSetRollingUpgradesClient client.
|
||||||
|
func NewVirtualMachineScaleSetRollingUpgradesClient(subscriptionID string) VirtualMachineScaleSetRollingUpgradesClient {
|
||||||
|
return NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI creates an instance of the
|
||||||
|
// VirtualMachineScaleSetRollingUpgradesClient client.
|
||||||
|
func NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetRollingUpgradesClient {
|
||||||
|
return VirtualMachineScaleSetRollingUpgradesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cancel cancels the current virtual machine scale set rolling upgrade.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// VMScaleSetName - the name of the VM scale set.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) Cancel(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetRollingUpgradesCancelFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetRollingUpgradesClient.Cancel")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.CancelPreparer(ctx, resourceGroupName, VMScaleSetName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "Cancel", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CancelSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "Cancel", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CancelPreparer prepares the Cancel request.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) CancelPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CancelSender sends the Cancel request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) CancelSender(req *http.Request) (future VirtualMachineScaleSetRollingUpgradesCancelFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CancelResponder handles the response to the Cancel request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLatest gets the status of the latest virtual machine scale set rolling upgrade.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// VMScaleSetName - the name of the VM scale set.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatest(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result RollingUpgradeStatusInfo, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetRollingUpgradesClient.GetLatest")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.GetLatestPreparer(ctx, resourceGroupName, VMScaleSetName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "GetLatest", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetLatestSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "GetLatest", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetLatestResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "GetLatest", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLatestPreparer prepares the GetLatest request.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatestPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLatestSender sends the GetLatest request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatestSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLatestResponder handles the response to the GetLatest request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatestResponder(resp *http.Response) (result RollingUpgradeStatusInfo, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartExtensionUpgrade starts a rolling upgrade to move all extensions for all virtual machine scale set instances to
|
||||||
|
// the latest available extension version. Instances which are already running the latest extension versions are not
|
||||||
|
// affected.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// VMScaleSetName - the name of the VM scale set.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) StartExtensionUpgrade(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetRollingUpgradesClient.StartExtensionUpgrade")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.StartExtensionUpgradePreparer(ctx, resourceGroupName, VMScaleSetName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "StartExtensionUpgrade", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.StartExtensionUpgradeSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "StartExtensionUpgrade", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartExtensionUpgradePreparer prepares the StartExtensionUpgrade request.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) StartExtensionUpgradePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartExtensionUpgradeSender sends the StartExtensionUpgrade request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) StartExtensionUpgradeSender(req *http.Request) (future VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartExtensionUpgradeResponder handles the response to the StartExtensionUpgrade request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) StartExtensionUpgradeResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartOSUpgrade starts a rolling upgrade to move all virtual machine scale set instances to the latest available
|
||||||
|
// Platform Image OS version. Instances which are already running the latest available OS version are not affected.
|
||||||
|
// Parameters:
|
||||||
|
// resourceGroupName - the name of the resource group.
|
||||||
|
// VMScaleSetName - the name of the VM scale set.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgrade(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetRollingUpgradesClient.StartOSUpgrade")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response() != nil {
|
||||||
|
sc = result.Response().StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
req, err := client.StartOSUpgradePreparer(ctx, resourceGroupName, VMScaleSetName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "StartOSUpgrade", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.StartOSUpgradeSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "StartOSUpgrade", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartOSUpgradePreparer prepares the StartOSUpgrade request.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgradePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartOSUpgradeSender sends the StartOSUpgrade request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgradeSender(req *http.Request) (future VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture, err error) {
|
||||||
|
var resp *http.Response
|
||||||
|
resp, err = autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
future.Future, err = azure.NewFutureFromResponse(resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartOSUpgradeResponder handles the response to the StartOSUpgrade request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgradeResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
1905
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesets.go
generated
vendored
Normal file
1905
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesets.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1242
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesetvms.go
generated
vendored
Normal file
1242
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinescalesetvms.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
124
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinesizes.go
generated
vendored
Normal file
124
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute/virtualmachinesizes.go
generated
vendored
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
package compute
|
||||||
|
|
||||||
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// VirtualMachineSizesClient is the compute Client
|
||||||
|
type VirtualMachineSizesClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineSizesClient creates an instance of the VirtualMachineSizesClient client.
|
||||||
|
func NewVirtualMachineSizesClient(subscriptionID string) VirtualMachineSizesClient {
|
||||||
|
return NewVirtualMachineSizesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineSizesClientWithBaseURI creates an instance of the VirtualMachineSizesClient client.
|
||||||
|
func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSizesClient {
|
||||||
|
return VirtualMachineSizesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List this API is deprecated. Use [Resources
|
||||||
|
// Skus](https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list)
|
||||||
|
// Parameters:
|
||||||
|
// location - the location upon which virtual-machine-sizes is queried.
|
||||||
|
func (client VirtualMachineSizesClient) List(ctx context.Context, location string) (result VirtualMachineSizeListResult, err error) {
|
||||||
|
if tracing.IsEnabled() {
|
||||||
|
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineSizesClient.List")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
if result.Response.Response != nil {
|
||||||
|
sc = result.Response.Response.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: location,
|
||||||
|
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.VirtualMachineSizesClient", "List", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.ListPreparer(ctx, location)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client VirtualMachineSizesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2019-03-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineSizesClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineSizesClient) ListResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
|
@ -12,6 +12,7 @@ contrib.go.opencensus.io/exporter/ocagent
|
||||||
github.com/1and1/oneandone-cloudserver-sdk-go
|
github.com/1and1/oneandone-cloudserver-sdk-go
|
||||||
# github.com/Azure/azure-sdk-for-go v30.0.0+incompatible
|
# github.com/Azure/azure-sdk-for-go v30.0.0+incompatible
|
||||||
github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute
|
github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute
|
||||||
|
github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute
|
||||||
github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network
|
github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network
|
||||||
github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources
|
github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources
|
||||||
github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage
|
github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage
|
||||||
|
|
|
@ -135,7 +135,6 @@ Following is an example.
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
||||||
"shared_image_gallery_destination": {
|
"shared_image_gallery_destination": {
|
||||||
"subscription": "00000000-0000-0000-0000-00000000000",
|
|
||||||
"resource_group": "ResourceGroup",
|
"resource_group": "ResourceGroup",
|
||||||
"gallery_name": "GalleryName",
|
"gallery_name": "GalleryName",
|
||||||
"image_name": "ImageName",
|
"image_name": "ImageName",
|
||||||
|
|
Loading…
Reference in New Issue