예제 #1
0
 internal ArmDeploymentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation?location, ArmDeploymentPropertiesExtended properties, IReadOnlyDictionary <string, string> tags) : base(id, name, resourceType, systemData)
 {
     Location   = location;
     Properties = properties;
     Tags       = tags;
 }
예제 #2
0
        internal static ArmDeploymentData DeserializeArmDeploymentData(JsonElement element)
        {
            Optional <AzureLocation> location = default;
            Optional <ArmDeploymentPropertiesExtended>       properties = default;
            Optional <IReadOnlyDictionary <string, string> > tags       = default;
            ResourceIdentifier id         = default;
            string             name       = default;
            ResourceType       type       = default;
            SystemData         systemData = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("location"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    location = new AzureLocation(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    properties = ArmDeploymentPropertiesExtended.DeserializeArmDeploymentPropertiesExtended(property.Value);
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                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 = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
            }
            return(new ArmDeploymentData(id, name, type, systemData, Optional.ToNullable(location), properties.Value, Optional.ToDictionary(tags)));
        }
예제 #3
0
 internal ArmDeploymentValidateResult(ResourcesResponseError error, ArmDeploymentPropertiesExtended properties)
 {
     Error      = error;
     Properties = properties;
 }