public virtual ArmOperation <DataCollectionRuleAssociationResource> Update(WaitUntil waitUntil, DataCollectionRuleAssociationData data = null, CancellationToken cancellationToken = default) { using var scope = _dataCollectionRuleAssociationClientDiagnostics.CreateScope("DataCollectionRuleAssociationResource.Update"); scope.Start(); try { var response = _dataCollectionRuleAssociationRestClient.Create(Id.Parent, Id.Name, data, cancellationToken); var operation = new MonitorArmOperation <DataCollectionRuleAssociationResource>(Response.FromValue(new DataCollectionRuleAssociationResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal DataCollectionRuleAssociationResource(ArmClient client, DataCollectionRuleAssociationData data) : this(client, data.Id) { HasData = true; _data = data; }
public virtual async Task <ArmOperation <DataCollectionRuleAssociationResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string associationName, DataCollectionRuleAssociationData data = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(associationName, nameof(associationName)); using var scope = _dataCollectionRuleAssociationClientDiagnostics.CreateScope("DataCollectionRuleAssociationCollection.CreateOrUpdate"); scope.Start(); try { var response = await _dataCollectionRuleAssociationRestClient.CreateAsync(Id, associationName, data, cancellationToken).ConfigureAwait(false); var operation = new MonitorArmOperation <DataCollectionRuleAssociationResource>(Response.FromValue(new DataCollectionRuleAssociationResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }