pycloudlib.cloud module¶
Base class for all other clouds to provide consistent set of functions.
-
class
pycloudlib.cloud.
BaseCloud
(tag: str, timestamp_suffix: bool = True, config_file: Union[pathlib.Path, _io.StringIO, None] = None, required_values: Optional[Sequence[Optional[Any]]] = None)[source]¶ Bases:
abc.ABC
Base Cloud Class.
-
__init__
(tag: str, timestamp_suffix: bool = True, config_file: Union[pathlib.Path, _io.StringIO, None] = None, required_values: Optional[Sequence[Optional[Any]]] = None)[source]¶ Initialize base cloud class.
Parameters: - tag – string used to name and tag resources with
- timestamp_suffix – Append a timestamped suffix to the tag string.
- config_file – path to pycloudlib configuration file
-
create_key_pair
()[source]¶ Create and set a ssh key pair for a cloud instance.
Returns: A tuple containing the public and private key created
-
daily_image
(release: str, **kwargs)[source]¶ ID of the latest daily image for a particular release.
Parameters: release – The release to look for Returns: A single string with the latest daily image ID for the specified release.
-
delete_image
(image_id, **kwargs)[source]¶ Delete an image.
Parameters: - image_id – string, id of the image to delete
- **kwargs – dictionary of other arguments to pass to delete_image
-
get_instance
(instance_id, **kwargs) → pycloudlib.instance.BaseInstance[source]¶ Get an instance by id.
Parameters: instance_id – Returns: An instance object to use to manipulate the instance further.
-
image_serial
(image_id)[source]¶ Find the image serial of the latest daily image for a particular release.
Parameters: image_id – string, Ubuntu image id Returns: string, serial of latest image
-
launch
(image_id: str, instance_type=None, user_data=None, wait: bool = True, **kwargs) → pycloudlib.instance.BaseInstance[source]¶ Launch an instance.
Parameters: - image_id – string, image ID to use for the instance
- instance_type – string, type of instance to create
- user_data – used by cloud-init to run custom scripts/configuration
- wait – wait for instance to be live
- **kwargs – dictionary of other arguments to pass to launch
Returns: An instance object to use to manipulate the instance further.
-
list_keys
()[source]¶ List ssh key names present on the cloud for accessing instances.
Returns: A list of strings of key pair names accessible to the cloud.
-
released_image
(release, **kwargs)[source]¶ ID of the latest released image for a particular release.
Parameters: release – The release to look for Returns: A single string with the latest released image ID for the specified release.
-