public virtual GalleryApplicationVersionUpdateOperation Update(GalleryApplicationVersionUpdate galleryApplicationVersion, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (galleryApplicationVersion == null) { throw new ArgumentNullException(nameof(galleryApplicationVersion)); } using var scope = _clientDiagnostics.CreateScope("GalleryApplicationVersion.Update"); scope.Start(); try { var response = _restClient.Update(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, galleryApplicationVersion, cancellationToken); var operation = new GalleryApplicationVersionUpdateOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateRequest(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, galleryApplicationVersion).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual GalleryApplicationVersionsUpdateOperation StartUpdate(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (galleryName == null) { throw new ArgumentNullException(nameof(galleryName)); } if (galleryApplicationName == null) { throw new ArgumentNullException(nameof(galleryApplicationName)); } if (galleryApplicationVersionName == null) { throw new ArgumentNullException(nameof(galleryApplicationVersionName)); } if (galleryApplicationVersion == null) { throw new ArgumentNullException(nameof(galleryApplicationVersion)); } using var scope = _clientDiagnostics.CreateScope("GalleryApplicationVersionsOperations.StartUpdate"); scope.Start(); try { var originalResponse = RestClient.Update(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, cancellationToken); return(new GalleryApplicationVersionsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion).Request, originalResponse)); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <GalleryApplicationVersionUpdateOperation> UpdateAsync(bool waitForCompletion, GalleryApplicationVersionUpdate galleryApplicationVersion, CancellationToken cancellationToken = default) { if (galleryApplicationVersion == null) { throw new ArgumentNullException(nameof(galleryApplicationVersion)); } using var scope = _clientDiagnostics.CreateScope("GalleryApplicationVersion.Update"); scope.Start(); try { var response = await _galleryApplicationVersionsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, galleryApplicationVersion, cancellationToken).ConfigureAwait(false); var operation = new GalleryApplicationVersionUpdateOperation(this, _clientDiagnostics, Pipeline, _galleryApplicationVersionsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, galleryApplicationVersion).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
/// <summary> /// Update a gallery Application Version. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='galleryName'> /// The name of the Shared Application Gallery in which the Application /// Definition resides. /// </param> /// <param name='galleryApplicationName'> /// The name of the gallery Application Definition in which the Application /// Version is to be updated. /// </param> /// <param name='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: /// <MajorVersion>.<MinorVersion>.<Patch> /// </param> /// <param name='galleryApplicationVersion'> /// Parameters supplied to the update gallery Application Version operation. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <GalleryApplicationVersionInner> UpdateAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public Response Update(string subscriptionId, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, CancellationToken cancellationToken = default) { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (galleryName == null) { throw new ArgumentNullException(nameof(galleryName)); } if (galleryApplicationName == null) { throw new ArgumentNullException(nameof(galleryApplicationName)); } if (galleryApplicationVersionName == null) { throw new ArgumentNullException(nameof(galleryApplicationVersionName)); } if (galleryApplicationVersion == null) { throw new ArgumentNullException(nameof(galleryApplicationVersion)); } using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: return(message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } }
internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Compute/galleries/", false); uri.AppendPath(galleryName, true); uri.AppendPath("/applications/", false); uri.AppendPath(galleryApplicationName, true); uri.AppendPath("/versions/", false); uri.AppendPath(galleryApplicationVersionName, true); uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(galleryApplicationVersion); request.Content = content; message.SetProperty("UserAgentOverride", _userAgent); return(message); }
/// <summary> /// Update a gallery Application Version. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='galleryName'> /// The name of the Shared Application Gallery in which the Application /// Definition resides. /// </param> /// <param name='galleryApplicationName'> /// The name of the gallery Application Definition in which the Application /// Version is to be updated. /// </param> /// <param name='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: /// <MajorVersion>.<MinorVersion>.<Patch> /// </param> /// <param name='galleryApplicationVersion'> /// Parameters supplied to the update gallery Application Version operation. /// </param> public static GalleryApplicationVersion BeginUpdate(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion) { return(operations.BeginUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion).GetAwaiter().GetResult()); }
public async Task <Response> UpdateAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (galleryName == null) { throw new ArgumentNullException(nameof(galleryName)); } if (galleryApplicationName == null) { throw new ArgumentNullException(nameof(galleryApplicationName)); } if (galleryApplicationVersionName == null) { throw new ArgumentNullException(nameof(galleryApplicationVersionName)); } if (galleryApplicationVersion == null) { throw new ArgumentNullException(nameof(galleryApplicationVersion)); } using var message = CreateUpdateRequest(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: return(message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } }
public virtual ArmOperation <GalleryApplicationVersion> Update(bool waitForCompletion, GalleryApplicationVersionUpdate galleryApplicationVersion, CancellationToken cancellationToken = default) { if (galleryApplicationVersion == null) { throw new ArgumentNullException(nameof(galleryApplicationVersion)); } using var scope = _galleryApplicationVersionClientDiagnostics.CreateScope("GalleryApplicationVersion.Update"); scope.Start(); try { var response = _galleryApplicationVersionRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, galleryApplicationVersion, cancellationToken); var operation = new ComputeArmOperation <GalleryApplicationVersion>(new GalleryApplicationVersionOperationSource(Client), _galleryApplicationVersionClientDiagnostics, Pipeline, _galleryApplicationVersionRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, galleryApplicationVersion).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }