linode
#
- class platypush.plugins.linode.LinodePlugin(*_, **__)[source]#
Bases:
RunnablePlugin
,CloudInstanceEntityManager
,EnumSwitchEntityManager
This plugin can interact with a Linode account and manage node and volumes.
To get your token:
Login to <https://cloud.linode.com/>.
Go to My Profile -> API Tokens -> Add a Personal Access Token.
Select the scopes that you want to provide to your new token.
Requires:
linode_api4 (
pip install linode_api4
)
Triggers:
platypush.message.event.linode.LinodeInstanceStatusChanged
when the status of an instance changes.
- __init__(token: str, poll_interval: float = 60.0, **kwargs)[source]#
- Parameters:
token – Linode API token.
poll_interval – How often to poll the Linode API (default: 60 seconds).
- boot(instance: str | int | UUID, token: str | None = None, **_)[source]#
Boot an instance.
- Parameters:
instance – Instance ID, label or host UUID.
token – Default access token override.
- reboot(instance: str | int | UUID, token: str | None = None, **_)[source]#
Reboot an instance.
- Parameters:
instance – Instance ID, label or host UUID.
token – Default access token override.
- set(entity: str, value: str, **kwargs)[source]#
Entity framework compatible method to run an action on the instance through an
EnumSwitch
.- Parameters:
entity – Entity ID, as
<instance_id>
or<instance_id>:__action__
.value – Action to run, one among
boot
,reboot
andshutdown
.
- shutdown(instance: str | int | UUID, token: str | None = None, **_)[source]#
Shutdown an instance.
- Parameters:
instance – Instance ID, label or host UUID.
token – Default access token override.
- status(*_, instance: str | UUID | int | None = None, token: str | None = None, publish_entities: bool = True, **__) List[LinodeInstance] [source]#
Get the full status and info of the instances associated to a selected account.
- Parameters:
token – Override the default access token if you want to query another account.
instance – Select only one instance, either by name, ID or host UUID.
publish_entities – Whether
platypush.message.event.entities.EntityUpdateEvent
should be published for all the instances, whether or not their status has changed (default:True
).
- Returns:
[ { "alerts": { "cpu": 90, "io": 5000, "network_in": 10, "network_out": 10, "transfer_quota": 80 }, "backups": { "available": false, "enabled": true, "last_successful": "2020-01-01T00:00:00Z", "schedule": { "day": "enumfield", "window": "enumfield" } }, "created_at": "2020-01-01T00:00:00Z", "group": "my-group", "hypervisor": "kvm", "id": 12345, "image": "fieldwithid", "instance_type": "fieldwithid", "ipv4_addresses": "[\"1.2.3.4\"]", "ipv6_address": "1234:5678::9abc:def0:1234:5678/128", "name": "my-instance", "region": "fieldwithid", "specs": { "cpus": 4, "disk": 100000, "gpus": 1, "memory": 8192, "transfer": 5000 }, "status": "running", "tags": "[\"tag1\", \"tag2\"]", "updated_at": "2020-01-01T01:00:00Z" } ]
- transform_entities(entities: Collection[LinodeInstance]) Collection[CloudInstance] [source]#
This method takes a list of entities in any (plugin-specific) format and converts them into a standardized collection of Entity objects. Since this method is called by
publish_entities()
before entity updates are published, you may usually want to extend it to pre-process the entities managed by your extension into the standard format before they are stored and published to all the consumers.