internal UriSigningKeyDefinition(SecretType secretType, string keyId, WritableSubResource secretSource, string secretVersion) : base(secretType) { KeyId = keyId; SecretSource = secretSource; SecretVersion = secretVersion; SecretType = secretType; }
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("type"); writer.WriteStringValue(SecretType.ToString()); writer.WriteEndObject(); }
internal static ManagedCertificateDefinition DeserializeManagedCertificateDefinition(JsonElement element) { Optional <string> subject = default; Optional <string> expirationDate = default; SecretType type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("subject")) { subject = property.Value.GetString(); continue; } if (property.NameEquals("expirationDate")) { expirationDate = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = new SecretType(property.Value.GetString()); continue; } } return(new ManagedCertificateDefinition(type, subject.Value, expirationDate.Value)); }
internal static UriSigningKeyProperties DeserializeUriSigningKeyProperties(JsonElement element) { string keyId = default; WritableSubResource secretSource = default; Optional <string> secretVersion = default; SecretType type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyId")) { keyId = property.Value.GetString(); continue; } if (property.NameEquals("secretSource")) { secretSource = JsonSerializer.Deserialize <WritableSubResource>(property.Value.ToString()); continue; } if (property.NameEquals("secretVersion")) { secretVersion = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = new SecretType(property.Value.GetString()); continue; } } return(new UriSigningKeyProperties(type, keyId, secretSource, secretVersion.Value)); }
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("secretSource"); JsonSerializer.Serialize(writer, SecretSource); if (Optional.IsDefined(SecretVersion)) { writer.WritePropertyName("secretVersion"); writer.WriteStringValue(SecretVersion); } if (Optional.IsDefined(UseLatestVersion)) { writer.WritePropertyName("useLatestVersion"); writer.WriteBooleanValue(UseLatestVersion.Value); } if (Optional.IsCollectionDefined(SubjectAlternativeNames)) { writer.WritePropertyName("subjectAlternativeNames"); writer.WriteStartArray(); foreach (var item in SubjectAlternativeNames) { writer.WriteStringValue(item); } writer.WriteEndArray(); } writer.WritePropertyName("type"); writer.WriteStringValue(SecretType.ToString()); writer.WriteEndObject(); }
internal static ManagedCertificateProperties DeserializeManagedCertificateProperties(JsonElement element) { Optional <string> subject = default; Optional <DateTimeOffset> expirationDate = default; SecretType type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("subject")) { subject = property.Value.GetString(); continue; } if (property.NameEquals("expirationDate")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } expirationDate = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("type")) { type = new SecretType(property.Value.GetString()); continue; } } return(new ManagedCertificateProperties(type, subject.Value, Optional.ToNullable(expirationDate))); }
internal UrlSigningKeyParameters(SecretType type, string keyId, WritableSubResource secretSource, string secretVersion) : base(type) { KeyId = keyId; SecretSource = secretSource; SecretVersion = secretVersion; Type = type; }
internal static SecretParameters DeserializeSecretParameters(JsonElement element) { if (element.TryGetProperty("type", out JsonElement discriminator)) { switch (discriminator.GetString()) { case "CustomerCertificate": return(CustomerCertificateParameters.DeserializeCustomerCertificateParameters(element)); case "ManagedCertificate": return(ManagedCertificateParameters.DeserializeManagedCertificateParameters(element)); case "UrlSigningKey": return(UrlSigningKeyParameters.DeserializeUrlSigningKeyParameters(element)); } } SecretType type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type")) { type = new SecretType(property.Value.GetString()); continue; } } return(new SecretParameters(type)); }
internal static CustomerCertificateParameters DeserializeCustomerCertificateParameters(JsonElement element) { WritableSubResource secretSource = default; Optional <string> secretVersion = default; Optional <string> certificateAuthority = default; Optional <bool> useLatestVersion = default; Optional <IList <string> > subjectAlternativeNames = default; SecretType type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secretSource")) { secretSource = JsonSerializer.Deserialize <WritableSubResource>(property.Value.ToString()); continue; } if (property.NameEquals("secretVersion")) { secretVersion = property.Value.GetString(); continue; } if (property.NameEquals("certificateAuthority")) { certificateAuthority = property.Value.GetString(); continue; } if (property.NameEquals("useLatestVersion")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } useLatestVersion = property.Value.GetBoolean(); continue; } if (property.NameEquals("subjectAlternativeNames")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } subjectAlternativeNames = array; continue; } if (property.NameEquals("type")) { type = new SecretType(property.Value.GetString()); continue; } } return(new CustomerCertificateParameters(type, secretSource, secretVersion.Value, certificateAuthority.Value, Optional.ToNullable(useLatestVersion), Optional.ToList(subjectAlternativeNames))); }
internal CustomerCertificateParameters(SecretType type, WritableSubResource secretSource, string secretVersion, string certificateAuthority, bool?useLatestVersion, IList <string> subjectAlternativeNames) : base(type) { SecretSource = secretSource; SecretVersion = secretVersion; CertificateAuthority = certificateAuthority; UseLatestVersion = useLatestVersion; SubjectAlternativeNames = subjectAlternativeNames; Type = type; }
internal ValidateSecretInput(SecretType secretType, WritableSubResource secretSource) { if (secretSource == null) { throw new ArgumentNullException(nameof(secretSource)); } SecretType = secretType; SecretSource = secretSource; }
internal CustomerCertificateParameters(SecretType secretType, WritableSubResource secretSource, string secretVersion, bool?useLatestVersion, string subject, string expirationDate, string certificateAuthority, IList <string> subjectAlternativeNames, string thumbprint) : base(secretType) { SecretSource = secretSource; SecretVersion = secretVersion; UseLatestVersion = useLatestVersion; Subject = subject; ExpirationDate = expirationDate; CertificateAuthority = certificateAuthority; SubjectAlternativeNames = subjectAlternativeNames; Thumbprint = thumbprint; SecretType = secretType; }
internal static ManagedCertificateParameters DeserializeManagedCertificateParameters(JsonElement element) { SecretType type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type")) { type = new SecretType(property.Value.GetString()); continue; } } return(new ManagedCertificateParameters(type)); }
internal static AzureFirstPartyManagedCertificateDefinition DeserializeAzureFirstPartyManagedCertificateDefinition(JsonElement element) { SecretType type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type")) { type = new SecretType(property.Value.GetString()); continue; } } return(new AzureFirstPartyManagedCertificateDefinition(type)); }
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("keyId"); writer.WriteStringValue(KeyId); writer.WritePropertyName("secretSource"); JsonSerializer.Serialize(writer, SecretSource); if (Optional.IsDefined(SecretVersion)) { writer.WritePropertyName("secretVersion"); writer.WriteStringValue(SecretVersion); } writer.WritePropertyName("type"); writer.WriteStringValue(SecretType.ToString()); writer.WriteEndObject(); }
internal ManagedCertificateProperties(SecretType secretType, string subject, DateTimeOffset?expiresOn) : base(secretType) { Subject = subject; ExpiresOn = expiresOn; SecretType = secretType; }