ec2-instance-absent

Description

Create an instance on Amazon EC2, if it doesn't exist yet.

Variables

Name Type Default Description

aws_access_key

string --

The AWS access key. Required

aws_secret_key

string --

The AWS secret key. Required

instance_id

string --

The instance id. Required

region

string --

The AWS region to use. Required

Code

doc:
  short_help: Create an instance on Amazon EC2, if it doesn't exist yet.

args:
  instance_id:
    doc:
      short_help: The instance id.
    type: string
    required: true
  aws_access_key:
    doc:
      short_help: The AWS access key.
    type: string
    required: true
  aws_secret_key:
    doc:
      short_help: The AWS secret key.
    type: string
    secret: true
    required: true
  wait:
    doc:
      short_help: Wait for the instance to be deleted.
      help: |
        Wait for the instance to be deleted.

        If set to 'false', no result will be registered as the details of this instance won't be known.
    type: boolean
    required: false
    default: true
  wait_timeout:
    doc:
      short_help: How long to wait (in seconds) for the instance to finish booting/terminating.
    type: integer
    required: false
    default: 600
  region:
    doc:
      short_help: The AWS region to use.
      references:
        AWS region documentation: https://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region
    type: string
    required: true

frecklets:
- frecklet:
    name: ec2_instance
    type: ansible-module
    properties:
      elevated: false
      idempotent: true
      internet: true
    resources:
      python-package:
      - boto
      - boto3
      - botocore
    desc:
      short: 'delete EC2 instance: {{:: instance_id ::}}'
  task:
    include-type: include
    delegate_to: localhost
  vars:
    aws_access_key: '{{:: aws_access_key ::}}'
    aws_secret_key: '{{:: aws_secret_key ::}}'
    region: '{{:: region ::}}'
    state: absent
    instance_ids:
    - '{{:: instance_id ::}}'
frecklecute --community ec2-instance-absent --help

Usage: frecklecute ec2-instance-absent [OPTIONS]

  Create an instance on Amazon EC2, if it doesn't exist yet.

Options:
  --aws-access-key AWS_ACCESS_KEY
                                  The AWS access key.  [required]
  --aws-secret-key AWS_SECRET_KEY
                                  The AWS secret key.  [required]
  --instance-id INSTANCE_ID       The instance id.  [required]
  --region REGION                 The AWS region to use.  [required]
  --help                          Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.ec2_instance_absent.Ec2InstanceAbsent
#


from dataclasses import dataclass
from pyckles import AutoPycklet
from typing import *    # noqa

@dataclass
class Ec2InstanceAbsent(AutoPycklet):
    """Create an instance on Amazon EC2, if it doesn't exist yet.

       Args:
         aws_access_key: The AWS access key.
         aws_secret_key: The AWS secret key.
         instance_id: The instance id.
         region: The AWS region to use.

    """

    FRECKLET_ID = "ec2-instance-absent"

    aws_access_key: str = None
    aws_secret_key: str = None
    instance_id: str = None
    region: str = None


    def __post_init__(self):
        super(Ec2InstanceAbsent, self).__init__(var_names=["aws_access_key", "aws_secret_key", "instance_id", "region"])


frecklet_class = Ec2InstanceAbsent
# -*- coding: utf-8 -*-


#
# module path: pycklets.ec2_instance_absent.Ec2InstanceAbsent
#


from pyckles import AutoPycklet

class Ec2InstanceAbsent(AutoPycklet):
    """Create an instance on Amazon EC2, if it doesn't exist yet.

       Args:
         aws_access_key: The AWS access key.
         aws_secret_key: The AWS secret key.
         instance_id: The instance id.
         region: The AWS region to use.

    """

    FRECKLET_ID = "ec2-instance-absent"

    def __init__(self, aws_access_key=None, aws_secret_key=None, instance_id=None, region=None):

        super(Ec2InstanceAbsent, self).__init__(var_names=["aws_access_key", "aws_secret_key", "instance_id", "region"])
        self._aws_access_key = aws_access_key
        self._aws_secret_key = aws_secret_key
        self._instance_id = instance_id
        self._region = region

    @property
    def aws_access_key(self):
        return self._aws_access_key

    @aws_access_key.setter
    def aws_access_key(self, aws_access_key):
        self._aws_access_key = aws_access_key

    @property
    def aws_secret_key(self):
        return self._aws_secret_key

    @aws_secret_key.setter
    def aws_secret_key(self, aws_secret_key):
        self._aws_secret_key = aws_secret_key

    @property
    def instance_id(self):
        return self._instance_id

    @instance_id.setter
    def instance_id(self, instance_id):
        self._instance_id = instance_id

    @property
    def region(self):
        return self._region

    @region.setter
    def region(self, region):
        self._region = region



frecklet_class = Ec2InstanceAbsent