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; } }
public virtual FlowLogCreateOrUpdateOperation CreateOrUpdate(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 = _flowLogRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, flowLogName, parameters, cancellationToken); var operation = new FlowLogCreateOrUpdateOperation(ArmClient, _flowLogClientDiagnostics, Pipeline, _flowLogRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, flowLogName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <FlowLog> CreateOrUpdate(WaitUntil waitUntil, string flowLogName, FlowLogData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(flowLogName, nameof(flowLogName)); Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _flowLogClientDiagnostics.CreateScope("FlowLogCollection.CreateOrUpdate"); scope.Start(); try { var response = _flowLogRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, flowLogName, parameters, cancellationToken); var operation = new NetworkArmOperation <FlowLog>(new FlowLogOperationSource(Client), _flowLogClientDiagnostics, Pipeline, _flowLogRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, flowLogName, parameters).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }