From dcefcd90387b78dd21fa019e10980ae6d86d6aec Mon Sep 17 00:00:00 2001 From: Azure SDK Bot Date: Tue, 19 Nov 2019 03:08:39 +0800 Subject: [PATCH] [AutoPR compute/resource-manager] [Compute] Add patch spec for SharedImageGallery (#6320) * Generated from 861dd1bc2d11f46b781ac8e0ccd470bfe770125a change descriptions to updated * Generated from 50f8e2ff68772de9ca3bbd01baa59d1d8989a7b8 updateresource * Generated from c53057ddac2e6b3be44ff07da16ab09cdd77f936 Added example and id/type to UpdateResource * Generated from a5ef75d4927df2d8a8c967b993926766254cff30 add name * Generated from fd8f83b368a420de1057b009b7efeb5988d94cfb make gallery json pretty --- .../latest/compute/mgmt/compute/models.go | 10 + .../preview/compute/mgmt/compute/models.go | 10 + .../compute/computeapi/interfaces.go | 5 + .../mgmt/2019-07-01/compute/galleries.go | 81 ++ .../2019-07-01/compute/galleryapplications.go | 85 ++ .../compute/galleryapplicationversions.go | 87 ++ .../mgmt/2019-07-01/compute/galleryimages.go | 84 ++ .../compute/galleryimageversions.go | 86 ++ .../compute/mgmt/2019-07-01/compute/models.go | 877 +++++++++++++++++- 9 files changed, 1294 insertions(+), 31 deletions(-) diff --git a/profiles/latest/compute/mgmt/compute/models.go b/profiles/latest/compute/mgmt/compute/models.go index 90f743c15286..e089fec5cee5 100644 --- a/profiles/latest/compute/mgmt/compute/models.go +++ b/profiles/latest/compute/mgmt/compute/models.go @@ -761,24 +761,29 @@ type EncryptionSettingsElement = original.EncryptionSettingsElement type GalleriesClient = original.GalleriesClient type GalleriesCreateOrUpdateFuture = original.GalleriesCreateOrUpdateFuture type GalleriesDeleteFuture = original.GalleriesDeleteFuture +type GalleriesUpdateFuture = original.GalleriesUpdateFuture type Gallery = original.Gallery type GalleryApplication = original.GalleryApplication type GalleryApplicationList = original.GalleryApplicationList type GalleryApplicationListIterator = original.GalleryApplicationListIterator type GalleryApplicationListPage = original.GalleryApplicationListPage type GalleryApplicationProperties = original.GalleryApplicationProperties +type GalleryApplicationUpdate = original.GalleryApplicationUpdate type GalleryApplicationVersion = original.GalleryApplicationVersion type GalleryApplicationVersionList = original.GalleryApplicationVersionList type GalleryApplicationVersionListIterator = original.GalleryApplicationVersionListIterator type GalleryApplicationVersionListPage = original.GalleryApplicationVersionListPage type GalleryApplicationVersionProperties = original.GalleryApplicationVersionProperties type GalleryApplicationVersionPublishingProfile = original.GalleryApplicationVersionPublishingProfile +type GalleryApplicationVersionUpdate = original.GalleryApplicationVersionUpdate type GalleryApplicationVersionsClient = original.GalleryApplicationVersionsClient type GalleryApplicationVersionsCreateOrUpdateFuture = original.GalleryApplicationVersionsCreateOrUpdateFuture type GalleryApplicationVersionsDeleteFuture = original.GalleryApplicationVersionsDeleteFuture +type GalleryApplicationVersionsUpdateFuture = original.GalleryApplicationVersionsUpdateFuture type GalleryApplicationsClient = original.GalleryApplicationsClient type GalleryApplicationsCreateOrUpdateFuture = original.GalleryApplicationsCreateOrUpdateFuture type GalleryApplicationsDeleteFuture = original.GalleryApplicationsDeleteFuture +type GalleryApplicationsUpdateFuture = original.GalleryApplicationsUpdateFuture type GalleryArtifactPublishingProfileBase = original.GalleryArtifactPublishingProfileBase type GalleryArtifactSource = original.GalleryArtifactSource type GalleryArtifactVersionSource = original.GalleryArtifactVersionSource @@ -791,6 +796,7 @@ type GalleryImageList = original.GalleryImageList type GalleryImageListIterator = original.GalleryImageListIterator type GalleryImageListPage = original.GalleryImageListPage type GalleryImageProperties = original.GalleryImageProperties +type GalleryImageUpdate = original.GalleryImageUpdate type GalleryImageVersion = original.GalleryImageVersion type GalleryImageVersionList = original.GalleryImageVersionList type GalleryImageVersionListIterator = original.GalleryImageVersionListIterator @@ -798,17 +804,21 @@ type GalleryImageVersionListPage = original.GalleryImageVersionListPage type GalleryImageVersionProperties = original.GalleryImageVersionProperties type GalleryImageVersionPublishingProfile = original.GalleryImageVersionPublishingProfile type GalleryImageVersionStorageProfile = original.GalleryImageVersionStorageProfile +type GalleryImageVersionUpdate = original.GalleryImageVersionUpdate type GalleryImageVersionsClient = original.GalleryImageVersionsClient type GalleryImageVersionsCreateOrUpdateFuture = original.GalleryImageVersionsCreateOrUpdateFuture type GalleryImageVersionsDeleteFuture = original.GalleryImageVersionsDeleteFuture +type GalleryImageVersionsUpdateFuture = original.GalleryImageVersionsUpdateFuture type GalleryImagesClient = original.GalleryImagesClient type GalleryImagesCreateOrUpdateFuture = original.GalleryImagesCreateOrUpdateFuture type GalleryImagesDeleteFuture = original.GalleryImagesDeleteFuture +type GalleryImagesUpdateFuture = original.GalleryImagesUpdateFuture type GalleryList = original.GalleryList type GalleryListIterator = original.GalleryListIterator type GalleryListPage = original.GalleryListPage type GalleryOSDiskImage = original.GalleryOSDiskImage type GalleryProperties = original.GalleryProperties +type GalleryUpdate = original.GalleryUpdate type GrantAccessData = original.GrantAccessData type HardwareProfile = original.HardwareProfile type Image = original.Image diff --git a/profiles/preview/compute/mgmt/compute/models.go b/profiles/preview/compute/mgmt/compute/models.go index 8549d68cfcef..f187e0d0536c 100644 --- a/profiles/preview/compute/mgmt/compute/models.go +++ b/profiles/preview/compute/mgmt/compute/models.go @@ -761,24 +761,29 @@ type EncryptionSettingsElement = original.EncryptionSettingsElement type GalleriesClient = original.GalleriesClient type GalleriesCreateOrUpdateFuture = original.GalleriesCreateOrUpdateFuture type GalleriesDeleteFuture = original.GalleriesDeleteFuture +type GalleriesUpdateFuture = original.GalleriesUpdateFuture type Gallery = original.Gallery type GalleryApplication = original.GalleryApplication type GalleryApplicationList = original.GalleryApplicationList type GalleryApplicationListIterator = original.GalleryApplicationListIterator type GalleryApplicationListPage = original.GalleryApplicationListPage type GalleryApplicationProperties = original.GalleryApplicationProperties +type GalleryApplicationUpdate = original.GalleryApplicationUpdate type GalleryApplicationVersion = original.GalleryApplicationVersion type GalleryApplicationVersionList = original.GalleryApplicationVersionList type GalleryApplicationVersionListIterator = original.GalleryApplicationVersionListIterator type GalleryApplicationVersionListPage = original.GalleryApplicationVersionListPage type GalleryApplicationVersionProperties = original.GalleryApplicationVersionProperties type GalleryApplicationVersionPublishingProfile = original.GalleryApplicationVersionPublishingProfile +type GalleryApplicationVersionUpdate = original.GalleryApplicationVersionUpdate type GalleryApplicationVersionsClient = original.GalleryApplicationVersionsClient type GalleryApplicationVersionsCreateOrUpdateFuture = original.GalleryApplicationVersionsCreateOrUpdateFuture type GalleryApplicationVersionsDeleteFuture = original.GalleryApplicationVersionsDeleteFuture +type GalleryApplicationVersionsUpdateFuture = original.GalleryApplicationVersionsUpdateFuture type GalleryApplicationsClient = original.GalleryApplicationsClient type GalleryApplicationsCreateOrUpdateFuture = original.GalleryApplicationsCreateOrUpdateFuture type GalleryApplicationsDeleteFuture = original.GalleryApplicationsDeleteFuture +type GalleryApplicationsUpdateFuture = original.GalleryApplicationsUpdateFuture type GalleryArtifactPublishingProfileBase = original.GalleryArtifactPublishingProfileBase type GalleryArtifactSource = original.GalleryArtifactSource type GalleryArtifactVersionSource = original.GalleryArtifactVersionSource @@ -791,6 +796,7 @@ type GalleryImageList = original.GalleryImageList type GalleryImageListIterator = original.GalleryImageListIterator type GalleryImageListPage = original.GalleryImageListPage type GalleryImageProperties = original.GalleryImageProperties +type GalleryImageUpdate = original.GalleryImageUpdate type GalleryImageVersion = original.GalleryImageVersion type GalleryImageVersionList = original.GalleryImageVersionList type GalleryImageVersionListIterator = original.GalleryImageVersionListIterator @@ -798,17 +804,21 @@ type GalleryImageVersionListPage = original.GalleryImageVersionListPage type GalleryImageVersionProperties = original.GalleryImageVersionProperties type GalleryImageVersionPublishingProfile = original.GalleryImageVersionPublishingProfile type GalleryImageVersionStorageProfile = original.GalleryImageVersionStorageProfile +type GalleryImageVersionUpdate = original.GalleryImageVersionUpdate type GalleryImageVersionsClient = original.GalleryImageVersionsClient type GalleryImageVersionsCreateOrUpdateFuture = original.GalleryImageVersionsCreateOrUpdateFuture type GalleryImageVersionsDeleteFuture = original.GalleryImageVersionsDeleteFuture +type GalleryImageVersionsUpdateFuture = original.GalleryImageVersionsUpdateFuture type GalleryImagesClient = original.GalleryImagesClient type GalleryImagesCreateOrUpdateFuture = original.GalleryImagesCreateOrUpdateFuture type GalleryImagesDeleteFuture = original.GalleryImagesDeleteFuture +type GalleryImagesUpdateFuture = original.GalleryImagesUpdateFuture type GalleryList = original.GalleryList type GalleryListIterator = original.GalleryListIterator type GalleryListPage = original.GalleryListPage type GalleryOSDiskImage = original.GalleryOSDiskImage type GalleryProperties = original.GalleryProperties +type GalleryUpdate = original.GalleryUpdate type GrantAccessData = original.GrantAccessData type HardwareProfile = original.HardwareProfile type Image = original.Image diff --git a/services/compute/mgmt/2019-07-01/compute/computeapi/interfaces.go b/services/compute/mgmt/2019-07-01/compute/computeapi/interfaces.go index 9ff264b98815..e5e0b27d586c 100644 --- a/services/compute/mgmt/2019-07-01/compute/computeapi/interfaces.go +++ b/services/compute/mgmt/2019-07-01/compute/computeapi/interfaces.go @@ -310,6 +310,7 @@ type GalleriesClientAPI interface { Get(ctx context.Context, resourceGroupName string, galleryName string) (result compute.Gallery, err error) List(ctx context.Context) (result compute.GalleryListPage, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result compute.GalleryListPage, err error) + Update(ctx context.Context, resourceGroupName string, galleryName string, gallery compute.GalleryUpdate) (result compute.GalleriesUpdateFuture, err error) } var _ GalleriesClientAPI = (*compute.GalleriesClient)(nil) @@ -320,6 +321,7 @@ type GalleryImagesClientAPI interface { Delete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (result compute.GalleryImagesDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (result compute.GalleryImage, err error) ListByGallery(ctx context.Context, resourceGroupName string, galleryName string) (result compute.GalleryImageListPage, err error) + Update(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage compute.GalleryImageUpdate) (result compute.GalleryImagesUpdateFuture, err error) } var _ GalleryImagesClientAPI = (*compute.GalleryImagesClient)(nil) @@ -330,6 +332,7 @@ type GalleryImageVersionsClientAPI interface { Delete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string) (result compute.GalleryImageVersionsDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, expand compute.ReplicationStatusTypes) (result compute.GalleryImageVersion, err error) ListByGalleryImage(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string) (result compute.GalleryImageVersionListPage, err error) + Update(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion compute.GalleryImageVersionUpdate) (result compute.GalleryImageVersionsUpdateFuture, err error) } var _ GalleryImageVersionsClientAPI = (*compute.GalleryImageVersionsClient)(nil) @@ -340,6 +343,7 @@ type GalleryApplicationsClientAPI interface { Delete(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string) (result compute.GalleryApplicationsDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string) (result compute.GalleryApplication, err error) ListByGallery(ctx context.Context, resourceGroupName string, galleryName string) (result compute.GalleryApplicationListPage, err error) + Update(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication compute.GalleryApplicationUpdate) (result compute.GalleryApplicationsUpdateFuture, err error) } var _ GalleryApplicationsClientAPI = (*compute.GalleryApplicationsClient)(nil) @@ -350,6 +354,7 @@ type GalleryApplicationVersionsClientAPI interface { Delete(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string) (result compute.GalleryApplicationVersionsDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, expand compute.ReplicationStatusTypes) (result compute.GalleryApplicationVersion, err error) ListByGalleryApplication(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string) (result compute.GalleryApplicationVersionListPage, err error) + Update(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion compute.GalleryApplicationVersionUpdate) (result compute.GalleryApplicationVersionsUpdateFuture, err error) } var _ GalleryApplicationVersionsClientAPI = (*compute.GalleryApplicationVersionsClient)(nil) diff --git a/services/compute/mgmt/2019-07-01/compute/galleries.go b/services/compute/mgmt/2019-07-01/compute/galleries.go index 553defda18ea..8b9486b00652 100644 --- a/services/compute/mgmt/2019-07-01/compute/galleries.go +++ b/services/compute/mgmt/2019-07-01/compute/galleries.go @@ -496,3 +496,84 @@ func (client GalleriesClient) ListByResourceGroupComplete(ctx context.Context, r result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) return } + +// Update update a Shared Image Gallery. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Image Gallery. The allowed characters are alphabets and numbers with +// dots and periods allowed in the middle. The maximum length is 80 characters. +// gallery - parameters supplied to the update Shared Image Gallery operation. +func (client GalleriesClient) Update(ctx context.Context, resourceGroupName string, galleryName string, gallery GalleryUpdate) (result GalleriesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleriesClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, galleryName, gallery) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client GalleriesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, galleryName string, gallery GalleryUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", pathParameters), + autorest.WithJSON(gallery), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client GalleriesClient) UpdateSender(req *http.Request) (future GalleriesUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client GalleriesClient) UpdateResponder(resp *http.Response) (result Gallery, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/compute/mgmt/2019-07-01/compute/galleryapplications.go b/services/compute/mgmt/2019-07-01/compute/galleryapplications.go index c2c651209dee..60651d079a35 100644 --- a/services/compute/mgmt/2019-07-01/compute/galleryapplications.go +++ b/services/compute/mgmt/2019-07-01/compute/galleryapplications.go @@ -399,3 +399,88 @@ func (client GalleryApplicationsClient) ListByGalleryComplete(ctx context.Contex result.page, err = client.ListByGallery(ctx, resourceGroupName, galleryName) return } + +// Update update a gallery Application Definition. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Application Gallery in which the Application Definition is to be +// updated. +// galleryApplicationName - the name of the gallery Application Definition to be updated. The allowed +// characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum +// length is 80 characters. +// galleryApplication - parameters supplied to the update gallery Application operation. +func (client GalleryApplicationsClient) Update(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplicationUpdate) (result GalleryApplicationsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryApplicationsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplication) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryApplicationsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryApplicationsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client GalleryApplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplicationUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryApplicationName": autorest.Encode("path", galleryApplicationName), + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", pathParameters), + autorest.WithJSON(galleryApplication), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryApplicationsClient) UpdateSender(req *http.Request) (future GalleryApplicationsUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client GalleryApplicationsClient) UpdateResponder(resp *http.Response) (result GalleryApplication, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/compute/mgmt/2019-07-01/compute/galleryapplicationversions.go b/services/compute/mgmt/2019-07-01/compute/galleryapplicationversions.go index 40b2dc830e93..e2d3695d8d08 100644 --- a/services/compute/mgmt/2019-07-01/compute/galleryapplicationversions.go +++ b/services/compute/mgmt/2019-07-01/compute/galleryapplicationversions.go @@ -426,3 +426,90 @@ func (client GalleryApplicationVersionsClient) ListByGalleryApplicationComplete( result.page, err = client.ListByGalleryApplication(ctx, resourceGroupName, galleryName, galleryApplicationName) return } + +// Update update a gallery Application Version. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Application Gallery in which the Application Definition resides. +// galleryApplicationName - the name of the gallery Application Definition in which the Application Version is +// to be updated. +// galleryApplicationVersionName - the name of the gallery Application Version to be updated. Needs to follow +// semantic version name pattern: The allowed characters are digit and period. Digits must be within the range +// of a 32-bit integer. Format: .. +// galleryApplicationVersion - parameters supplied to the update gallery Application Version operation. +func (client GalleryApplicationVersionsClient) Update(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersionUpdate) (result GalleryApplicationVersionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryApplicationVersionsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryApplicationVersionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryApplicationVersionsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client GalleryApplicationVersionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersionUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryApplicationName": autorest.Encode("path", galleryApplicationName), + "galleryApplicationVersionName": autorest.Encode("path", galleryApplicationVersionName), + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", pathParameters), + autorest.WithJSON(galleryApplicationVersion), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryApplicationVersionsClient) UpdateSender(req *http.Request) (future GalleryApplicationVersionsUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client GalleryApplicationVersionsClient) UpdateResponder(resp *http.Response) (result GalleryApplicationVersion, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/compute/mgmt/2019-07-01/compute/galleryimages.go b/services/compute/mgmt/2019-07-01/compute/galleryimages.go index c4c78e5706bb..c992180ec1e4 100644 --- a/services/compute/mgmt/2019-07-01/compute/galleryimages.go +++ b/services/compute/mgmt/2019-07-01/compute/galleryimages.go @@ -408,3 +408,87 @@ func (client GalleryImagesClient) ListByGalleryComplete(ctx context.Context, res result.page, err = client.ListByGallery(ctx, resourceGroupName, galleryName) return } + +// Update update a gallery Image Definition. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Image Gallery in which the Image Definition is to be updated. +// galleryImageName - the name of the gallery Image Definition to be updated. The allowed characters are +// alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 +// characters. +// galleryImage - parameters supplied to the update gallery image operation. +func (client GalleryImagesClient) Update(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImageUpdate) (result GalleryImagesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, galleryName, galleryImageName, galleryImage) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client GalleryImagesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImageUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryImageName": autorest.Encode("path", galleryImageName), + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", pathParameters), + autorest.WithJSON(galleryImage), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImagesClient) UpdateSender(req *http.Request) (future GalleryImagesUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client GalleryImagesClient) UpdateResponder(resp *http.Response) (result GalleryImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/compute/mgmt/2019-07-01/compute/galleryimageversions.go b/services/compute/mgmt/2019-07-01/compute/galleryimageversions.go index 658da5864e04..e1c934b0e17a 100644 --- a/services/compute/mgmt/2019-07-01/compute/galleryimageversions.go +++ b/services/compute/mgmt/2019-07-01/compute/galleryimageversions.go @@ -420,3 +420,89 @@ func (client GalleryImageVersionsClient) ListByGalleryImageComplete(ctx context. result.page, err = client.ListByGalleryImage(ctx, resourceGroupName, galleryName, galleryImageName) return } + +// Update update a gallery Image Version. +// Parameters: +// resourceGroupName - the name of the resource group. +// galleryName - the name of the Shared Image Gallery in which the Image Definition resides. +// galleryImageName - the name of the gallery Image Definition in which the Image Version is to be updated. +// galleryImageVersionName - the name of the gallery Image Version to be updated. Needs to follow semantic +// version name pattern: The allowed characters are digit and period. Digits must be within the range of a +// 32-bit integer. Format: .. +// galleryImageVersion - parameters supplied to the update gallery Image Version operation. +func (client GalleryImageVersionsClient) Update(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersionUpdate) (result GalleryImageVersionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageVersionsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client GalleryImageVersionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersionUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryImageName": autorest.Encode("path", galleryImageName), + "galleryImageVersionName": autorest.Encode("path", galleryImageVersionName), + "galleryName": autorest.Encode("path", galleryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", pathParameters), + autorest.WithJSON(galleryImageVersion), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImageVersionsClient) UpdateSender(req *http.Request) (future GalleryImageVersionsUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client GalleryImageVersionsClient) UpdateResponder(resp *http.Response) (result GalleryImageVersion, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/compute/mgmt/2019-07-01/compute/models.go b/services/compute/mgmt/2019-07-01/compute/models.go index 56d76c70c964..3b1f20a9f5d2 100644 --- a/services/compute/mgmt/2019-07-01/compute/models.go +++ b/services/compute/mgmt/2019-07-01/compute/models.go @@ -1728,6 +1728,12 @@ 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. @@ -1781,6 +1787,33 @@ 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 + } } } @@ -2685,6 +2718,12 @@ 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. @@ -2738,6 +2777,33 @@ 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 + } } } @@ -3007,6 +3073,12 @@ 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. @@ -3048,6 +3120,33 @@ 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 + } } } @@ -4130,6 +4229,35 @@ func (future *GalleriesDeleteFuture) Result(client GalleriesClient) (ar autorest return } +// GalleriesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GalleriesUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GalleriesUpdateFuture) Result(client GalleriesClient) (g Gallery, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.GalleriesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if g.Response.Response, err = future.GetResult(sender); err == nil && g.Response.Response.StatusCode != http.StatusNoContent { + g, err = client.UpdateResponder(g.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleriesUpdateFuture", "Result", g.Response.Response, "Failure responding to request") + } + } + return +} + // Gallery specifies information about the Shared Image Gallery that you want to create or update. type Gallery struct { autorest.Response `json:"-"` @@ -4545,6 +4673,121 @@ func (future *GalleryApplicationsDeleteFuture) Result(client GalleryApplications return } +// GalleryApplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GalleryApplicationsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GalleryApplicationsUpdateFuture) Result(client GalleryApplicationsClient) (ga GalleryApplication, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryApplicationsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.GalleryApplicationsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ga.Response.Response, err = future.GetResult(sender); err == nil && ga.Response.Response.StatusCode != http.StatusNoContent { + ga, err = client.UpdateResponder(ga.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryApplicationsUpdateFuture", "Result", ga.Response.Response, "Failure responding to request") + } + } + return +} + +// GalleryApplicationUpdate specifies information about the gallery Application Definition that you want to +// 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"` +} + +// MarshalJSON is the custom marshaler for GalleryApplicationUpdate. +func (gau GalleryApplicationUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gau.GalleryApplicationProperties != nil { + objectMap["properties"] = gau.GalleryApplicationProperties + } + if gau.Tags != nil { + objectMap["tags"] = gau.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for GalleryApplicationUpdate struct. +func (gau *GalleryApplicationUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var galleryApplicationProperties GalleryApplicationProperties + err = json.Unmarshal(*v, &galleryApplicationProperties) + if err != nil { + return err + } + 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 + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + gau.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + gau.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + gau.Type = &typeVar + } + } + } + + return nil +} + // GalleryApplicationVersion specifies information about the gallery Application Version that you want to // create or update. type GalleryApplicationVersion struct { @@ -4875,6 +5118,121 @@ func (future *GalleryApplicationVersionsDeleteFuture) Result(client GalleryAppli return } +// GalleryApplicationVersionsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GalleryApplicationVersionsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GalleryApplicationVersionsUpdateFuture) Result(client GalleryApplicationVersionsClient) (gav GalleryApplicationVersion, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryApplicationVersionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.GalleryApplicationVersionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gav.Response.Response, err = future.GetResult(sender); err == nil && gav.Response.Response.StatusCode != http.StatusNoContent { + gav, err = client.UpdateResponder(gav.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryApplicationVersionsUpdateFuture", "Result", gav.Response.Response, "Failure responding to request") + } + } + return +} + +// GalleryApplicationVersionUpdate specifies information about the gallery Application Version that you +// 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"` +} + +// MarshalJSON is the custom marshaler for GalleryApplicationVersionUpdate. +func (gavu GalleryApplicationVersionUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gavu.GalleryApplicationVersionProperties != nil { + objectMap["properties"] = gavu.GalleryApplicationVersionProperties + } + if gavu.Tags != nil { + objectMap["tags"] = gavu.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for GalleryApplicationVersionUpdate struct. +func (gavu *GalleryApplicationVersionUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var galleryApplicationVersionProperties GalleryApplicationVersionProperties + err = json.Unmarshal(*v, &galleryApplicationVersionProperties) + if err != nil { + return err + } + 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 + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + gavu.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + gavu.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + gavu.Type = &typeVar + } + } + } + + return nil +} + // GalleryArtifactPublishingProfileBase describes the basic gallery artifact publishing profile. type GalleryArtifactPublishingProfileBase struct { // TargetRegions - The target regions where the Image Version is going to be replicated to. This property is updatable. @@ -5262,6 +5620,120 @@ func (future *GalleryImagesDeleteFuture) Result(client GalleryImagesClient) (ar return } +// GalleryImagesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GalleryImagesUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GalleryImagesUpdateFuture) Result(client GalleryImagesClient) (gi GalleryImage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.GalleryImagesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gi.Response.Response, err = future.GetResult(sender); err == nil && gi.Response.Response.StatusCode != http.StatusNoContent { + gi, err = client.UpdateResponder(gi.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImagesUpdateFuture", "Result", gi.Response.Response, "Failure responding to request") + } + } + return +} + +// 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"` +} + +// MarshalJSON is the custom marshaler for GalleryImageUpdate. +func (giu GalleryImageUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if giu.GalleryImageProperties != nil { + objectMap["properties"] = giu.GalleryImageProperties + } + if giu.Tags != nil { + objectMap["tags"] = giu.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for GalleryImageUpdate struct. +func (giu *GalleryImageUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var galleryImageProperties GalleryImageProperties + err = json.Unmarshal(*v, &galleryImageProperties) + if err != nil { + return err + } + 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 + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + giu.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + giu.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + giu.Type = &typeVar + } + } + } + + return nil +} + // GalleryImageVersion specifies information about the gallery Image Version that you want to create or // update. type GalleryImageVersion struct { @@ -5561,38 +6033,152 @@ func (future *GalleryImageVersionsCreateOrUpdateFuture) Result(client GalleryIma err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsCreateOrUpdateFuture", "Result", giv.Response.Response, "Failure responding to request") } } - return -} - -// GalleryImageVersionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type GalleryImageVersionsDeleteFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *GalleryImageVersionsDeleteFuture) Result(client GalleryImageVersionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("compute.GalleryImageVersionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} + return +} + +// GalleryImageVersionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GalleryImageVersionsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GalleryImageVersionsDeleteFuture) Result(client GalleryImageVersionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.GalleryImageVersionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// GalleryImageVersionStorageProfile this is the storage profile of a Gallery Image Version. +type GalleryImageVersionStorageProfile struct { + Source *GalleryArtifactVersionSource `json:"source,omitempty"` + OsDiskImage *GalleryOSDiskImage `json:"osDiskImage,omitempty"` + // DataDiskImages - A list of data disk images. + DataDiskImages *[]GalleryDataDiskImage `json:"dataDiskImages,omitempty"` +} + +// GalleryImageVersionsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GalleryImageVersionsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GalleryImageVersionsUpdateFuture) Result(client GalleryImageVersionsClient) (giv GalleryImageVersion, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.GalleryImageVersionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if giv.Response.Response, err = future.GetResult(sender); err == nil && giv.Response.Response.StatusCode != http.StatusNoContent { + giv, err = client.UpdateResponder(giv.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.GalleryImageVersionsUpdateFuture", "Result", giv.Response.Response, "Failure responding to request") + } + } + return +} + +// 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"` +} + +// MarshalJSON is the custom marshaler for GalleryImageVersionUpdate. +func (givu GalleryImageVersionUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if givu.GalleryImageVersionProperties != nil { + objectMap["properties"] = givu.GalleryImageVersionProperties + } + if givu.Tags != nil { + objectMap["tags"] = givu.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for GalleryImageVersionUpdate struct. +func (givu *GalleryImageVersionUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var galleryImageVersionProperties GalleryImageVersionProperties + err = json.Unmarshal(*v, &galleryImageVersionProperties) + if err != nil { + return err + } + 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 + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + givu.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + givu.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + givu.Type = &typeVar + } + } + } -// GalleryImageVersionStorageProfile this is the storage profile of a Gallery Image Version. -type GalleryImageVersionStorageProfile struct { - Source *GalleryArtifactVersionSource `json:"source,omitempty"` - OsDiskImage *GalleryOSDiskImage `json:"osDiskImage,omitempty"` - // DataDiskImages - A list of data disk images. - DataDiskImages *[]GalleryDataDiskImage `json:"dataDiskImages,omitempty"` + return nil } // GalleryList the List Galleries operation response. @@ -5759,6 +6345,91 @@ type GalleryProperties struct { ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` } +// 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"` +} + +// MarshalJSON is the custom marshaler for GalleryUpdate. +func (gu GalleryUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gu.GalleryProperties != nil { + objectMap["properties"] = gu.GalleryProperties + } + if gu.Tags != nil { + objectMap["tags"] = gu.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for GalleryUpdate struct. +func (gu *GalleryUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var galleryProperties GalleryProperties + err = json.Unmarshal(*v, &galleryProperties) + if err != nil { + return err + } + 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 + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + gu.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + gu.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + gu.Type = &typeVar + } + } + } + + return nil +} + // GrantAccessData data used for requesting a SAS. type GrantAccessData struct { // Access - Possible values include: 'None', 'Read', 'Write' @@ -6223,6 +6894,12 @@ 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. @@ -6264,6 +6941,33 @@ 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 + } } } @@ -7097,6 +7801,12 @@ 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. @@ -8441,6 +9151,12 @@ 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. @@ -9091,6 +9807,12 @@ 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. @@ -9132,6 +9854,33 @@ 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 + } } } @@ -11442,6 +12191,12 @@ 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. @@ -11519,6 +12274,33 @@ 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 + } } } @@ -13019,6 +13801,12 @@ 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. @@ -13096,6 +13884,33 @@ 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 + } } }