# Google Monitoring API . projects . groups

## Instance Methods

Returns the members Resource.

Creates a new group.

Deletes an existing group.

Gets a single group.

Lists the existing groups.

Retrieves the next page of results.

Updates an existing group. You can change any group attributes except `name`.

### Method Details

`create(name, body, validateOnly=None, x__xgafv=None)`

    Creates a new group.

    Args:
      name: string, The project in which to create the group. The format is `"projects/{project_id_or_number}"`. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # The description of a dynamic collection of monitored resources. Each group has a filter that is matched against monitored resources and their associated metadata. If a group's filter matches an available monitored resource, then that resource is a member of that group. Groups can contain any number of monitored resources, and each monitored resource can be a member of any number of groups. Groups can be nested in parent-child hierarchies. The `parentName` field identifies an optional parent for each group. If a group has a parent, then the only monitored resources available to be matched by the group's filter are the resources contained in the parent group. In other words, a group contains the monitored resources that match its filter and the filters of all the group's ancestors. A group without a parent can contain any monitored resource. For example, consider an infrastructure running a set of instances with two user-defined tags: `"environment"` and `"role"`. A parent group has a filter, `environment="production"`. A child of that parent group has a filter, `role="transcoder"`. The parent group contains all instances in the production environment, regardless of their roles. The child group contains instances that have the transcoder role *and* are in the production environment. The monitored resources contained in a group can change at any moment, depending on what resources exist and what filters are associated with the group and its ancestors.
        "filter": "A String", # The filter used to determine which monitored resources belong to this group.
        "parentName": "A String", # The name of the group's parent, if it has one. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. For groups with no parent, `parentName` is the empty string, `""`.
        "displayName": "A String", # A user-assigned name for this group, used only for display purposes.
        "name": "A String", # The name of this group. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to `CreateGroup` and a unique `{group_id}` that is generated automatically. @OutputOnly
        "isCluster": True or False, # If true, the members of this group are considered to be a cluster. The system can perform additional analysis on groups that are clusters.
      }

      validateOnly: boolean, If true, validate this request but do not create the group.
      x__xgafv: string, V1 error format.

    Returns:
      An object of the form:

        { # The description of a dynamic collection of monitored resources. Each group has a filter that is matched against monitored resources and their associated metadata. If a group's filter matches an available monitored resource, then that resource is a member of that group. Groups can contain any number of monitored resources, and each monitored resource can be a member of any number of groups. Groups can be nested in parent-child hierarchies. The `parentName` field identifies an optional parent for each group. If a group has a parent, then the only monitored resources available to be matched by the group's filter are the resources contained in the parent group. In other words, a group contains the monitored resources that match its filter and the filters of all the group's ancestors. A group without a parent can contain any monitored resource. For example, consider an infrastructure running a set of instances with two user-defined tags: `"environment"` and `"role"`. A parent group has a filter, `environment="production"`. A child of that parent group has a filter, `role="transcoder"`. The parent group contains all instances in the production environment, regardless of their roles. The child group contains instances that have the transcoder role *and* are in the production environment. The monitored resources contained in a group can change at any moment, depending on what resources exist and what filters are associated with the group and its ancestors.
          "filter": "A String", # The filter used to determine which monitored resources belong to this group.
          "parentName": "A String", # The name of the group's parent, if it has one. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. For groups with no parent, `parentName` is the empty string, `""`.
          "displayName": "A String", # A user-assigned name for this group, used only for display purposes.
          "name": "A String", # The name of this group. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to `CreateGroup` and a unique `{group_id}` that is generated automatically. @OutputOnly
          "isCluster": True or False, # If true, the members of this group are considered to be a cluster. The system can perform additional analysis on groups that are clusters.
        }

`delete(name, x__xgafv=None)`

    Deletes an existing group.

    Args:
      name: string, The group to delete. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. (required)
      x__xgafv: string, V1 error format.

    Returns:
      An object of the form:

        { # A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`.
      }

