Beispiel #1
0
        protected async Task <AfdSecret> CreateAfdSecret(Profile profile, string secretName)
        {
            AfdSecretData input = ResourceDataHelper.CreateAfdSecretData();
            var           lro   = await profile.GetAfdSecrets().CreateOrUpdateAsync(true, secretName, input);

            return(lro.Value);
        }
        AfdSecret IOperationSource <AfdSecret> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = AfdSecretData.DeserializeAfdSecretData(document.RootElement);

            return(new AfdSecret(_operationBase, data));
        }
        internal static SecretListResult DeserializeSecretListResult(JsonElement element)
        {
            Optional <IReadOnlyList <AfdSecretData> > value = default;
            Optional <string> nextLink = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <AfdSecretData> array = new List <AfdSecretData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(AfdSecretData.DeserializeAfdSecretData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new SecretListResult(Optional.ToList(value), nextLink.Value));
        }