internal RoleInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string location, IReadOnlyDictionary <string, string> tags, InstanceSku sku, RoleInstanceProperties properties) : base(id, name, resourceType, systemData) { Location = location; Tags = tags; Sku = sku; Properties = properties; }
internal CloudServiceRoleInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation?location, IReadOnlyDictionary <string, string> tags, InstanceSku sku, RoleInstanceNetworkProfile networkProfile, RoleInstanceView instanceView) : base(id, name, resourceType, systemData) { Location = location; Tags = tags; Sku = sku; NetworkProfile = networkProfile; InstanceView = instanceView; }
internal static RoleInstanceData DeserializeRoleInstanceData(JsonElement element) { Optional <string> location = default; Optional <IReadOnlyDictionary <string, string> > tags = default; Optional <InstanceSku> sku = default; Optional <RoleInstanceProperties> properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location")) { location = property.Value.GetString(); 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("sku")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sku = InstanceSku.DeserializeInstanceSku(property.Value); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } properties = RoleInstanceProperties.DeserializeRoleInstanceProperties(property.Value); 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; } } return(new RoleInstanceData(id, name, type, location.Value, Optional.ToDictionary(tags), sku.Value, properties.Value)); }
internal static CloudServiceRoleInstanceData DeserializeCloudServiceRoleInstanceData(JsonElement element) { Optional <AzureLocation> location = default; Optional <IReadOnlyDictionary <string, string> > tags = default; Optional <InstanceSku> sku = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; Optional <RoleInstanceNetworkProfile> networkProfile = default; Optional <RoleInstanceView> instanceView = 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("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("sku")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sku = InstanceSku.DeserializeInstanceSku(property.Value); 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; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("networkProfile")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } networkProfile = RoleInstanceNetworkProfile.DeserializeRoleInstanceNetworkProfile(property0.Value); continue; } if (property0.NameEquals("instanceView")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } instanceView = RoleInstanceView.DeserializeRoleInstanceView(property0.Value); continue; } } continue; } } return(new CloudServiceRoleInstanceData(id, name, type, systemData, Optional.ToNullable(location), Optional.ToDictionary(tags), sku.Value, networkProfile.Value, instanceView.Value)); }