linode#

Description#

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.

Configuration#

linode:
  # [Required]
  # Linode API token.
  token:   # type=str

  # [Optional]
  # How often to poll the Linode API
  # (default: 60 seconds).
  # poll_interval: 60.0  # type=float

  # [Optional]
  # How long we should wait for any running
  # threads/processes to stop before exiting (default: 5 seconds).
  # stop_timeout: 5  # type=Optional[float]

  # [Optional]
  # If set to True then the plugin will not monitor
  # for new events. This is useful if you want to run a plugin in
  # stateless mode and only leverage its actions, without triggering any
  # events. Defaults to False.
  # disable_monitor: False  # type=bool

Dependencies#

pip

pip install linode_api4

Triggered events#

Actions#

Module reference#

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.

__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.

main()[source]#

Implementation of the main loop of the plugin.

publish_entities(entities: Collection[Any] | None, callback: Callable[[Entity], Any] | None = None, **kwargs) Collection[Entity]#

Publishes a list of entities. The downstream consumers include:

It also accepts an optional callback that will be called when each of the entities in the set is flushed to the database.

You usually don’t need to override this class (but you may want to extend transform_entities() instead if your extension doesn’t natively handle Entity objects).

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 and shutdown.

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.

start()#

Start the plugin.

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:

{}

stop()#

Stop the plugin.

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.

wait_stop(timeout=None)#

Wait until a stop event is received.