Пример #1
0
 internal ResourceGroupPatchable(string name, ResourceGroupProperties properties, string managedBy, IDictionary <string, string> tags)
 {
     Name       = name;
     Properties = properties;
     ManagedBy  = managedBy;
     Tags       = tags;
 }
Пример #2
0
 internal ResourceGroup(string id, string name, string type, ResourceGroupProperties properties, string location, string managedBy, IDictionary <string, string> tags)
 {
     Id         = id;
     Name       = name;
     Type       = type;
     Properties = properties;
     Location   = location;
     ManagedBy  = managedBy;
     Tags       = tags;
 }
        internal static ResourceGroup DeserializeResourceGroup(JsonElement element)
        {
            Optional <string> id   = default;
            Optional <string> name = default;
            Optional <string> type = default;
            Optional <ResourceGroupProperties> properties = default;
            string            location  = default;
            Optional <string> managedBy = default;
            Optional <IDictionary <string, string> > tags = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = 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("properties"))
                {
                    properties = ResourceGroupProperties.DeserializeResourceGroupProperties(property.Value);
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("managedBy"))
                {
                    managedBy = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    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;
                }
            }
            return(new ResourceGroup(id.Value, name.Value, type.Value, properties.Value, location, managedBy.Value, Optional.ToDictionary(tags)));
        }
Пример #4
0
        internal static ResourceGroup DeserializeResourceGroup(JsonElement element)
        {
            string id   = default;
            string name = default;
            string type = default;
            ResourceGroupProperties properties = default;
            string location  = default;
            string managedBy = default;
            IDictionary <string, string> tags = 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"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    properties = ResourceGroupProperties.DeserializeResourceGroupProperties(property.Value);
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("managedBy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    managedBy = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.Value.ValueKind == JsonValueKind.Null)
                        {
                            dictionary.Add(property0.Name, null);
                        }
                        else
                        {
                            dictionary.Add(property0.Name, property0.Value.GetString());
                        }
                    }
                    tags = dictionary;
                    continue;
                }
            }
            return(new ResourceGroup(id, name, type, properties, location, managedBy, tags));
        }