public async Task <Response <ManagedServerSecurityAlertPolicy> > GetAsync(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (managedInstanceName == null)
            {
                throw new ArgumentNullException(nameof(managedInstanceName));
            }

            using var message = CreateGetRequest(resourceGroupName, managedInstanceName, securityAlertPolicyName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                ManagedServerSecurityAlertPolicy value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = ManagedServerSecurityAlertPolicy.DeserializeManagedServerSecurityAlertPolicy(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
 public virtual Response <ServerSecurityAlertPolicy> Get(string resourceGroupName, string serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("ServerSecurityAlertPoliciesOperations.Get");
     scope.Start();
     try
     {
         return(RestClient.Get(resourceGroupName, serverName, securityAlertPolicyName, cancellationToken));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
        internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName)
        {
            var message = _pipeline.CreateMessage();
            var request = message.Request;

            request.Method = RequestMethod.Get;
            var uri = new RawRequestUriBuilder();

            uri.Reset(endpoint);
            uri.AppendPath("/subscriptions/", false);
            uri.AppendPath(subscriptionId, true);
            uri.AppendPath("/resourceGroups/", false);
            uri.AppendPath(resourceGroupName, true);
            uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false);
            uri.AppendPath(managedInstanceName, true);
            uri.AppendPath("/securityAlertPolicies/", false);
            uri.AppendPath(securityAlertPolicyName.ToString(), true);
            uri.AppendQuery("api-version", "2017-03-01-preview", true);
            request.Uri = uri;
            request.Headers.Add("Accept", "application/json");
            return(message);
        }
        public virtual ServerSecurityAlertPoliciesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, ServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (serverName == null)
            {
                throw new ArgumentNullException(nameof(serverName));
            }
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            using var scope = _clientDiagnostics.CreateScope("ServerSecurityAlertPoliciesOperations.StartCreateOrUpdate");
            scope.Start();
            try
            {
                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serverName, securityAlertPolicyName, parameters, cancellationToken);
                return(new ServerSecurityAlertPoliciesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, securityAlertPolicyName, parameters).Request, originalResponse));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }