Exemplo n.º 1
0
        internal static DeploymentExtended DeserializeDeploymentExtended(JsonElement element)
        {
            string id   = default;
            string name = default;
            DeploymentPropertiesExtended properties = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    properties = DeploymentPropertiesExtended.DeserializeDeploymentPropertiesExtended(property.Value);
                    continue;
                }
            }
            return(new DeploymentExtended(id, name, properties));
        }
Exemplo n.º 2
0
        internal static DeploymentValidateResult DeserializeDeploymentValidateResult(JsonElement element)
        {
            ResourceManagementErrorWithDetails error      = default;
            DeploymentPropertiesExtended       properties = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("error"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    error = ResourceManagementErrorWithDetails.DeserializeResourceManagementErrorWithDetails(property.Value);
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    properties = DeploymentPropertiesExtended.DeserializeDeploymentPropertiesExtended(property.Value);
                    continue;
                }
            }
            return(new DeploymentValidateResult(error, properties));
        }
Exemplo n.º 3
0
 internal DeploymentExtended(string id, string name, DeploymentPropertiesExtended properties)
 {
     Id         = id;
     Name       = name;
     Properties = properties;
 }