public async virtual Task <FlowLogCreateOrUpdateOperation> CreateOrUpdateAsync(bool waitForCompletion, string flowLogName, FlowLogData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(flowLogName, nameof(flowLogName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _flowLogClientDiagnostics.CreateScope("FlowLogCollection.CreateOrUpdate"); scope.Start(); try { var response = await _flowLogRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, flowLogName, parameters, cancellationToken).ConfigureAwait(false); var operation = new FlowLogCreateOrUpdateOperation(ArmClient, _flowLogClientDiagnostics, Pipeline, _flowLogRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, flowLogName, parameters).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual FlowLogCreateOrUpdateOperation CreateOrUpdate(string flowLogName, FlowLogData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (flowLogName == null) { throw new ArgumentNullException(nameof(flowLogName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("FlowLogContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, flowLogName, parameters, cancellationToken); var operation = new FlowLogCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, flowLogName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }