internal static PolicyCertificatesModificationResult DeserializePolicyCertificatesModificationResult(JsonElement element)
        {
            Optional <string> xMsCertificateThumbprint = default;
            Optional <PolicyCertificateResolution> xMsPolicycertificatesResult = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("x-ms-certificate-thumbprint"))
                {
                    xMsCertificateThumbprint = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("x-ms-policycertificates-result"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    xMsPolicycertificatesResult = new PolicyCertificateResolution(property.Value.GetString());
                    continue;
                }
            }
            return(new PolicyCertificatesModificationResult(xMsCertificateThumbprint.Value, Optional.ToNullable(xMsPolicycertificatesResult)));
        }
Esempio n. 2
0
 /// <summary>
 /// Creates a new instance of <see cref="Attestation.PolicyCertificatesModificationResult"/> for mocking purposes.
 /// </summary>
 /// <param name="certificateThumbprint">The thumbprint of the certificate which was modified.</param>
 /// <param name="certificateResolution">The modification which was performed.</param>
 /// <returns>A <see cref="Attestation.PolicyCertificatesModificationResult"/> object.</returns>
 public static PolicyCertificatesModificationResult PolicyCertificatesModificationResult(PolicyCertificateResolution certificateResolution, string certificateThumbprint) =>
 new PolicyCertificatesModificationResult(certificateThumbprint, certificateResolution);