Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose get_assigned_tos as virtual attribute to allow access via the API #17182

Merged
merged 1 commit into from
Mar 21, 2018

Conversation

jntullo
Copy link

@jntullo jntullo commented Mar 21, 2018

Follow up to ManageIQ/manageiq-api#348

This exposes get_assigned_tos as a virtual attribute so that the assigned objects and tags (classifications) can be returned like so:

{  
   "href":"http://localhost:3000/api/alert_definition_profiles/10000000000084",
   "id":"10000000000084",
   ...
   "get_assigned_tos":{  
      "objects":[  
         {  
            "href":"http://localhost:3000/api/vms/10000000000001",
            "id":"10000000000001",
            "vendor":"vmware",
            "format":null,
            "version":null,
            "name":"jmarc-nginx",
            "description":null,
            ...
         }
      ],
      "tags":[  
         [  
            {  
               "id":"10000000000198",
               "description":"api",
               "icon":null,
               "read_only":false,
              ...
            },
            "vms"
         ]
      ],
      "labels":[  

      ]
   }
}

Have validated (as can be seen above) that hrefs are returned for objects. These tags are "classification tags" (class Classification), which are not currently exposed via the API. Will have to follow up with a PR for Classification to return those hrefs

@miq-bot assign @abellotti

@miq-bot
Copy link
Member

miq-bot commented Mar 21, 2018

Checked commit jntullo@d7b6caf with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 👍

@@ -78,6 +78,22 @@
end
end

describe "#get_assigned_tos" do
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added test because once this exposed and available in API, would not want format to change

@abellotti abellotti added this to the Sprint 82 Ending Mar 26, 2018 milestone Mar 21, 2018
@abellotti
Copy link
Member

Thanks @jntullo for this enhancement. 👍

@abellotti abellotti merged commit f21d2a9 into ManageIQ:master Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants