/// <summary>
 /// Initializes a new instance of the <see cref="Certificates.CertificateOperationProperties"/> for mocking purposes.
 /// </summary>
 /// <param name="id">Sets the <see cref="Certificates.CertificateOperationProperties.Id"/> property.</param>
 /// <param name="name">Sets the <see cref="Certificates.CertificateOperationProperties.Name"/> property.</param>
 /// <param name="vaultUri">Sets the <see cref="Certificates.CertificateOperationProperties.VaultUri"/> property.</param>
 /// <param name="issuerName">Sets the <see cref="Certificates.CertificateOperationProperties.IssuerName"/> property.</param>
 /// <param name="certificateType">Sets the <see cref="Certificates.CertificateOperationProperties.CertificateType"/> property.</param>
 /// <param name="certificateTransparency">Sets the <see cref="Certificates.CertificateOperationProperties.CertificateTransparency"/> property.</param>
 /// <param name="csr">Sets the <see cref="Certificates.CertificateOperationProperties.Csr"/> property.</param>
 /// <param name="cancellationRequested">Sets the <see cref="Certificates.CertificateOperationProperties.CancellationRequested"/> property.</param>
 /// <param name="requestId">Sets the <see cref="Certificates.CertificateOperationProperties.RequestId"/> property.</param>
 /// <param name="status">Sets the <see cref="Certificates.CertificateOperationProperties.Status"/> property.</param>
 /// <param name="statusDetails">Sets the <see cref="Certificates.CertificateOperationProperties.StatusDetails"/> property.</param>
 /// <param name="target">Sets the <see cref="Certificates.CertificateOperationProperties.Target"/> property.</param>
 /// <param name="error">Sets the <see cref="Certificates.CertificateOperationProperties.Error"/> property.</param>
 /// <returns>A new instance of the <see cref="Certificates.CertificateOperationProperties"/> for mocking purposes.</returns>
 public static CertificateOperationProperties CertificateOperationProperties(
     Uri id                          = default,
     string name                     = default,
     Uri vaultUri                    = default,
     string issuerName               = default,
     string certificateType          = default,
     bool?certificateTransparency    = default,
     byte[] csr                      = default,
     bool cancellationRequested      = default,
     string requestId                = default,
     string status                   = default,
     string statusDetails            = default,
     string target                   = default,
     CertificateOperationError error = default) => new CertificateOperationProperties
 {
     Id                      = id,
     Name                    = name,
     VaultUri                = vaultUri,
     IssuerName              = issuerName,
     CertificateType         = certificateType,
     CertificateTransparency = certificateTransparency,
     Csr                     = csr,
     CancellationRequested   = cancellationRequested,
     RequestId               = requestId,
     Status                  = status,
     StatusDetails           = statusDetails,
     Target                  = target,
     Error                   = error,
 };
        // TODO: How should we support CertificateOperation?

        /// <summary>
        /// Initializes a new instance of the <see cref="Certificates.CertificateOperationError"/> for mocking purposes.
        /// </summary>
        /// <param name="code">Sets the <see cref="Certificates.CertificateOperationError.Code"/> property.</param>
        /// <param name="message">Sets the <see cref="Certificates.CertificateOperationError.Message"/> property.</param>
        /// <param name="innerError">Sets the <see cref="Certificates.CertificateOperationError.InnerError"/> property.</param>
        /// <returns>A new instance of the <see cref="Certificates.CertificateOperationError"/> for mocking purposes.</returns>
        public static CertificateOperationError CertificateOperationError(
            string code    = default,
            string message = default,
            CertificateOperationError innerError = default) => new CertificateOperationError
        {
            Code       = code,
            Message    = message,
            InnerError = innerError,
        };
Exemple #3
0
        void IJsonDeserializable.ReadProperties(JsonElement json)
        {
            foreach (JsonProperty prop in json.EnumerateObject())
            {
                switch (prop.Name)
                {
                case IdPropertyName:
                    var id = prop.Value.GetString();
                    Id = new Uri(id);
                    ParseId(Id);
                    break;

                case IssuerProperyName:
                    IssuerName = prop.Value.GetProperty(IssuerNamePropertyName).GetString();
                    break;

                case CsrPropertyName:
                    CertificateSigningRequest = prop.Value.GetString();
                    break;

                case CancellationRequestedPropertyName:
                    CancellationRequested = prop.Value.GetBoolean();
                    break;

                case RequestIdPropertyName:
                    RequestId = prop.Value.GetString();
                    break;

                case StatusPropertyName:
                    Status = prop.Value.GetString();
                    break;

                case StatusDetailsPropertyName:
                    StatusDetails = prop.Value.GetString();
                    break;

                case TargetPropertyName:
                    Target = prop.Value.GetString();
                    break;

                case ErrorPropertyName:
                    Error = new CertificateOperationError();
                    ((IJsonDeserializable)Error).ReadProperties(prop.Value);
                    break;
                }
            }
        }
        void IJsonDeserializable.ReadProperties(JsonElement json)
        {
            foreach (JsonProperty prop in json.EnumerateObject())
            {
                switch (prop.Name)
                {
                case CodePropertyName:
                    Code = prop.Value.GetString();
                    break;

                case MessagePropertyName:
                    Message = prop.Value.GetString();
                    break;

                case InnerErrorPropertyName:
                    InnerError = new CertificateOperationError();
                    ((IJsonDeserializable)InnerError).ReadProperties(prop.Value);
                    break;
                }
            }
        }