gerrit.groups package

Submodules

gerrit.groups.group module

class gerrit.groups.group.GerritGroup(group_id: str, gerrit: GerritClient)[source]

Bases: GerritBase

delete_description() None[source]

Deletes the description of a Gerrit internal group. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

Returns:

get_audit_log() Any[source]

Gets the audit log of a Gerrit internal group. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

Returns:

get_description() Any[source]

Retrieves the description of a group.

Returns:

get_detail() Any[source]

Retrieves a group with the direct members and the directly included groups.

Returns:

get_name() Any[source]

Retrieves the name of a group.

Returns:

get_options() Any[source]

Retrieves the options of a group.

Returns:

get_owner() Any[source]

Retrieves the owner group of a Gerrit internal group.

Returns:

As response a GroupInfo entity is returned that describes the owner group.

index() None[source]

Adds or updates the internal group in the secondary index.

Returns:

property members: GerritGroupMembers
set_description(input_: Dict[str, Any]) Any[source]

Sets the description of a Gerrit internal group. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

input_ = {
    "description": "The committers of MyProject."
}
group = client.groups.get('0017af503a22f7b3fa6ce2cd3b551734d90701b4')
result = group.set_description(input_)
Parameters:

input

Returns:

set_name(input_: Dict[str, Any]) Any[source]

Renames a Gerrit internal group. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

input_ = {
    "name": "My Project Committers"
}

group = client.groups.get('0017af503a22f7b3fa6ce2cd3b551734d90701b4')
result = group.set_name(input_)
Parameters:

input

Returns:

set_options(input_: Dict[str, Any]) Any[source]

Sets the options of a Gerrit internal group. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

input_ = {
    "visible_to_all": True
}
group = client.groups.get('0017af503a22f7b3fa6ce2cd3b551734d90701b4')
result = group.set_options(input_)
Parameters:

input – the GroupOptionsInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#group-options-input

Returns:

set_owner(input_: Dict[str, Any]) Any[source]

Sets the owner group of a Gerrit internal group. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

input_ = {
    "owner": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
}
group = client.groups.get('0017af503a22f7b3fa6ce2cd3b551734d90701b4')
result = group.set_owner(input_)
Parameters:

input – As response a GroupInfo entity is returned that describes the new owner

group. :return:

property subgroup: GerritGroupSubGroups

gerrit.groups.groups module

class gerrit.groups.groups.GerritGroups(gerrit: GerritClient)[source]

Bases: object

create(name: str, input_: Dict[str, Any]) Any[source]

Creates a new Gerrit internal group.

input_ = {
    "description": "contains all committers for MyProject2",
    "visible_to_all": 'true',
    "owner": "Administrators",
    "owner_id": "af01a8cb8cbd8ee7be072b98b1ee882867c0cf06"
}
new_group = client.groups.create('My-Project2-Committers', input_)
Parameters:
Returns:

get(id_: Any) Any[source]

Retrieves a group.

Parameters:

id – group id, or group_id, or group name

Returns:

list(pattern_dispatcher: Dict[str, Any] | None = None, options: List[str] | None = None, limit: int = 25, skip: int = 0) List[Any][source]

Lists the groups accessible by the caller.

Parameters:
  • pattern_dispatcher – Dict of pattern type with respective pattern value: {(‘match’|’regex’) : value}

  • options

    Additional fields can be obtained by adding o parameters, each option requires more lookups and slows down the query response time to the client so they are generally disabled by default. Optional fields are:

    INCLUDES: include list of direct subgroups. MEMBERS: include list of direct group members.

  • limit – Int value that allows to limit the number of groups to be included in the output results

  • skip – Int value that allows to skip the given number of groups from the beginning of the list

Returns:

search(query: str, options: List[str] | None = None, limit: int = 25, skip: int = 0) List[Any][source]

Query Groups

Parameters:
  • query

  • options

    Additional fields can be obtained by adding o parameters, each option requires more lookups and slows down the query response time to the client so they are generally disabled by default. Optional fields are:

    INCLUDES: include list of direct subgroups. MEMBERS: include list of direct group members.

  • limit – Int value that allows to limit the number of groups to be included in the output results

  • skip – Int value that allows to skip the given number of groups from the beginning of the list

Returns:

gerrit.groups.members module

class gerrit.groups.members.GerritGroupMembers(group_id: str, gerrit: GerritClient)[source]

Bases: object

add(account: Any) Any[source]

Adds a user as member to a Gerrit internal group. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

Parameters:

account – account username or id

Returns:

add_members(input_: Dict[str, Any]) Any[source]

Adds multiple users as members to a Gerrit internal group in a single request. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

input_ = {
    "members": ["jane.roe", "john.doe"]
}
group = client.groups.get('0017af503a22f7b3fa6ce2cd3b551734d90701b4')
result = group.members.add_members(input_)
Parameters:

input – the MembersInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#add-group-members

Returns:

get(account: Any) Any[source]

Retrieves a group member. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

Parameters:

account – account username or id

Returns:

list() List[Any][source]

Lists the direct members of a Gerrit internal group. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

Returns:

remove(account: Any) None[source]

Removes a user from a Gerrit internal group. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

Parameters:

account – account username or id

Returns:

remove_members(input_: Dict[str, Any]) None[source]

Removes multiple members from a Gerrit internal group in a single request. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

input_ = {
    "members": ["jane.roe", "john.doe"]
}
group = client.groups.get('0017af503a22f7b3fa6ce2cd3b551734d90701b4')
group.members.remove_members(input_)
Parameters:

input – the MembersInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#remove-group-members

Returns:

gerrit.groups.subgroups module

class gerrit.groups.subgroups.GerritGroupSubGroups(group_id: str, gerrit: GerritClient)[source]

Bases: object

add(subgroup: Any) Any[source]

Adds an internal or external group as subgroup to a Gerrit internal group. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

Parameters:

subgroup – subgroup id or name

Returns:

add_subgroups(input_: Dict[str, Any]) Any[source]

Adds multiple groups as subgroups to a Gerrit internal group in a single request. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

input_ = {
    "groups": ["MyGroup", "MyOtherGroup"]
}
group = client.groups.get('0017af503a22f7b3fa6ce2cd3b551734d90701b4')
result = group.subgroup.add_subgroups(input_)
Parameters:

input – the GroupsInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#add-subgroups

Returns:

get(subgroup: Any) Any[source]

Retrieves a subgroup. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

Parameters:

subgroup – subgroup id or name

Returns:

list() List[Any][source]

Lists the direct subgroups of a group. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

Returns:

remove(subgroup: Any) None[source]

Removes a subgroup from a Gerrit internal group. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

Parameters:

subgroup – subgroup id or name

Returns:

remove_subgroups(input_: Dict[str, Any]) None[source]

Removes multiple subgroups from a Gerrit internal group in a single request. This endpoint is only allowed for Gerrit internal groups; attempting to call on a non-internal group will return 405 Method Not Allowed.

input_ = {
    "groups": ["MyGroup", "MyOtherGroup"]
}
group = client.groups.get('0017af503a22f7b3fa6ce2cd3b551734d90701b4')
group.subgroup.remove_subgroups(input_)
Parameters:

input – the GroupsInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#remove-subgroups

Returns:

Module contents