Пример #1
0
        public async Task <Response <CheckNameAvailabilityResult> > CheckNameAvailabilityAsync(string subscriptionId, string resourceGroupName, string namespaceName, CheckNameAvailability parameters, CancellationToken cancellationToken = default)
        {
            if (subscriptionId == null)
            {
                throw new ArgumentNullException(nameof(subscriptionId));
            }
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (namespaceName == null)
            {
                throw new ArgumentNullException(nameof(namespaceName));
            }
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            using var message = CreateCheckNameAvailabilityRequest(subscriptionId, resourceGroupName, namespaceName, parameters);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

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

                value = CheckNameAvailabilityResult.DeserializeCheckNameAvailabilityResult(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
        public async Task <Response <CheckNameAvailabilityResult> > CheckNameAvailabilityAsync(string subscriptionId, string resourceGroupName, string namespaceName, CheckNameAvailability checkNameAvailability, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
            Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName));
            Argument.AssertNotNull(checkNameAvailability, nameof(checkNameAvailability));

            using var message = CreateCheckNameAvailabilityRequest(subscriptionId, resourceGroupName, namespaceName, checkNameAvailability);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

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

                value = CheckNameAvailabilityResult.DeserializeCheckNameAvailabilityResult(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Пример #3
0
        public async Task <Response <CheckNameAvailabilityResult> > CheckAvailabilityAsync(StorageAccountCheckNameAvailabilityParameters accountName, CancellationToken cancellationToken = default)
        {
            if (accountName == null)
            {
                throw new ArgumentNullException(nameof(accountName));
            }

            using var message = CreateCheckAvailabilityRequest(accountName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

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

                value = CheckNameAvailabilityResult.DeserializeCheckNameAvailabilityResult(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }