public async virtual Task <ManagedInstanceVulnerabilityAssessmentCreateOrUpdateOperation> CreateOrUpdateAsync(bool waitForCompletion, VulnerabilityAssessmentName vulnerabilityAssessmentName, ManagedInstanceVulnerabilityAssessmentData parameters, CancellationToken cancellationToken = default) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _managedInstanceVulnerabilityAssessmentClientDiagnostics.CreateScope("ManagedInstanceVulnerabilityAssessmentCollection.CreateOrUpdate"); scope.Start(); try { var response = await _managedInstanceVulnerabilityAssessmentRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vulnerabilityAssessmentName, parameters, cancellationToken).ConfigureAwait(false); var operation = new ManagedInstanceVulnerabilityAssessmentCreateOrUpdateOperation(ArmClient, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ManagedInstanceVulnerabilityAssessmentCreateOrUpdateOperation CreateOrUpdate(VulnerabilityAssessmentName vulnerabilityAssessmentName, ManagedInstanceVulnerabilityAssessmentData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("ManagedInstanceVulnerabilityAssessmentCollection.CreateOrUpdate"); scope.Start(); try { var response = _managedInstanceVulnerabilityAssessmentsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vulnerabilityAssessmentName, parameters, cancellationToken); var operation = new ManagedInstanceVulnerabilityAssessmentCreateOrUpdateOperation(Parent, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }