internal ResourceLinkData(string id, string name, object type, ResourceLinkProperties properties) { Id = id; Name = name; Type = type; Properties = properties; }
protected async Task <ResourceLink> CreateResourceLink(Tenant tenant, GenericResource vn1, GenericResource vn2, string resourceLinkName) { ResourceIdentifier resourceLinkId = new ResourceIdentifier(vn1.Id + "/providers/Microsoft.Resources/links/" + resourceLinkName); ResourceLinkProperties properties = new ResourceLinkProperties(vn2.Id); ResourceLinkData data = new ResourceLinkData() { Properties = properties }; ArmOperation <ResourceLink> lro = await tenant.GetResourceLinks(resourceLinkId).CreateOrUpdateAsync(WaitUntil.Completed, data); return(lro.Value); }
internal static ResourceLinkData DeserializeResourceLinkData(JsonElement element) { Optional <ResourceLinkProperties> properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } properties = ResourceLinkProperties.DeserializeResourceLinkProperties(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; } if (property.NameEquals("systemData")) { systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString()); continue; } } return(new ResourceLinkData(id, name, type, systemData, properties.Value)); }
internal static ResourceLinkData DeserializeResourceLinkData(JsonElement element) { Optional <string> id = default; Optional <string> name = default; Optional <object> type = default; Optional <ResourceLinkProperties> properties = 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")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } type = property.Value.GetObject(); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } properties = ResourceLinkProperties.DeserializeResourceLinkProperties(property.Value); continue; } } return(new ResourceLinkData(id.Value, name.Value, type.Value, properties.Value)); }
internal ResourceLinkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceLinkProperties properties) : base(id, name, resourceType, systemData) { Properties = properties; }