`get(name, x__xgafv=None)`

    Gets a single group.

    Args:
      name: string, The group to retrieve. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. (required)
      x__xgafv: string, V1 error format.

    Returns:
      An object of the form:

        { # The description of a dynamic collection of monitored resources. Each group has a filter that is matched against monitored resources and their associated metadata. If a group's filter matches an available monitored resource, then that resource is a member of that group. Groups can contain any number of monitored resources, and each monitored resource can be a member of any number of groups. Groups can be nested in parent-child hierarchies. The `parentName` field identifies an optional parent for each group. If a group has a parent, then the only monitored resources available to be matched by the group's filter are the resources contained in the parent group. In other words, a group contains the monitored resources that match its filter and the filters of all the group's ancestors. A group without a parent can contain any monitored resource. For example, consider an infrastructure running a set of instances with two user-defined tags: `"environment"` and `"role"`. A parent group has a filter, `environment="production"`. A child of that parent group has a filter, `role="transcoder"`. The parent group contains all instances in the production environment, regardless of their roles. The child group contains instances that have the transcoder role *and* are in the production environment. The monitored resources contained in a group can change at any moment, depending on what resources exist and what filters are associated with the group and its ancestors.
          "filter": "A String", # The filter used to determine which monitored resources belong to this group.
          "parentName": "A String", # The name of the group's parent, if it has one. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. For groups with no parent, `parentName` is the empty string, `""`.
          "displayName": "A String", # A user-assigned name for this group, used only for display purposes.
          "name": "A String", # The name of this group. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to `CreateGroup` and a unique `{group_id}` that is generated automatically. @OutputOnly
          "isCluster": True or False, # If true, the members of this group are considered to be a cluster. The system can perform additional analysis on groups that are clusters.
        }

`list(name, ancestorsOfGroup=None, descendantsOfGroup=None, pageSize=None, x__xgafv=None, pageToken=None, childrenOfGroup=None)`

    Lists the existing groups.

    Args:
      name: string, The project whose groups are to be listed. The format is `"projects/{project_id_or_number}"`. (required)
      ancestorsOfGroup: string, A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. Returns groups that are ancestors of the specified group. The groups are returned in order, starting with the immediate parent and ending with the most distant ancestor. If the specified group has no immediate parent, the results are empty.
      descendantsOfGroup: string, A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. Returns the descendants of the specified group. This is a superset of the results returned by the `childrenOfGroup` filter, and includes children-of-children, and so forth.
      pageSize: integer, A positive number that is the maximum number of results to return.
      x__xgafv: string, V1 error format.
      pageToken: string, If this field is not empty then it must contain the `nextPageToken` value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.
      childrenOfGroup: string, A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. Returns groups whose `parentName` field contains the group name. If no groups have this parent, the results are empty.

    Returns:
      An object of the form:

        { # The `ListGroups` response.
        "nextPageToken": "A String", # If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as `pageToken` in the next call to this method.
        "group": [ # The groups that match the specified filters.
          { # The description of a dynamic collection of monitored resources. Each group has a filter that is matched against monitored resources and their associated metadata. If a group's filter matches an available monitored resource, then that resource is a member of that group. Groups can contain any number of monitored resources, and each monitored resource can be a member of any number of groups. Groups can be nested in parent-child hierarchies. The `parentName` field identifies an optional parent for each group. If a group has a parent, then the only monitored resources available to be matched by the group's filter are the resources contained in the parent group. In other words, a group contains the monitored resources that match its filter and the filters of all the group's ancestors. A group without a parent can contain any monitored resource. For example, consider an infrastructure running a set of instances with two user-defined tags: `"environment"` and `"role"`. A parent group has a filter, `environment="production"`. A child of that parent group has a filter, `role="transcoder"`. The parent group contains all instances in the production environment, regardless of their roles. The child group contains instances that have the transcoder role *and* are in the production environment. The monitored resources contained in a group can change at any moment, depending on what resources exist and what filters are associated with the group and its ancestors.
              "filter": "A String", # The filter used to determine which monitored resources belong to this group.
              "parentName": "A String", # The name of the group's parent, if it has one. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. For groups with no parent, `parentName` is the empty string, `""`.
              "displayName": "A String", # A user-assigned name for this group, used only for display purposes.
              "name": "A String", # The name of this group. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to `CreateGroup` and a unique `{group_id}` that is generated automatically. @OutputOnly
              "isCluster": True or False, # If true, the members of this group are considered to be a cluster. The system can perform additional analysis on groups that are clusters.
            },
        ],
      }

