diff --git a/builder/azure/chroot/builder.go b/builder/azure/chroot/builder.go index ab234783b..8bb4e4284 100644 --- a/builder/azure/chroot/builder.go +++ b/builder/azure/chroot/builder.go @@ -24,10 +24,10 @@ import ( "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" - "github.com/mitchellh/mapstructure" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest/azure" + "github.com/mitchellh/mapstructure" ) // BuilderID is the unique ID for this builder @@ -42,7 +42,10 @@ type Config struct { // When set to `true`, starts with an empty, unpartitioned disk. Defaults to `false`. FromScratch bool `mapstructure:"from_scratch"` - // Either a managed disk resource ID or a publisher:offer:sku:version specifier for plaform image sources. + // One of the following can be used as a source for an image: + // - a shared image version resource ID + // - a managed disk resource ID + // - a publisher:offer:sku:version specifier for plaform image sources. Source string `mapstructure:"source" required:"true"` sourceType sourceType @@ -112,6 +115,7 @@ type sourceType string const ( sourcePlatformImage sourceType = "PlatformImage" sourceDisk sourceType = "Disk" + sourceSharedImage sourceType = "SharedImage" ) // GetContext implements ContextProvider to allow steps to use the config context @@ -246,10 +250,16 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { if _, err := client.ParsePlatformImageURN(b.config.Source); err == nil { log.Println("Source is platform image:", b.config.Source) b.config.sourceType = sourcePlatformImage - } else if id, err := azure.ParseResourceID(b.config.Source); err == nil && - strings.EqualFold(id.Provider, "Microsoft.Compute") && strings.EqualFold(id.ResourceType, "disks") { + } else if id, err := client.ParseResourceID(b.config.Source); err == nil && + strings.EqualFold(id.Provider, "Microsoft.Compute") && + strings.EqualFold(id.ResourceType.String(), "disks") { log.Println("Source is a disk resource ID:", b.config.Source) b.config.sourceType = sourceDisk + } else if id, err := client.ParseResourceID(b.config.Source); err == nil && + strings.EqualFold(id.Provider, "Microsoft.Compute") && + strings.EqualFold(id.ResourceType.String(), "galleries/images/versions") { + log.Println("Source is a shared image ID:", b.config.Source) + b.config.sourceType = sourceSharedImage } else { errs = packer.MultiErrorAppend( errs, fmt.Errorf("source: %q is not a valid platform image specifier, nor is it a disk resource ID", b.config.Source)) @@ -410,7 +420,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack func buildsteps(config Config, info *client.ComputeInfo) []multistep.Step { // Build the steps var steps []multistep.Step - addSteps := func(s ...multistep.Step) { // convenience + addSteps := func(s ...multistep.Step) { // convenience function steps = append(steps, s...) } @@ -477,6 +487,22 @@ func buildsteps(config Config, info *client.ComputeInfo) []multistep.Step { SkipCleanup: config.SkipCleanup, }) + case sourceSharedImage: + addSteps( + &StepVerifySharedImageSource{ + SharedImageID: config.Source, + SubscriptionID: info.SubscriptionID, + Location: info.Location, + }, + &StepCreateNewDisk{ + ResourceID: config.TemporaryOSDiskID, + DiskSizeGB: config.OSDiskSizeGB, + SourceImageResourceID: config.Source, + Location: info.Location, + + SkipCleanup: config.SkipCleanup, + }) + default: panic(fmt.Errorf("Unknown source type: %+q", config.sourceType)) } diff --git a/builder/azure/chroot/builder_test.go b/builder/azure/chroot/builder_test.go index 1b588dbc4..8f01b9969 100644 --- a/builder/azure/chroot/builder_test.go +++ b/builder/azure/chroot/builder_test.go @@ -4,9 +4,10 @@ import ( "strings" "testing" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" "github.com/hashicorp/packer/builder/azure/common/client" "github.com/hashicorp/packer/helper/multistep" + + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" ) func TestBuilder_Prepare(t *testing.T) { @@ -27,6 +28,12 @@ func TestBuilder_Prepare(t *testing.T) { "subscription_id": "789", "source": "credativ:Debian:9:latest", "image_resource_id": "/subscriptions/789/resourceGroups/otherrgname/providers/Microsoft.Compute/images/MyDebianOSImage-{{timestamp}}", + "shared_image_destination": config{ + "resource_group": "otherrgname", + "gallery_name": "myGallery", + "image_name": "imageName", + "image_version": "1.0.2", + }, }, validate: func(c Config) { if c.OSDiskSizeGB != 0 { @@ -85,6 +92,19 @@ func TestBuilder_Prepare(t *testing.T) { }, wantErr: true, }, + { + name: "from shared image", + config: config{ + "shared_image_destination": config{ + "resource_group": "otherrgname", + "gallery_name": "myGallery", + "image_name": "imageName", + "image_version": "1.0.2", + }, + "source": "/subscriptions/789/resourceGroups/testrg/providers/Microsoft.Compute/disks/diskname", + }, + wantErr: false, + }, { name: "err: no output", config: config{ diff --git a/builder/azure/chroot/diskattacher.go b/builder/azure/chroot/diskattacher.go index 5a9af3d54..6440491b7 100644 --- a/builder/azure/chroot/diskattacher.go +++ b/builder/azure/chroot/diskattacher.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/packer/builder/azure/common/client" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/to" ) diff --git a/builder/azure/chroot/diskattacher_test.go b/builder/azure/chroot/diskattacher_test.go index 2ce5b4464..9e617f59b 100644 --- a/builder/azure/chroot/diskattacher_test.go +++ b/builder/azure/chroot/diskattacher_test.go @@ -6,7 +6,7 @@ import ( "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/hashicorp/packer/builder/azure/common/client" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/builder/azure/chroot/step_attach_disk_test.go b/builder/azure/chroot/step_attach_disk_test.go index 87531b278..e14be17e9 100644 --- a/builder/azure/chroot/step_attach_disk_test.go +++ b/builder/azure/chroot/step_attach_disk_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest" "github.com/hashicorp/packer/builder/azure/common/client" "github.com/hashicorp/packer/helper/multistep" diff --git a/builder/azure/chroot/step_create_image.go b/builder/azure/chroot/step_create_image.go index 2d08e5280..76dfcf5a4 100644 --- a/builder/azure/chroot/step_create_image.go +++ b/builder/azure/chroot/step_create_image.go @@ -5,7 +5,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/to" "github.com/hashicorp/packer/builder/azure/common/client" diff --git a/builder/azure/chroot/step_create_new_disk.go b/builder/azure/chroot/step_create_new_disk.go index 5ed688b67..0a0a2615d 100644 --- a/builder/azure/chroot/step_create_new_disk.go +++ b/builder/azure/chroot/step_create_new_disk.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/to" "github.com/hashicorp/packer/builder/azure/common/client" @@ -30,6 +30,8 @@ type StepCreateNewDisk struct { SourceDiskResourceID string + SourceImageResourceID string + SkipCleanup bool } @@ -67,34 +69,44 @@ func (s *StepCreateNewDisk) Run(ctx context.Context, state multistep.StateBag) m disk := compute.Disk{ Location: to.StringPtr(s.Location), - Sku: &compute.DiskSku{ - Name: compute.DiskStorageAccountTypes(s.DiskStorageAccountType), - }, - //Zones: nil, DiskProperties: &compute.DiskProperties{ - OsType: "Linux", - HyperVGeneration: compute.HyperVGeneration(s.HyperVGeneration), - CreationData: &compute.CreationData{}, + OsType: "Linux", + CreationData: &compute.CreationData{}, }, - //Tags: map[string]*string{ + } + + if s.DiskStorageAccountType != "" { + disk.Sku = &compute.DiskSku{ + Name: compute.DiskStorageAccountTypes(s.DiskStorageAccountType), + } + } + + if s.HyperVGeneration != "" { + disk.DiskProperties.HyperVGeneration = compute.HyperVGeneration(s.HyperVGeneration) } if s.DiskSizeGB > 0 { disk.DiskProperties.DiskSizeGB = to.Int32Ptr(s.DiskSizeGB) } - if s.SourceDiskResourceID != "" { - disk.CreationData.CreateOption = compute.Copy - disk.CreationData.SourceResourceID = to.StringPtr(s.SourceDiskResourceID) - } else if s.PlatformImage == nil { - disk.CreationData.CreateOption = compute.Empty - } else { + switch { + case s.PlatformImage != nil: disk.CreationData.CreateOption = compute.FromImage disk.CreationData.ImageReference = &compute.ImageDiskReference{ ID: to.StringPtr(fmt.Sprintf( "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/publishers/%s/artifacttypes/vmimage/offers/%s/skus/%s/versions/%s", s.subscriptionID, s.Location, s.PlatformImage.Publisher, s.PlatformImage.Offer, s.PlatformImage.Sku, s.PlatformImage.Version)), } + case s.SourceDiskResourceID != "": + disk.CreationData.CreateOption = compute.Copy + disk.CreationData.SourceResourceID = to.StringPtr(s.SourceDiskResourceID) + case s.SourceImageResourceID != "": + disk.CreationData.CreateOption = compute.FromImage + disk.CreationData.GalleryImageReference = &compute.ImageDiskReference{ + ID: to.StringPtr(s.SourceImageResourceID), + } + default: + disk.CreationData.CreateOption = compute.Empty } f, err := azcli.DisksClient().CreateOrUpdate(ctx, s.resourceGroup, s.diskName, disk) diff --git a/builder/azure/chroot/step_create_new_disk_test.go b/builder/azure/chroot/step_create_new_disk_test.go index b82d68358..64739150a 100644 --- a/builder/azure/chroot/step_create_new_disk_test.go +++ b/builder/azure/chroot/step_create_new_disk_test.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest" ) diff --git a/builder/azure/chroot/step_create_shared_image_version.go b/builder/azure/chroot/step_create_shared_image_version.go index 3042d992b..88da684b4 100644 --- a/builder/azure/chroot/step_create_shared_image_version.go +++ b/builder/azure/chroot/step_create_shared_image_version.go @@ -4,8 +4,9 @@ import ( "context" "fmt" "log" + "time" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest/to" "github.com/hashicorp/packer/builder/azure/common/client" "github.com/hashicorp/packer/helper/multistep" @@ -63,7 +64,11 @@ func (s *StepCreateSharedImageVersion) Run(ctx context.Context, state multistep. imageVersion) if err == nil { log.Println("Shared image version creation in process...") - err = f.WaitForCompletionRef(ctx, azcli.PollClient()) + pollClient := azcli.PollClient() + pollClient.PollingDelay = 10 * time.Second + ctx, cancel := context.WithTimeout(ctx, time.Hour*12) + defer cancel() + err = f.WaitForCompletionRef(ctx, pollClient) } if err != nil { log.Printf("StepCreateSharedImageVersion.Run: error: %+v", err) diff --git a/builder/azure/chroot/step_create_shared_image_version_test.go b/builder/azure/chroot/step_create_shared_image_version_test.go index dc79b4da5..5721a978e 100644 --- a/builder/azure/chroot/step_create_shared_image_version_test.go +++ b/builder/azure/chroot/step_create_shared_image_version_test.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest" ) diff --git a/builder/azure/chroot/step_create_snapshot.go b/builder/azure/chroot/step_create_snapshot.go index 61ff36e9c..3f6bfceac 100644 --- a/builder/azure/chroot/step_create_snapshot.go +++ b/builder/azure/chroot/step_create_snapshot.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/to" ) @@ -73,9 +73,11 @@ func (s *StepCreateSnapshot) Run(ctx context.Context, state multistep.StateBag) f, err := azcli.SnapshotsClient().CreateOrUpdate(ctx, s.resourceGroup, s.snapshotName, snapshot) if err == nil { - cli := azcli.PollClient() // quick polling for quick operations - cli.PollingDelay = time.Second - err = f.WaitForCompletionRef(ctx, cli) + pollClient := azcli.PollClient() + pollClient.PollingDelay = 2 * time.Second + ctx, cancel := context.WithTimeout(ctx, time.Hour*12) + defer cancel() + err = f.WaitForCompletionRef(ctx, pollClient) } if err != nil { log.Printf("StepCreateSnapshot.Run: error: %+v", err) diff --git a/builder/azure/chroot/step_create_snapshot_test.go b/builder/azure/chroot/step_create_snapshot_test.go index 8734f83e8..40ccf3419 100644 --- a/builder/azure/chroot/step_create_snapshot_test.go +++ b/builder/azure/chroot/step_create_snapshot_test.go @@ -9,11 +9,12 @@ import ( "strings" "testing" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" - "github.com/Azure/go-autorest/autorest" "github.com/hashicorp/packer/builder/azure/common/client" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" + + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" + "github.com/Azure/go-autorest/autorest" ) func Test_parseSnapshotResourceID(t *testing.T) { @@ -176,13 +177,13 @@ func TestStepCreateSnapshot_Cleanup(t *testing.T) { m := compute.NewSnapshotsClient("subscriptionId") { expectedCalls := []string{ - "POST /subscriptions/subscriptionId/resourceGroups/rg/providers/Microsoft.Compute/snapshots/snap1/endGetAccess?api-version=2019-07-01", - "DELETE /subscriptions/subscriptionId/resourceGroups/rg/providers/Microsoft.Compute/snapshots/snap1?api-version=2019-07-01", + "POST /subscriptions/subscriptionId/resourceGroups/rg/providers/Microsoft.Compute/snapshots/snap1/endGetAccess", + "DELETE /subscriptions/subscriptionId/resourceGroups/rg/providers/Microsoft.Compute/snapshots/snap1", } i := 0 m.Sender = autorest.SenderFunc(func(r *http.Request) (*http.Response, error) { want := expectedCalls[i] - got := r.Method + " " + r.URL.RequestURI() + got := r.Method + " " + r.URL.Path if want != got { t.Errorf("unexpected HTTP call: %v, wanted %v", got, want) return &http.Response{ diff --git a/builder/azure/chroot/step_resolve_plaform_image_version_test.go b/builder/azure/chroot/step_resolve_plaform_image_version_test.go index 77210b1a9..0030b8090 100644 --- a/builder/azure/chroot/step_resolve_plaform_image_version_test.go +++ b/builder/azure/chroot/step_resolve_plaform_image_version_test.go @@ -8,10 +8,11 @@ import ( "testing" "time" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" - "github.com/Azure/go-autorest/autorest" "github.com/hashicorp/packer/builder/azure/common/client" "github.com/hashicorp/packer/helper/multistep" + + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" + "github.com/Azure/go-autorest/autorest" ) func TestStepResolvePlatformImageVersion_Run(t *testing.T) { diff --git a/builder/azure/chroot/step_verify_shared_image_destination.go b/builder/azure/chroot/step_verify_shared_image_destination.go index 481c24b63..7877948fe 100644 --- a/builder/azure/chroot/step_verify_shared_image_destination.go +++ b/builder/azure/chroot/step_verify_shared_image_destination.go @@ -6,7 +6,7 @@ import ( "log" "strings" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest/to" "github.com/hashicorp/packer/builder/azure/common/client" "github.com/hashicorp/packer/helper/multistep" diff --git a/builder/azure/chroot/step_verify_shared_image_destination_test.go b/builder/azure/chroot/step_verify_shared_image_destination_test.go index 9ff8a7c00..b34d24840 100644 --- a/builder/azure/chroot/step_verify_shared_image_destination_test.go +++ b/builder/azure/chroot/step_verify_shared_image_destination_test.go @@ -8,11 +8,12 @@ import ( "strings" "testing" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" - "github.com/Azure/go-autorest/autorest" "github.com/hashicorp/packer/builder/azure/common/client" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" + + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" + "github.com/Azure/go-autorest/autorest" ) func TestStepVerifySharedImageDestination_Run(t *testing.T) { diff --git a/builder/azure/chroot/step_verify_shared_image_source.go b/builder/azure/chroot/step_verify_shared_image_source.go new file mode 100644 index 000000000..ff64a565a --- /dev/null +++ b/builder/azure/chroot/step_verify_shared_image_source.go @@ -0,0 +1,126 @@ +package chroot + +import ( + "context" + "fmt" + "log" + "strings" + + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" + "github.com/Azure/go-autorest/autorest/to" + "github.com/hashicorp/packer/builder/azure/common/client" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +var _ multistep.Step = &StepVerifySharedImageSource{} + +// StepVerifySharedImageSource verifies that the shared image location matches the Location field in the step. +// Also verifies that the OS Type is Linux. +type StepVerifySharedImageSource struct { + SharedImageID string + SubscriptionID string + Location string +} + +// Run retrieves the image metadata from Azure and compares the location to Location. Verifies the OS Type. +func (s *StepVerifySharedImageSource) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + azcli := state.Get("azureclient").(client.AzureClientSet) + ui := state.Get("ui").(packer.Ui) + + errorMessage := func(message string, parameters ...interface{}) multistep.StepAction { + err := fmt.Errorf(message, parameters...) + log.Printf("StepVerifySharedImageSource.Run: error: %+v", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + resource, err := client.ParseResourceID(s.SharedImageID) + if err != nil { + return errorMessage("Could not parse resource id %q: %w", s.SharedImageID, err) + } + + if !strings.EqualFold(resource.Provider, "Microsoft.Compute") || + !strings.EqualFold(resource.ResourceType.String(), "galleries/images/versions") { + return errorMessage("Resource id %q does not identify a shared image version, expected Microsoft.Compute/galleries/images/versions", s.SharedImageID) + } + + ui.Say(fmt.Sprintf("Validating that shared image version %q exists", + s.SharedImageID)) + + version, err := azcli.GalleryImageVersionsClient().Get(ctx, + resource.ResourceGroup, + resource.ResourceName[0], + resource.ResourceName[1], + resource.ResourceName[2], + "") + + if err != nil { + return errorMessage("Error retrieving shared image version %q: %+v ", s.SharedImageID, err) + } + + if version.ID == nil || *version.ID == "" { + return errorMessage("Error retrieving shared image version %q: ID field in response is empty", s.SharedImageID) + } + + if version.GalleryImageVersionProperties == nil || + version.GalleryImageVersionProperties.PublishingProfile == nil || + version.GalleryImageVersionProperties.PublishingProfile.TargetRegions == nil { + return errorMessage("Could not retrieve shared image version properties for image %q.", s.SharedImageID) + } + + targetLocations := make([]string, 0, len(*version.GalleryImageVersionProperties.PublishingProfile.TargetRegions)) + vmLocation := client.NormalizeLocation(s.Location) + locationFound := false + for _, tr := range *version.GalleryImageVersionProperties.PublishingProfile.TargetRegions { + l := to.String(tr.Name) + l = client.NormalizeLocation(l) + targetLocations = append(targetLocations, l) + if strings.EqualFold(vmLocation, l) { + locationFound = true + break + } + } + if !locationFound { + return errorMessage("Target locations %q for %q does not include VM location %q", + targetLocations, s.SharedImageID, vmLocation) + } + + imageResource, _ := resource.Parent() + image, err := azcli.GalleryImagesClient().Get(ctx, + resource.ResourceGroup, + resource.ResourceName[0], + resource.ResourceName[1]) + + if err != nil { + return errorMessage("Error retrieving shared image %q: %+v ", imageResource.String(), err) + } + + if image.ID == nil || *image.ID == "" { + return errorMessage("Error retrieving shared image %q: ID field in response is empty", imageResource.String()) + } + + if image.GalleryImageProperties == nil { + return errorMessage("Could not retrieve shared image properties for image %q.", imageResource.String()) + } + + log.Printf("StepVerifySharedImageSource:Run: Image %q, HvGen: %q, osState: %q", + to.String(image.ID), + image.GalleryImageProperties.HyperVGeneration, + image.GalleryImageProperties.OsState) + + if image.GalleryImageProperties.OsType != compute.Linux { + return errorMessage("The shared image (%q) is not a Linux image (found %q). Currently only Linux images are supported.", + to.String(image.ID), + image.GalleryImageProperties.OsType) + } + + ui.Say(fmt.Sprintf("Found image source image version %q, available in location %s", + s.SharedImageID, + s.Location)) + + return multistep.ActionContinue +} + +func (*StepVerifySharedImageSource) Cleanup(multistep.StateBag) {} diff --git a/builder/azure/chroot/step_verify_shared_image_source_test.go b/builder/azure/chroot/step_verify_shared_image_source_test.go new file mode 100644 index 000000000..69ad4065d --- /dev/null +++ b/builder/azure/chroot/step_verify_shared_image_source_test.go @@ -0,0 +1,188 @@ +package chroot + +import ( + "context" + "io/ioutil" + "net/http" + "reflect" + "regexp" + "strings" + "testing" + + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" + "github.com/Azure/go-autorest/autorest" + "github.com/hashicorp/packer/builder/azure/common/client" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" +) + +func TestStepVerifySharedImageSource_Run(t *testing.T) { + type fields struct { + SharedImageID string + SubscriptionID string + Location string + } + tests := []struct { + name string + fields fields + want multistep.StepAction + wantErr string + }{ + { + name: "happy path", + fields: fields{ + SharedImageID: "/subscriptions/subscriptionID/resourceGroups/rg/providers/Microsoft.Compute/galleries/myGallery/images/myImage/versions/1.2.3", + Location: "VM location", + }, + }, + { + name: "resource is not a shared image", + fields: fields{ + SharedImageID: "/subscriptions/subscriptionID/resourceGroups/rg/providers/Microsoft.Compute/disks/myDisk", + Location: "VM location", + }, + want: multistep.ActionHalt, + wantErr: "does not identify a shared image version", + }, + { + name: "error in resource id", + fields: fields{ + SharedImageID: "not-a-resource-id", + }, + want: multistep.ActionHalt, + wantErr: "Could not parse resource id", + }, + { + name: "wrong location", + fields: fields{ + SharedImageID: "/subscriptions/subscriptionID/resourceGroups/rg/providers/Microsoft.Compute/galleries/myGallery/images/myImage/versions/1.2.3", + Location: "other location", + }, + want: multistep.ActionHalt, + wantErr: "does not include VM location", + }, + { + name: "image not found", + fields: fields{ + SharedImageID: "/subscriptions/subscriptionID/resourceGroups/rg/providers/Microsoft.Compute/galleries/myGallery/images/myImage/versions/2.3.4", + Location: "vm location", + }, + want: multistep.ActionHalt, + wantErr: "Error retrieving shared image version", + }, + { + name: "windows image", + fields: fields{ + SharedImageID: "/subscriptions/subscriptionID/resourceGroups/rg/providers/Microsoft.Compute/galleries/myGallery/images/windowsImage/versions/1.2.3", + Location: "VM location", + }, + want: multistep.ActionHalt, + wantErr: "not a Linux image", + }, + } + for _, tt := range tests { + giv := compute.NewGalleryImageVersionsClient("subscriptionID") + giv.Sender = autorest.SenderFunc(func(r *http.Request) (*http.Response, error) { + if r.Method == "GET" { + switch { + case strings.HasSuffix(r.URL.Path, "/versions/1.2.3"): + return &http.Response{ + Request: r, + Body: ioutil.NopCloser(strings.NewReader(`{ + "id": "image-version-id", + "properties": { + "publishingProfile": { + "targetRegions": [ + { "name": "vm Location" } + ] + } + } + }`)), + StatusCode: 200, + }, nil + case regexp.MustCompile(`(?i)^/subscriptions/subscriptionID/resourceGroups/rg/providers/Microsoft.Compute/galleries/myGallery/images/myImage/versions/\d+\.\d+\.\d+$`). + MatchString(r.URL.Path): + return &http.Response{ + Request: r, + Body: ioutil.NopCloser(strings.NewReader(`{"error":{"code":"NotFound"}}`)), + StatusCode: 404, + }, nil + } + } + + t.Errorf("Unexpected HTTP call: %s %s", r.Method, r.URL.RequestURI()) + return &http.Response{ + Request: r, + Status: "Unexpected HTTP call", + Body: ioutil.NopCloser(strings.NewReader(`{"code":"TestError"}`)), + StatusCode: 599, + }, nil + }) + + gi := compute.NewGalleryImagesClient("subscriptionID") + gi.Sender = autorest.SenderFunc(func(r *http.Request) (*http.Response, error) { + if r.Method == "GET" { + switch { + case strings.HasSuffix(r.URL.Path, "/images/myImage"): + return &http.Response{ + Request: r, + Body: ioutil.NopCloser(strings.NewReader(`{ + "id": "image-id", + "properties": { + "osType": "Linux" + } + }`)), + StatusCode: 200, + }, nil + case strings.HasSuffix(r.URL.Path, "/images/windowsImage"): + return &http.Response{ + Request: r, + Body: ioutil.NopCloser(strings.NewReader(`{ + "id": "image-id", + "properties": { + "osType": "Windows" + } + }`)), + StatusCode: 200, + }, nil + } + } + + t.Errorf("Unexpected HTTP call: %s %s", r.Method, r.URL.RequestURI()) + return &http.Response{ + Request: r, + Status: "Unexpected HTTP call", + Body: ioutil.NopCloser(strings.NewReader(`{"error":{"code":"TestError"}}`)), + StatusCode: 599, + }, nil + }) + + state := new(multistep.BasicStateBag) + state.Put("azureclient", &client.AzureClientSetMock{ + SubscriptionIDMock: "subscriptionID", + GalleryImageVersionsClientMock: giv, + GalleryImagesClientMock: gi, + }) + state.Put("ui", packer.TestUi(t)) + + t.Run(tt.name, func(t *testing.T) { + s := &StepVerifySharedImageSource{ + SharedImageID: tt.fields.SharedImageID, + SubscriptionID: tt.fields.SubscriptionID, + Location: tt.fields.Location, + } + if got := s.Run(context.TODO(), state); !reflect.DeepEqual(got, tt.want) { + t.Errorf("StepVerifySharedImageSource.Run() = %v, want %v", got, tt.want) + } + d, _ := state.GetOk("error") + err, _ := d.(error) + if tt.wantErr != "" { + if !strings.Contains(err.Error(), tt.wantErr) { + t.Errorf("Wanted error %q, got %q", tt.wantErr, err) + } + } else if err != nil && err.Error() != "" { + t.Errorf("Unexpected error: %v", err) + } + }) + } +} diff --git a/builder/azure/chroot/step_verify_source_disk_test.go b/builder/azure/chroot/step_verify_source_disk_test.go index 77fefd890..dd3732b10 100644 --- a/builder/azure/chroot/step_verify_source_disk_test.go +++ b/builder/azure/chroot/step_verify_source_disk_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest" "github.com/hashicorp/packer/builder/azure/common/client" "github.com/hashicorp/packer/helper/multistep" diff --git a/builder/azure/common/client/azure_client_set.go b/builder/azure/common/client/azure_client_set.go index 4fac8e804..04fb6a473 100644 --- a/builder/azure/common/client/azure_client_set.go +++ b/builder/azure/common/client/azure_client_set.go @@ -7,8 +7,8 @@ import ( "github.com/hashicorp/packer/helper/useragent" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/computeapi" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/computeapi" "github.com/Azure/go-autorest/autorest" ) diff --git a/builder/azure/common/client/azure_client_set_mock.go b/builder/azure/common/client/azure_client_set_mock.go index 0eeab6b2c..b13b79ed6 100644 --- a/builder/azure/common/client/azure_client_set_mock.go +++ b/builder/azure/common/client/azure_client_set_mock.go @@ -1,7 +1,7 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/computeapi" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/computeapi" "github.com/Azure/go-autorest/autorest" ) diff --git a/builder/azure/common/client/normalize_location.go b/builder/azure/common/client/normalize_location.go new file mode 100644 index 000000000..6a82d73f1 --- /dev/null +++ b/builder/azure/common/client/normalize_location.go @@ -0,0 +1,9 @@ +package client + +import "strings" + +// NormalizeLocation returns a normalized location string. +// Strings are converted to lower case and spaces are removed. +func NormalizeLocation(loc string) string { + return strings.ReplaceAll(strings.ToLower(loc), " ", "") +} diff --git a/builder/azure/common/client/normalize_location_test.go b/builder/azure/common/client/normalize_location_test.go new file mode 100644 index 000000000..adec5aa04 --- /dev/null +++ b/builder/azure/common/client/normalize_location_test.go @@ -0,0 +1,22 @@ +package client + +import "testing" + +func TestNormalizeLocation(t *testing.T) { + tests := []struct { + name string + loc string + want string + }{ + {"removes spaces", " with spaces ", "withspaces"}, + {"makes lowercase", "MiXed Case", "mixedcase"}, + {"North East US", "North East US", "northeastus"}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := NormalizeLocation(tt.loc); got != tt.want { + t.Errorf("NormalizeLocation() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/builder/azure/common/client/platform_image.go b/builder/azure/common/client/platform_image.go index a1c88ecbe..d2e798def 100644 --- a/builder/azure/common/client/platform_image.go +++ b/builder/azure/common/client/platform_image.go @@ -6,8 +6,8 @@ import ( "regexp" "strings" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/computeapi" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/computeapi" "github.com/Azure/go-autorest/autorest/to" ) diff --git a/builder/azure/common/client/resource.go b/builder/azure/common/client/resource.go new file mode 100644 index 000000000..db1163fa4 --- /dev/null +++ b/builder/azure/common/client/resource.go @@ -0,0 +1,125 @@ +package client + +import ( + "errors" + "fmt" + "strings" +) + +// ParseResourceID parses an Azure resource ID +func ParseResourceID(resourceID string) (Resource, error) { + resourceID = strings.Trim(resourceID, "/") + segments := strings.Split(resourceID, "/") + if len(segments)%2 != 0 { + return Resource{}, errors.New("Expected even number of segments") + } + + npairs := len(segments) / 2 + + keys := make([]string, npairs) + values := make([]string, npairs) + for i := 0; i < len(segments); i += 2 { + keys[i/2] = segments[i] + values[i/2] = segments[i+1] + + if keys[i/2] == "" { + return Resource{}, fmt.Errorf("Found empty segment (%d)", i) + } + if values[i/2] == "" { + return Resource{}, fmt.Errorf("Found empty segment (%d)", i+1) + } + } + + if !strings.EqualFold(keys[0], "subscriptions") { + return Resource{}, fmt.Errorf("Expected first segment to be 'subscriptions', but found %q", keys[0]) + } + + if !strings.EqualFold(keys[1], "resourceGroups") { + return Resource{}, fmt.Errorf("Expected second segment to be 'resourceGroups', but found %q", keys[1]) + } + + if !strings.EqualFold(keys[2], "providers") { + return Resource{}, fmt.Errorf("Expected third segment to be 'providers', but found %q", keys[1]) + } + + r := Resource{ + values[0], + values[1], + values[2], + CompoundName(keys[3:]), + CompoundName(values[3:]), + } + if err := r.Validate(); err != nil { + return Resource{}, fmt.Errorf("Error validating resource: %w", err) + } + + return r, nil +} + +type Resource struct { + Subscription string + ResourceGroup string + Provider string + ResourceType CompoundName + ResourceName CompoundName +} + +func (r Resource) String() string { + return fmt.Sprintf( + "/subscriptions/%s"+ + "/resourceGroups/%s"+ + "/providers/%s"+ + "/%s", + r.Subscription, + r.ResourceGroup, + r.Provider, + strings.Join(zipstrings(r.ResourceType, r.ResourceName), "/")) +} + +func (r Resource) Validate() error { + if r.Subscription == "" { + return errors.New("subscription is not set") + } + if r.ResourceGroup == "" { + return errors.New("resource group is not set") + } + if r.Provider == "" { + return errors.New("provider is not set") + } + if len(r.ResourceType) > len(r.ResourceName) { + return errors.New("not enough values in resource name") + } + if len(r.ResourceType) < len(r.ResourceName) { + return errors.New("too many values in resource name") + } + return nil +} + +// Parent produces a resource ID representing the parent resource if this is a child resource +func (r Resource) Parent() (Resource, error) { + newLen := len(r.ResourceType) - 1 + if newLen == 0 { + return Resource{}, errors.New("Top-level resource has no parent") + } + return Resource{ + Subscription: r.Subscription, + ResourceGroup: r.ResourceGroup, + Provider: r.Provider, + ResourceType: r.ResourceType[:newLen], + ResourceName: r.ResourceName[:newLen], + }, nil +} + +type CompoundName []string + +func (n CompoundName) String() string { + return strings.Join(n, "/") +} + +func zipstrings(a []string, b []string) []string { + c := make([]string, 0, len(a)+len(b)) + for i := 0; i < len(a) && i < len(b); i++ { + c = append(c, a[i], b[i]) + } + return c +} diff --git a/builder/azure/common/client/resource_test.go b/builder/azure/common/client/resource_test.go new file mode 100644 index 000000000..10084ef15 --- /dev/null +++ b/builder/azure/common/client/resource_test.go @@ -0,0 +1,188 @@ +package client + +import ( + "reflect" + "testing" +) + +func TestParseResourceID(t *testing.T) { + tests := []struct { + name string + resourceID string + want Resource + wantErr bool + }{ + { + name: "happy path", + resourceID: "/subscriptions/17c60680-0e49-465b-aa54-ece043ce5571/resourceGroups/rg/providers/Microsoft.Resources/resources/resource", + want: Resource{ + Subscription: "17c60680-0e49-465b-aa54-ece043ce5571", + ResourceGroup: "rg", + Provider: "Microsoft.Resources", + ResourceType: CompoundName{"resources"}, + ResourceName: CompoundName{"resource"}, + }, + }, + { + name: "sub resource", + resourceID: "/subscriptions/17c60680-0e49-465b-aa54-ece043ce5571/resourcegroups/rg/providers/Microsoft.Resources/resources/resource/subResources/child", + want: Resource{ + Subscription: "17c60680-0e49-465b-aa54-ece043ce5571", + ResourceGroup: "rg", + Provider: "Microsoft.Resources", + ResourceType: CompoundName{"resources", "subResources"}, + ResourceName: CompoundName{"resource", "child"}, + }, + }, + { + name: "incomplete", + resourceID: "/subscriptions/17c60680-0e49-465b-aa54-ece043ce5571/resourceGroups/rg/providers/Microsoft.Resources/resources/resource/subResources", + wantErr: true, + }, + { + name: "incomplete 2", + resourceID: "/subscriptions/17c60680-0e49-465b-aa54-ece043ce5571/resourceGroups/rg/providers/Microsoft.Resources/resources/", + wantErr: true, + }, + { + name: "extra slash", + resourceID: "/subscriptions/17c60680-0e49-465b-aa54-ece043ce5571/resourceGroups/rg/providers/Microsoft.Resources/resources//resources", + wantErr: true, + }, + { + name: "empty resource name", + resourceID: "/subscriptions/17c60680-0e49-465b-aa54-ece043ce5571/resourceGroups/rg/providers/Microsoft.Resources/resources//subresources/child", + wantErr: true, + }, + { + name: "empty sub resource type", + resourceID: "/subscriptions/17c60680-0e49-465b-aa54-ece043ce5571/resourceGroups/rg/providers/Microsoft.Resources/resources/resource//child", + wantErr: true, + }, + { + name: "ungrouped resource path", + resourceID: "/subscriptions/17c60680-0e49-465b-aa54-ece043ce5571/providers/Microsoft.Resources/resources/resource", + wantErr: true, + }, + { + name: "misspelled subscriptions", + resourceID: "/subscription/17c60680-0e49-465b-aa54-ece043ce5571/resourceGroups/rg/providers/Microsoft.Resources/resources/resource/subResources/child", + wantErr: true, + }, + { + name: "misspelled resourceGroups", + resourceID: "/subscriptions/17c60680-0e49-465b-aa54-ece043ce5571/resourceGroup/rg/providers/Microsoft.Resources/resources/resource/subResources/child", + wantErr: true, + }, + { + name: "misspelled providers", + resourceID: "/subscriptions/17c60680-0e49-465b-aa54-ece043ce5571/resourceGroups/rg/provider/Microsoft.Resources/resources/resource/subResources/child", + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := ParseResourceID(tt.resourceID) + if (err != nil) != tt.wantErr { + t.Errorf("ParseResourceID() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("ParseResourceID() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestResource_String(t *testing.T) { + type fields struct { + Subscription string + ResourceGroup string + Provider string + ResourceType CompoundName + ResourceName CompoundName + } + tests := []struct { + name string + fields fields + want string + }{ + { + name: "happy path", + fields: fields{ + Subscription: "sub", + ResourceGroup: "rg", + Provider: "provider", + ResourceType: CompoundName{"type"}, + ResourceName: CompoundName{"name"}, + }, + want: "/subscriptions/sub/resourceGroups/rg/providers/provider/type/name", + }, + { + name: "happy path - child resource", + fields: fields{ + Subscription: "sub", + ResourceGroup: "rg", + Provider: "provider", + ResourceType: CompoundName{"type", "sub"}, + ResourceName: CompoundName{"name", "child"}, + }, + want: "/subscriptions/sub/resourceGroups/rg/providers/provider/type/name/sub/child", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + r := Resource{ + Subscription: tt.fields.Subscription, + ResourceGroup: tt.fields.ResourceGroup, + Provider: tt.fields.Provider, + ResourceType: tt.fields.ResourceType, + ResourceName: tt.fields.ResourceName, + } + if got := r.String(); got != tt.want { + t.Errorf("Resource.String() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestResource_Parent(t *testing.T) { + tests := []struct { + name string + resourceID string + want string + wantErr bool + }{ + { + name: "happy path", + resourceID: "/subscriptions/17c60680-0e49-465b-aa54-ece043ce5571/resourceGroups/rg/providers/Microsoft.Resources/resources/resource/sub/child", + want: "/subscriptions/17c60680-0e49-465b-aa54-ece043ce5571/resourceGroups/rg/providers/Microsoft.Resources/resources/resource", + }, + { + name: "sub sub", + resourceID: "/subscriptions/17c60680-0e49-465b-aa54-ece043ce5571/resourceGroups/rg/providers/Microsoft.Resources/resources/resource/sub/child/subsub/grandchild", + want: "/subscriptions/17c60680-0e49-465b-aa54-ece043ce5571/resourceGroups/rg/providers/Microsoft.Resources/resources/resource/sub/child", + }, + { + name: "top level resource", + resourceID: "/subscriptions/17c60680-0e49-465b-aa54-ece043ce5571/resourceGroups/rg/providers/Microsoft.Resources/resources/resource", + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + r, err := ParseResourceID(tt.resourceID) + if err != nil { + t.Fatalf("Error parsing test resource: %v", err) + } + got, err := r.Parent() + if (err != nil) != tt.wantErr { + t.Errorf("Resource.Parent() error = %v, wantErr %v", err, tt.wantErr) + return + } + if err == nil && got.String() != tt.want { + t.Errorf("Resource.Parent() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/availabilitysets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/availabilitysets.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/availabilitysets.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/availabilitysets.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/client.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/client.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/computeapi/interfaces.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/computeapi/interfaces.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/computeapi/interfaces.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/computeapi/interfaces.go index e1a7ce40a..7f435b9d4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/computeapi/interfaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/computeapi/interfaces.go @@ -19,7 +19,7 @@ package computeapi import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest" ) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/containerservices.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/containerservices.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/containerservices.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/containerservices.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/dedicatedhostgroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/dedicatedhostgroups.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/dedicatedhostgroups.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/dedicatedhostgroups.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/dedicatedhosts.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/dedicatedhosts.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/dedicatedhosts.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/dedicatedhosts.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/diskencryptionsets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/diskencryptionsets.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/diskencryptionsets.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/diskencryptionsets.go index a6013cb97..12874d026 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/diskencryptionsets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/diskencryptionsets.go @@ -96,7 +96,7 @@ func (client DiskEncryptionSetsClient) CreateOrUpdatePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -176,7 +176,7 @@ func (client DiskEncryptionSetsClient) DeletePreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -259,7 +259,7 @@ func (client DiskEncryptionSetsClient) GetPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -331,7 +331,7 @@ func (client DiskEncryptionSetsClient) ListPreparer(ctx context.Context) (*http. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -443,7 +443,7 @@ func (client DiskEncryptionSetsClient) ListByResourceGroupPreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -554,7 +554,7 @@ func (client DiskEncryptionSetsClient) UpdatePreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/disks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/disks.go similarity index 98% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/disks.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/disks.go index fc2d8e052..420deb654 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/disks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/disks.go @@ -66,6 +66,8 @@ func (client DisksClient) CreateOrUpdate(ctx context.Context, resourceGroupName 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.CreationData.GalleryImageReference", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "disk.DiskProperties.CreationData.GalleryImageReference.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}}}, @@ -96,12 +98,13 @@ func (client DisksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } disk.ManagedBy = nil + disk.ManagedByExtended = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), @@ -177,7 +180,7 @@ func (client DisksClient) DeletePreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -260,7 +263,7 @@ func (client DisksClient) GetPreparer(ctx context.Context, resourceGroupName str "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -339,7 +342,7 @@ func (client DisksClient) GrantAccessPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -419,7 +422,7 @@ func (client DisksClient) ListPreparer(ctx context.Context) (*http.Request, erro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -531,7 +534,7 @@ func (client DisksClient) ListByResourceGroupPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -640,7 +643,7 @@ func (client DisksClient) RevokeAccessPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -718,7 +721,7 @@ func (client DisksClient) UpdatePreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/galleries.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/galleries.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/galleries.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/galleries.go index f9e53940b..e4f6dad92 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/galleries.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/galleries.go @@ -81,7 +81,7 @@ func (client GalleriesClient) CreateOrUpdatePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -159,7 +159,7 @@ func (client GalleriesClient) DeletePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -240,7 +240,7 @@ func (client GalleriesClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -312,7 +312,7 @@ func (client GalleriesClient) ListPreparer(ctx context.Context) (*http.Request, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -424,7 +424,7 @@ func (client GalleriesClient) ListByResourceGroupPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -533,7 +533,7 @@ func (client GalleriesClient) UpdatePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/galleryapplications.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/galleryapplications.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/galleryapplications.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/galleryapplications.go index 5c17994e5..1968d2533 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/galleryapplications.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/galleryapplications.go @@ -86,7 +86,7 @@ func (client GalleryApplicationsClient) CreateOrUpdatePreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -167,7 +167,7 @@ func (client GalleryApplicationsClient) DeletePreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -251,7 +251,7 @@ func (client GalleryApplicationsClient) GetPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -329,7 +329,7 @@ func (client GalleryApplicationsClient) ListByGalleryPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -442,7 +442,7 @@ func (client GalleryApplicationsClient) UpdatePreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/galleryapplicationversions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/galleryapplicationversions.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/galleryapplicationversions.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/galleryapplicationversions.go index d0f81b22c..795f6c8e8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/galleryapplicationversions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/galleryapplicationversions.go @@ -103,7 +103,7 @@ func (client GalleryApplicationVersionsClient) CreateOrUpdatePreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -186,7 +186,7 @@ func (client GalleryApplicationVersionsClient) DeletePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -273,7 +273,7 @@ func (client GalleryApplicationVersionsClient) GetPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -356,7 +356,7 @@ func (client GalleryApplicationVersionsClient) ListByGalleryApplicationPreparer( "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -471,7 +471,7 @@ func (client GalleryApplicationVersionsClient) UpdatePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/galleryimages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/galleryimages.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/galleryimages.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/galleryimages.go index 549aab2e4..c88030f69 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/galleryimages.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/galleryimages.go @@ -97,7 +97,7 @@ func (client GalleryImagesClient) CreateOrUpdatePreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -177,7 +177,7 @@ func (client GalleryImagesClient) DeletePreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -260,7 +260,7 @@ func (client GalleryImagesClient) GetPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -337,7 +337,7 @@ func (client GalleryImagesClient) ListByGalleryPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -449,7 +449,7 @@ func (client GalleryImagesClient) UpdatePreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/galleryimageversions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/galleryimageversions.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/galleryimageversions.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/galleryimageversions.go index 02f3a9465..223b938eb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/galleryimageversions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/galleryimageversions.go @@ -99,7 +99,7 @@ func (client GalleryImageVersionsClient) CreateOrUpdatePreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -181,7 +181,7 @@ func (client GalleryImageVersionsClient) DeletePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -267,7 +267,7 @@ func (client GalleryImageVersionsClient) GetPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -350,7 +350,7 @@ func (client GalleryImageVersionsClient) ListByGalleryImagePreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -464,7 +464,7 @@ func (client GalleryImageVersionsClient) UpdatePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/images.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/images.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/images.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/images.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/loganalytics.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/loganalytics.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/loganalytics.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/loganalytics.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/models.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/models.go index 1a5dc0df1..150c8c383 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/models.go @@ -29,7 +29,7 @@ import ( ) // The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" +const fqdn = "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" // AccessLevel enumerates the values for access level. type AccessLevel string @@ -277,7 +277,8 @@ const ( Copy DiskCreateOption = "Copy" // Empty Create an empty data disk of a size given by diskSizeGB. Empty DiskCreateOption = "Empty" - // FromImage Create a new disk from a platform image specified by the given imageReference. + // FromImage Create a new disk from a platform image specified by the given imageReference or + // galleryImageReference. FromImage DiskCreateOption = "FromImage" // Import Create a disk by importing from a blob specified by a sourceUri in a storage account specified by // storageAccountId. @@ -1726,12 +1727,6 @@ type AvailabilitySetUpdate struct { Sku *Sku `json:"sku,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` } // MarshalJSON is the custom marshaler for AvailabilitySetUpdate. @@ -1785,33 +1780,6 @@ func (asu *AvailabilitySetUpdate) UnmarshalJSON(body []byte) error { } asu.Tags = tags } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asu.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asu.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asu.Type = &typeVar - } } } @@ -2265,6 +2233,8 @@ type CreationData struct { StorageAccountID *string `json:"storageAccountId,omitempty"` // ImageReference - Disk source information. ImageReference *ImageDiskReference `json:"imageReference,omitempty"` + // GalleryImageReference - Required if creating from a Gallery Image. The id of the ImageDiskReference will be the ARM id of the shared galley image version from which to create a disk. + GalleryImageReference *ImageDiskReference `json:"galleryImageReference,omitempty"` // SourceURI - If createOption is Import, this is the URI of a blob to be imported into a managed disk. SourceURI *string `json:"sourceUri,omitempty"` // SourceResourceID - If createOption is Copy, this is the ARM id of the source snapshot or disk. @@ -2309,6 +2279,14 @@ type DataDiskImage struct { Lun *int32 `json:"lun,omitempty"` } +// DataDiskImageEncryption contains encryption settings for a data disk image. +type DataDiskImageEncryption struct { + // Lun - This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. + Lun *int32 `json:"lun,omitempty"` + // DiskEncryptionSetID - A relative URI containing the resource ID of the disk encryption set. + DiskEncryptionSetID *string `json:"diskEncryptionSetId,omitempty"` +} + // DedicatedHost specifies information about the Dedicated host. type DedicatedHost struct { autorest.Response `json:"-"` @@ -2716,12 +2694,6 @@ type DedicatedHostGroupUpdate struct { Zones *[]string `json:"zones,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` } // MarshalJSON is the custom marshaler for DedicatedHostGroupUpdate. @@ -2775,33 +2747,6 @@ func (dhgu *DedicatedHostGroupUpdate) UnmarshalJSON(body []byte) error { } dhgu.Tags = tags } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dhgu.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dhgu.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dhgu.Type = &typeVar - } } } @@ -3071,12 +3016,6 @@ type DedicatedHostUpdate struct { *DedicatedHostProperties `json:"properties,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` } // MarshalJSON is the custom marshaler for DedicatedHostUpdate. @@ -3118,33 +3057,6 @@ func (dhu *DedicatedHostUpdate) UnmarshalJSON(body []byte) error { } dhu.Tags = tags } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dhu.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dhu.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dhu.Type = &typeVar - } } } @@ -3175,8 +3087,10 @@ type Disallowed struct { type Disk struct { autorest.Response `json:"-"` // ManagedBy - READ-ONLY; A relative URI containing the ID of the VM that has the disk attached. - ManagedBy *string `json:"managedBy,omitempty"` - Sku *DiskSku `json:"sku,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` + // ManagedByExtended - READ-ONLY; List of relative URIs containing the IDs of the VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. + ManagedByExtended *[]string `json:"managedByExtended,omitempty"` + Sku *DiskSku `json:"sku,omitempty"` // Zones - The Logical zone list for Disk. Zones *[]string `json:"zones,omitempty"` *DiskProperties `json:"properties,omitempty"` @@ -3231,6 +3145,15 @@ func (d *Disk) UnmarshalJSON(body []byte) error { } d.ManagedBy = &managedBy } + case "managedByExtended": + if v != nil { + var managedByExtended []string + err = json.Unmarshal(*v, &managedByExtended) + if err != nil { + return err + } + d.ManagedByExtended = &managedByExtended + } case "sku": if v != nil { var sku DiskSku @@ -3724,6 +3647,12 @@ type DiskEncryptionSetUpdateProperties struct { ActiveKey *KeyVaultAndKeyReference `json:"activeKey,omitempty"` } +// DiskImageEncryption this is the disk image encryption base class. +type DiskImageEncryption struct { + // DiskEncryptionSetID - A relative URI containing the resource ID of the disk encryption set. + DiskEncryptionSetID *string `json:"diskEncryptionSetId,omitempty"` +} + // DiskInstanceView the instance view of the disk. type DiskInstanceView struct { // Name - The disk name. @@ -3903,11 +3832,19 @@ type DiskProperties struct { // DiskIOPSReadWrite - The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` // DiskMBpsReadWrite - The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - DiskMBpsReadWrite *int32 `json:"diskMBpsReadWrite,omitempty"` + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"` + // DiskIOPSReadOnly - The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + DiskIOPSReadOnly *int64 `json:"diskIOPSReadOnly,omitempty"` + // DiskMBpsReadOnly - The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + DiskMBpsReadOnly *int64 `json:"diskMBpsReadOnly,omitempty"` // DiskState - READ-ONLY; The state of the disk. Possible values include: 'Unattached', 'Attached', 'Reserved', 'ActiveSAS', 'ReadyToUpload', 'ActiveUpload' DiskState DiskState `json:"diskState,omitempty"` // Encryption - Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. Encryption *Encryption `json:"encryption,omitempty"` + // MaxShares - The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + MaxShares *int32 `json:"maxShares,omitempty"` + // ShareInfo - READ-ONLY; Details of the list of all VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. + ShareInfo *[]ShareInfoElement `json:"shareInfo,omitempty"` } // DisksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running @@ -4125,7 +4062,13 @@ type DiskUpdateProperties struct { // DiskIOPSReadWrite - The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` // DiskMBpsReadWrite - The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. - DiskMBpsReadWrite *int32 `json:"diskMBpsReadWrite,omitempty"` + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"` + // DiskIOPSReadOnly - The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + DiskIOPSReadOnly *int64 `json:"diskIOPSReadOnly,omitempty"` + // DiskMBpsReadOnly - The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + DiskMBpsReadOnly *int64 `json:"diskMBpsReadOnly,omitempty"` + // MaxShares - The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + MaxShares *int32 `json:"maxShares,omitempty"` // Encryption - Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. Encryption *Encryption `json:"encryption,omitempty"` } @@ -4138,6 +4081,14 @@ type Encryption struct { Type EncryptionType `json:"type,omitempty"` } +// EncryptionImages optional. Allows users to provide customer managed keys for encrypting the OS and data +// disks in the gallery artifact. +type EncryptionImages struct { + OsDiskImage *OSDiskImageEncryption `json:"osDiskImage,omitempty"` + // DataDiskImages - A list of encryption specifications for data disk images. + DataDiskImages *[]DataDiskImageEncryption `json:"dataDiskImages,omitempty"` +} + // EncryptionSetIdentity the managed identity for the disk encryption set. It should be given permission on // the key vault before it can be used to encrypt disks. type EncryptionSetIdentity struct { @@ -4706,14 +4657,14 @@ func (future *GalleryApplicationsUpdateFuture) Result(client GalleryApplications // update. type GalleryApplicationUpdate struct { *GalleryApplicationProperties `json:"properties,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name Name *string `json:"name,omitempty"` // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` } // MarshalJSON is the custom marshaler for GalleryApplicationUpdate. @@ -4746,15 +4697,6 @@ func (gau *GalleryApplicationUpdate) UnmarshalJSON(body []byte) error { } gau.GalleryApplicationProperties = &galleryApplicationProperties } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gau.Tags = tags - } case "id": if v != nil { var ID string @@ -4782,6 +4724,15 @@ func (gau *GalleryApplicationUpdate) UnmarshalJSON(body []byte) error { } gau.Type = &typeVar } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + gau.Tags = tags + } } } @@ -5151,14 +5102,14 @@ func (future *GalleryApplicationVersionsUpdateFuture) Result(client GalleryAppli // want to update. type GalleryApplicationVersionUpdate struct { *GalleryApplicationVersionProperties `json:"properties,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name Name *string `json:"name,omitempty"` // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` } // MarshalJSON is the custom marshaler for GalleryApplicationVersionUpdate. @@ -5191,15 +5142,6 @@ func (gavu *GalleryApplicationVersionUpdate) UnmarshalJSON(body []byte) error { } gavu.GalleryApplicationVersionProperties = &galleryApplicationVersionProperties } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gavu.Tags = tags - } case "id": if v != nil { var ID string @@ -5227,6 +5169,15 @@ func (gavu *GalleryApplicationVersionUpdate) UnmarshalJSON(body []byte) error { } gavu.Type = &typeVar } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + gavu.Tags = tags + } } } @@ -5652,14 +5603,14 @@ func (future *GalleryImagesUpdateFuture) Result(client GalleryImagesClient) (gi // GalleryImageUpdate specifies information about the gallery Image Definition that you want to update. type GalleryImageUpdate struct { *GalleryImageProperties `json:"properties,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name Name *string `json:"name,omitempty"` // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` } // MarshalJSON is the custom marshaler for GalleryImageUpdate. @@ -5692,15 +5643,6 @@ func (giu *GalleryImageUpdate) UnmarshalJSON(body []byte) error { } giu.GalleryImageProperties = &galleryImageProperties } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - giu.Tags = tags - } case "id": if v != nil { var ID string @@ -5728,6 +5670,15 @@ func (giu *GalleryImageUpdate) UnmarshalJSON(body []byte) error { } giu.Type = &typeVar } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + giu.Tags = tags + } } } @@ -6099,14 +6050,14 @@ func (future *GalleryImageVersionsUpdateFuture) Result(client GalleryImageVersio // GalleryImageVersionUpdate specifies information about the gallery Image Version that you want to update. type GalleryImageVersionUpdate struct { *GalleryImageVersionProperties `json:"properties,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name Name *string `json:"name,omitempty"` // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` } // MarshalJSON is the custom marshaler for GalleryImageVersionUpdate. @@ -6139,15 +6090,6 @@ func (givu *GalleryImageVersionUpdate) UnmarshalJSON(body []byte) error { } givu.GalleryImageVersionProperties = &galleryImageVersionProperties } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - givu.Tags = tags - } case "id": if v != nil { var ID string @@ -6175,6 +6117,15 @@ func (givu *GalleryImageVersionUpdate) UnmarshalJSON(body []byte) error { } givu.Type = &typeVar } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + givu.Tags = tags + } } } @@ -6348,14 +6299,14 @@ type GalleryProperties struct { // GalleryUpdate specifies information about the Shared Image Gallery that you want to update. type GalleryUpdate struct { *GalleryProperties `json:"properties,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name Name *string `json:"name,omitempty"` // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` } // MarshalJSON is the custom marshaler for GalleryUpdate. @@ -6388,15 +6339,6 @@ func (gu *GalleryUpdate) UnmarshalJSON(body []byte) error { } gu.GalleryProperties = &galleryProperties } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gu.Tags = tags - } case "id": if v != nil { var ID string @@ -6424,6 +6366,15 @@ func (gu *GalleryUpdate) UnmarshalJSON(body []byte) error { } gu.Type = &typeVar } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + gu.Tags = tags + } } } @@ -6896,12 +6847,6 @@ type ImageUpdate struct { *ImageProperties `json:"properties,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` } // MarshalJSON is the custom marshaler for ImageUpdate. @@ -6943,33 +6888,6 @@ func (iu *ImageUpdate) UnmarshalJSON(body []byte) error { } iu.Tags = tags } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - iu.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - iu.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - iu.Type = &typeVar - } } } @@ -7501,6 +7419,12 @@ type OSDiskImage struct { OperatingSystem OperatingSystemTypes `json:"operatingSystem,omitempty"` } +// OSDiskImageEncryption contains encryption settings for an OS disk image. +type OSDiskImageEncryption struct { + // DiskEncryptionSetID - A relative URI containing the resource ID of the disk encryption set. + DiskEncryptionSetID *string `json:"diskEncryptionSetId,omitempty"` +} + // OSProfile specifies the operating system settings for the virtual machine. Some of the settings cannot // be changed once VM is provisioned. type OSProfile struct { @@ -7806,12 +7730,6 @@ type ProximityPlacementGroupProperties struct { type ProximityPlacementGroupUpdate struct { // Tags - Resource tags Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` } // MarshalJSON is the custom marshaler for ProximityPlacementGroupUpdate. @@ -8552,6 +8470,12 @@ type ScheduledEventsProfile struct { TerminateNotificationProfile *TerminateNotificationProfile `json:"terminateNotificationProfile,omitempty"` } +// ShareInfoElement ... +type ShareInfoElement struct { + // VMURI - READ-ONLY; A relative URI containing the ID of the VM that has the disk attached. + VMURI *string `json:"vmUri,omitempty"` +} + // Sku describes a virtual machine scale set sku. type Sku struct { // Name - The sku name. @@ -9136,6 +9060,7 @@ type TargetRegion struct { RegionalReplicaCount *int32 `json:"regionalReplicaCount,omitempty"` // StorageAccountType - Specifies the storage account type to be used to store the image. This property is not updatable. Possible values include: 'StorageAccountTypeStandardLRS', 'StorageAccountTypeStandardZRS' StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` + Encryption *EncryptionImages `json:"encryption,omitempty"` } // TerminateNotificationProfile ... @@ -9166,12 +9091,6 @@ type ThrottledRequestsInput struct { type UpdateResource struct { // Tags - Resource tags Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` } // MarshalJSON is the custom marshaler for UpdateResource. @@ -9183,6 +9102,27 @@ func (ur UpdateResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// UpdateResourceDefinition the Update Resource model definition. +type UpdateResourceDefinition struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for UpdateResourceDefinition. +func (urd UpdateResourceDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if urd.Tags != nil { + objectMap["tags"] = urd.Tags + } + return json.Marshal(objectMap) +} + // UpgradeOperationHistoricalStatusInfo virtual Machine Scale Set OS Upgrade History operation response. type UpgradeOperationHistoricalStatusInfo struct { // Properties - READ-ONLY; Information about the properties of the upgrade operation. @@ -9822,12 +9762,6 @@ type VirtualMachineExtensionUpdate struct { *VirtualMachineExtensionUpdateProperties `json:"properties,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` } // MarshalJSON is the custom marshaler for VirtualMachineExtensionUpdate. @@ -9869,33 +9803,6 @@ func (vmeu *VirtualMachineExtensionUpdate) UnmarshalJSON(body []byte) error { } vmeu.Tags = tags } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vmeu.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vmeu.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vmeu.Type = &typeVar - } } } @@ -12317,12 +12224,6 @@ type VirtualMachineScaleSetUpdate struct { Identity *VirtualMachineScaleSetIdentity `json:"identity,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` } // MarshalJSON is the custom marshaler for VirtualMachineScaleSetUpdate. @@ -12400,33 +12301,6 @@ func (vmssu *VirtualMachineScaleSetUpdate) UnmarshalJSON(body []byte) error { } vmssu.Tags = tags } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vmssu.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vmssu.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vmssu.Type = &typeVar - } } } @@ -13927,12 +13801,6 @@ type VirtualMachineUpdate struct { Zones *[]string `json:"zones,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` } // MarshalJSON is the custom marshaler for VirtualMachineUpdate. @@ -14010,33 +13878,6 @@ func (vmu *VirtualMachineUpdate) UnmarshalJSON(body []byte) error { } vmu.Tags = tags } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vmu.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vmu.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vmu.Type = &typeVar - } } } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/operations.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/operations.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/proximityplacementgroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/proximityplacementgroups.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/proximityplacementgroups.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/proximityplacementgroups.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/resourceskus.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/resourceskus.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/resourceskus.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/resourceskus.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/snapshots.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/snapshots.go similarity index 98% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/snapshots.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/snapshots.go index 046a45bfb..e3f4980da 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/snapshots.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/snapshots.go @@ -65,6 +65,8 @@ func (client SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupN 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.CreationData.GalleryImageReference", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "snapshot.SnapshotProperties.CreationData.GalleryImageReference.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}}}, @@ -95,7 +97,7 @@ func (client SnapshotsClient) CreateOrUpdatePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -175,7 +177,7 @@ func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -257,7 +259,7 @@ func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -335,7 +337,7 @@ func (client SnapshotsClient) GrantAccessPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -415,7 +417,7 @@ func (client SnapshotsClient) ListPreparer(ctx context.Context) (*http.Request, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -527,7 +529,7 @@ func (client SnapshotsClient) ListByResourceGroupPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -635,7 +637,7 @@ func (client SnapshotsClient) RevokeAccessPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -712,7 +714,7 @@ func (client SnapshotsClient) UpdatePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-07-01" + const APIVersion = "2019-11-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/usage.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/usage.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/usage.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/usage.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/version.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/version.go index 7ad07e015..39a5f55e5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " compute/2019-07-01" + return "Azure-SDK-For-Go/" + version.Number + " compute/2019-12-01" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachineextensionimages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachineextensionimages.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachineextensionimages.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachineextensionimages.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachineextensions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachineextensions.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachineextensions.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachineextensions.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachineimages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachineimages.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachineimages.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachineimages.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachineruncommands.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachineruncommands.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachineruncommands.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachineruncommands.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachines.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachines.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachines.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachines.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachinescalesetextensions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachinescalesetextensions.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachinescalesetextensions.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachinescalesetextensions.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachinescalesetrollingupgrades.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachinescalesetrollingupgrades.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachinescalesetrollingupgrades.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachinescalesetrollingupgrades.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachinescalesets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachinescalesets.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachinescalesets.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachinescalesets.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachinescalesetvmextensions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachinescalesetvmextensions.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachinescalesetvmextensions.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachinescalesetvmextensions.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachinescalesetvms.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachinescalesetvms.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachinescalesetvms.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachinescalesetvms.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachinesizes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachinesizes.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/virtualmachinesizes.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/virtualmachinesizes.go diff --git a/vendor/modules.txt b/vendor/modules.txt index 7fcc843e4..63d6e5522 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -13,8 +13,8 @@ github.com/1and1/oneandone-cloudserver-sdk-go # github.com/Azure/azure-sdk-for-go v40.5.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/2019-03-01/compute -github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute -github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/computeapi +github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute +github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute/computeapi github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2018-02-14/keyvault github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network diff --git a/website/pages/partials/builder/azure/chroot/Config-required.mdx b/website/pages/partials/builder/azure/chroot/Config-required.mdx index 386e2a277..956320d13 100644 --- a/website/pages/partials/builder/azure/chroot/Config-required.mdx +++ b/website/pages/partials/builder/azure/chroot/Config-required.mdx @@ -1,4 +1,7 @@ -- `source` (string) - Either a managed disk resource ID or a publisher:offer:sku:version specifier for plaform image sources. +- `source` (string) - One of the following can be used as a source for an image: + - a shared image version resource ID + - a managed disk resource ID + - a publisher:offer:sku:version specifier for plaform image sources. \ No newline at end of file