public async Task <Response <ServerAzureADOnlyAuthentication> > GetAsync(string resourceGroupName, string serverName, AuthenticationName authenticationName, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (serverName == null)
            {
                throw new ArgumentNullException(nameof(serverName));
            }

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

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

                value = ServerAzureADOnlyAuthentication.DeserializeServerAzureADOnlyAuthentication(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
コード例 #2
0
        public virtual ServerAzureADOnlyAuthenticationsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, AuthenticationName authenticationName, ServerAzureADOnlyAuthentication 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("ServerAzureADOnlyAuthenticationsOperations.StartCreateOrUpdate");
            scope.Start();
            try
            {
                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serverName, authenticationName, parameters, cancellationToken);
                return(new ServerAzureADOnlyAuthenticationsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, authenticationName, parameters).Request, originalResponse));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }