internal static CdnCustomDomainData DeserializeCdnCustomDomainData(JsonElement element) { ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; Optional <string> hostName = default; Optional <CustomDomainResourceState> resourceState = default; Optional <CustomHttpsProvisioningState> customHttpsProvisioningState = default; Optional <CustomHttpsAvailabilityState> customHttpsProvisioningSubstate = default; Optional <CustomDomainHttpsContent> customHttpsParameters = default; Optional <string> validationData = default; Optional <CustomHttpsProvisioningState> provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("systemData")) { systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString()); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("hostName")) { hostName = property0.Value.GetString(); continue; } if (property0.NameEquals("resourceState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } resourceState = new CustomDomainResourceState(property0.Value.GetString()); continue; } if (property0.NameEquals("customHttpsProvisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } customHttpsProvisioningState = new CustomHttpsProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("customHttpsProvisioningSubstate")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } customHttpsProvisioningSubstate = new CustomHttpsAvailabilityState(property0.Value.GetString()); continue; } if (property0.NameEquals("customHttpsParameters")) { if (property0.Value.ValueKind == JsonValueKind.Null) { customHttpsParameters = null; continue; } customHttpsParameters = CustomDomainHttpsContent.DeserializeCustomDomainHttpsContent(property0.Value); continue; } if (property0.NameEquals("validationData")) { validationData = property0.Value.GetString(); continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new CustomHttpsProvisioningState(property0.Value.GetString()); continue; } } continue; } } return(new CdnCustomDomainData(id, name, type, systemData, hostName.Value, Optional.ToNullable(resourceState), Optional.ToNullable(customHttpsProvisioningState), Optional.ToNullable(customHttpsProvisioningSubstate), customHttpsParameters.Value, validationData.Value, Optional.ToNullable(provisioningState))); }
/// <summary> /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider" /// /> and <see cref="ignoreCase" /> /// </summary> /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param> /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param> /// <param name="formatProvider">not used by this TypeConverter.</param> /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param> /// <returns> /// an instance of <see cref="CustomDomainResourceState" />, or <c>null</c> if there is no suitable conversion. /// </returns> public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => CustomDomainResourceState.CreateFrom(sourceValue);