public virtual async Task<ArmOperation<ScVmmServerResource>> CreateOrUpdateAsync(WaitUntil waitUntil, string vmmServerName, ScVmmServerData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(vmmServerName, nameof(vmmServerName)); Argument.AssertNotNull(data, nameof(data)); using var scope = _scVmmServerVmmServersClientDiagnostics.CreateScope("ScVmmServerCollection.CreateOrUpdate"); scope.Start(); try { var response = await _scVmmServerVmmServersRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, vmmServerName, data, cancellationToken).ConfigureAwait(false); var operation = new ArcScVmmArmOperation<ScVmmServerResource>(new ScVmmServerOperationSource(Client), _scVmmServerVmmServersClientDiagnostics, Pipeline, _scVmmServerVmmServersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, vmmServerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <ArmOperation <InventoryItemResource> > UpdateAsync(WaitUntil waitUntil, InventoryItemData data = null, CancellationToken cancellationToken = default) { using var scope = _inventoryItemClientDiagnostics.CreateScope("InventoryItemResource.Update"); scope.Start(); try { var response = await _inventoryItemRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); var operation = new ArcScVmmArmOperation <InventoryItemResource>(Response.FromValue(new InventoryItemResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <ArmOperation <ScVmmVirtualMachineTemplateResource> > UpdateAsync(WaitUntil waitUntil, ResourcePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); using var scope = _scVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics.CreateScope("ScVmmVirtualMachineTemplateResource.Update"); scope.Start(); try { var response = await _scVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); var operation = new ArcScVmmArmOperation <ScVmmVirtualMachineTemplateResource>(new ScVmmVirtualMachineTemplateOperationSource(Client), _scVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics, Pipeline, _scVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }