synology_apm.sdk.collections.retirement_plans module

RetirementPlanCollection — collection interface for retirement plans.

class synology_apm.sdk.collections.retirement_plans.RetirementPlanCollection(session)

Bases: object

Collection interface for managing retirement plans.

Accessed via APMClient.retirement_plans; should not be instantiated directly. Retirement plans are category-agnostic and apply across all workload categories.

async list(name_contains=None, limit=500, offset=0)

List all Retirement Plans.

Parameters:
  • name_contains (str | None) – Name keyword search. None = no filter.

  • limit (int) – Maximum records to return (default 500).

  • offset (int) – Pagination start offset (default 0).

Returns:

(list of RetirementPlan, total count matching the filter)

Return type:

tuple[list[RetirementPlan], int]

async get(plan_id)

Fetch a Retirement Plan by UUID.

Parameters:

plan_id (str) – Plan UUID.

Raises:

ResourceNotFoundError – No matching plan found.

async get_by_name(name)

Fetch a Retirement Plan by name.

Parameters:

name (str) – Plan name (exact match, case-insensitive).

Raises:

ResourceNotFoundError – Plan not found.

async create(request)

Create a Retirement Plan.

Parameters:

request (RetirementPlanCreateRequest) – Plan creation parameters.

Returns:

The created plan.

Raises:

PlanNameConflictError – A plan with this name already exists.

Return type:

RetirementPlan

async update(plan_id, request)

Update an existing Retirement Plan.

Parameters:
Returns:

The updated plan.

Raises:

PlanNameConflictError – The new name is already taken by another plan.

Return type:

RetirementPlan

async delete(plan)

Delete a Retirement Plan by plan object or UUID.

Deleting a plan that does not exist is a no-op (the operation succeeds silently).

Parameters:

plan (RetirementPlan | str) – RetirementPlan object or plan UUID string.

Raises:

PlanInUseError – The plan is still assigned to workloads.