{"action":"reopened","issue":{"url":"https://api.github.com/repos/cloudfoundry/bosh/issues/1649","repository_url":"https://api.github.com/repos/cloudfoundry/bosh","labels_url":"https://api.github.com/repos/cloudfoundry/bosh/issues/1649/labels{/name}","comments_url":"https://api.github.com/repos/cloudfoundry/bosh/issues/1649/comments","events_url":"https://api.github.com/repos/cloudfoundry/bosh/issues/1649/events","html_url":"https://github.com/cloudfoundry/bosh/issues/1649","id":220012899,"node_id":"MDU6SXNzdWUyMjAwMTI4OTk=","number":1649,"title":"Question about consuming a dynamic set of links [migrated from Gist]","user":{"login":"Amit-PivotalLabs","id":3108318,"node_id":"MDQ6VXNlcjMxMDgzMTg=","avatar_url":"https://avatars0.githubusercontent.com/u/3108318?v=4","gravatar_id":"","url":"https://api.github.com/users/Amit-PivotalLabs","html_url":"https://github.com/Amit-PivotalLabs","followers_url":"https://api.github.com/users/Amit-PivotalLabs/followers","following_url":"https://api.github.com/users/Amit-PivotalLabs/following{/other_user}","gists_url":"https://api.github.com/users/Amit-PivotalLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/Amit-PivotalLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Amit-PivotalLabs/subscriptions","organizations_url":"https://api.github.com/users/Amit-PivotalLabs/orgs","repos_url":"https://api.github.com/users/Amit-PivotalLabs/repos","events_url":"https://api.github.com/users/Amit-PivotalLabs/events{/privacy}","received_events_url":"https://api.github.com/users/Amit-PivotalLabs/received_events","type":"User","site_admin":false},"labels":[{"id":311933150,"node_id":"MDU6TGFiZWwzMTE5MzMxNTA=","url":"https://api.github.com/repos/cloudfoundry/bosh/labels/discuss","name":"discuss","color":"fad8c7","default":false},{"id":598908103,"node_id":"MDU6TGFiZWw1OTg5MDgxMDM=","url":"https://api.github.com/repos/cloudfoundry/bosh/labels/feature:links","name":"feature:links","color":"5319e7","default":false},{"id":53781140,"node_id":"MDU6TGFiZWw1Mzc4MTE0MA==","url":"https://api.github.com/repos/cloudfoundry/bosh/labels/open-for-contribution","name":"open-for-contribution","color":"0052cc","default":false},{"id":294636394,"node_id":"MDU6TGFiZWwyOTQ2MzYzOTQ=","url":"https://api.github.com/repos/cloudfoundry/bosh/labels/planned-enhancement","name":"planned-enhancement","color":"009800","default":false},{"id":1017564340,"node_id":"MDU6TGFiZWwxMDE3NTY0MzQw","url":"https://api.github.com/repos/cloudfoundry/bosh/labels/triaged","name":"triaged","color":"d1adf4","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2017-04-06T19:52:03Z","updated_at":"2018-09-13T18:32:41Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"> Original question: [here](https://gist.github.com/Amit-PivotalLabs/c39528248b8cdc4ba8e347f8aa68abb6#gistcomment-2046092)\r\n> Original asker: @claudio-benfatto\r\n\r\n---\r\n\r\nHello @Amit-PivotalLabs thanks for the very helpful explanation.\r\n\r\nWe are actually facing a problem while trying to integrate `links` with one of our bosh releases and we think that our use case may not be fully covered by the current `links` functionalities.\r\nI think it could be seen as a subcase of [What happens if multiple things provide the same type of link?](https://gist.github.com/Amit-PivotalLabs/c39528248b8cdc4ba8e347f8aa68abb6#what-happens-if-multiple-things-provide-the-same-type-of-link).\r\n\r\nThe specific problem is due to the fact that we do not know in advance, (referring to the examples in this document) the number of `database_instance` instance groups. \r\nAt the same time we need to access them somehow dynamically from our configuration templates and specifically from the same instance group, something like the following:\r\n\r\n```\r\ninstance_groups:\r\n- name: web_server_instances\r\n  jobs:\r\n  - release: app\r\n    name: web_server_process\r\n    properties:\r\n      greeting: \"Namaste!\"\r\n    consumes:\r\n      hindi_database_data_object_reference: {from: hindi_database}\r\n      french_database_data_object_reference: {from: french_database}\r\n```\r\n```\r\n<%\r\ndatabase_links = Array.new\r\ndatabase_links << link(\"hindi_database_data_object_reference\")\r\ndatabase_links << link(\"french_database_data_object_reference\")\r\n%>\r\n\r\ndatabase_addresses={\r\n<% database_links.each_with_index do |database, i| %>\r\n  \"<%= link(\"database\").instances[0].address %>\"<%= ',' if i < (database_links.size - 1) %>\r\n<% end %>\r\n}\r\n\r\n```\r\n\r\nbut this ofc doesn't work very elegantly, for example, if we decided to add an `italian_database_data_object_reference: {from: italian_database}`, we would be forced to modify all the template files accordingly.\r\n\r\nWould be really great to have something of this kind:\r\n\r\n```\r\n<%\r\ndatabase_links = link_by_type(\"database_data_class\")\r\n%>\r\n\r\ndatabase_addresses={\r\n<% database_links.each_with_index do |database, i| %>\r\n  \"<%= link(\"database\").instances[0].address %>\"<%= ',' if i < (database_links.size - 1) %>\r\n<% end %>\r\n}\r\n\r\n```\r\n\r\nI have the feeling that we are missing something or trying to bend `links` functionalities a bit too much. Is there a better approach in order to achieve the same result?\r\n\r\nThanks a lot\r\nClaudio"}}
{"actor":{"display_login":"jfmyers9"}}