waft.actions.dashboard_actions.dashboard_actions module

class waft.actions.dashboard_actions.dashboard_actions.DashboardActions(token: str | None = None, email: str | None = None, global_api_key: str | None = None, origin_ca_key: str | None = None, account_id: str | None = None)

Bases: Actions

Main class for all Cloudflare dashboard actions to be called from the Python SDK

property account_id: str

Returns currently set Account ID.

client: Cloudflare

Cloudflare Python SDK (external link)

static convert(api_model: BaseModel, return_type: Type[T]) T

Convert an API model object to a Python dictionary.

Parameters:
  • api_model (BaseModel) – API model instance

  • return_type (type) – Type to cast returned dict

Returns:

Python dictionary cast as return_type

Return type:

dict

delete(api_resource: ApiResourceSupportsDelete, resource_id: str)

Deletes a resource by ID from dashboard.

Parameters:
  • api_resource (ApiResourceSupportsDelete) – Dashboard ApiResource which implements a delete method.

  • resource_id (str) – Unique resource ID

Returns:

API delete response

Return type:

Any

property device_posture: DevicePostureActions

Returns DevicePostureActions instance.

property devices: DeviceActions

Returns DeviceActions instance.

property gateway: GatewayActions

Returns GatewayActions instance.

get(api_resource: ApiResourceSupportsGet, resource_id: str)

Fetches a resource by ID from dashboard.

Parameters:
  • api_resource (ApiResourceSupportsGet) – Dashboard ApiResource which implements a get method.

  • resource_id (str) – Unique resource ID

Returns:

API resource object

Return type:

Any

list(api_resource: ApiResourceSupportsList) list

Lists resources matching type from dashboard.

Parameters:

api_resource (ApiResourceSupportsList) – Any dashboard ApiResource which implements a list method.

Returns:

Fetched list of resources

Return type:

list

search(api_resource: ApiResourceSupportsList, **kwargs) list

Search list of resources using kwargs and return all that match criteria.

Parameters:
  • api_resource (ApiResourceSupportsList) – Any dashboard ApiResource which implements a list method.

  • kwargs – Keyword parameters representing resource attribute values to match within available resources.

Returns:

Fetched list of resources whose attributes match the indicated search parameters

Return type:

list

set_account_id(org_name: str | None = None, org_id: str | None = None)

Sets account ID to be used in API calls.