public virtual DscpConfigurationCreateOrUpdateOperation CreateOrUpdate(string dscpConfigurationName, DscpConfigurationData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (dscpConfigurationName == null) { throw new ArgumentNullException(nameof(dscpConfigurationName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("DscpConfigurationContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, dscpConfigurationName, parameters, cancellationToken); var operation = new DscpConfigurationCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, dscpConfigurationName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual DscpConfigurationCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string dscpConfigurationName, DscpConfigurationData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(dscpConfigurationName, nameof(dscpConfigurationName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _dscpConfigurationClientDiagnostics.CreateScope("DscpConfigurationCollection.CreateOrUpdate"); scope.Start(); try { var response = _dscpConfigurationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, dscpConfigurationName, parameters, cancellationToken); var operation = new DscpConfigurationCreateOrUpdateOperation(ArmClient, _dscpConfigurationClientDiagnostics, Pipeline, _dscpConfigurationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, dscpConfigurationName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <DscpConfigurationResource> Update(WaitUntil waitUntil, DscpConfigurationData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _dscpConfigurationClientDiagnostics.CreateScope("DscpConfigurationResource.Update"); scope.Start(); try { var response = _dscpConfigurationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken); var operation = new NetworkArmOperation <DscpConfigurationResource>(new DscpConfigurationOperationSource(Client), _dscpConfigurationClientDiagnostics, Pipeline, _dscpConfigurationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }