# Admin SDK API . roles

## Instance Methods

Close httplib2 connections.

Deletes a role.

Retrieves a role.

Creates a role.

Retrieves a paginated list of all the roles in a domain.

Retrieves the next page of results.

Patches a role.

Updates a role.

### Method Details

`close()`

    Close httplib2 connections.

`delete(customer, roleId, x__xgafv=None)`

    Deletes a role.

    Args:
      customer: string, Immutable ID of the Google Workspace account. (required)
      roleId: string, Immutable ID of the role. (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

`get(customer, roleId, x__xgafv=None)`

    Retrieves a role.

    Args:
      customer: string, The unique ID for the customer's Google Workspace account. In case of a multi-domain account, to fetch all groups for a customer, use this field instead of `domain`. You can also use the `my_customer` alias to represent your account's `customerId`. The `customerId` is also returned as part of the [Users](https://developers.google.com/workspace/admin/directory/v1/reference/users) resource. You must provide either the `customer` or the `domain` parameter. (required)
      roleId: string, Immutable ID of the role. (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        {
      "etag": "A String", # ETag of the resource.
      "isSuperAdminRole": True or False, # Returns `true` if the role is a super admin role.
      "isSystemRole": True or False, # Returns `true` if this is a pre-defined system role.
      "kind": "admin#directory#role", # The type of the API resource. This is always `admin#directory#role`.
      "roleDescription": "A String", # A short description of the role.
      "roleId": "A String", # ID of the role.
      "roleName": "A String", # Name of the role.
      "rolePrivileges": [ # The set of privileges that are granted to this role.
        {
          "privilegeName": "A String", # The name of the privilege.
          "serviceId": "A String", # The obfuscated ID of the service this privilege is for. This value is returned with [`Privileges.list()`](https://developers.google.com/workspace/admin/directory/v1/reference/privileges/list).
        },
      ],
    }

`insert(customer, body=None, x__xgafv=None)`

    Creates a role.

    Args:
      customer: string, Immutable ID of the Google Workspace account. (required)
      body: object, The request body.
        The object takes the form of:

    {
      "etag": "A String", # ETag of the resource.
      "isSuperAdminRole": True or False, # Returns `true` if the role is a super admin role.
      "isSystemRole": True or False, # Returns `true` if this is a pre-defined system role.
      "kind": "admin#directory#role", # The type of the API resource. This is always `admin#directory#role`.
      "roleDescription": "A String", # A short description of the role.
      "roleId": "A String", # ID of the role.
      "roleName": "A String", # Name of the role.
      "rolePrivileges": [ # The set of privileges that are granted to this role.
        {
          "privilegeName": "A String", # The name of the privilege.
          "serviceId": "A String", # The obfuscated ID of the service this privilege is for. This value is returned with [`Privileges.list()`](https://developers.google.com/workspace/admin/directory/v1/reference/privileges/list).
        },
      ],
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        {
      "etag": "A String", # ETag of the resource.
      "isSuperAdminRole": True or False, # Returns `true` if the role is a super admin role.
      "isSystemRole": True or False, # Returns `true` if this is a pre-defined system role.
      "kind": "admin#directory#role", # The type of the API resource. This is always `admin#directory#role`.
      "roleDescription": "A String", # A short description of the role.
      "roleId": "A String", # ID of the role.
      "roleName": "A String", # Name of the role.
      "rolePrivileges": [ # The set of privileges that are granted to this role.
        {
          "privilegeName": "A String", # The name of the privilege.
          "serviceId": "A String", # The obfuscated ID of the service this privilege is for. This value is returned with [`Privileges.list()`](https://developers.google.com/workspace/admin/directory/v1/reference/privileges/list).
        },
      ],
    }

`list(customer, maxResults=None, pageToken=None, x__xgafv=None)`

    Retrieves a paginated list of all the roles in a domain.

    Args:
      customer: string, The unique ID for the customer's Google Workspace account. In case of a multi-domain account, to fetch all groups for a customer, use this field instead of `domain`. You can also use the `my_customer` alias to represent your account's `customerId`. The `customerId` is also returned as part of the [Users](https://developers.google.com/workspace/admin/directory/v1/reference/users) resource. You must provide either the `customer` or the `domain` parameter. (required)
      maxResults: integer, Maximum number of results to return.
      pageToken: string, Token to specify the next page in the list.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        {
      "etag": "A String", # ETag of the resource.
      "items": [ # A list of Role resources.
        {
          "etag": "A String", # ETag of the resource.
          "isSuperAdminRole": True or False, # Returns `true` if the role is a super admin role.
          "isSystemRole": True or False, # Returns `true` if this is a pre-defined system role.
          "kind": "admin#directory#role", # The type of the API resource. This is always `admin#directory#role`.
          "roleDescription": "A String", # A short description of the role.
          "roleId": "A String", # ID of the role.
          "roleName": "A String", # Name of the role.
          "rolePrivileges": [ # The set of privileges that are granted to this role.
            {
              "privilegeName": "A String", # The name of the privilege.
              "serviceId": "A String", # The obfuscated ID of the service this privilege is for. This value is returned with [`Privileges.list()`](https://developers.google.com/workspace/admin/directory/v1/reference/privileges/list).
            },
          ],
        },
      ],
      "kind": "admin#directory#roles", # The type of the API resource. This is always `admin#directory#roles`.
      "nextPageToken": "A String",
    }

`list_next()`

    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.

`patch(customer, roleId, body=None, x__xgafv=None)`

    Patches a role.

    Args:
      customer: string, Immutable ID of the Google Workspace account. (required)
      roleId: string, Immutable ID of the role. (required)
      body: object, The request body.
        The object takes the form of:

    {
      "etag": "A String", # ETag of the resource.
      "isSuperAdminRole": True or False, # Returns `true` if the role is a super admin role.
      "isSystemRole": True or False, # Returns `true` if this is a pre-defined system role.
      "kind": "admin#directory#role", # The type of the API resource. This is always `admin#directory#role`.
      "roleDescription": "A String", # A short description of the role.
      "roleId": "A String", # ID of the role.
      "roleName": "A String", # Name of the role.
      "rolePrivileges": [ # The set of privileges that are granted to this role.
        {
          "privilegeName": "A String", # The name of the privilege.
          "serviceId": "A String", # The obfuscated ID of the service this privilege is for. This value is returned with [`Privileges.list()`](https://developers.google.com/workspace/admin/directory/v1/reference/privileges/list).
        },
      ],
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        {
      "etag": "A String", # ETag of the resource.
      "isSuperAdminRole": True or False, # Returns `true` if the role is a super admin role.
      "isSystemRole": True or False, # Returns `true` if this is a pre-defined system role.
      "kind": "admin#directory#role", # The type of the API resource. This is always `admin#directory#role`.
      "roleDescription": "A String", # A short description of the role.
      "roleId": "A String", # ID of the role.
      "roleName": "A String", # Name of the role.
      "rolePrivileges": [ # The set of privileges that are granted to this role.
        {
          "privilegeName": "A String", # The name of the privilege.
          "serviceId": "A String", # The obfuscated ID of the service this privilege is for. This value is returned with [`Privileges.list()`](https://developers.google.com/workspace/admin/directory/v1/reference/privileges/list).
        },
      ],
    }

`update(customer, roleId, body=None, x__xgafv=None)`

    Updates a role.

    Args:
      customer: string, Immutable ID of the Google Workspace account. (required)
      roleId: string, Immutable ID of the role. (required)
      body: object, The request body.
        The object takes the form of:

    {
      "etag": "A String", # ETag of the resource.
      "isSuperAdminRole": True or False, # Returns `true` if the role is a super admin role.
      "isSystemRole": True or False, # Returns `true` if this is a pre-defined system role.
      "kind": "admin#directory#role", # The type of the API resource. This is always `admin#directory#role`.
      "roleDescription": "A String", # A short description of the role.
      "roleId": "A String", # ID of the role.
      "roleName": "A String", # Name of the role.
      "rolePrivileges": [ # The set of privileges that are granted to this role.
        {
          "privilegeName": "A String", # The name of the privilege.
          "serviceId": "A String", # The obfuscated ID of the service this privilege is for. This value is returned with [`Privileges.list()`](https://developers.google.com/workspace/admin/directory/v1/reference/privileges/list).
        },
      ],
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        {
      "etag": "A String", # ETag of the resource.
      "isSuperAdminRole": True or False, # Returns `true` if the role is a super admin role.
      "isSystemRole": True or False, # Returns `true` if this is a pre-defined system role.
      "kind": "admin#directory#role", # The type of the API resource. This is always `admin#directory#role`.
      "roleDescription": "A String", # A short description of the role.
      "roleId": "A String", # ID of the role.
      "roleName": "A String", # Name of the role.
      "rolePrivileges": [ # The set of privileges that are granted to this role.
        {
          "privilegeName": "A String", # The name of the privilege.
          "serviceId": "A String", # The obfuscated ID of the service this privilege is for. This value is returned with [`Privileges.list()`](https://developers.google.com/workspace/admin/directory/v1/reference/privileges/list).
        },
      ],
    }