Example #1
0
 internal EventHubClusterData(ResourceIdentifier id, string name, ResourceType type, IDictionary <string, string> tags, Location location, ClusterSku sku, SystemData systemData, string createdAt, string updatedAt, string metricId, string status) : base(id, name, type, tags, location)
 {
     Sku        = sku;
     SystemData = systemData;
     CreatedAt  = createdAt;
     UpdatedAt  = updatedAt;
     MetricId   = metricId;
     Status     = status;
 }
Example #2
0
 public PSClusterSku(ClusterSku sku)
 {
     this.Capacity = sku.Capacity;
     this.Name     = sku.Name;
 }
        internal static EventHubClusterData DeserializeEventHubClusterData(JsonElement element)
        {
            Optional <ClusterSku>        sku  = default;
            IDictionary <string, string> tags = default;
            AzureLocation      location       = default;
            ResourceIdentifier id             = default;
            string             name           = default;
            ResourceType       type           = default;
            SystemData         systemData     = default;
            Optional <string>  createdAt      = default;
            Optional <string>  updatedAt      = default;
            Optional <string>  metricId       = default;
            Optional <string>  status         = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = ClusterSku.DeserializeClusterSku(property.Value);
                    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;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    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 = 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("createdAt"))
                        {
                            createdAt = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("updatedAt"))
                        {
                            updatedAt = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("metricId"))
                        {
                            metricId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("status"))
                        {
                            status = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new EventHubClusterData(id, name, type, systemData, tags, location, sku.Value, createdAt.Value, updatedAt.Value, metricId.Value, status.Value));
        }