buildgrid.server.client.quota module

class buildgrid.server.client.quota.QuotaInterface(channel: Channel)

Bases: object

Interface for calls to the Quota Service.

get_instance_quota(instance_name: str, bot_cohort: str) InstanceQuota

Returns the quota configuration for a specific instance and bot cohort.

Parameters:
  • instance_name (str) – The name of the REAPI instance.

  • bot_cohort (str) – The name of the bot cohort.

Returns:

The quota configuration.

Return type:

InstanceQuota

Raises:
  • NotFoundError – When the quota doesn’t exist.

  • ConnectionError – When there’s a connection issue.

put_instance_quota(instance_name: str, bot_cohort: str, min_quota: int, max_quota: int) None

Sets or updates the quota configuration for a specific instance and bot cohort.

Parameters:
  • instance_name (str) – The name of the REAPI instance.

  • bot_cohort (str) – The name of the bot cohort.

  • min_quota (int) – Minimum quota limit for the instance.

  • max_quota (int) – Maximum quota limit for the instance.

Raises:

ConnectionError – When there’s a connection issue.

delete_instance_quota(instance_name: str, bot_cohort: str) None

Deletes the quota configuration for a specific instance and bot cohort.

Parameters:
  • instance_name (str) – The name of the REAPI instance.

  • bot_cohort (str) – The name of the bot cohort.

Raises:
  • NotFoundError – When the quota doesn’t exist.

  • ConnectionError – When there’s a connection issue.