awspec 1.24.3 → 1.25.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +67 -0
- data/.github/workflows/doc.yml +29 -0
- data/.rubocop.yml +76 -27
- data/Gemfile +4 -0
- data/README.md +1 -3
- data/Rakefile +5 -4
- data/awspec.gemspec +5 -5
- data/bin/console +1 -0
- data/bin/toolbox +1 -0
- data/doc/_resource_types/cloudwatch_logs.md +9 -0
- data/doc/_resource_types/eks_nodegroup.md +53 -0
- data/doc/resource_types.md +76 -23
- data/exe/awspec +1 -0
- data/lib/awspec/cli.rb +2 -0
- data/lib/awspec/command/generate.rb +11 -9
- data/lib/awspec/config.rb +2 -0
- data/lib/awspec/error.rb +4 -0
- data/lib/awspec/ext/array.rb +5 -2
- data/lib/awspec/ext/hash.rb +5 -2
- data/lib/awspec/ext/string.rb +2 -0
- data/lib/awspec/ext/struct.rb +2 -0
- data/lib/awspec/ext.rb +2 -0
- data/lib/awspec/generator/doc/type/account.rb +4 -4
- data/lib/awspec/generator/doc/type/account_attribute.rb +4 -4
- data/lib/awspec/generator/doc/type/account_attribute_base.rb +3 -2
- data/lib/awspec/generator/doc/type/acm.rb +4 -2
- data/lib/awspec/generator/doc/type/alb.rb +5 -3
- data/lib/awspec/generator/doc/type/alb_listener.rb +3 -1
- data/lib/awspec/generator/doc/type/alb_target_group.rb +3 -1
- data/lib/awspec/generator/doc/type/ami.rb +4 -2
- data/lib/awspec/generator/doc/type/apigateway.rb +2 -0
- data/lib/awspec/generator/doc/type/autoscaling_group.rb +2 -0
- data/lib/awspec/generator/doc/type/base.rb +11 -8
- data/lib/awspec/generator/doc/type/batch_compute_environment.rb +6 -4
- data/lib/awspec/generator/doc/type/batch_job_definition.rb +2 -0
- data/lib/awspec/generator/doc/type/batch_job_queue.rb +2 -0
- data/lib/awspec/generator/doc/type/cloudformation_stack.rb +2 -0
- data/lib/awspec/generator/doc/type/cloudfront_distribution.rb +4 -2
- data/lib/awspec/generator/doc/type/cloudtrail.rb +2 -0
- data/lib/awspec/generator/doc/type/cloudwatch_alarm.rb +3 -1
- data/lib/awspec/generator/doc/type/cloudwatch_event.rb +2 -0
- data/lib/awspec/generator/doc/type/cloudwatch_logs.rb +2 -0
- data/lib/awspec/generator/doc/type/codebuild.rb +2 -0
- data/lib/awspec/generator/doc/type/codedeploy.rb +2 -0
- data/lib/awspec/generator/doc/type/codedeploy_deployment_group.rb +2 -0
- data/lib/awspec/generator/doc/type/cognito_identity_pool.rb +2 -0
- data/lib/awspec/generator/doc/type/cognito_user_pool.rb +2 -0
- data/lib/awspec/generator/doc/type/customer_gateway.rb +4 -2
- data/lib/awspec/generator/doc/type/directconnect_virtual_interface.rb +4 -2
- data/lib/awspec/generator/doc/type/dynamodb_table.rb +4 -2
- data/lib/awspec/generator/doc/type/ebs.rb +4 -2
- data/lib/awspec/generator/doc/type/ec2.rb +4 -2
- data/lib/awspec/generator/doc/type/ec2_account_attributes.rb +2 -0
- data/lib/awspec/generator/doc/type/ecr_repository.rb +2 -0
- data/lib/awspec/generator/doc/type/ecs_cluster.rb +4 -2
- data/lib/awspec/generator/doc/type/ecs_container_instance.rb +4 -2
- data/lib/awspec/generator/doc/type/ecs_service.rb +4 -2
- data/lib/awspec/generator/doc/type/ecs_task_definition.rb +4 -2
- data/lib/awspec/generator/doc/type/efs.rb +2 -0
- data/lib/awspec/generator/doc/type/eip.rb +2 -0
- data/lib/awspec/generator/doc/type/eks.rb +4 -2
- data/lib/awspec/generator/doc/type/eks_nodegroup.rb +4 -2
- data/lib/awspec/generator/doc/type/elasticache.rb +4 -2
- data/lib/awspec/generator/doc/type/elasticache_cache_parameter_group.rb +2 -0
- data/lib/awspec/generator/doc/type/elasticsearch.rb +2 -0
- data/lib/awspec/generator/doc/type/elastictranscoder_pipeline.rb +4 -2
- data/lib/awspec/generator/doc/type/elb.rb +5 -3
- data/lib/awspec/generator/doc/type/emr.rb +4 -2
- data/lib/awspec/generator/doc/type/firehose.rb +2 -0
- data/lib/awspec/generator/doc/type/iam_group.rb +3 -1
- data/lib/awspec/generator/doc/type/iam_policy.rb +2 -0
- data/lib/awspec/generator/doc/type/iam_role.rb +3 -1
- data/lib/awspec/generator/doc/type/iam_user.rb +3 -1
- data/lib/awspec/generator/doc/type/internet_gateway.rb +2 -0
- data/lib/awspec/generator/doc/type/kinesis.rb +2 -0
- data/lib/awspec/generator/doc/type/kms.rb +2 -0
- data/lib/awspec/generator/doc/type/lambda.rb +3 -1
- data/lib/awspec/generator/doc/type/lambda_account_settings.rb +2 -0
- data/lib/awspec/generator/doc/type/launch_configuration.rb +2 -0
- data/lib/awspec/generator/doc/type/launch_template.rb +2 -0
- data/lib/awspec/generator/doc/type/mq.rb +5 -3
- data/lib/awspec/generator/doc/type/msk.rb +2 -0
- data/lib/awspec/generator/doc/type/nat_gateway.rb +4 -2
- data/lib/awspec/generator/doc/type/network_acl.rb +4 -2
- data/lib/awspec/generator/doc/type/network_interface.rb +4 -2
- data/lib/awspec/generator/doc/type/nlb.rb +4 -2
- data/lib/awspec/generator/doc/type/nlb_listener.rb +3 -1
- data/lib/awspec/generator/doc/type/nlb_target_group.rb +3 -1
- data/lib/awspec/generator/doc/type/rds.rb +5 -3
- data/lib/awspec/generator/doc/type/rds_account_attributes.rb +2 -0
- data/lib/awspec/generator/doc/type/rds_db_cluster_parameter_group.rb +2 -0
- data/lib/awspec/generator/doc/type/rds_db_parameter_group.rb +2 -0
- data/lib/awspec/generator/doc/type/redshift.rb +5 -3
- data/lib/awspec/generator/doc/type/redshift_cluster_parameter_group.rb +2 -0
- data/lib/awspec/generator/doc/type/route53_hosted_zone.rb +2 -0
- data/lib/awspec/generator/doc/type/route_table.rb +2 -0
- data/lib/awspec/generator/doc/type/s3_bucket.rb +3 -1
- data/lib/awspec/generator/doc/type/secretsmanager.rb +2 -0
- data/lib/awspec/generator/doc/type/security_group.rb +4 -2
- data/lib/awspec/generator/doc/type/ses_identity.rb +4 -2
- data/lib/awspec/generator/doc/type/ses_send_quota.rb +2 -0
- data/lib/awspec/generator/doc/type/sns_topic.rb +5 -3
- data/lib/awspec/generator/doc/type/sqs.rb +2 -0
- data/lib/awspec/generator/doc/type/ssm_parameter.rb +2 -0
- data/lib/awspec/generator/doc/type/subnet.rb +4 -2
- data/lib/awspec/generator/doc/type/transit_gateway.rb +2 -0
- data/lib/awspec/generator/doc/type/vpc.rb +4 -2
- data/lib/awspec/generator/doc/type/vpc_endpoints.rb +2 -0
- data/lib/awspec/generator/doc/type/vpn_connection.rb +4 -2
- data/lib/awspec/generator/doc/type/vpn_gateway.rb +4 -2
- data/lib/awspec/generator/doc/type/waf_web_acl.rb +3 -1
- data/lib/awspec/generator/doc/type/wafregional_web_acl.rb +3 -1
- data/lib/awspec/generator/doc/type.rb +5 -3
- data/lib/awspec/generator/spec/acm.rb +4 -2
- data/lib/awspec/generator/spec/alb.rb +6 -4
- data/lib/awspec/generator/spec/alb_listener.rb +6 -4
- data/lib/awspec/generator/spec/autoscaling_group.rb +6 -4
- data/lib/awspec/generator/spec/cloudwatch_alarm.rb +4 -2
- data/lib/awspec/generator/spec/cloudwatch_event.rb +4 -2
- data/lib/awspec/generator/spec/cloudwatch_logs.rb +9 -3
- data/lib/awspec/generator/spec/codebuild.rb +4 -2
- data/lib/awspec/generator/spec/directconnect.rb +4 -2
- data/lib/awspec/generator/spec/ebs.rb +5 -4
- data/lib/awspec/generator/spec/ec2.rb +5 -2
- data/lib/awspec/generator/spec/efs.rb +4 -2
- data/lib/awspec/generator/spec/eip.rb +4 -2
- data/lib/awspec/generator/spec/elasticache.rb +5 -2
- data/lib/awspec/generator/spec/elasticsearch.rb +4 -2
- data/lib/awspec/generator/spec/elb.rb +8 -6
- data/lib/awspec/generator/spec/iam_group.rb +4 -2
- data/lib/awspec/generator/spec/iam_policy.rb +3 -0
- data/lib/awspec/generator/spec/iam_role.rb +4 -2
- data/lib/awspec/generator/spec/iam_user.rb +4 -2
- data/lib/awspec/generator/spec/internet_gateway.rb +6 -4
- data/lib/awspec/generator/spec/kms.rb +4 -2
- data/lib/awspec/generator/spec/lambda.rb +4 -2
- data/lib/awspec/generator/spec/nat_gateway.rb +6 -4
- data/lib/awspec/generator/spec/network_acl.rb +15 -13
- data/lib/awspec/generator/spec/network_interface.rb +13 -10
- data/lib/awspec/generator/spec/nlb.rb +6 -4
- data/lib/awspec/generator/spec/nlb_listener.rb +6 -4
- data/lib/awspec/generator/spec/rds.rb +5 -2
- data/lib/awspec/generator/spec/rds_db_cluster_parameter_group.rb +3 -2
- data/lib/awspec/generator/spec/rds_db_parameter_group.rb +3 -2
- data/lib/awspec/generator/spec/redshift.rb +5 -2
- data/lib/awspec/generator/spec/redshift_cluster_parameter_group.rb +3 -2
- data/lib/awspec/generator/spec/route53_hosted_zone.rb +4 -2
- data/lib/awspec/generator/spec/route_table.rb +12 -14
- data/lib/awspec/generator/spec/s3_bucket.rb +9 -6
- data/lib/awspec/generator/spec/security_group.rb +9 -8
- data/lib/awspec/generator/spec/subnet.rb +6 -4
- data/lib/awspec/generator/spec/vpc.rb +5 -2
- data/lib/awspec/generator/template.rb +17 -15
- data/lib/awspec/generator.rb +4 -2
- data/lib/awspec/helper/client_wrap.rb +5 -1
- data/lib/awspec/helper/color.rb +2 -0
- data/lib/awspec/helper/finder/account_attributes.rb +8 -6
- data/lib/awspec/helper/finder/acm.rb +4 -0
- data/lib/awspec/helper/finder/alb.rb +7 -5
- data/lib/awspec/helper/finder/ami.rb +4 -0
- data/lib/awspec/helper/finder/apigateway.rb +2 -0
- data/lib/awspec/helper/finder/autoscaling.rb +3 -0
- data/lib/awspec/helper/finder/batch.rb +2 -0
- data/lib/awspec/helper/finder/cloudformation.rb +2 -0
- data/lib/awspec/helper/finder/cloudfront.rb +3 -0
- data/lib/awspec/helper/finder/cloudtrail.rb +2 -0
- data/lib/awspec/helper/finder/cloudwatch.rb +3 -0
- data/lib/awspec/helper/finder/cloudwatch_event.rb +2 -0
- data/lib/awspec/helper/finder/cloudwatch_logs.rb +10 -5
- data/lib/awspec/helper/finder/codebuild.rb +3 -0
- data/lib/awspec/helper/finder/codedeploy.rb +2 -0
- data/lib/awspec/helper/finder/cognito_identity_pool.rb +2 -0
- data/lib/awspec/helper/finder/cognito_user_pool.rb +2 -0
- data/lib/awspec/helper/finder/directconnect.rb +2 -0
- data/lib/awspec/helper/finder/dynamodb.rb +2 -0
- data/lib/awspec/helper/finder/ebs.rb +5 -0
- data/lib/awspec/helper/finder/ec2.rb +56 -26
- data/lib/awspec/helper/finder/ecr.rb +2 -0
- data/lib/awspec/helper/finder/ecs.rb +5 -2
- data/lib/awspec/helper/finder/efs.rb +5 -4
- data/lib/awspec/helper/finder/eks.rb +2 -0
- data/lib/awspec/helper/finder/elasticache.rb +3 -1
- data/lib/awspec/helper/finder/elasticsearch.rb +3 -1
- data/lib/awspec/helper/finder/elastictranscoder.rb +3 -0
- data/lib/awspec/helper/finder/elb.rb +6 -4
- data/lib/awspec/helper/finder/emr.rb +2 -0
- data/lib/awspec/helper/finder/firehose.rb +2 -0
- data/lib/awspec/helper/finder/iam.rb +16 -12
- data/lib/awspec/helper/finder/kinesis.rb +2 -0
- data/lib/awspec/helper/finder/kms.rb +3 -1
- data/lib/awspec/helper/finder/lambda.rb +3 -0
- data/lib/awspec/helper/finder/mq.rb +3 -1
- data/lib/awspec/helper/finder/msk.rb +2 -0
- data/lib/awspec/helper/finder/nlb.rb +11 -8
- data/lib/awspec/helper/finder/rds.rb +4 -1
- data/lib/awspec/helper/finder/redshift.rb +4 -1
- data/lib/awspec/helper/finder/route53.rb +4 -1
- data/lib/awspec/helper/finder/s3.rb +4 -2
- data/lib/awspec/helper/finder/secretsmanager.rb +2 -0
- data/lib/awspec/helper/finder/security_group.rb +2 -0
- data/lib/awspec/helper/finder/ses.rb +2 -0
- data/lib/awspec/helper/finder/sns_topic.rb +5 -3
- data/lib/awspec/helper/finder/sqs.rb +2 -0
- data/lib/awspec/helper/finder/ssm_parameter.rb +4 -1
- data/lib/awspec/helper/finder/subnet.rb +126 -20
- data/lib/awspec/helper/finder/vpc.rb +12 -6
- data/lib/awspec/helper/finder/vpc_endpoints.rb +2 -0
- data/lib/awspec/helper/finder/waf.rb +5 -0
- data/lib/awspec/helper/finder/wafregional.rb +5 -0
- data/lib/awspec/helper/finder.rb +3 -1
- data/lib/awspec/helper/states.rb +4 -2
- data/lib/awspec/helper/type.rb +8 -4
- data/lib/awspec/helper.rb +2 -0
- data/lib/awspec/matcher/be_allowed.rb +2 -0
- data/lib/awspec/matcher/be_allowed_action.rb +2 -0
- data/lib/awspec/matcher/be_attached_to.rb +3 -0
- data/lib/awspec/matcher/be_connected_to_vpc.rb +2 -0
- data/lib/awspec/matcher/be_denied.rb +2 -0
- data/lib/awspec/matcher/be_opened.rb +2 -0
- data/lib/awspec/matcher/be_opened_only.rb +2 -0
- data/lib/awspec/matcher/belong_to_alb.rb +4 -0
- data/lib/awspec/matcher/belong_to_cache_subnet_group.rb +2 -0
- data/lib/awspec/matcher/belong_to_cluster_subnet_group.rb +2 -0
- data/lib/awspec/matcher/belong_to_db_subnet_group.rb +2 -0
- data/lib/awspec/matcher/belong_to_domain.rb +2 -0
- data/lib/awspec/matcher/belong_to_iam_group.rb +2 -0
- data/lib/awspec/matcher/belong_to_metric.rb +2 -0
- data/lib/awspec/matcher/belong_to_nlb.rb +4 -0
- data/lib/awspec/matcher/belong_to_replication_group.rb +2 -0
- data/lib/awspec/matcher/belong_to_subnet.rb +5 -0
- data/lib/awspec/matcher/belong_to_subnets.rb +16 -0
- data/lib/awspec/matcher/belong_to_vpc.rb +4 -0
- data/lib/awspec/matcher/have_attribute_definition.rb +2 -0
- data/lib/awspec/matcher/have_cluster_parameter_group.rb +2 -0
- data/lib/awspec/matcher/have_custom_response_error_code.rb +3 -2
- data/lib/awspec/matcher/have_db_parameter_group.rb +2 -0
- data/lib/awspec/matcher/have_env_var.rb +2 -0
- data/lib/awspec/matcher/have_env_var_value.rb +2 -0
- data/lib/awspec/matcher/have_env_vars.rb +2 -0
- data/lib/awspec/matcher/have_inline_policy.rb +2 -0
- data/lib/awspec/matcher/have_key_policy.rb +2 -0
- data/lib/awspec/matcher/have_key_schema.rb +2 -0
- data/lib/awspec/matcher/have_metric_filter.rb +11 -0
- data/lib/awspec/matcher/have_network_interface.rb +2 -0
- data/lib/awspec/matcher/have_option_group.rb +2 -0
- data/lib/awspec/matcher/have_origin.rb +3 -2
- data/lib/awspec/matcher/have_private_ip_address.rb +2 -0
- data/lib/awspec/matcher/have_record_set.rb +3 -1
- data/lib/awspec/matcher/have_route.rb +5 -3
- data/lib/awspec/matcher/have_rule.rb +3 -0
- data/lib/awspec/matcher/have_subscription_attributes.rb +3 -0
- data/lib/awspec/matcher/have_subscription_filter.rb +2 -0
- data/lib/awspec/matcher/have_tag.rb +2 -0
- data/lib/awspec/matcher/have_vpc_peering_connection.rb +2 -0
- data/lib/awspec/matcher/include_subscribed.rb +2 -0
- data/lib/awspec/matcher.rb +6 -0
- data/lib/awspec/resource_reader.rb +3 -0
- data/lib/awspec/setup.rb +7 -5
- data/lib/awspec/shared_context.rb +3 -0
- data/lib/awspec/stub/account.rb +2 -0
- data/lib/awspec/stub/acm.rb +2 -0
- data/lib/awspec/stub/alb.rb +3 -1
- data/lib/awspec/stub/alb_listener.rb +4 -3
- data/lib/awspec/stub/alb_target_group.rb +3 -1
- data/lib/awspec/stub/ami.rb +2 -0
- data/lib/awspec/stub/apigateway.rb +2 -0
- data/lib/awspec/stub/autoscaling_group.rb +6 -4
- data/lib/awspec/stub/batch_compute_environment.rb +2 -0
- data/lib/awspec/stub/batch_job_definition.rb +2 -0
- data/lib/awspec/stub/batch_job_queue.rb +2 -0
- data/lib/awspec/stub/cloudformation_stack.rb +4 -2
- data/lib/awspec/stub/cloudfront_distribution.rb +6 -4
- data/lib/awspec/stub/cloudtrail.rb +2 -0
- data/lib/awspec/stub/cloudwatch_logs.rb +4 -1
- data/lib/awspec/stub/codebuild.rb +5 -3
- data/lib/awspec/stub/codedeploy.rb +2 -0
- data/lib/awspec/stub/codedeploy_deployment_group.rb +2 -0
- data/lib/awspec/stub/cognito_identity_pool.rb +2 -0
- data/lib/awspec/stub/cognito_user_pool.rb +2 -0
- data/lib/awspec/stub/directconnect_virtual_interface.rb +2 -0
- data/lib/awspec/stub/duplicated_resource_type.rb +2 -0
- data/lib/awspec/stub/dynamodb_table.rb +2 -0
- data/lib/awspec/stub/ebs.rb +2 -0
- data/lib/awspec/stub/ec2.rb +2 -0
- data/lib/awspec/stub/ec2_has_multi_security_groups.rb +2 -0
- data/lib/awspec/stub/ec2_non_existing.rb +2 -0
- data/lib/awspec/stub/ecr_repository.rb +2 -0
- data/lib/awspec/stub/ecs.rb +13 -22
- data/lib/awspec/stub/ecs_cluster.rb +4 -4
- data/lib/awspec/stub/ecs_container_instance.rb +3 -2
- data/lib/awspec/stub/ecs_service.rb +4 -4
- data/lib/awspec/stub/ecs_task_definition.rb +9 -14
- data/lib/awspec/stub/efs.rb +2 -0
- data/lib/awspec/stub/eip.rb +2 -0
- data/lib/awspec/stub/eks.rb +5 -3
- data/lib/awspec/stub/eks_nodegroup.rb +63 -1
- data/lib/awspec/stub/elasticache.rb +2 -0
- data/lib/awspec/stub/elasticache_cache_parameter_group.rb +2 -0
- data/lib/awspec/stub/elasticsearch.rb +1 -0
- data/lib/awspec/stub/elastictranscoder_pipeline.rb +2 -0
- data/lib/awspec/stub/elb.rb +2 -0
- data/lib/awspec/stub/emr.rb +2 -0
- data/lib/awspec/stub/firehose.rb +2 -0
- data/lib/awspec/stub/iam_group.rb +3 -2
- data/lib/awspec/stub/iam_policy.rb +2 -0
- data/lib/awspec/stub/iam_role.rb +3 -2
- data/lib/awspec/stub/iam_user.rb +3 -2
- data/lib/awspec/stub/internet_gateway.rb +2 -0
- data/lib/awspec/stub/kinesis.rb +8 -6
- data/lib/awspec/stub/kms.rb +2 -0
- data/lib/awspec/stub/lambda.rb +2 -0
- data/lib/awspec/stub/launch_configuration.rb +2 -0
- data/lib/awspec/stub/launch_template.rb +2 -0
- data/lib/awspec/stub/mq.rb +5 -3
- data/lib/awspec/stub/msk.rb +5 -3
- data/lib/awspec/stub/nat_gateway.rb +2 -0
- data/lib/awspec/stub/network_acl.rb +2 -0
- data/lib/awspec/stub/network_interface.rb +2 -0
- data/lib/awspec/stub/nlb.rb +3 -1
- data/lib/awspec/stub/nlb_listener.rb +4 -3
- data/lib/awspec/stub/nlb_target_group.rb +3 -1
- data/lib/awspec/stub/rds.rb +2 -0
- data/lib/awspec/stub/rds_db_cluster_parameter_group.rb +2 -0
- data/lib/awspec/stub/rds_db_parameter_group.rb +10 -0
- data/lib/awspec/stub/redshift.rb +2 -0
- data/lib/awspec/stub/redshift_cluster_parameter_group.rb +2 -0
- data/lib/awspec/stub/route53_hosted_zone.rb +2 -0
- data/lib/awspec/stub/route_table.rb +2 -0
- data/lib/awspec/stub/s3_bucket.rb +2 -0
- data/lib/awspec/stub/secretsmanager.rb +2 -0
- data/lib/awspec/stub/security_group.rb +2 -0
- data/lib/awspec/stub/ses_identity.rb +2 -0
- data/lib/awspec/stub/sns_topic.rb +18 -9
- data/lib/awspec/stub/sns_topic_error.rb +17 -0
- data/lib/awspec/stub/sqs.rb +2 -0
- data/lib/awspec/stub/ssm_parameter.rb +2 -0
- data/lib/awspec/stub/subnet.rb +2 -0
- data/lib/awspec/stub/transit_gateway.rb +2 -0
- data/lib/awspec/stub/vpc.rb +2 -0
- data/lib/awspec/stub/vpc_endpoints.rb +2 -0
- data/lib/awspec/stub/waf_web_acl.rb +2 -0
- data/lib/awspec/stub/wafregional_web_acl.rb +2 -0
- data/lib/awspec/stub.rb +3 -1
- data/lib/awspec/toolbox.rb +2 -0
- data/lib/awspec/type/account.rb +4 -2
- data/lib/awspec/type/account_attribute.rb +5 -2
- data/lib/awspec/type/account_attribute_base.rb +2 -0
- data/lib/awspec/type/acm.rb +8 -6
- data/lib/awspec/type/alb.rb +8 -3
- data/lib/awspec/type/alb_listener.rb +4 -0
- data/lib/awspec/type/alb_target_group.rb +3 -0
- data/lib/awspec/type/ami.rb +5 -3
- data/lib/awspec/type/apigateway.rb +9 -3
- data/lib/awspec/type/autoscaling_group.rb +3 -0
- data/lib/awspec/type/base.rb +6 -3
- data/lib/awspec/type/batch_compute_environment.rb +6 -4
- data/lib/awspec/type/batch_job_definition.rb +2 -0
- data/lib/awspec/type/batch_job_queue.rb +4 -2
- data/lib/awspec/type/cloudformation_stack.rb +2 -0
- data/lib/awspec/type/cloudfront_distribution.rb +11 -5
- data/lib/awspec/type/cloudtrail.rb +2 -0
- data/lib/awspec/type/cloudwatch_alarm.rb +2 -0
- data/lib/awspec/type/cloudwatch_event.rb +2 -0
- data/lib/awspec/type/cloudwatch_logs.rb +10 -3
- data/lib/awspec/type/codebuild.rb +2 -0
- data/lib/awspec/type/codedeploy.rb +2 -0
- data/lib/awspec/type/codedeploy_deployment_group.rb +4 -0
- data/lib/awspec/type/cognito_identity_pool.rb +2 -0
- data/lib/awspec/type/cognito_user_pool.rb +2 -0
- data/lib/awspec/type/customer_gateway.rb +5 -3
- data/lib/awspec/type/directconnect_virtual_interface.rb +5 -3
- data/lib/awspec/type/dynamodb_table.rb +5 -3
- data/lib/awspec/type/ebs.rb +6 -3
- data/lib/awspec/type/ec2.rb +10 -0
- data/lib/awspec/type/ec2_account_attributes.rb +2 -0
- data/lib/awspec/type/ecr_repository.rb +2 -0
- data/lib/awspec/type/ecs_cluster.rb +5 -2
- data/lib/awspec/type/ecs_container_instance.rb +4 -2
- data/lib/awspec/type/ecs_service.rb +5 -2
- data/lib/awspec/type/ecs_task_definition.rb +4 -2
- data/lib/awspec/type/efs.rb +3 -0
- data/lib/awspec/type/eip.rb +3 -0
- data/lib/awspec/type/eks.rb +4 -2
- data/lib/awspec/type/eks_nodegroup.rb +109 -2
- data/lib/awspec/type/elasticache.rb +7 -3
- data/lib/awspec/type/elasticache_cache_parameter_group.rb +3 -0
- data/lib/awspec/type/elasticsearch.rb +2 -0
- data/lib/awspec/type/elastictranscoder_pipeline.rb +5 -3
- data/lib/awspec/type/elb.rb +11 -3
- data/lib/awspec/type/emr.rb +8 -6
- data/lib/awspec/type/firehose.rb +4 -2
- data/lib/awspec/type/iam_group.rb +4 -0
- data/lib/awspec/type/iam_policy.rb +5 -0
- data/lib/awspec/type/iam_role.rb +3 -0
- data/lib/awspec/type/iam_user.rb +3 -0
- data/lib/awspec/type/internet_gateway.rb +2 -0
- data/lib/awspec/type/kinesis.rb +3 -0
- data/lib/awspec/type/kms.rb +3 -0
- data/lib/awspec/type/lambda.rb +2 -0
- data/lib/awspec/type/lambda_account_settings.rb +2 -0
- data/lib/awspec/type/launch_configuration.rb +3 -0
- data/lib/awspec/type/launch_template.rb +3 -0
- data/lib/awspec/type/mq.rb +7 -3
- data/lib/awspec/type/msk.rb +5 -3
- data/lib/awspec/type/nat_gateway.rb +5 -3
- data/lib/awspec/type/network_acl.rb +9 -2
- data/lib/awspec/type/network_interface.rb +9 -3
- data/lib/awspec/type/nlb.rb +6 -3
- data/lib/awspec/type/nlb_listener.rb +4 -0
- data/lib/awspec/type/nlb_target_group.rb +3 -0
- data/lib/awspec/type/rds.rb +7 -3
- data/lib/awspec/type/rds_account_attributes.rb +2 -0
- data/lib/awspec/type/rds_db_cluster_parameter_group.rb +3 -0
- data/lib/awspec/type/rds_db_parameter_group.rb +58 -0
- data/lib/awspec/type/redshift.rb +7 -3
- data/lib/awspec/type/redshift_cluster_parameter_group.rb +2 -0
- data/lib/awspec/type/resource_base.rb +2 -0
- data/lib/awspec/type/route53_hosted_zone.rb +7 -2
- data/lib/awspec/type/route_table.rb +12 -0
- data/lib/awspec/type/s3_bucket.rb +7 -4
- data/lib/awspec/type/secretsmanager.rb +2 -0
- data/lib/awspec/type/security_group.rb +14 -2
- data/lib/awspec/type/ses_identity.rb +8 -6
- data/lib/awspec/type/ses_send_quota.rb +2 -0
- data/lib/awspec/type/sns_topic.rb +4 -0
- data/lib/awspec/type/sqs.rb +4 -0
- data/lib/awspec/type/ssm_parameter.rb +3 -0
- data/lib/awspec/type/subnet.rb +6 -3
- data/lib/awspec/type/transit_gateway.rb +2 -0
- data/lib/awspec/type/vpc.rb +7 -3
- data/lib/awspec/type/vpc_endpoints.rb +5 -3
- data/lib/awspec/type/vpn_connection.rb +5 -3
- data/lib/awspec/type/vpn_gateway.rb +5 -3
- data/lib/awspec/type/waf_web_acl.rb +3 -0
- data/lib/awspec/type/wafregional_web_acl.rb +3 -0
- data/lib/awspec/version.rb +3 -1
- data/lib/awspec.rb +2 -0
- metadata +31 -28
- data/.tachikoma.yml +0 -1
- data/.travis.yml +0 -27
@@ -1,21 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Helper
|
2
4
|
module Finder
|
3
5
|
module Iam
|
4
6
|
# find_iam_user, find_iam_group find_iam_role find_iam_policy
|
5
|
-
role_types = %w
|
7
|
+
role_types = %w[user group role policy]
|
6
8
|
role_types.each do |type|
|
7
|
-
define_method
|
9
|
+
define_method "find_iam_#{type}" do |*args|
|
8
10
|
id = args.first
|
9
11
|
selected = []
|
10
|
-
res = iam_client.send(
|
12
|
+
res = iam_client.send("list_#{type.pluralize}")
|
11
13
|
loop do
|
12
14
|
selected += res[type.pluralize].select do |u|
|
13
|
-
u[type
|
15
|
+
u["#{type}_name"] == id || u["#{type}_id"] == id || u.arn == id
|
14
16
|
end
|
15
17
|
|
16
18
|
break unless res.is_truncated
|
19
|
+
|
17
20
|
res = iam_client.send(
|
18
|
-
|
21
|
+
"list_#{type.pluralize}",
|
19
22
|
{ marker: res.marker }
|
20
23
|
)
|
21
24
|
end
|
@@ -43,19 +46,19 @@ module Awspec::Helper
|
|
43
46
|
res.groups
|
44
47
|
end
|
45
48
|
|
46
|
-
%w
|
47
|
-
define_method
|
49
|
+
%w[user group role].each do |type|
|
50
|
+
define_method "select_iam_policy_by_#{type}_name" do |name|
|
48
51
|
res = iam_client.send(
|
49
|
-
|
50
|
-
{
|
52
|
+
"list_attached_#{type}_policies",
|
53
|
+
{ "#{type}_name".to_sym => name }
|
51
54
|
)
|
52
55
|
res.attached_policies
|
53
56
|
end
|
54
57
|
|
55
|
-
define_method
|
58
|
+
define_method "select_inline_policy_by_#{type}_name" do |name|
|
56
59
|
res = iam_client.send(
|
57
|
-
|
58
|
-
{
|
60
|
+
"list_#{type}_policies",
|
61
|
+
{ "#{type}_name".to_sym => name }
|
59
62
|
)
|
60
63
|
res.policy_names
|
61
64
|
end
|
@@ -68,6 +71,7 @@ module Awspec::Helper
|
|
68
71
|
loop do
|
69
72
|
selected += res.policies.select { |p| p.attachment_count > 0 }
|
70
73
|
break unless res.is_truncated
|
74
|
+
|
71
75
|
res = iam_client.list_policies({
|
72
76
|
marker: res.marker
|
73
77
|
})
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Helper
|
2
4
|
module Finder
|
3
5
|
module Lambda
|
@@ -10,6 +12,7 @@ module Awspec::Helper
|
|
10
12
|
function.function_name == id || function.function_arn == id
|
11
13
|
end
|
12
14
|
break if res.next_marker.nil?
|
15
|
+
|
13
16
|
res = lambda_client.list_functions({
|
14
17
|
marker: res.next_marker
|
15
18
|
})
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Helper
|
2
4
|
module Finder
|
3
5
|
module Nlb
|
@@ -6,8 +8,8 @@ module Awspec::Helper
|
|
6
8
|
res.load_balancers.select do |lb|
|
7
9
|
lb.type == 'network'
|
8
10
|
end.single_resource(id)
|
9
|
-
rescue
|
10
|
-
|
11
|
+
rescue StandardError
|
12
|
+
nil
|
11
13
|
end
|
12
14
|
|
13
15
|
def select_nlb_by_vpc_id(vpc_id)
|
@@ -20,8 +22,8 @@ module Awspec::Helper
|
|
20
22
|
def find_nlb_listener(arn)
|
21
23
|
res = elbv2_client.describe_listeners({ listener_arns: [arn] })
|
22
24
|
res.listeners.single_resource(arn)
|
23
|
-
rescue
|
24
|
-
|
25
|
+
rescue StandardError
|
26
|
+
nil
|
25
27
|
end
|
26
28
|
|
27
29
|
def select_nlb_listener_by_nlb_arn(arn)
|
@@ -38,18 +40,19 @@ module Awspec::Helper
|
|
38
40
|
def find_nlb_target_group(id)
|
39
41
|
res = elbv2_client.describe_target_groups({ names: [id] })
|
40
42
|
httpx_res = res.target_groups.select do |tg|
|
41
|
-
%w
|
43
|
+
%w[HTTP HTTPS].include?(tg.protocol)
|
42
44
|
end
|
43
45
|
if !httpx_res || httpx_res.empty?
|
44
46
|
raise "ERROR: Found no HTTP nor HTTPS -protocol target group named '#{id}'."
|
45
47
|
end
|
48
|
+
|
46
49
|
httpx_res.single_resource(id)
|
47
|
-
rescue
|
50
|
+
rescue StandardError
|
48
51
|
# Prefer the HTTP/HTTPS protocol target group, but survive without it:
|
49
52
|
begin
|
50
53
|
res.target_groups.single_resource(id)
|
51
|
-
rescue
|
52
|
-
|
54
|
+
rescue StandardError
|
55
|
+
nil
|
53
56
|
end
|
54
57
|
end
|
55
58
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Helper
|
2
4
|
module Finder
|
3
5
|
module Rds
|
@@ -6,7 +8,7 @@ module Awspec::Helper
|
|
6
8
|
res = rds_client.describe_db_instances({
|
7
9
|
db_instance_identifier: id
|
8
10
|
})
|
9
|
-
rescue
|
11
|
+
rescue StandardError
|
10
12
|
res = rds_client.describe_db_instances({
|
11
13
|
filters: [{ name: 'db-instance-id', values: [id] }]
|
12
14
|
})
|
@@ -31,6 +33,7 @@ module Awspec::Helper
|
|
31
33
|
parameters[param.parameter_name] = param.parameter_value
|
32
34
|
end
|
33
35
|
break if res.marker.nil?
|
36
|
+
|
34
37
|
res = rds_client.describe_db_parameters({
|
35
38
|
db_parameter_group_name: parameter_group,
|
36
39
|
marker: res.marker
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Helper
|
2
4
|
module Finder
|
3
5
|
module Redshift
|
4
6
|
def find_redshift_cluster_identifier(id)
|
5
7
|
res = redshift_client.describe_clusters(cluster_identifier: id)
|
6
8
|
res.clusters.single_resource(id)
|
7
|
-
rescue
|
9
|
+
rescue StandardError
|
8
10
|
nil
|
9
11
|
end
|
10
12
|
|
@@ -25,6 +27,7 @@ module Awspec::Helper
|
|
25
27
|
parameters[param.parameter_name] = param.parameter_value
|
26
28
|
end
|
27
29
|
break if res.marker.nil?
|
30
|
+
|
28
31
|
res = redshift_client.describe_cluster_parameters({
|
29
32
|
parameter_group_name: parameter_group,
|
30
33
|
marker: res.marker
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Helper
|
2
4
|
module Finder
|
3
5
|
module Route53
|
@@ -6,12 +8,13 @@ module Awspec::Helper
|
|
6
8
|
selected = []
|
7
9
|
loop do
|
8
10
|
res.hosted_zones.each do |hosted_zone|
|
9
|
-
if hosted_zone[:name] == id || hosted_zone[:id] ==
|
11
|
+
if hosted_zone[:name] == id || hosted_zone[:id] == "/hostedzone/#{id}" || hosted_zone[:id] == id
|
10
12
|
selected.push(hosted_zone)
|
11
13
|
end
|
12
14
|
end
|
13
15
|
|
14
16
|
break unless res.is_truncated
|
17
|
+
|
15
18
|
res = route53_client.list_hosted_zones({
|
16
19
|
marker: res.next_marker
|
17
20
|
})
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Helper
|
2
4
|
module Finder
|
3
5
|
module S3
|
@@ -16,9 +18,9 @@ module Awspec::Helper
|
|
16
18
|
def head_object(id, key)
|
17
19
|
res = s3_client.head_object({
|
18
20
|
bucket: id,
|
19
|
-
key: key.sub(%r
|
21
|
+
key: key.sub(%r{\A/}, '')
|
20
22
|
})
|
21
|
-
res.data.
|
23
|
+
res.data.instance_of?(Aws::S3::Types::HeadObjectOutput)
|
22
24
|
rescue Aws::S3::Errors::NotFound
|
23
25
|
false
|
24
26
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Helper
|
2
4
|
module Finder
|
3
5
|
module SNSTopic
|
@@ -20,10 +22,10 @@ module Awspec::Helper
|
|
20
22
|
end
|
21
23
|
|
22
24
|
def to_s
|
23
|
-
output = ["SnsTopic: #{
|
24
|
-
|
25
|
+
output = ["SnsTopic: #{name}"]
|
26
|
+
instance_variables.each do |attrib|
|
25
27
|
tmp = attrib.to_s.sub('@', '')
|
26
|
-
output << " #{tmp} = #{
|
28
|
+
output << " #{tmp} = #{send(tmp)}"
|
27
29
|
end
|
28
30
|
output.join("\n")
|
29
31
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Helper
|
2
4
|
module Finder
|
3
5
|
module SsmParameter
|
@@ -10,7 +12,8 @@ module Awspec::Helper
|
|
10
12
|
values: [name]
|
11
13
|
}
|
12
14
|
]
|
13
|
-
}
|
15
|
+
}
|
16
|
+
).parameters[0]
|
14
17
|
end
|
15
18
|
|
16
19
|
def find_parameter_tag(id, tag_key)
|
@@ -1,29 +1,135 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'singleton'
|
4
|
+
|
1
5
|
module Awspec::Helper
|
2
6
|
module Finder
|
3
7
|
module Subnet
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
8
|
+
# Implements in-memory cache for +AWS::Ec2::Client+ +describe_subnets+
|
9
|
+
# method.
|
10
|
+
|
11
|
+
# == Usage
|
12
|
+
# Includes {Singleton}[https://ruby-doc.org/stdlib-2.7.3/libdoc/singleton/rdoc/index.html]
|
13
|
+
# module, so use +instance+ instead of +new+ to get a instance.
|
14
|
+
#
|
15
|
+
# It is intended to be used internally by the +find_subnet+ function only.
|
16
|
+
#
|
17
|
+
# Many of the methods expect a symbol to search through the cache to
|
18
|
+
# avoid having to call +to_sym+ multiple times.
|
19
|
+
|
20
|
+
class SubnetCache
|
21
|
+
include Singleton
|
22
|
+
|
23
|
+
def initialize # :nodoc:
|
24
|
+
@by_tag_name = {}
|
25
|
+
@by_cidr = {}
|
26
|
+
@subnet_ids = {}
|
27
|
+
@ip_matcher = Regexp.new('^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/\d{1,2}$')
|
28
|
+
end
|
29
|
+
|
30
|
+
# Add a mapping of a CIDR to the respective subnet ID
|
31
|
+
def add_by_cidr(cidr, subnet_id)
|
32
|
+
key_sym = cidr.to_sym
|
33
|
+
@by_cidr[key_sym] = subnet_id.to_sym unless @by_cidr.key?(key_sym)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Add a mapping of a tag to the respective subnet ID
|
37
|
+
def add_by_tag(tag, subnet_id)
|
38
|
+
key_sym = tag.to_sym
|
39
|
+
@by_tag_name[key_sym] = subnet_id.to_sym unless @by_tag_name.key?(key_sym)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Add a +Aws::EC2::Types::Subnet+ instance to the cache, mapping it's ID
|
43
|
+
# to the instance itself.
|
44
|
+
def add_subnet(subnet)
|
45
|
+
key_sym = subnet.subnet_id.to_sym
|
46
|
+
@subnet_ids[key_sym] = subnet unless @subnet_ids.key?(key_sym)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Check if a subnet ID (as a symbol) exists in the cache.
|
50
|
+
def has_subnet?(subnet_id_symbol)
|
51
|
+
@subnet_ids.key?(subnet_id_symbol)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Check if a IPv4 CIDR (as a symbol) exists in the cache.
|
55
|
+
def has_cidr?(cidr_symbol)
|
56
|
+
@by_cidr.key?(cidr_symbol)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Return a +Aws::EC2::Types::Subnet+ that matches the given CIDR.
|
60
|
+
def subnet_by_cidr(cidr_symbol)
|
61
|
+
@subnet_ids[@by_cidr[cidr_symbol]]
|
62
|
+
end
|
63
|
+
|
64
|
+
# Return a +Aws::EC2::Types::Subnet+ that matches the given tag.
|
65
|
+
def subnet_by_tag(tag_symbol)
|
66
|
+
@subnet_ids[@by_tag_name[tag_symbol]]
|
67
|
+
end
|
68
|
+
|
69
|
+
# Return a +Aws::EC2::Types::Subnet+ that matches the given subnet ID.
|
70
|
+
def subnet_by_id(subnet_id_symbol)
|
71
|
+
@subnet_ids[subnet_id_symbol]
|
72
|
+
end
|
73
|
+
|
74
|
+
# Check if a given string looks like a IPv4 CIDR.
|
75
|
+
def is_cidr?(subnet_id)
|
76
|
+
@ip_matcher.match(subnet_id)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Check if the cache was already initialized or not.
|
80
|
+
def empty?
|
81
|
+
@subnet_ids.empty?
|
82
|
+
end
|
83
|
+
|
84
|
+
# Return the cache as a string.
|
85
|
+
def to_s
|
86
|
+
"by tag name: #{@by_tag_name}, by CIDR: #{@by_cidr}"
|
87
|
+
end
|
19
88
|
end
|
20
89
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
90
|
+
# Try to locate a +Aws::EC2::Types::Subnet+ with a given subnet ID.
|
91
|
+
#
|
92
|
+
# A subnet ID might be multiple things, like the
|
93
|
+
# +Aws::EC2::Types::Subnet.subnet_id+, or a IPv4 CIDR or the value for the
|
94
|
+
# +Name+ tag associated with the subnet.
|
95
|
+
#
|
96
|
+
# Returns a instance of +Aws::EC2::Types::Subnet+ or +nil+.
|
97
|
+
def find_subnet(subnet_id)
|
98
|
+
cache = SubnetCache.instance
|
99
|
+
|
100
|
+
if cache.empty?
|
101
|
+
res = ec2_client.describe_subnets
|
102
|
+
|
103
|
+
res.subnets.each do |sub|
|
104
|
+
cache.add_by_cidr(sub.cidr_block, sub.subnet_id)
|
105
|
+
cache.add_subnet(sub)
|
106
|
+
next if sub.tags.empty?
|
107
|
+
|
108
|
+
sub.tags.each do |tag|
|
109
|
+
if tag[:key].eql?('Name')
|
110
|
+
cache.add_by_tag(tag[:value], sub.subnet_id)
|
111
|
+
break
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
id_key = subnet_id.to_sym
|
118
|
+
return cache.subnet_by_id(id_key) if subnet_id.start_with?('subnet-') && cache.has_subnet?(id_key)
|
119
|
+
return cache.subnet_by_cidr(id_key) if cache.is_cidr?(subnet_id) && cache.has_cidr?(id_key)
|
120
|
+
|
121
|
+
cache.subnet_by_tag(id_key)
|
26
122
|
end
|
27
123
|
end
|
124
|
+
|
125
|
+
# Search for the subnets associated with a given VPC ID.
|
126
|
+
#
|
127
|
+
# Returns an array of +Aws::EC2::Types::Subnet+ instances.
|
128
|
+
def select_subnet_by_vpc_id(vpc_id)
|
129
|
+
res = ec2_client.describe_subnets({
|
130
|
+
filters: [{ name: 'vpc-id', values: [vpc_id] }]
|
131
|
+
})
|
132
|
+
res.subnets
|
133
|
+
end
|
28
134
|
end
|
29
135
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Helper
|
2
4
|
module Finder
|
3
5
|
module Vpc
|
@@ -7,6 +9,7 @@ module Awspec::Helper
|
|
7
9
|
})
|
8
10
|
resource = res.vpcs.single_resource(id)
|
9
11
|
return resource if resource
|
12
|
+
|
10
13
|
res = ec2_client.describe_vpcs({
|
11
14
|
filters: [{ name: 'tag:Name', values: [id] }]
|
12
15
|
})
|
@@ -19,6 +22,7 @@ module Awspec::Helper
|
|
19
22
|
})
|
20
23
|
resource = res.route_tables.single_resource(route_table_id)
|
21
24
|
return resource if resource
|
25
|
+
|
22
26
|
res = ec2_client.describe_route_tables({
|
23
27
|
filters: [{ name: 'tag:Name', values: [route_table_id] }]
|
24
28
|
})
|
@@ -31,6 +35,7 @@ module Awspec::Helper
|
|
31
35
|
})
|
32
36
|
resource = res.network_acls.single_resource(id)
|
33
37
|
return resource if resource
|
38
|
+
|
34
39
|
res = ec2_client.describe_network_acls({
|
35
40
|
filters: [{ name: 'tag:Name', values: [id] }]
|
36
41
|
})
|
@@ -62,6 +67,7 @@ module Awspec::Helper
|
|
62
67
|
})
|
63
68
|
resource = res.vpc_peering_connections.single_resource(vpc_peering_connection_id)
|
64
69
|
return resource if resource
|
70
|
+
|
65
71
|
res = ec2_client.describe_vpc_peering_connections({
|
66
72
|
filters: [
|
67
73
|
{
|
@@ -87,24 +93,24 @@ module Awspec::Helper
|
|
87
93
|
def find_vpc_attribute(vpc_id, vpc_attribute)
|
88
94
|
res = ec2_client.describe_vpc_attribute({ vpc_id: vpc_id, attribute: vpc_attribute })
|
89
95
|
case vpc_attribute
|
90
|
-
when 'enableDnsSupport'
|
96
|
+
when 'enableDnsSupport'
|
91
97
|
res.enable_dns_support.value
|
92
|
-
when 'enableDnsHostnames'
|
98
|
+
when 'enableDnsHostnames'
|
93
99
|
res.enable_dns_hostnames.value
|
94
100
|
end
|
95
101
|
end
|
96
102
|
|
97
103
|
def select_vpc_attribute(vpc_id)
|
98
104
|
attributes = {}
|
99
|
-
vpc_attributes = %w
|
105
|
+
vpc_attributes = %w[
|
100
106
|
enableDnsHostnames enableDnsSupport
|
101
|
-
|
107
|
+
]
|
102
108
|
vpc_attributes.each do |vpc_attribute|
|
103
109
|
res = ec2_client.describe_vpc_attribute({ vpc_id: vpc_id, attribute: vpc_attribute })
|
104
110
|
attributes[vpc_attribute] = case vpc_attribute
|
105
|
-
when 'enableDnsHostnames'
|
111
|
+
when 'enableDnsHostnames'
|
106
112
|
res.enable_dns_hostnames.value
|
107
|
-
when 'enableDnsSupport'
|
113
|
+
when 'enableDnsSupport'
|
108
114
|
res.enable_dns_support.value
|
109
115
|
end
|
110
116
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Helper
|
2
4
|
module Finder
|
3
5
|
module Waf
|
@@ -14,6 +16,7 @@ module Awspec::Helper
|
|
14
16
|
end
|
15
17
|
|
16
18
|
return nil unless finded
|
19
|
+
|
17
20
|
waf_client.get_web_acl(web_acl_id: finded.web_acl_id).web_acl
|
18
21
|
end
|
19
22
|
|
@@ -30,6 +33,7 @@ module Awspec::Helper
|
|
30
33
|
end
|
31
34
|
|
32
35
|
return nil unless finded
|
36
|
+
|
33
37
|
waf_client.get_rule(rule_id: finded.rule_id).rule
|
34
38
|
end
|
35
39
|
|
@@ -46,6 +50,7 @@ module Awspec::Helper
|
|
46
50
|
end
|
47
51
|
|
48
52
|
return nil unless finded
|
53
|
+
|
49
54
|
waf_client.get_ip_set(ip_set_id: finded.ip_set_id).ip_set
|
50
55
|
end
|
51
56
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Helper
|
2
4
|
module Finder
|
3
5
|
module WafRegional
|
@@ -14,6 +16,7 @@ module Awspec::Helper
|
|
14
16
|
end
|
15
17
|
|
16
18
|
return nil unless finded
|
19
|
+
|
17
20
|
wafregional_client.get_web_acl(web_acl_id: finded.web_acl_id).web_acl
|
18
21
|
end
|
19
22
|
|
@@ -30,6 +33,7 @@ module Awspec::Helper
|
|
30
33
|
end
|
31
34
|
|
32
35
|
return nil unless finded
|
36
|
+
|
33
37
|
wafregional_client.get_rule(rule_id: finded.rule_id).rule
|
34
38
|
end
|
35
39
|
|
@@ -46,6 +50,7 @@ module Awspec::Helper
|
|
46
50
|
end
|
47
51
|
|
48
52
|
return nil unless finded
|
53
|
+
|
49
54
|
wafregional_client.get_ip_set(ip_set_id: finded.ip_set_id).ip_set
|
50
55
|
end
|
51
56
|
end
|
data/lib/awspec/helper/finder.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'aws-sdk'
|
2
4
|
require 'awspec/helper/finder/nlb'
|
3
5
|
require 'awspec/helper/finder/alb'
|
@@ -174,7 +176,7 @@ module Awspec::Helper
|
|
174
176
|
|
175
177
|
CLIENTS.each do |method_name, client|
|
176
178
|
define_method method_name do
|
177
|
-
unless
|
179
|
+
unless methods.include? "@#{method_name}"
|
178
180
|
instance_variable_set(
|
179
181
|
"@#{method_name}",
|
180
182
|
Awspec::Helper::ClientWrap.new(client.new(CLIENT_OPTIONS))
|
data/lib/awspec/helper/states.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Helper
|
2
4
|
module States
|
3
|
-
EC2_STATES = %w
|
5
|
+
EC2_STATES = %w[pending running shutting-down terminated stopping stopped]
|
4
6
|
|
5
7
|
def self.ec2_states_checks
|
6
8
|
Enumerator.new do |yielder|
|
7
9
|
n = 0
|
8
10
|
while n < EC2_STATES.size
|
9
|
-
method_name = EC2_STATES[n].tr('-', '_')
|
11
|
+
method_name = "#{EC2_STATES[n].tr('-', '_')}?"
|
10
12
|
yielder.yield(method_name, EC2_STATES[n])
|
11
13
|
n += 1
|
12
14
|
end
|