`list_next(previous_request, previous_response)`

    Retrieves the next page of results.

    Args:
      previous_request: The request for the previous page. (required)
      previous_response: The response from the request for the previous page. (required)

    Returns:
      A request object that you can call 'execute()' on to request the next
      page. Returns None if there are no more items in the collection.

`update(name, body, validateOnly=None, x__xgafv=None)`

    Updates an existing group. You can change any group attributes except `name`.

    Args:
      name: string, The name of this group. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to `CreateGroup` and a unique `{group_id}` that is generated automatically. @OutputOnly (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # The description of a dynamic collection of monitored resources. Each group has a filter that is matched against monitored resources and their associated metadata. If a group's filter matches an available monitored resource, then that resource is a member of that group. Groups can contain any number of monitored resources, and each monitored resource can be a member of any number of groups. Groups can be nested in parent-child hierarchies. The `parentName` field identifies an optional parent for each group. If a group has a parent, then the only monitored resources available to be matched by the group's filter are the resources contained in the parent group. In other words, a group contains the monitored resources that match its filter and the filters of all the group's ancestors. A group without a parent can contain any monitored resource. For example, consider an infrastructure running a set of instances with two user-defined tags: `"environment"` and `"role"`. A parent group has a filter, `environment="production"`. A child of that parent group has a filter, `role="transcoder"`. The parent group contains all instances in the production environment, regardless of their roles. The child group contains instances that have the transcoder role *and* are in the production environment. The monitored resources contained in a group can change at any moment, depending on what resources exist and what filters are associated with the group and its ancestors.
        "filter": "A String", # The filter used to determine which monitored resources belong to this group.
        "parentName": "A String", # The name of the group's parent, if it has one. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. For groups with no parent, `parentName` is the empty string, `""`.
        "displayName": "A String", # A user-assigned name for this group, used only for display purposes.
        "name": "A String", # The name of this group. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to `CreateGroup` and a unique `{group_id}` that is generated automatically. @OutputOnly
        "isCluster": True or False, # If true, the members of this group are considered to be a cluster. The system can perform additional analysis on groups that are clusters.
      }

      validateOnly: boolean, If true, validate this request but do not update the existing group.
      x__xgafv: string, V1 error format.

    Returns:
      An object of the form:

        { # The description of a dynamic collection of monitored resources. Each group has a filter that is matched against monitored resources and their associated metadata. If a group's filter matches an available monitored resource, then that resource is a member of that group. Groups can contain any number of monitored resources, and each monitored resource can be a member of any number of groups. Groups can be nested in parent-child hierarchies. The `parentName` field identifies an optional parent for each group. If a group has a parent, then the only monitored resources available to be matched by the group's filter are the resources contained in the parent group. In other words, a group contains the monitored resources that match its filter and the filters of all the group's ancestors. A group without a parent can contain any monitored resource. For example, consider an infrastructure running a set of instances with two user-defined tags: `"environment"` and `"role"`. A parent group has a filter, `environment="production"`. A child of that parent group has a filter, `role="transcoder"`. The parent group contains all instances in the production environment, regardless of their roles. The child group contains instances that have the transcoder role *and* are in the production environment. The monitored resources contained in a group can change at any moment, depending on what resources exist and what filters are associated with the group and its ancestors.
          "filter": "A String", # The filter used to determine which monitored resources belong to this group.
          "parentName": "A String", # The name of the group's parent, if it has one. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. For groups with no parent, `parentName` is the empty string, `""`.
          "displayName": "A String", # A user-assigned name for this group, used only for display purposes.
          "name": "A String", # The name of this group. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to `CreateGroup` and a unique `{group_id}` that is generated automatically. @OutputOnly
          "isCluster": True or False, # If true, the members of this group are considered to be a cluster. The system can perform additional analysis on groups that are clusters.
        }