public virtual JitRequestDefinitionCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string jitRequestName, JitRequestDefinitionData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(jitRequestName, nameof(jitRequestName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _jitRequestDefinitionJitRequestsClientDiagnostics.CreateScope("JitRequestDefinitionCollection.CreateOrUpdate"); scope.Start(); try { var response = _jitRequestDefinitionJitRequestsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, jitRequestName, parameters, cancellationToken); var operation = new JitRequestDefinitionCreateOrUpdateOperation(ArmClient, _jitRequestDefinitionJitRequestsClientDiagnostics, Pipeline, _jitRequestDefinitionJitRequestsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, jitRequestName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual JitRequestCreateOrUpdateOperation CreateOrUpdate(string jitRequestName, JitRequestDefinitionData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (jitRequestName == null) { throw new ArgumentNullException(nameof(jitRequestName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("JitRequestDefinitionContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, jitRequestName, parameters, cancellationToken); var operation = new JitRequestCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, jitRequestName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <JitRequest> CreateOrUpdate(WaitUntil waitUntil, string jitRequestName, JitRequestData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(jitRequestName, nameof(jitRequestName)); Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _jitRequestClientDiagnostics.CreateScope("JitRequestCollection.CreateOrUpdate"); scope.Start(); try { var response = _jitRequestRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, jitRequestName, parameters, cancellationToken); var operation = new ResourcesArmOperation <JitRequest>(new JitRequestOperationSource(Client), _jitRequestClientDiagnostics, Pipeline, _jitRequestRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, jitRequestName, parameters).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }