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:
ActionsMain class for all Cloudflare dashboard actions to be called from the Python SDK
- property account_id: str¶
Returns currently set Account ID.
- property client: Cloudflare¶
Returns Cloudflare client.
- 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
- init_cloudflare_client(api_token=None, api_key=None, api_email=None, user_service_key=None)¶
Initializes Cloudflare client with given authentication.
- Parameters:
api_token – API token to use for access to CF Dashboard.
api_key – Global API Key to use for access to CF Dashboard.
api_email – Email to use for logging in to CF Dashboard.
user_service_key – Origin CA Key used to interact with Origin CA certificates and/or Keyless SSL key server.
- 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(account_name: str | None = None, account_id: str | None = None)¶
Sets account ID to be used in API calls.