Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
Add Group support to the Monitoring API#2035
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cc0f814
Add Group support to the Monitoring API
supriyagarg 0018b01
Added support for creating and deleting Stackdriver groups.
supriyagarg 335d909
Added support for updating Stackdriver groups.
supriyagarg cedca63
Add system tests for the groups API under monitoring.
supriyagarg c795598
Change Groups API to take group and parent IDs as the inputs.
supriyagarg 3b3a996
Remove the helpers module from monitoring API.
supriyagarg d205cec
Edits to the Groups API
supriyagarg 5dfa1be
Remove retries during system tests for group.
supriyagarg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Groups | ||
| ====== | ||
| .. automodule:: gcloud.monitoring.group | ||
| :members: | ||
| :show-inheritance: | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -30,6 +30,7 @@ | ||
| from gcloud.client import JSONClient | ||
| from gcloud.monitoring.connection import Connection | ||
| from gcloud.monitoring.group import Group | ||
| from gcloud.monitoring.metric import MetricDescriptor | ||
| from gcloud.monitoring.metric import MetricKind | ||
| from gcloud.monitoring.metric import ValueType | ||
| @@ -282,3 +283,82 @@ def list_resource_descriptors(self, filter_string=None): | ||
| https://cloud.google.com/monitoring/api/v3/filters | ||
| """ | ||
| return ResourceDescriptor._list(self, filter_string) | ||
| def group(self, group_id=None, display_name=None, parent_id=None, | ||
| filter_string=None, is_cluster=False): | ||
| """Factory constructor for group object. | ||
| .. note:: | ||
| This will not make an HTTP request; it simply instantiates | ||
| a group object owned by this client. | ||
| :type group_id: string or None | ||
| :param group_id: The ID of the group. | ||
| :type display_name: string or None | ||
| :param display_name: | ||
| A user-assigned name for this group, used only for display | ||
| purposes. | ||
| :type parent_id: string or None | ||
| :param parent_id: | ||
| The ID of the group's parent, if it has one. | ||
| :type filter_string: string or None | ||
| :param filter_string: | ||
| The filter string used to determine which monitored resources | ||
| belong to this group. | ||
| :type is_cluster: boolean | ||
| :param is_cluster: | ||
| If true, the members of this group are considered to be a cluster. | ||
| The system can perform additional analysis on groups that are | ||
| clusters. | ||
| :rtype: :class:`Group` | ||
| :returns: The group created with the passed-in arguments. | ||
| :raises: | ||
| :exc:`ValueError` if both ``group_id`` and ``name`` are specified. | ||
| """ | ||
| return Group( | ||
| self, | ||
| group_id=group_id, | ||
| display_name=display_name, | ||
| parent_id=parent_id, | ||
| filter_string=filter_string, | ||
| is_cluster=is_cluster, | ||
| ) | ||
| def fetch_group(self, group_id): | ||
| """Fetch a group from the API based on it's ID. | ||
| Example:: | ||
| >>> try: | ||
| >>> group = client.fetch_group('1234') | ||
| >>> except gcloud.exceptions.NotFound: | ||
| >>> print('That group does not exist!') | ||
| :type group_id: string | ||
| :param group_id: The ID of the group. | ||
| :rtype: :class:`~gcloud.monitoring.group.Group` | ||
| :returns: The group instance. | ||
This comment was marked as spam.Sorry, something went wrong. Uh oh!There was an error while loading. Please reload this page. | ||
| :raises: :class:`gcloud.exceptions.NotFound` if the group is not found. | ||
| """ | ||
| return Group._fetch(self, group_id) | ||
| def list_groups(self): | ||
| """List all groups for the project. | ||
| Example:: | ||
| >>> for group in client.list_groups(): | ||
| ... print((group.display_name, group.name)) | ||
| :rtype: list of :class:`~gcloud.monitoring.group.Group` | ||
| :returns: A list of group instances. | ||
| """ | ||
| return Group._list(self) | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.