public virtual ServerVulnerabilityAssessmentCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, VulnerabilityAssessmentName vulnerabilityAssessmentName, ServerVulnerabilityAssessmentData parameters, CancellationToken cancellationToken = default)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            using var scope = _serverVulnerabilityAssessmentClientDiagnostics.CreateScope("ServerVulnerabilityAssessmentCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response  = _serverVulnerabilityAssessmentRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vulnerabilityAssessmentName, parameters, cancellationToken);
                var operation = new ServerVulnerabilityAssessmentCreateOrUpdateOperation(ArmClient, response);
                if (waitForCompletion)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
        public virtual ArmOperation <ServerVulnerabilityAssessmentResource> Update(WaitUntil waitUntil, ServerVulnerabilityAssessmentData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _serverVulnerabilityAssessmentClientDiagnostics.CreateScope("ServerVulnerabilityAssessmentResource.Update");
            scope.Start();
            try
            {
                var response  = _serverVulnerabilityAssessmentRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken);
                var operation = new SqlArmOperation <ServerVulnerabilityAssessmentResource>(Response.FromValue(new ServerVulnerabilityAssessmentResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemple #3
0
        public virtual ArmOperation <ServerVulnerabilityAssessment> CreateOrUpdate(bool waitForCompletion, VulnerabilityAssessmentName vulnerabilityAssessmentName, ServerVulnerabilityAssessmentData parameters, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(parameters, nameof(parameters));

            using var scope = _serverVulnerabilityAssessmentClientDiagnostics.CreateScope("ServerVulnerabilityAssessmentCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response  = _serverVulnerabilityAssessmentRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vulnerabilityAssessmentName, parameters, cancellationToken);
                var operation = new SqlArmOperation <ServerVulnerabilityAssessment>(Response.FromValue(new ServerVulnerabilityAssessment(Client, response), response.GetRawResponse()));
                if (waitForCompletion)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }