Cloudforms.TagManager¶
Tag Manager
license: | MIT, see LICENSE for more details. |
---|
-
class
Cloudforms.managers.tag.
ServiceTagManager
(client, svc)[source]¶ Manages Tags for Services.
Parameters: - client (Cloudforms.API.Client) – an API client instance
- svc (string) – a service name to bind to
-
assign
(_id, names)[source]¶ Assigns one or more tags to a service
Parameters: - _id (string) – Specifies which service item the request is for
- names (list) – Names of tags to assign ([‘/my/tag’, ‘/a/tag’])
Example:
# Add the tag /environment/prod to all providers for prov in prov_mgr.list_providers(): prov_mgr.tags.assign(prov.get('id'), [ '/environment/prod' ])
-
unassign
(_id, names)[source]¶ Un-assigns one or more tags to a service
Parameters: - _id (string) – Specifies which service item the request is for
- names (list) – Names of tags to un-assign ([‘/my/tag’, ‘/a/tag’])
Example:
# Removes the tag /environment/prod from all providers for prov in prov_mgr.list_providers(): prov_mgr.tags.unassign(prov.get('id'), [ '/environment/prod' ])
-
class
Cloudforms.managers.tag.
TagManager
(client)[source]¶ Manages Tags.
Parameters: client (Cloudforms.API.Client) – an API client instance Example:
import Cloudforms client = Cloudforms.Client() tag_mgr = Cloudforms.TagManager(client)
-
get
(_id, params=None)[source]¶ Retrieve details about a tag on the account
Parameters: - _id (string) – Specifies which tag the request is for
- params (dict) – response-level options (attributes, limit, etc.)
Returns: Dictionary representing the matching tag
Example:
# Gets a list of all tags (returns IDs only) tags = tag_mgr.list({'attributes': 'id'}) for tag in tags: tag_details = tag_mgr.get(tag['id'])
-
list
(params=None)[source]¶ Retrieve a list of all tags on the account
Parameters: params (dict) – response-level options (attributes, limit, etc.) Returns: List of dictionaries representing the matching tags Example:
# Gets a list of all tags (returns IDs only) tags = tag_mgr.list({'attributes': 'id'})
-