gerrit.groups package

Submodules

gerrit.groups.group module

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

Bases: GerritBase

delete_description()[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()[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()[source]

Retrieves the description of a group.

Returns:

get_detail()[source]

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

Returns:

get_name()[source]

Retrieves the name of a group.

Returns:

get_options()[source]

Retrieves the options of a group.

Returns:

get_owner()[source]

Retrieves the owner group of a Gerrit internal group.

Returns:

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

index()[source]

Adds or updates the internal group in the secondary index.

Returns:

property members
set_description(input_)[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_)[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_)[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_)[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

gerrit.groups.groups module

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

Bases: object

create(name, input_)[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_)[source]

Retrieves a group.

Parameters:
  • id – group id, or group_id, or group name

  • detailed

Returns:

list(pattern_dispatcher=None, options=None, limit: int = 25, skip: int = 0)[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, options=None, limit: int = 25, skip: int = 0)[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, gerrit)[source]

Bases: object

add(account)[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:

get(account)[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()[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)[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:

gerrit.groups.subgroups module

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

Bases: object

add(subgroup)[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:

get(subgroup)[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()[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)[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:

Module contents