示例#1
0
        ConfigurationServiceResource IOperationSource <ConfigurationServiceResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = ConfigurationServiceResourceData.DeserializeConfigurationServiceResourceData(document.RootElement);

            return(new ConfigurationServiceResource(_client, data));
        }
示例#2
0
        public async Task <Response <ConfigurationServiceResourceData> > GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string configurationServiceName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
            Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName));
            Argument.AssertNotNullOrEmpty(configurationServiceName, nameof(configurationServiceName));

            using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, configurationServiceName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

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

                value = ConfigurationServiceResourceData.DeserializeConfigurationServiceResourceData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }