Skip to main content

FinOps Budgets

FinOps budgets.

Access it as client.finops.budgets on a Strongly client, or the same path on AsyncStrongly with await. All methods exist on both with identical signatures.

Quick start​

from strongly import Strongly

client = Strongly()

# List (auto-paginates as you iterate) # filters: search, status, scope_level
for finop in client.finops.budgets.list():
print(finop.id)

Methods​

Core​

list​

list(*, search: str | None = None, status: str | None = None, scope_level: str | None = None, limit: int | None = None) -> SyncPaginator[BudgetSummary]

List the budgets you can read, newest first.

Parameters

  • search (str | None, optional): Case-insensitive match on the budget name.
  • status (str | None, optional): active, paused or exhausted.
  • scope_level (str | None, optional): platform, organization, user, resourceGroup, resourceType, resource or tag.
  • limit (int | None, optional): The most budgets to return; None returns every match.

Returns

  • SyncPaginator[BudgetSummary]: The matching budgets, fetched a page at a time, each its summary (no notifications, alerts sent or stopped resources: retrieve has them).

Raises

  • ValidationError: An unknown status or scope_level.
  • PermissionDeniedError: The key's user does not manage budgets.
  • BadGatewayError: The budget service is not reachable.

create​

create(*, name: str, organization_id: str, scope: Mapping[str, Any], budget: Mapping[str, Any], thresholds: Sequence[Mapping[str, Any]], description: str | None = None, notifications: Mapping[str, Any] | None = None, enabled: bool | None = None) -> Budget

Create a budget and return it.

Parameters

  • name (str): The budget's name.
  • organization_id (str): The organization it belongs to (an organization owner or admin: their own; __platform__ for a platform scope).
  • scope (Mapping[str, Any]): What it counts: {"level": "platform" | "organization" | "user" | "resourceGroup" | "resource" | "resourceType" | "tag", "userId", "resourceGroupId", "resourceId", "resourceType", "tag": {"key", "value"}} (the ids its level needs).
  • budget (Mapping[str, Any]): The amount: {"amount": US cents, "currency": "USD", "type": "total" | "recurring", "period": "daily" | "weekly" | "monthly", "resetDay"}.
  • thresholds (Sequence[Mapping[str, Any]]): [{"percent", "action": "alert" | "pause"}]: unique percents, at most one pause.
  • description (str | None, optional): What it is for.
  • notifications (Mapping[str, Any] | None, optional): Alert email: {"email", "mode": "immediate" | "digest", "digestFrequency", "digestHourOfDay", "digestDayOfWeek", "minSeverity"}.
  • enabled (bool | None, optional): Whether it is enforced (default true).

Returns

  • Budget: The budget.

Raises

  • ValidationError: A member is missing or not valid.
  • PermissionDeniedError: The key's user does not manage budgets, or not this organization's.

retrieve​

retrieve(budget_id: str) -> Budget

Return a budget, with its current usage and status.

stopped says why the platform stopped it: user-archived when its user was archived.

Parameters

  • budget_id (str): The budget's id (24 hexadecimal characters).

Returns

  • Budget: The budget.

Raises

  • NotFoundError: No budget has this id, or it belongs to another organization than the one you manage.
  • PermissionDeniedError: The key's user does not manage budgets.
  • BadGatewayError: The budget service is not reachable.

update​

update(budget_id: str, *, name: str | None = None, description: str | None = None, organization_id: str | None = None, scope: Mapping[str, Any] | None = None, budget: Mapping[str, Any] | None = None, thresholds: Sequence[Mapping[str, Any]] | None = None, notifications: Mapping[str, Any] | None = None, enabled: bool | None = None) -> Budget

Change a budget and return it; only the members given change.

Parameters

  • budget_id (str): The budget's id (24 hexadecimal characters).
  • name, description, organization_id, scope, budget, thresholds, notifications, enabled: As in create; each left out (None) stays as it is.

Raises

  • NotFoundError: No budget has this id, or it belongs to another organization than the one you manage.
  • ValidationError: A member is not valid.

delete​

delete(budget_id: str) -> None

Delete a budget, with its alerts still waiting to be sent.

Parameters

  • budget_id (str): The budget's id (24 hexadecimal characters).

Raises

  • NotFoundError: No budget has this id, or it belongs to another organization than the one you manage.

Lifecycle & actions​

pause​

pause(budget_id: str) -> Budget

Pause a budget (not enforced, no alerts) and return it.

Parameters

  • budget_id (str): The budget's id (24 hexadecimal characters).

resume​

resume(budget_id: str) -> Budget

Resume a paused budget (enforced again) and return it.

Parameters

  • budget_id (str): The budget's id (24 hexadecimal characters).