def ensure_tags(conn, module, subnet, tags, purge_tags, start_time): changed = False filters = ansible_dict_to_boto3_filter_list({ 'resource-id': subnet['id'], 'resource-type': 'subnet' }) try: cur_tags = conn.describe_tags(Filters=filters) except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: module.fail_json_aws(e, msg="Couldn't describe tags") to_update, to_delete = compare_aws_tags( boto3_tag_list_to_ansible_dict(cur_tags.get('Tags')), tags, purge_tags) if to_update: try: if not module.check_mode: AWSRetry.exponential_backoff( catch_extra_error_codes=['InvalidSubnetID.NotFound'])( conn.create_tags)( Resources=[subnet['id']], Tags=ansible_dict_to_boto3_tag_list(to_update)) changed = True except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: module.fail_json_aws(e, msg="Couldn't create tags") if to_delete: try: if not module.check_mode: tags_list = [] for key in to_delete: tags_list.append({'Key': key}) AWSRetry.exponential_backoff( catch_extra_error_codes=['InvalidSubnetID.NotFound'])( conn.delete_tags)(Resources=[subnet['id']], Tags=tags_list) changed = True except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: module.fail_json_aws(e, msg="Couldn't delete tags") if module.params['wait'] and not module.check_mode: # Wait for tags to be updated filters = [{ 'Name': 'tag:{0}'.format(k), 'Values': [v] } for k, v in tags.items()] handle_waiter(conn, module, 'subnet_exists', { 'SubnetIds': [subnet['id']], 'Filters': filters }, start_time) return changed
def ensure_tags(self, tgw_vpc_attachment_id, tags, purge_tags): """ Ensures tags are applied to the transit gateway. Optionally will remove any existing tags not in the tags argument if purge_tags is set to true :param tgw_vpc_attachment_id: The AWS id of the transit gateway VPC attachment :param tags: list of tags to apply to the transit gateway. :param purge_tags: when true existing tags not in tags parms are removed :return: true if tags were updated """ tags_changed = False filters = ansible_dict_to_boto3_filter_list( {'resource-id': tgw_vpc_attachment_id}) try: cur_tags = self._connection.describe_tags(Filters=filters) except (ClientError, BotoCoreError) as e: self._module.fail_json_aws(e, msg="Couldn't describe tags") to_update, to_delete = compare_aws_tags( boto3_tag_list_to_ansible_dict(cur_tags.get('Tags')), tags, purge_tags) if to_update: try: if not self._check_mode: AWSRetry.exponential_backoff()( self._connection.create_tags)( Resources=[tgw_vpc_attachment_id], Tags=ansible_dict_to_boto3_tag_list(to_update)) self._results['changed'] = True tags_changed = True except (ClientError, BotoCoreError) as e: self._module.fail_json_aws( e, msg="Couldn't create tags {0} for resource {1}".format( ansible_dict_to_boto3_tag_list(to_update), tgw_vpc_attachment_id)) if to_delete: try: if not self._check_mode: tags_list = [] for key in to_delete: tags_list.append({'Key': key}) AWSRetry.exponential_backoff()( self._connection.delete_tags)( Resources=[tgw_vpc_attachment_id], Tags=tags_list) self._results['changed'] = True tags_changed = True except (ClientError, BotoCoreError) as e: self._module.fail_json_aws( e, msg="Couldn't delete tags {0} for resource {1}".format( ansible_dict_to_boto3_tag_list(to_delete), tgw_vpc_attachment_id)) return tags_changed
def main(): argument_spec = dict( entity_type=dict(required=False), catalog=dict(required=False, choices=['AWSMarketplace'], default='AWSMarketplace'), list_change_sets=dict(required=False, type=bool), list_entities=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=( ('list_change_sets', True, ['catalog']), ('list_entities', True, ['catalog', 'entity_type']), ), mutually_exclusive=[ ( 'list_change_sets', 'list_entities', ) ], ) client = module.client('marketplace-catalog', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _marketplace_catalog(client, module) if module.params['list_change_sets']: module.exit_json(change_sets=aws_response_list_parser(paginate, it, 'ChangeSetSummaryList')) elif module.params['list_entities']: module.exit_json(entities=aws_response_list_parser(paginate, it, 'EntitySummaryList')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict(alias=dict(required=False), list_workspace=dict(required=False, type=bool), workspace_id=dict(required=False), describe_workspace=dict(required=False, type=bool)) module = AnsibleAWSModule(argument_spec=argument_spec, mutually_exclusive=[('list_workspace', 'describe_workspace')]) amp = module.client('amp', retry_decorator=AWSRetry.exponential_backoff()) _it, paginate = _amp(amp, module) if module.params['list_workspace']: module.exit_json( workspaces=aws_response_list_parser(paginate, _it, 'workspaces')) elif module.params['describe_workspace']: try: _des = amp.describe_workspace( workspaceId=module.params['workspace_id']) module.exit_json( workspace=camel_dict_to_snake_dict(_des['workspace'])) except amp.exceptions.ResourceNotFoundException: module.fail_json(msg="workspace not found") else: module.fail_json(msg="unknown options are passed")
def main(): argument_spec = dict( name=dict(required=False), list_packages_for_domain=dict(required=False, type=bool), describe_elasticsearch_domain=dict(required=False, type=bool), describe_elasticsearch_domain_config=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=( ('list_packages_for_domain', True, ['name']), ('describe_elasticsearch_domain', True, ['name']), ('describe_elasticsearch_domain_config', True, ['name']), ), mutually_exclusive=[ ( 'list_packages_for_domain', 'describe_elasticsearch_domain', 'describe_elasticsearch_domain_config', ) ], ) client = module.client('es', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _es(client, module) if module.params['list_packages_for_domain']: module.exit_json(packages=aws_response_list_parser(paginate, it, 'DomainPackageDetailsList')) elif module.params['describe_elasticsearch_domain']: module.exit_json(domain_status=camel_dict_to_snake_dict(it['DomainStatus'])) elif module.params['describe_elasticsearch_domain_config']: module.exit_json(domain_config=camel_dict_to_snake_dict(it['DomainConfig'])) else: module.exit_json(domain_names=aws_response_list_parser(paginate, it, 'DomainNames'))
def main(): argument_spec = dict( get_sms_sandbox_account_status=dict(required=False, type=bool), list_phone_numbers_opted_out=dict(required=False, type=bool), list_sms_sandbox_phone_numbers=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, mutually_exclusive=[( 'get_sms_sandbox_account_status', 'list_phone_numbers_opted_out', 'list_sms_sandbox_phone_numbers', )], ) client = module.client('sns', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _sms(client, module) if module.params['get_sms_sandbox_account_status']: module.exit_json(is_in_sandbox=it['IsInSandbox']) elif module.params['list_phone_numbers_opted_out']: module.exit_json(phone_numbers_opted_out=aws_response_list_parser( paginate, it, 'phoneNumbers')) elif module.params['list_sms_sandbox_phone_numbers']: module.exit_json(phone_numbers=aws_response_list_parser( paginate, it, 'PhoneNumbers')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( access_token=dict(required=False), account_id=dict(required=False), list_account_roles=dict(required=False, type=bool), list_accounts=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=( ('list_account_roles', True, ['access_token', 'account_id']), ('list_accounts', True, ['access_token']), ), mutually_exclusive=[ ( 'list_account_roles', 'list_accounts', ) ], ) client = module.client('sso', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _sso(client, module) if module.params['list_account_roles']: module.exit_json(account_roles=aws_response_list_parser(paginate, it, 'roleList')) elif module.params['list_accounts']: module.exit_json(accounts=aws_response_list_parser(paginate, it, 'accountList')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( domain=dict(required=False), registration_status=dict(required=False, choices=['REGISTERED', 'DEPRECATED'], default='REGISTERED'), list_activity_types=dict(required=False, type=bool), list_domains=dict(required=False, type=bool), list_workflow_types=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=( ('list_activity_types', True, ['domain']), ('list_workflow_types', True, ['domain']), ), mutually_exclusive=[ ( 'list_activity_types', 'list_domains', 'list_workflow_types', ) ], ) client = module.client('swf', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _swf(client, module) if module.params['list_activity_types']: module.exit_json(activity_types=aws_response_list_parser(paginate, it, 'typeInfos')) elif module.params['list_domains']: module.exit_json(domains=aws_response_list_parser(paginate, it, 'domainInfos')) elif module.params['list_workflow_types']: module.exit_json(workflow_types=aws_response_list_parser(paginate, it, 'typeInfos')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( list_firewall_policies=dict(required=False, type=bool), list_firewalls=dict(required=False, type=bool), list_rule_groups=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=(), mutually_exclusive=[( 'list_firewall_policies', 'list_firewalls', 'list_rule_groups', )], ) client = module.client('network-firewall', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _network_firewall(client, module) if module.params['list_firewall_policies']: module.exit_json(firewall_policies=aws_response_list_parser( paginate, it, 'FirewallPolicies')) elif module.params['list_firewalls']: module.exit_json( firewalls=aws_response_list_parser(paginate, it, 'Firewalls')) elif module.params['list_rule_groups']: module.exit_json( rule_groups=aws_response_list_parser(paginate, it, 'RuleGroups')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( id=dict(required=False), state=dict(required=False, choices=['ENABLED', 'DISABLED', 'ERROR'], default='ENABLED'), resource_types=dict(required=False, type=list), get_lifecycle_policy=dict(required=False, type=bool), get_lifecycle_policies=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=( ('get_lifecycle_policy', True, ['id']), ('get_lifecycle_policies', True, ['resource_types']), ), mutually_exclusive=[( 'get_lifecycle_policy', 'get_lifecycle_policies', )], ) client = module.client('dlm', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _dlm(client, module) if module.params['get_lifecycle_policy']: module.exit_json(policy=camel_dict_to_snake_dict(it['Policy'])) elif module.params['get_lifecycle_policies']: module.exit_json( policies=aws_response_list_parser(paginate, it, 'Policies')) else: module.fail_json_aws("unknown options are passed")
def main(): argument_spec = dict( list_entitlements=dict(required=False, type=bool), list_flows=dict(required=False, type=bool), list_offerings=dict(required=False, type=bool), list_reservations=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=(), mutually_exclusive=[ ( 'list_entitlements', 'list_flows', 'list_offerings', 'list_reservations', ) ], ) client = module.client('mediaconnect', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _mediaconnect(client, module) if module.params['list_entitlements']: module.exit_json(entitlements=aws_response_list_parser(paginate, it, 'Entitlements')) elif module.params['list_flows']: module.exit_json(flows=aws_response_list_parser(paginate, it, 'Flows')) elif module.params['list_offerings']: module.exit_json(offerings=aws_response_list_parser(paginate, it, 'Offerings')) elif module.params['list_reservations']: module.exit_json(reservations=aws_response_list_parser(paginate, it, 'Reservations')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( id=dict(required=False), job_run_states=dict(required=False, type=list, default=[]), managed_endpoint_states=dict(required=False, type=list, default=[]), list_job_runs=dict(required=False, type=bool), list_managed_endpoints=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=( ('list_job_runs', True, ['id']), ('list_managed_endpoints', True, ['id']), ), mutually_exclusive=[( 'list_job_runs', 'list_managed_endpoints', )], ) client = module.client('emr-containers', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _emr_containers(client, module) if module.params['list_job_runs']: module.exit_json( job_runs=aws_response_list_parser(paginate, it, 'jobRuns')) elif module.params['list_managed_endpoints']: module.exit_json(managed_endpoints=aws_response_list_parser( paginate, it, 'endpoints')) else: module.exit_json( clusters=aws_response_list_parser(paginate, it, 'virtualClusters'))
def main(): argument_spec = dict( name=dict(required=False, aliases=['group_name']), list_groups=dict(required=False, type=bool), list_group_resources=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=(('list_group_resources', True, ['name']), ), mutually_exclusive=[( 'list_groups', 'list_group_resources', )], ) client = module.client('resource-groups', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _resource_groups(client, module) if module.params['list_groups']: module.exit_json( groups=aws_response_list_parser(paginate, it, 'GroupIdentifiers')) elif module.params['list_group_resources']: module.exit_json(group_resources=aws_response_list_parser( paginate, it, 'Resources')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( cluster_ids=dict(required=False, type=list), describe_clusters=dict(required=False, type=bool), describe_backups=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=[ ('describe_clusters', True, ['cluster_ids']), ('describe_backups', True, ['cluster_ids']), ], mutually_exclusive=[], ) client = module.client('cloudhsmv2', retry_decorator=AWSRetry.exponential_backoff()) _it, paginate = _cloudhsm(client, module) if module.params['describe_clusters']: module.exit_json(clusters=aws_response_list_parser(paginate, _it, 'Clusters')) elif module.params['describe_backups']: module.exit_json(backups=aws_response_list_parser(paginate, _it, 'Backups')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( connection_token=dict(required=False), attachment_id=dict(required=False), contact_id=dict(required=False), get_attachment=dict(required=False, type=bool), get_transcript=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=( ('get_attachment', True, ['connection_token', 'attachment_id']), ('get_transcript', True, ['connection_token', 'contact_id']), ), mutually_exclusive=[( 'get_attachment', 'get_transcript', )], ) client = module.client('connectparticipant', retry_decorator=AWSRetry.exponential_backoff()) _it, paginate = _connect(client, module) if module.params['get_attachment']: module.exit_json(attachment=camel_dict_to_snake_dict(_it)) elif module.params['get_transcript']: module.exit_json( transcript=aws_response_list_parser(paginate, _it, 'Transcript')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( name=dict(required=False, aliases=['domain_name']), list_domains=dict(required=False, type=bool), get_domain_detail=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=( ('get_domain_detail', True, ['name']), ), mutually_exclusive=[ ( 'list_domains', 'get_domain_detail', ) ], ) client = module.client('route53domains', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _route53domains(client, module) if module.params['list_domains']: module.exit_json(domains=aws_response_list_parser(paginate, it, 'Domains')) elif module.params['get_domain_detail']: module.exit_json(domain_detail=camel_dict_to_snake_dict(it)) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( status=dict(required=False, choices=['scheduled', 'inProgress', 'completed', 'failed'], default='inProgress'), list_lexicons=dict(required=False, type=bool), list_speech_synthesis_tasks=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=(), mutually_exclusive=[( 'list_lexicons', 'list_speech_synthesis_tasks', )], ) client = module.client('polly', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _polly(client, module) if module.params['list_lexicons']: module.exit_json( lexicons=aws_response_list_parser(paginate, it, 'Lexicons')) elif module.params['list_speech_synthesis_tasks']: module.exit_json(speech_synthesis_tasks=aws_response_list_parser( paginate, it, 'SynthesisTasks')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( scaling_plan_name=dict(required=False), scaling_plan_names=dict(required=False, type=list, default=[]), scaling_plan_version=dict(required=False, type=int), describe_scaling_plans=dict(required=False, type=bool), describe_scaling_plan_resources=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=[ ('describe_scaling_plans', True, ['scaling_plan_names']), ('describe_scaling_plan_resources', True, ['scaling_plan_name', 'scaling_plan_version']), ], mutually_exclusive=[ ('describe_scaling_plans', 'describe_scaling_plan_resources'), ], ) client = module.client('autoscaling-plans', retry_decorator=AWSRetry.exponential_backoff()) _it, paginate = _autoscaling(client, module) if module.params['describe_scaling_plans']: module.exit_json(scaling_plans=aws_response_list_parser( paginate, _it, 'ScalingPlans')) elif module.params['describe_scaling_plan_resources']: module.exit_json(scaling_plan_resources=aws_response_list_parser( paginate, _it, 'ScalingPlanResources')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( graph_arn=dict(required=False), list_invitations=dict(required=False, type=bool), list_members=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=(('list_members', True, ['graph_arn']), ), mutually_exclusive=[( 'list_invitations', 'list_members', )], ) client = module.client('detective', retry_decorator=AWSRetry.exponential_backoff()) _it, paginate = _detective(client, module) if module.params['list_invitations']: module.exit_json( invitations=aws_response_list_parser(paginate, _it, 'Invitations')) elif module.params['list_members']: module.exit_json( members=aws_response_list_parser(paginate, _it, 'MemberDetails')) else: module.exit_json( graph_list=aws_response_list_parser(paginate, _it, 'GraphList'))
def main(): argument_spec = dict( list_configuration_sets=dict(required=False, type=bool), list_dedicated_ip_pools=dict(required=False, type=bool), list_deliverability_test_reports=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=(), mutually_exclusive=[( 'list_configuration_sets', 'list_dedicated_ip_pools', 'list_deliverability_test_reports', )], ) client = module.client('pinpoint-email', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _pinpoint_email(client, module) if module.params['list_configuration_sets']: module.exit_json(configuration_sets=aws_response_list_parser( paginate, it, 'ConfigurationSets')) elif module.params['list_dedicated_ip_pools']: module.exit_json(dedicated_ip_pools=aws_response_list_parser( paginate, it, 'DedicatedIpPools')) elif module.params['list_deliverability_test_reports']: module.exit_json(deliverability_test_reports=aws_response_list_parser( paginate, it, 'DeliverabilityTestReports')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( id=dict(required=False, aliases=['protection_group_id']), list_protection_groups=dict(required=False, type=bool), list_protections=dict(required=False, type=bool), list_resources_in_protection_group=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=(('list_resources_in_protection_group', True, ['id']), ), mutually_exclusive=[( 'list_protection_groups', 'list_protections', 'list_resources_in_protection_group', )], ) client = module.client('shield', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _shield(client, module) if module.params['list_protection_groups']: module.exit_json(protection_groups=aws_response_list_parser( paginate, it, 'ProtectionGroups')) elif module.params['list_protections']: module.exit_json( protections=aws_response_list_parser(paginate, it, 'Protections')) elif module.params['list_resources_in_protection_group']: module.exit_json( resources_in_protection_group=aws_response_list_parser( paginate, it, 'ResourceArns')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( id=dict(required=False), group_id=dict(required=False), list_groups=dict(required=False, type=bool), list_users=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=( ('list_groups', True, ['id']), ('list_users', True, ['id']), ), mutually_exclusive=[( 'list_groups', 'list_users', )], ) client = module.client('identitystore', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _identitystore(client, module) if module.params['list_groups']: module.exit_json( groups=aws_response_list_parser(paginate, it, 'Groups')) elif module.params['list_users']: module.exit_json(users=aws_response_list_parser(paginate, it, 'Users')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( id=dict(required=False), name=dict(required=False), describe_repositories=dict(required=False, type=bool), describe_images=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=( ('describe_repositories', True, ['id']), ('describe_images', True, ['id', 'name']), ), mutually_exclusive=[], ) client = module.client('ecr-public', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _ecr_public(client, module) if module.params['describe_repositories']: module.exit_json(repositories=aws_response_list_parser( paginate, it, 'repositories')) elif module.params['describe_images']: module.exit_json( images=aws_response_list_parser(paginate, it, 'imageDetails')) else: module.exit_json( registries=aws_response_list_parser(paginate, it, 'registries'))
def main(): argument_spec = dict( name=dict(required=False, aliases=['flow_name']), describe_flow=dict(required=False, type=bool), describe_connectors=dict(required=False, type=bool), describe_connector_types=dict(required=False, type=list) ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=[ ('describe_flow', True, ['name']), ('describe_connectors', True, ['describe_connector_types']) ], mutually_exclusive=[ ('describe_flow', 'describe_connectors'), ], ) appflow = module.client('appflow', retry_decorator=AWSRetry.exponential_backoff()) _it, paginate = _appflow(appflow, module) if module.params['describe_flow']: module.exit_json(flow=camel_dict_to_snake_dict(_it)) elif module.params['describe_connectors']: module.exit_json(connector_configurations=camel_dict_to_snake_dict(_it['connectorConfigurations'])) else: module.exit_json(flows=aws_response_list_parser(paginate, _it, 'flows'))
def main(): argument_spec = dict(name=dict(required=False, aliases=['event_integration_name']), list_event_integration_associations=dict( required=False, type=bool), describe_event_integration=dict(required=False, type=bool)) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=[ ('list_event_integration_associations', True, ['name']), ('describe_event_integration', True, ['name']), ], mutually_exclusive=[('list_event_integration_associations', 'describe_event_integration')], ) # remove below warning once service become GA module.warn("aws app integration service is preview on 25-12-2020") appintegrations = module.client( 'appintegrations', retry_decorator=AWSRetry.exponential_backoff()) _it, paginate = _appintegrations(appintegrations, module) if module.params['list_event_integration_associations']: module.exit_json( event_integration_associations=aws_response_list_parser( paginate, _it, 'EventIntegrationAssociations')) elif module.params['describe_event_integration']: module.exit_json(event_integration=camel_dict_to_snake_dict(_it)) else: module.exit_json(event_integrations=aws_response_list_parser( paginate, _it, 'EventIntegrations'))
def main(): argument_spec = dict( id=dict(required=False, aliases=['collection_id']), list_collections=dict(required=False, type=bool), list_faces=dict(required=False, type=bool), list_stream_processors=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=(('list_faces', True, ['id']), ), mutually_exclusive=[( 'list_collections', 'list_faces', 'list_stream_processors', )], ) client = module.client('rekognition', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _rekognition(client, module) if module.params['list_collections']: module.exit_json(collections=aws_response_list_parser( paginate, it, 'CollectionIds')) elif module.params['list_faces']: module.exit_json(faces=aws_response_list_parser(paginate, it, 'Faces')) elif module.params['list_stream_processors']: module.exit_json(stream_processors=aws_response_list_parser( paginate, it, 'StreamProcessors')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( name=dict(required=False), list_applications=dict(required=False, type=bool), list_application_snapshots=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=(('list_application_snapshots', True, ['name']), ), mutually_exclusive=[( 'list_applications', 'list_application_snapshots', )], ) client = module.client('kinesisanalyticsv2', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _kinesisanalyticsv2(client, module) if module.params['list_applications']: module.exit_json(applications=aws_response_list_parser( paginate, it, 'ApplicationSummaries')) elif module.params['list_application_snapshots']: module.exit_json(application_snapshots=aws_response_list_parser( paginate, it, 'SnapshotSummaries')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( arn=dict(required=False), list_event_types=dict(required=False, type=bool), list_targets=dict(required=False, type=bool), describe_notification_rule=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=(('describe_notification_rule', True, ['arn']), ), mutually_exclusive=[( 'list_event_types', 'list_targets', 'describe_notification_rule', )], ) client = module.client('codestar-notifications', retry_decorator=AWSRetry.exponential_backoff()) _it, paginate = _codestar(client, module) if module.params['list_event_types']: module.exit_json( event_types=aws_response_list_parser(paginate, _it, 'EventTypes')) elif module.params['list_targets']: module.exit_json( targets=aws_response_list_parser(paginate, _it, 'Targets')) elif module.params['describe_notification_rule']: module.exit_json(rule=camel_dict_to_snake_dict(_it)) else: module.exit_json( rules=aws_response_list_parser(paginate, _it, 'NotificationRules'))
def main(): argument_spec = dict( id=dict(required=False, aliases=['broker_id']), list_brokers=dict(required=False, type=bool), list_configurations=dict(required=False, type=bool), list_users=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=(('list_users', True, ['id']), ), mutually_exclusive=[( 'list_brokers', 'list_configurations', 'list_users', )], ) client = module.client('mq', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _mq(client, module) if module.params['list_brokers']: module.exit_json( brokers=aws_response_list_parser(paginate, it, 'BrokerSummaries')) elif module.params['list_configurations']: module.exit_json(configurations=aws_response_list_parser( paginate, it, 'Configurations')) elif module.params['list_users']: module.exit_json(users=aws_response_list_parser(paginate, it, 'Users')) else: module.fail_json("unknown options are passed")
def main(): argument_spec = dict( database_name=dict(required=False), list_databases=dict(required=False, type=bool), list_tables=dict(required=False, type=bool), ) module = AnsibleAWSModule( argument_spec=argument_spec, required_if=(('list_tables', True, ['database_name']), ), mutually_exclusive=[( 'list_databases', 'list_tables', )], ) client = module.client('timestream-write', retry_decorator=AWSRetry.exponential_backoff()) it, paginate = _timestream_write(client, module) if module.params['list_databases']: module.exit_json( databases=aws_response_list_parser(paginate, it, 'Databases')) elif module.params['list_tables']: module.exit_json( tables=aws_response_list_parser(paginate, it, 'Tables')) else: module.fail_json("unknown options are passed")