awspec 1.25.0 → 1.26.0
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 +8 -9
- data/.rubocop.yml +66 -62
- data/Gemfile +3 -1
- data/Rakefile +19 -4
- data/awspec.gemspec +5 -2
- data/bin/console +1 -0
- data/bin/toolbox +1 -0
- data/doc/_resource_types/transfer_server.md +23 -0
- data/doc/resource_types.md +57 -25
- 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/transfer_server.rb +21 -0
- 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 +4 -2
- 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 +16 -10
- 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 +9 -1
- data/lib/awspec/helper/finder/transfer.rb +12 -0
- data/lib/awspec/helper/finder/vpc.rb +12 -6
- data/lib/awspec/helper/finder/vpc_endpoints.rb +18 -1
- data/lib/awspec/helper/finder/waf.rb +5 -0
- data/lib/awspec/helper/finder/wafregional.rb +5 -0
- data/lib/awspec/helper/finder.rb +7 -2
- data/lib/awspec/helper/states.rb +4 -2
- data/lib/awspec/helper/type.rb +9 -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 +2 -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 +2 -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 +2 -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 +2 -0
- 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 +2 -0
- 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 +2 -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 +2 -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 +3 -1
- data/lib/awspec/stub/sns_topic_error.rb +6 -2
- 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/transfer_server.rb +41 -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 +2 -0
- 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 +4 -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 +5 -1
- 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 +6 -3
- 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/transfer_server.rb +28 -0
- data/lib/awspec/type/transit_gateway.rb +2 -0
- data/lib/awspec/type/vpc.rb +7 -3
- data/lib/awspec/type/vpc_endpoints.rb +10 -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 +35 -16
data/lib/awspec/type/kms.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class Kms < ResourceBase
|
3
5
|
def resource_via_client
|
@@ -15,6 +17,7 @@ module Awspec::Type
|
|
15
17
|
def has_key_policy?(policy_name, document = nil)
|
16
18
|
res = kms_client.get_key_policy(key_id: id, policy_name: policy_name)
|
17
19
|
return JSON.parse(URI.decode_www_form_component(res.policy)) == JSON.parse(document) if document
|
20
|
+
|
18
21
|
res
|
19
22
|
end
|
20
23
|
end
|
data/lib/awspec/type/lambda.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class LaunchConfiguration < ResourceBase
|
3
5
|
def resource_via_client
|
@@ -14,6 +16,7 @@ module Awspec::Type
|
|
14
16
|
sg == sg_id
|
15
17
|
end
|
16
18
|
return true if ret
|
19
|
+
|
17
20
|
sg2 = find_security_group(sg_id)
|
18
21
|
sgs.find do |sg|
|
19
22
|
sg == sg2.group_id
|
data/lib/awspec/type/mq.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class Mq < ResourceBase
|
3
5
|
def resource_via_client
|
@@ -8,13 +10,13 @@ module Awspec::Type
|
|
8
10
|
@id ||= resource_via_client.broker_id if resource_via_client
|
9
11
|
end
|
10
12
|
|
11
|
-
STATES = %w
|
13
|
+
STATES = %w[
|
12
14
|
running reboot-in-progress creation-in-progress
|
13
15
|
creation-failed deletion-in-progress
|
14
|
-
|
16
|
+
]
|
15
17
|
|
16
18
|
STATES.each do |state|
|
17
|
-
define_method state.tr('-', '_')
|
19
|
+
define_method "#{state.tr('-', '_')}?" do
|
18
20
|
resource_via_client.broker_state.downcase == state
|
19
21
|
end
|
20
22
|
end
|
@@ -44,6 +46,7 @@ module Awspec::Type
|
|
44
46
|
res = select_security_group_by_group_name([sg_id])
|
45
47
|
|
46
48
|
return false unless res.count == 1
|
49
|
+
|
47
50
|
has_vpc_security_group_id?(res.first.group_id)
|
48
51
|
end
|
49
52
|
|
@@ -51,6 +54,7 @@ module Awspec::Type
|
|
51
54
|
res = select_security_group_by_tag_name([sg_id])
|
52
55
|
|
53
56
|
return false unless res.count == 1
|
57
|
+
|
54
58
|
has_vpc_security_group_id?(res.first.group_id)
|
55
59
|
end
|
56
60
|
end
|
data/lib/awspec/type/msk.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class Msk < ResourceBase
|
3
5
|
def initialize(name)
|
@@ -13,13 +15,13 @@ module Awspec::Type
|
|
13
15
|
@id ||= resource_via_client.cluster_arn if resource_via_client
|
14
16
|
end
|
15
17
|
|
16
|
-
STATES = %w
|
18
|
+
STATES = %w[
|
17
19
|
active creating updating
|
18
20
|
deleting failed
|
19
|
-
|
21
|
+
]
|
20
22
|
|
21
23
|
STATES.each do |state|
|
22
|
-
define_method state
|
24
|
+
define_method "#{state}?" do
|
23
25
|
resource_via_client.state == state.upcase
|
24
26
|
end
|
25
27
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class NatGateway < ResourceBase
|
3
5
|
tags_allowed
|
@@ -10,12 +12,12 @@ module Awspec::Type
|
|
10
12
|
@id ||= resource_via_client.nat_gateway_id if resource_via_client
|
11
13
|
end
|
12
14
|
|
13
|
-
STATES = %w
|
15
|
+
STATES = %w[
|
14
16
|
pending failed available deleting deleted
|
15
|
-
|
17
|
+
]
|
16
18
|
|
17
19
|
STATES.each do |state|
|
18
|
-
define_method state.tr('-', '_')
|
20
|
+
define_method "#{state.tr('-', '_')}?" do
|
19
21
|
resource_via_client.state == state
|
20
22
|
end
|
21
23
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class NetworkAcl < ResourceBase
|
3
5
|
aws_resource Aws::EC2::NetworkAcl
|
@@ -14,8 +16,10 @@ module Awspec::Type
|
|
14
16
|
def has_subnet?(subnet_id)
|
15
17
|
resource_via_client.associations.find do |a|
|
16
18
|
next true if a.subnet_id == subnet_id
|
19
|
+
|
17
20
|
subnet = find_subnet(subnet_id)
|
18
21
|
next false unless subnet
|
22
|
+
|
19
23
|
next a.subnet_id == subnet.subnet_id
|
20
24
|
end
|
21
25
|
end
|
@@ -52,7 +56,7 @@ module Awspec::Type
|
|
52
56
|
end
|
53
57
|
end
|
54
58
|
|
55
|
-
# rubocop:disable
|
59
|
+
# rubocop:disable Layout/LineLength
|
56
60
|
PROTOCOLS = { 'ALL' => -1, 'HOPOPT' => 0, 'ICMP' => 1, 'IGMP' => 2, 'GGP' => 3, 'IPv4' => 4, 'ST' => 5, 'TCP' => 6, 'CBT' => 7, 'EGP' => 8, 'IGP' => 9, 'BBN-RCC-MON' => 10,
|
57
61
|
'NVP-II' => 11, 'PUP' => 12, 'ARGUS' => 13, 'EMCON' => 14, 'XNET' => 15, 'CHAOS' => 16, 'UDP' => 17, 'MUX' => 18, 'DCN-MEAS' => 19, 'HMP' => 20,
|
58
62
|
'PRM' => 21, 'XNS-IDP' => 22, 'TRUNK-1' => 23, 'TRUNK-2' => 24, 'LEAF-1' => 25, 'LEAF-2' => 26, 'RDP' => 27, 'IRTP' => 28, 'ISO-TP4' => 29, 'NETBLT' => 30,
|
@@ -68,7 +72,7 @@ module Awspec::Type
|
|
68
72
|
'SMP' => 121, 'SM' => 122, 'PTP' => 123, 'ISIS over IPv4' => 124, 'FIRE' => 125, 'CRTP' => 126, 'CRUDP' => 127, 'SSCOPMCE' => 128, 'IPLT' => 129, 'SPS' => 130,
|
69
73
|
'PIPE' => 131, 'SCTP' => 132, 'FC' => 133, 'RSVP-E2E-IGNORE' => 134, 'Mobility Header' => 135, 'UDPLite' => 136, 'MPLS-in-IP' => 137, 'manet' => 138, 'HIP' => 139, 'Shim6' => 140,
|
70
74
|
'WESP' => 141, 'ROHC' => 142, '253' => 253, '254' => 254 }
|
71
|
-
# rubocop:enable
|
75
|
+
# rubocop:enable Layout/LineLength
|
72
76
|
|
73
77
|
private
|
74
78
|
|
@@ -77,15 +81,18 @@ module Awspec::Type
|
|
77
81
|
# egress rule_action
|
78
82
|
next false if entry.egress != @egress
|
79
83
|
next false if entry.rule_action != rule_action
|
84
|
+
|
80
85
|
# protocol
|
81
86
|
unless protocol.nil?
|
82
87
|
next false unless protocol_match?(protocol, entry.protocol)
|
83
88
|
end
|
84
89
|
# cidr
|
85
90
|
next false if !cidr.nil? && entry.cidr_block != cidr
|
91
|
+
|
86
92
|
# rule_number
|
87
93
|
rule_number = 32_767 if rule_number == '*'
|
88
94
|
next false if !rule_number.nil? && entry.rule_number != rule_number
|
95
|
+
|
89
96
|
# port
|
90
97
|
unless entry.port_range.nil?
|
91
98
|
next false unless port_between?(port, entry.port_range.from, entry.port_range.to)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class NetworkInterface < ResourceBase
|
3
5
|
tags_allowed
|
@@ -10,12 +12,12 @@ module Awspec::Type
|
|
10
12
|
@id ||= resource_via_client.network_interface_id if resource_via_client
|
11
13
|
end
|
12
14
|
|
13
|
-
STATES = %w
|
15
|
+
STATES = %w[
|
14
16
|
available attaching in-use detaching
|
15
|
-
|
17
|
+
]
|
16
18
|
|
17
19
|
STATES.each do |state|
|
18
|
-
define_method state.tr('-', '_')
|
20
|
+
define_method "#{state.tr('-', '_')}?" do
|
19
21
|
resource_via_client.status == state
|
20
22
|
end
|
21
23
|
end
|
@@ -25,6 +27,7 @@ module Awspec::Type
|
|
25
27
|
return false unless instance
|
26
28
|
return false unless resource_via_client.attachment
|
27
29
|
return false if device_index && resource_via_client.attachment.device_index != device_index
|
30
|
+
|
28
31
|
resource_via_client.attachment.instance_id == instance.instance_id && \
|
29
32
|
resource_via_client.attachment.status == 'attached'
|
30
33
|
end
|
@@ -32,6 +35,7 @@ module Awspec::Type
|
|
32
35
|
def has_private_ip_address?(ip_address, primary = nil)
|
33
36
|
resource_via_client.private_ip_addresses.find do |i|
|
34
37
|
next false if !primary.nil? && i.primary != primary
|
38
|
+
|
35
39
|
i.private_ip_address == ip_address
|
36
40
|
end
|
37
41
|
end
|
@@ -42,8 +46,10 @@ module Awspec::Type
|
|
42
46
|
sg.group_id == sg_id || sg.group_name == sg_id
|
43
47
|
end
|
44
48
|
return true if ret
|
49
|
+
|
45
50
|
sg2 = find_security_group(sg_id)
|
46
51
|
return false unless sg2.tag_name == sg_id
|
52
|
+
|
47
53
|
sgs.find do |sg|
|
48
54
|
sg.group_id == sg2.group_id
|
49
55
|
end
|
data/lib/awspec/type/nlb.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class Nlb < ResourceBase
|
3
5
|
def resource_via_client
|
@@ -8,12 +10,12 @@ module Awspec::Type
|
|
8
10
|
@id ||= resource_via_client.load_balancer_name if resource_via_client
|
9
11
|
end
|
10
12
|
|
11
|
-
STATES = %w
|
13
|
+
STATES = %w[
|
12
14
|
active provisioning failed
|
13
|
-
|
15
|
+
]
|
14
16
|
|
15
17
|
STATES.each do |state|
|
16
|
-
define_method state
|
18
|
+
define_method "#{state}?" do
|
17
19
|
resource_via_client.state.code == state
|
18
20
|
end
|
19
21
|
end
|
@@ -28,6 +30,7 @@ module Awspec::Type
|
|
28
30
|
az.subnet_id == subnet_id
|
29
31
|
end
|
30
32
|
return true if ret
|
33
|
+
|
31
34
|
subnet2 = find_subnet(subnet_id)
|
32
35
|
subnet2.subnet_id = subnet_id
|
33
36
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class NlbListener < ResourceBase
|
3
5
|
def resource_via_client
|
@@ -15,11 +17,13 @@ module Awspec::Type
|
|
15
17
|
actions = [actions] if actions.is_a?(Hash)
|
16
18
|
next false if !rule_id.nil? && rule.rule_arn != rule_id
|
17
19
|
next false if !priority.nil? && rule.priority != priority
|
20
|
+
|
18
21
|
unless conditions.nil?
|
19
22
|
next false unless conditions.map do |condition|
|
20
23
|
rule_conds = rule.conditions.select { |rule_cond| rule_cond[:field] == condition[:field] }
|
21
24
|
next if rule_conds.empty?
|
22
25
|
next unless rule_conds.reject { |rule_cond| condition[:values] == rule_cond[:values] }.empty?
|
26
|
+
|
23
27
|
condition
|
24
28
|
end.compact.size == conditions.size
|
25
29
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class NlbTargetGroup < ResourceBase
|
3
5
|
def resource_via_client
|
@@ -11,6 +13,7 @@ module Awspec::Type
|
|
11
13
|
def has_ec2?(id)
|
12
14
|
ec2 = find_ec2(id)
|
13
15
|
return nil unless ec2
|
16
|
+
|
14
17
|
descriptions = elbv2_client.describe_target_health(
|
15
18
|
target_group_arn: resource_via_client.target_group_arn
|
16
19
|
).target_health_descriptions
|
data/lib/awspec/type/rds.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class Rds < ResourceBase
|
3
5
|
aws_resource Aws::RDS::DBInstance
|
@@ -10,7 +12,7 @@ module Awspec::Type
|
|
10
12
|
@id ||= resource_via_client.db_instance_identifier if resource_via_client
|
11
13
|
end
|
12
14
|
|
13
|
-
STATES = %w
|
15
|
+
STATES = %w[
|
14
16
|
available backing-up creating deleting
|
15
17
|
failed inaccessible-encryption-credentials
|
16
18
|
incompatible-credentials incompatible-network
|
@@ -18,10 +20,10 @@ module Awspec::Type
|
|
18
20
|
incompatible-restore maintenance
|
19
21
|
modifying rebooting renaming resetting-master-credentials
|
20
22
|
restore-error storage-full upgrading
|
21
|
-
|
23
|
+
]
|
22
24
|
|
23
25
|
STATES.each do |state|
|
24
|
-
define_method state.tr('-', '_')
|
26
|
+
define_method "#{state.tr('-', '_')}?" do
|
25
27
|
resource_via_client.db_instance_status == state
|
26
28
|
end
|
27
29
|
end
|
@@ -83,6 +85,7 @@ module Awspec::Type
|
|
83
85
|
filters: [{ name: 'group-name', values: [sg_id] }]
|
84
86
|
})
|
85
87
|
return false unless res.security_groups.count == 1
|
88
|
+
|
86
89
|
sgs.find do |sg|
|
87
90
|
sg.vpc_security_group_id == res.security_groups.first.group_id
|
88
91
|
end
|
@@ -94,6 +97,7 @@ module Awspec::Type
|
|
94
97
|
filters: [{ name: 'tag:Name', values: [sg_id] }]
|
95
98
|
})
|
96
99
|
return false unless res.security_groups.count == 1
|
100
|
+
|
97
101
|
sgs.find do |sg|
|
98
102
|
sg.vpc_security_group_id == res.security_groups.first.group_id
|
99
103
|
end
|
@@ -1,7 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class RdsDbClusterParameterGroup < ResourceBase
|
3
5
|
def resource_via_client
|
4
6
|
return @resource_via_client if @resource_via_client
|
7
|
+
|
5
8
|
@resource_via_client ||= select_all_rds_db_cluster_parameters(@display_name)
|
6
9
|
end
|
7
10
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class InvalidRdsDbParameter < StandardError
|
3
5
|
##
|
@@ -24,12 +26,13 @@ module Awspec::Type
|
|
24
26
|
end
|
25
27
|
|
26
28
|
def to_s
|
27
|
-
|
29
|
+
"RdsDBParameters = #{@params}"
|
28
30
|
end
|
29
31
|
|
30
32
|
def method_missing(name)
|
31
33
|
param_name = name.to_sym
|
32
34
|
return @params[param_name] if @params.include?(param_name)
|
35
|
+
|
33
36
|
raise InvalidRdsDbParameter, name
|
34
37
|
end
|
35
38
|
end
|
@@ -37,6 +40,7 @@ module Awspec::Type
|
|
37
40
|
class RdsDbParameterGroup < ResourceBase
|
38
41
|
def resource_via_client
|
39
42
|
return @resource_via_client if @resource_via_client
|
43
|
+
|
40
44
|
@resource_via_client ||= select_all_rds_db_parameters(@display_name)
|
41
45
|
end
|
42
46
|
|
data/lib/awspec/type/redshift.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class Redshift < ResourceBase
|
3
5
|
def resource_via_client
|
@@ -8,16 +10,16 @@ module Awspec::Type
|
|
8
10
|
@id ||= resource_via_client.cluster_identifier if resource_via_client
|
9
11
|
end
|
10
12
|
|
11
|
-
STATES = %w
|
13
|
+
STATES = %w[
|
12
14
|
available cancelling-resize creating deleting
|
13
15
|
final-snapshot hardware-failure incompatible-hsm
|
14
16
|
incompatible-network incompatible-parameters incompatible-restore
|
15
17
|
modifying rebooting renaming resizing rotating-keys
|
16
18
|
storage-full updating-hsm
|
17
|
-
|
19
|
+
]
|
18
20
|
|
19
21
|
STATES.each do |state|
|
20
|
-
define_method state.tr('-', '_')
|
22
|
+
define_method "#{state.tr('-', '_')}?" do
|
21
23
|
resource_via_client.cluster_status == state
|
22
24
|
end
|
23
25
|
end
|
@@ -62,6 +64,7 @@ module Awspec::Type
|
|
62
64
|
filters: [{ name: 'group-name', values: [sg_id] }]
|
63
65
|
})
|
64
66
|
return false unless res.security_groups.count == 1
|
67
|
+
|
65
68
|
sgs.find do |sg|
|
66
69
|
sg.vpc_security_group_id == res.security_groups.first.group_id
|
67
70
|
end
|
@@ -73,6 +76,7 @@ module Awspec::Type
|
|
73
76
|
filters: [{ name: 'tag:Name', values: [sg_id] }]
|
74
77
|
})
|
75
78
|
return false unless res.security_groups.count == 1
|
79
|
+
|
76
80
|
sgs.find do |sg|
|
77
81
|
sg.vpc_security_group_id == res.security_groups.first.group_id
|
78
82
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class Route53HostedZone < ResourceBase
|
3
5
|
def resource_via_client
|
@@ -28,6 +30,7 @@ module Awspec::Type
|
|
28
30
|
|
29
31
|
record_sets.each do |record_set|
|
30
32
|
return match_record(record_set, name, value, options) unless record_set.resource_records.empty?
|
33
|
+
|
31
34
|
return match_alias_record(record_set, name, options)
|
32
35
|
end
|
33
36
|
end
|
@@ -37,8 +40,10 @@ module Awspec::Type
|
|
37
40
|
def match_failover_record(record_sets, name, value, options)
|
38
41
|
record_sets.select! { |record_set| record_set.failover == options[:record_type] }
|
39
42
|
return false if record_sets.empty?
|
43
|
+
|
40
44
|
record_sets.each do |record_set|
|
41
45
|
return match_alias_record(record_set, name, options) if value.nil?
|
46
|
+
|
42
47
|
return match_record(record_set, name, value, options)
|
43
48
|
end
|
44
49
|
end
|
@@ -58,8 +63,8 @@ module Awspec::Type
|
|
58
63
|
|
59
64
|
def match_alias_record(record_set, name, options)
|
60
65
|
record_set.name == name && \
|
61
|
-
|
62
|
-
|
66
|
+
record_set.alias_target.dns_name == options[:alias_dns_name] && \
|
67
|
+
record_set.alias_target.hosted_zone_id == options[:alias_hosted_zone_id]
|
63
68
|
end
|
64
69
|
end
|
65
70
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class RouteTable < ResourceBase
|
3
5
|
aws_resource Aws::EC2::RouteTable
|
@@ -30,6 +32,7 @@ module Awspec::Type
|
|
30
32
|
def has_subnet?(subnet_id)
|
31
33
|
subnet = find_subnet(subnet_id)
|
32
34
|
return false unless subnet
|
35
|
+
|
33
36
|
resource_via_client.associations.find do |a|
|
34
37
|
a.subnet_id == subnet.subnet_id
|
35
38
|
end
|
@@ -44,26 +47,33 @@ module Awspec::Type
|
|
44
47
|
def target_gateway?(route, gateway_id)
|
45
48
|
# * gateway
|
46
49
|
return true if route.gateway_id == gateway_id
|
50
|
+
|
47
51
|
# internet gateway
|
48
52
|
igw = find_internet_gateway(gateway_id)
|
49
53
|
return true if igw && igw.internet_gateway_id == route.gateway_id
|
54
|
+
|
50
55
|
# vpn gateway
|
51
56
|
vgw = find_vpn_gateway(gateway_id)
|
52
57
|
return true if vgw && vgw.vpn_gateway_id == route.gateway_id
|
58
|
+
|
53
59
|
# customer gateway
|
54
60
|
cgw = find_customer_gateway(gateway_id)
|
55
61
|
return true if cgw && cgw.customer_gateway_id == route.gateway_id
|
62
|
+
|
56
63
|
# nat gateway
|
57
64
|
nat = find_nat_gateway(gateway_id)
|
58
65
|
return true if nat.nat_gateway_id == route.nat_gateway_id
|
66
|
+
|
59
67
|
false
|
60
68
|
end
|
61
69
|
|
62
70
|
def target_instance?(route, instance_id)
|
63
71
|
# instance
|
64
72
|
return true if route.instance_id == instance_id
|
73
|
+
|
65
74
|
instance = find_ec2(instance_id)
|
66
75
|
return true if instance && instance.instance_id == route.instance_id
|
76
|
+
|
67
77
|
false
|
68
78
|
end
|
69
79
|
|
@@ -76,8 +86,10 @@ module Awspec::Type
|
|
76
86
|
def target_vpc_peering_connection?(route, vpc_peering_connection_id)
|
77
87
|
# vpc_peering_connection_id
|
78
88
|
return true if route.vpc_peering_connection_id == vpc_peering_connection_id
|
89
|
+
|
79
90
|
connection = find_vpc_peering_connection(vpc_peering_connection_id)
|
80
91
|
return true if connection && connection.vpc_peering_connection_id == route.vpc_peering_connection_id
|
92
|
+
|
81
93
|
false
|
82
94
|
end
|
83
95
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
class S3Bucket < ResourceBase
|
3
5
|
aws_resource Aws::S3::Bucket
|
@@ -41,9 +43,7 @@ module Awspec::Type
|
|
41
43
|
@acl.grants.count
|
42
44
|
end
|
43
45
|
|
44
|
-
def has_cors_rule?(allowed_headers: [],
|
45
|
-
allowed_methods:,
|
46
|
-
allowed_origins:,
|
46
|
+
def has_cors_rule?(allowed_methods:, allowed_origins:, allowed_headers: [],
|
47
47
|
expose_headers: [],
|
48
48
|
max_age_seconds: nil)
|
49
49
|
cors_rules.any? do |rule|
|
@@ -74,6 +74,7 @@ module Awspec::Type
|
|
74
74
|
check_existence
|
75
75
|
tag = find_bucket_tag(id, key)
|
76
76
|
return nil if tag.value != value
|
77
|
+
|
77
78
|
tag
|
78
79
|
end
|
79
80
|
|
@@ -85,6 +86,7 @@ module Awspec::Type
|
|
85
86
|
return false if le.nil?
|
86
87
|
return false if target_bucket && target_bucket != le.target_bucket
|
87
88
|
return false if target_prefix && target_prefix != le.target_prefix
|
89
|
+
|
88
90
|
true
|
89
91
|
end
|
90
92
|
|
@@ -102,6 +104,7 @@ module Awspec::Type
|
|
102
104
|
rule.all? do |key, value|
|
103
105
|
lc_rule.each do |r|
|
104
106
|
return false if value.is_a?(String) && r[key] != value
|
107
|
+
|
105
108
|
if value.is_a?(Hash)
|
106
109
|
return false if r[key].to_h != value
|
107
110
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Type
|
2
4
|
# rubocop:disable Metrics/ClassLength
|
3
5
|
class SecurityGroup < ResourceBase
|
@@ -14,11 +16,13 @@ module Awspec::Type
|
|
14
16
|
|
15
17
|
def opened?(port = nil, protocol = nil, cidr = nil)
|
16
18
|
return inbound_opened?(port, protocol, cidr) if @inbound
|
19
|
+
|
17
20
|
outbound_opened?(port, protocol, cidr)
|
18
21
|
end
|
19
22
|
|
20
23
|
def opened_only?(port = nil, protocol = nil, cidr = nil)
|
21
24
|
return inbound_opened_only?(port, protocol, cidr) if @inbound
|
25
|
+
|
22
26
|
outbound_opened_only?(port, protocol, cidr)
|
23
27
|
end
|
24
28
|
|
@@ -69,12 +73,12 @@ module Awspec::Type
|
|
69
73
|
def ip_permissions_count
|
70
74
|
resource_via_client.ip_permissions.count
|
71
75
|
end
|
72
|
-
|
76
|
+
alias inbound_permissions_count ip_permissions_count
|
73
77
|
|
74
78
|
def ip_permissions_egress_count
|
75
79
|
resource_via_client.ip_permissions_egress.count
|
76
80
|
end
|
77
|
-
|
81
|
+
alias outbound_permissions_count ip_permissions_egress_count
|
78
82
|
|
79
83
|
def has_inbound_rule?(rule)
|
80
84
|
resource_via_client.ip_permissions.find do |permission|
|
@@ -104,10 +108,12 @@ module Awspec::Type
|
|
104
108
|
|
105
109
|
def cidr_opened?(permission, cidr)
|
106
110
|
return true unless cidr
|
111
|
+
|
107
112
|
ret = permission.prefix_list_ids.select do |prefix_list_id|
|
108
113
|
prefix_list_id.prefix_list_id == cidr
|
109
114
|
end
|
110
115
|
return true if ret.count > 0
|
116
|
+
|
111
117
|
ret = permission.ip_ranges.select do |ip_range|
|
112
118
|
# if the cidr is an IP address then do a true CIDR match
|
113
119
|
if cidr =~ /^\d+\.\d+\.\d+\.\d+/
|
@@ -118,6 +124,7 @@ module Awspec::Type
|
|
118
124
|
end
|
119
125
|
end
|
120
126
|
return true if ret.count > 0
|
127
|
+
|
121
128
|
ret = permission.user_id_group_pairs.select do |sg|
|
122
129
|
# Compare the sg group_name if the remote group is in another account.
|
123
130
|
# find_security_group call doesn't return info on a remote security group.
|
@@ -125,9 +132,11 @@ module Awspec::Type
|
|
125
132
|
next (sg.group_name == cidr) || (sg.group_id == cidr)
|
126
133
|
end
|
127
134
|
next true if sg.group_id == cidr
|
135
|
+
|
128
136
|
sg2 = find_security_group(sg.group_id)
|
129
137
|
next false if sg2.nil?
|
130
138
|
next true if sg2.group_name == cidr
|
139
|
+
|
131
140
|
sg2.tags.find do |tag|
|
132
141
|
tag.key == 'Name' && tag.value == cidr
|
133
142
|
end
|
@@ -139,6 +148,7 @@ module Awspec::Type
|
|
139
148
|
return true unless protocol
|
140
149
|
return false if protocol == 'all' && permission.ip_protocol != '-1'
|
141
150
|
return true if permission.ip_protocol == '-1'
|
151
|
+
|
142
152
|
permission.ip_protocol == protocol
|
143
153
|
end
|
144
154
|
|
@@ -146,6 +156,7 @@ module Awspec::Type
|
|
146
156
|
return true unless port
|
147
157
|
return true unless permission.from_port
|
148
158
|
return true unless permission.to_port
|
159
|
+
|
149
160
|
port_between?(port, permission.from_port, permission.to_port)
|
150
161
|
end
|
151
162
|
|
@@ -185,6 +196,7 @@ module Awspec::Type
|
|
185
196
|
actual_pair.vpc_peering_connection_id == rule_pair[:vpc_peering_connection_id] ||
|
186
197
|
rule_pair[:vpc_peering_connection_id].nil?
|
187
198
|
return false unless actual_pair.peering_status == rule_pair[:peering_status] || rule_pair[:peering_status].nil?
|
199
|
+
|
188
200
|
true
|
189
201
|
end
|
190
202
|
end
|