Пример #1
0
        public async Task <Response <JsonWebKeySet> > GetAsync(CancellationToken cancellationToken = default)
        {
            using var message = CreateGetRequest();
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

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

                value = JsonWebKeySet.DeserializeJsonWebKeySet(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
        internal static PolicyCertificatesResult DeserializePolicyCertificatesResult(JsonElement element)
        {
            Optional <JsonWebKeySet> xMsPolicyCertificates = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("x-ms-policy-certificates"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    xMsPolicyCertificates = JsonWebKeySet.DeserializeJsonWebKeySet(property.Value);
                    continue;
                }
            }
            return(new PolicyCertificatesResult(xMsPolicyCertificates.Value));
        }