GroupServiceClient(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
The Group API lets you inspect and manage your
groups <#google.monitoring.v3.Group>
__.
A group is a named filter that is used to identify a collection of monitored resources. Groups are typically used to mirror the physical and/or logical topology of the environment. Because group membership is computed dynamically, monitored resources that are started in the future are automatically placed in matching groups. By using a group to name monitored resources in, for example, an alert policy, the target of that alert policy is updated automatically as monitored resources are added and removed from the infrastructure.
Methods
GroupServiceClient
GroupServiceClient(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
Constructor.
Parameters | |
---|---|
Name | Description |
channel |
grpc.Channel
DEPRECATED. A |
credentials |
google.auth.credentials.Credentials
The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to |
client_config |
dict
DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used. |
client_info |
google.api_core.gapic_v1.client_info.ClientInfo
The client info used to send a user-agent string along with API requests. If |
client_options |
Union[dict, google.api_core.client_options.ClientOptions]
Client options used to set user options on the client. API Endpoint should be set through client_options. |
create_group
create_group(name, group, validate_only=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Creates a new group.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.GroupServiceClient()
name = client.project_path('[PROJECT]')
TODO: Initialize
group
:group = {}
response = client.create_group(name, group)
Parameters | |
---|---|
Name | Description |
name |
str
The project in which to create the group. The format is |
group |
Union[dict, Group]
A group definition. It is an error to define the |
validate_only |
bool
If true, validate this request but do not create the group. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
delete_group
delete_group(name, recursive=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Deletes an existing group.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.GroupServiceClient()
name = client.group_path('[PROJECT]', '[GROUP]')
client.delete_group(name)
Parameters | |
---|---|
Name | Description |
name |
str
The group to delete. The format is |
recursive |
bool
If this field is true, then the request means to delete a group with all its descendants. Otherwise, the request means to delete a group only when it has no descendants. The default value is false. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
from_service_account_file
from_service_account_file(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameter | |
---|---|
Name | Description |
filename |
str
The path to the service account private key json file. |
Returns | |
---|---|
Type | Description |
GroupServiceClient | The constructed client. |
from_service_account_json
from_service_account_json(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameter | |
---|---|
Name | Description |
filename |
str
The path to the service account private key json file. |
Returns | |
---|---|
Type | Description |
GroupServiceClient | The constructed client. |
get_group
get_group(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Gets a single group.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.GroupServiceClient()
name = client.group_path('[PROJECT]', '[GROUP]')
response = client.get_group(name)
Parameters | |
---|---|
Name | Description |
name |
str
The group to retrieve. The format is |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
group_path
group_path(project, group)
DEPRECATED. Return a fully-qualified group string.
list_group_members
list_group_members(name, page_size=None, filter_=None, interval=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Lists the monitored resources that are members of a group.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.GroupServiceClient()
name = client.group_path('[PROJECT]', '[GROUP]')
Iterate over all results
for element in client.list_group_members(name): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.list_group_members(name).pages: ... for element in page: ... # process element ... pass
Parameters | |
---|---|
Name | Description |
name |
str
The group whose members are listed. The format is |
page_size |
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. |
filter_ |
str
An optional |
interval |
Union[dict, TimeInterval]
An optional time interval for which results should be returned. Only members that were part of the group during the specified interval are included in the response. If no interval is provided then the group membership over the last minute is returned. If a dict is provided, it must be of the same form as the protobuf message TimeInterval |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
list_groups
list_groups(name, children_of_group=None, ancestors_of_group=None, descendants_of_group=None, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Lists the existing groups.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.GroupServiceClient()
name = client.project_path('[PROJECT]')
Iterate over all results
for element in client.list_groups(name): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.list_groups(name).pages: ... for element in page: ... # process element ... pass
Parameters | |
---|---|
Name | Description |
name |
str
The project whose groups are to be listed. The format is |
children_of_group |
str
A group name: |
ancestors_of_group |
str
A group name: |
descendants_of_group |
str
A group name: |
page_size |
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
project_path
project_path(project)
DEPRECATED. Return a fully-qualified project string.
update_group
update_group(group, validate_only=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Updates an existing group. You can change any group attributes except
name
.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.GroupServiceClient()
TODO: Initialize
group
:group = {}
response = client.update_group(group)
Parameters | |
---|---|
Name | Description |
group |
Union[dict, Group]
The new definition of the group. All fields of the existing group, excepting |
validate_only |
bool
If true, validate this request but do not update the existing group. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |