Exemple #1
0
        internal static DiscoveryConfiguration DeserializeDiscoveryConfiguration(JsonElement element)
        {
            Optional <string>        centralServerVmId = default;
            Optional <AzureLocation> appLocation       = default;
            SapConfigurationType     configurationType = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("centralServerVmId"))
                {
                    centralServerVmId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("appLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    appLocation = new AzureLocation(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("configurationType"))
                {
                    configurationType = new SapConfigurationType(property.Value.GetString());
                    continue;
                }
            }
            return(new DiscoveryConfiguration(configurationType, centralServerVmId.Value, Optional.ToNullable(appLocation)));
        }
Exemple #2
0
 internal DeploymentConfiguration(SapConfigurationType configurationType, AzureLocation?appLocation, InfrastructureConfiguration infrastructureConfiguration, SoftwareConfiguration softwareConfiguration) : base(configurationType)
 {
     AppLocation = appLocation;
     InfrastructureConfiguration = infrastructureConfiguration;
     SoftwareConfiguration       = softwareConfiguration;
     ConfigurationType           = configurationType;
 }
Exemple #3
0
        internal static SapConfiguration DeserializeSapConfiguration(JsonElement element)
        {
            if (element.TryGetProperty("configurationType", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "Deployment": return(DeploymentConfiguration.DeserializeDeploymentConfiguration(element));

                case "DeploymentWithOSConfig": return(DeploymentWithOSConfiguration.DeserializeDeploymentWithOSConfiguration(element));

                case "Discovery": return(DiscoveryConfiguration.DeserializeDiscoveryConfiguration(element));
                }
            }
            SapConfigurationType configurationType = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("configurationType"))
                {
                    configurationType = new SapConfigurationType(property.Value.GetString());
                    continue;
                }
            }
            return(new SapConfiguration(configurationType));
        }
Exemple #4
0
        internal static DeploymentWithOSConfiguration DeserializeDeploymentWithOSConfiguration(JsonElement element)
        {
            Optional <AzureLocation> appLocation = default;
            Optional <InfrastructureConfiguration> infrastructureConfiguration = default;
            Optional <SoftwareConfiguration>       softwareConfiguration       = default;
            Optional <OSSapConfiguration>          osSapConfiguration          = default;
            SapConfigurationType configurationType = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("appLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    appLocation = new AzureLocation(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("infrastructureConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    infrastructureConfiguration = InfrastructureConfiguration.DeserializeInfrastructureConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("softwareConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    softwareConfiguration = SoftwareConfiguration.DeserializeSoftwareConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("osSapConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    osSapConfiguration = OSSapConfiguration.DeserializeOSSapConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("configurationType"))
                {
                    configurationType = new SapConfigurationType(property.Value.GetString());
                    continue;
                }
            }
            return(new DeploymentWithOSConfiguration(configurationType, Optional.ToNullable(appLocation), infrastructureConfiguration.Value, softwareConfiguration.Value, osSapConfiguration.Value));
        }
Exemple #5
0
 internal DiscoveryConfiguration(SapConfigurationType configurationType, string centralServerVmId, AzureLocation?appLocation) : base(configurationType)
 {
     CentralServerVmId = centralServerVmId;
     AppLocation       = appLocation;
     ConfigurationType = configurationType;
 }