public virtual async Task <ArmOperation <PolicyExemptionResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string policyExemptionName, PolicyExemptionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(policyExemptionName, nameof(policyExemptionName)); Argument.AssertNotNull(data, nameof(data)); using var scope = _policyExemptionClientDiagnostics.CreateScope("PolicyExemptionCollection.CreateOrUpdate"); scope.Start(); try { var response = await _policyExemptionRestClient.CreateOrUpdateAsync(Id, policyExemptionName, data, cancellationToken).ConfigureAwait(false); var operation = new ResourcesArmOperation <PolicyExemptionResource>(Response.FromValue(new PolicyExemptionResource(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 ArmOperation <PolicyExemption> CreateOrUpdate(WaitUntil waitUntil, string policyExemptionName, PolicyExemptionData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(policyExemptionName, nameof(policyExemptionName)); Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _policyExemptionClientDiagnostics.CreateScope("PolicyExemptionCollection.CreateOrUpdate"); scope.Start(); try { var response = _policyExemptionRestClient.CreateOrUpdate(Id, policyExemptionName, parameters, cancellationToken); var operation = new ResourcesArmOperation <PolicyExemption>(Response.FromValue(new PolicyExemption(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal PolicyExemption(ArmClient client, PolicyExemptionData data) : this(client, data.Id) { HasData = true; _data = data; }
public async virtual Task <PolicyExemptionCreateOrUpdateOperation> CreateOrUpdateAsync(bool waitForCompletion, string policyExemptionName, PolicyExemptionData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(policyExemptionName, nameof(policyExemptionName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _policyExemptionClientDiagnostics.CreateScope("PolicyExemptionCollection.CreateOrUpdate"); scope.Start(); try { var response = await _policyExemptionRestClient.CreateOrUpdateAsync(Id, policyExemptionName, parameters, cancellationToken).ConfigureAwait(false); var operation = new PolicyExemptionCreateOrUpdateOperation(ArmClient, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }