public async ValueTask <Response <AvailablePrivateEndpointTypesResult> > ListAsync(string location, CancellationToken cancellationToken = default)
        {
            if (location == null)
            {
                throw new ArgumentNullException(nameof(location));
            }

            using var message = CreateListRequest(location);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

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

                if (document.RootElement.ValueKind == JsonValueKind.Null)
                {
                    value = null;
                }
                else
                {
                    value = AvailablePrivateEndpointTypesResult.DeserializeAvailablePrivateEndpointTypesResult(document.RootElement);
                }
                return(Response.FromValue(value, message.Response));
            }
Ejemplo n.º 2
0
        public async Task <Response <AvailablePrivateEndpointTypesResult> > ListAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));

            using var message = CreateListRequest(subscriptionId, location);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

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

                value = AvailablePrivateEndpointTypesResult.DeserializeAvailablePrivateEndpointTypesResult(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }