From 3fa020a56ca22eb6bd0211bfc65a9d4ff0c566e5 Mon Sep 17 00:00:00 2001 From: Amndeep Singh Mann Date: Fri, 23 Jun 2023 14:50:37 -0400 Subject: [PATCH 01/15] added the iam credential report as a resource Signed-off-by: Amndeep Singh Mann --- libraries/aws_iam_credential_report.rb | 74 ++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 libraries/aws_iam_credential_report.rb diff --git a/libraries/aws_iam_credential_report.rb b/libraries/aws_iam_credential_report.rb new file mode 100644 index 000000000..22c2b0f4e --- /dev/null +++ b/libraries/aws_iam_credential_report.rb @@ -0,0 +1,74 @@ +require "csv" +require "aws_backend" + +class AwsIamCredentialReport < AwsCollectionResourceBase + name "aws_iam_credential_report" + desc "Lists all users in the AWS account and the status of their credentials." + + example " + describe aws_iam_credential_report.where(mfa_active: false) do + it { should_not exist } + end + " + + attr_reader :table + + FilterTable.create + .register_column(:user, field: :user) + .register_column(:arn, field: :arn) + .register_column(:user_creation_time, field: :user_creation_time) + .register_column(:password_enabled, field: :password_enabled) + .register_column(:password_last_used, field: :password_last_used) + .register_column(:password_last_changed, field: :password_last_changed) + .register_column(:password_next_rotation, field: :password_next_rotation) + .register_column(:mfa_active, field: :mfa_active) + .register_column(:access_key_1_active, field: :access_key_1_active) + .register_column(:access_key_1_last_rotated, field: :access_key_1_last_rotated) + .register_column(:access_key_1_last_used_date, field: :access_key_1_last_used_date) + .register_column(:access_key_1_last_used_region, field: :access_key_1_last_used_region) + .register_column(:access_key_1_last_used_service, field: :access_key_1_last_used_service) + .register_column(:access_key_2_active, field: :access_key_2_active) + .register_column(:access_key_2_last_rotated, field: :access_key_2_last_rotated) + .register_column(:access_key_2_last_used_date, field: :access_key_2_last_used_date) + .register_column(:access_key_2_last_used_region, field: :access_key_2_last_used_region) + .register_column(:access_key_2_last_used_service, field: :access_key_2_last_used_service) + .register_column(:cert_1_active, field: :cert_1_active) + .register_column(:cert_1_last_rotated, field: :cert_1_last_rotated) + .register_column(:cert_2_active, field: :cert_2_active) + .register_column(:cert_2_last_rotated, field: :cert_2_last_rotated) + .install_filter_methods_on_resource(self, :table) + + def initialize(opts = {}) + super(opts) + validate_parameters + @table = fetch_data + pp ["table", @table] + end + + def to_s + "IAM Credential Report" + end + + private + + def fetch_data + catch_aws_errors do + @aws.iam_client.generate_credential_report + begin + attempts ||= 0 + response = @aws.iam_client.get_credential_report + rescue Aws::IAM::Errors::ReportInProgress => e + if (attempts += 1) <= 5 + Inspec::Log.warn "AWS IAM Credential Report still being generated - attempt #{attempts}/5." + sleep 5 + retry + else + Inspec::Log.warn "AWS IAM Credential Report was not generated quickly enough." + raise e + end + end + report = CSV.parse(response.content, headers: true, header_converters: :symbol, converters: [:date_time, -> field { field == 'true' ? true : field == 'false' ? false : field }]) + report.map(&:to_h) + end + end +end From db1b67982c458e42c1f8c039a87cee5bd534dfde Mon Sep 17 00:00:00 2001 From: Amndeep Singh Mann Date: Fri, 23 Jun 2023 14:51:31 -0400 Subject: [PATCH 02/15] wip addition of the account as a resource Signed-off-by: Amndeep Singh Mann --- libraries/aws_account.rb | 72 ++++++++++++++++++++++++++++++++++++++++ libraries/aws_backend.rb | 5 +++ 2 files changed, 77 insertions(+) create mode 100644 libraries/aws_account.rb diff --git a/libraries/aws_account.rb b/libraries/aws_account.rb new file mode 100644 index 000000000..792066522 --- /dev/null +++ b/libraries/aws_account.rb @@ -0,0 +1,72 @@ +require "aws_backend" + +class AwsAccount < AwsResourceBase + name "aws_account" + desc "Verifies settings for an AWS IAM Access Key." + example " + describe aws_account.contact_information do + its('phone_number') { should eq '123-456-7890' } + end + " + + attr_reader :contact_information, :billing_contact_information, :operations_contact_information, :security_contact_information + + def initialize(opts = {}) + super(opts) + + catch_aws_errors do + query = {} + query[:user_name] = @username if @username + + resp = @aws.iam_client.list_access_keys(query) + + # Get all keys for the provided user. If no user provided, use current principal. + # If an `access_key_id` has been provided, get only that key. + access_keys = resp.access_key_metadata.select do |key| + if access_key_id + key.access_key_id == access_key_id + else + true + end + end + + return if access_keys.empty? + if access_keys.count > 1 + raise 'Request returned more than 1 key. Please scope by `access_key_id` to find one key \ + or consider using the `aws_iam_access_keys` plural resource for multiple keys.' + end + + @access_key_id = access_keys[0].access_key_id + @username = access_keys[0].user_name + @create_date = access_keys[0].create_date + @status = access_keys[0].status + end + end + + def resource_id + @access_key_id + end + + def active? + return nil unless exists? + status == "Active" + end + + def exists? + !@create_date.nil? + end + + def to_s + "AWS IAM Access Key #{@access_key_id} for User #{@username}" + end + + def last_used_date + return nil unless exists? + return @last_used_date if defined? @last_used_date + catch_aws_errors do + @last_used_date = @aws.iam_client.get_access_key_last_used({ access_key_id: @access_key_id }) + .access_key_last_used + .last_used_date + end + end +end diff --git a/libraries/aws_backend.rb b/libraries/aws_backend.rb index fb31dd227..e7a9c8172 100644 --- a/libraries/aws_backend.rb +++ b/libraries/aws_backend.rb @@ -61,6 +61,7 @@ require "aws-sdk-waf" require "aws-sdk-synthetics" require "aws-sdk-apigatewayv2" +require "aws-sdk-account" # AWS Inspec Backend Classes # @@ -337,6 +338,10 @@ def synthetics_client def apigatewayv2_client aws_client(Aws::ApiGatewayV2::Client) end + + def account_client + aws_client(Aws::Account::Client) + end end # Base class for AWS resources From 3b9614dc269a9eaa8e673511ab507a242470e4db Mon Sep 17 00:00:00 2001 From: Amndeep Singh Mann Date: Sun, 25 Jun 2023 21:16:30 -0400 Subject: [PATCH 03/15] implemented aws account resource Signed-off-by: Amndeep Singh Mann --- Gemfile | 3 ++ libraries/aws_account.rb | 70 +++++++++++++--------------------------- 2 files changed, 26 insertions(+), 47 deletions(-) diff --git a/Gemfile b/Gemfile index fee6f685c..4ce46d1ff 100644 --- a/Gemfile +++ b/Gemfile @@ -10,6 +10,9 @@ gem 'bundle' # Note if the gem required is commented out, please raise a PR against the train-aws repo first # In the mean time the gem can be added here for local development +# TODO: remove when https://github.com/inspec/train-aws/pull/457 is merged +gem 'aws-sdk-account', '~> 1.14' + # Use Latest Inspec gem 'inspec-bin' diff --git a/libraries/aws_account.rb b/libraries/aws_account.rb index 792066522..16dc56015 100644 --- a/libraries/aws_account.rb +++ b/libraries/aws_account.rb @@ -2,71 +2,47 @@ class AwsAccount < AwsResourceBase name "aws_account" - desc "Verifies settings for an AWS IAM Access Key." + desc "Verifies contact information for an AWS Account." example " + addr = { 'address_line_1' => '42 Wallaby Way', ... } describe aws_account.contact_information do - its('phone_number') { should eq '123-456-7890' } + it { should cmp addr } end " - attr_reader :contact_information, :billing_contact_information, :operations_contact_information, :security_contact_information - def initialize(opts = {}) super(opts) - - catch_aws_errors do - query = {} - query[:user_name] = @username if @username - - resp = @aws.iam_client.list_access_keys(query) - - # Get all keys for the provided user. If no user provided, use current principal. - # If an `access_key_id` has been provided, get only that key. - access_keys = resp.access_key_metadata.select do |key| - if access_key_id - key.access_key_id == access_key_id - else - true - end - end - - return if access_keys.empty? - if access_keys.count > 1 - raise 'Request returned more than 1 key. Please scope by `access_key_id` to find one key \ - or consider using the `aws_iam_access_keys` plural resource for multiple keys.' - end - - @access_key_id = access_keys[0].access_key_id - @username = access_keys[0].user_name - @create_date = access_keys[0].create_date - @status = access_keys[0].status - end end def resource_id - @access_key_id + "AWS Account Contact Information" end - def active? - return nil unless exists? - status == "Active" + def to_s + "AWS Account Contact Information" end - def exists? - !@create_date.nil? + def contact_information + @contact_information ||= catch_aws_errors do + @aws.account_client.get_contact_information.contact_information.to_h.transform_keys(&:to_s) + end end - def to_s - "AWS IAM Access Key #{@access_key_id} for User #{@username}" + def billing_contact_information + @billing_contact_information ||= catch_aws_errors do + @aws.account_client.get_alternate_contact("BILLING").alternate_contact.to_h.transform_keys(&:to_s) + end + end + + def operations_contact_information + @operations_contact_information ||= catch_aws_errors do + @aws.account_client.get_alternate_contact("OPERATIONS").alternate_contact.to_h.transform_keys(&:to_s) + end end - def last_used_date - return nil unless exists? - return @last_used_date if defined? @last_used_date - catch_aws_errors do - @last_used_date = @aws.iam_client.get_access_key_last_used({ access_key_id: @access_key_id }) - .access_key_last_used - .last_used_date + def security_contact_information + @security_contact_information ||= catch_aws_errors do + @aws.account_client.get_alternate_contact("SECURITY").alternate_contact.to_h.transform_keys(&:to_s) end end end From f34e9edd4babbc00d3d3dde3962710e2b7eedf74 Mon Sep 17 00:00:00 2001 From: Amndeep Singh Mann Date: Sun, 25 Jun 2023 21:33:25 -0400 Subject: [PATCH 04/15] pass arguments properly to the get_alternate_contact function Signed-off-by: Amndeep Singh Mann --- libraries/aws_account.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/aws_account.rb b/libraries/aws_account.rb index 16dc56015..fe769a6e4 100644 --- a/libraries/aws_account.rb +++ b/libraries/aws_account.rb @@ -30,19 +30,19 @@ def contact_information def billing_contact_information @billing_contact_information ||= catch_aws_errors do - @aws.account_client.get_alternate_contact("BILLING").alternate_contact.to_h.transform_keys(&:to_s) + @aws.account_client.get_alternate_contact({alternate_contact_type: "BILLING"}).alternate_contact.to_h.transform_keys(&:to_s) end end def operations_contact_information @operations_contact_information ||= catch_aws_errors do - @aws.account_client.get_alternate_contact("OPERATIONS").alternate_contact.to_h.transform_keys(&:to_s) + @aws.account_client.get_alternate_contact({alternate_contact_type: "OPERATIONS"}).alternate_contact.to_h.transform_keys(&:to_s) end end def security_contact_information @security_contact_information ||= catch_aws_errors do - @aws.account_client.get_alternate_contact("SECURITY").alternate_contact.to_h.transform_keys(&:to_s) + @aws.account_client.get_alternate_contact({alternate_contact_type: "SECURITY"}).alternate_contact.to_h.transform_keys(&:to_s) end end end From a09f972435bb82d2c2ead1fd43444f268a4552cb Mon Sep 17 00:00:00 2001 From: Amndeep Singh Mann Date: Thu, 29 Jun 2023 02:20:01 -0400 Subject: [PATCH 05/15] iam_access_keys - use correct function call for list_access_keys Signed-off-by: Amndeep Singh Mann --- libraries/aws_iam_access_keys.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/aws_iam_access_keys.rb b/libraries/aws_iam_access_keys.rb index ba4c4b441..cce375c64 100644 --- a/libraries/aws_iam_access_keys.rb +++ b/libraries/aws_iam_access_keys.rb @@ -83,7 +83,7 @@ def get_keys def fetch_keys(username) access_keys = catch_aws_errors do - iam_client.list_access_keys(user_name: username) + iam_client.list_access_keys({user_name: username}) rescue Aws::IAM::Errors::NoSuchEntity # Swallow - a miss on search results should return an empty table end From 821d3608d8599d42285322121225a7aa20c22b96 Mon Sep 17 00:00:00 2001 From: Amndeep Singh Mann Date: Thu, 29 Jun 2023 02:21:05 -0400 Subject: [PATCH 06/15] iam_access_keys - assign correct values to user_created_date Signed-off-by: Amndeep Singh Mann --- libraries/aws_iam_access_keys.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/aws_iam_access_keys.rb b/libraries/aws_iam_access_keys.rb index cce375c64..6b37e9ae8 100644 --- a/libraries/aws_iam_access_keys.rb +++ b/libraries/aws_iam_access_keys.rb @@ -96,7 +96,7 @@ def fetch_keys(username) access_key_hash[:inactive] = access_key_hash[:status] != "Active" access_key_hash[:created_hours_ago] = ((Time.now - access_key_hash[:create_date]) / (60*60)).to_i access_key_hash[:created_days_ago] = (access_key_hash[:created_hours_ago] / 24).to_i - access_key_hash[:user_created_date] = access_key_hash[:create_date] + access_key_hash[:user_created_date] = @_users.find {|user| user.user_name == access_key_hash[:username]}.create_date access_key_hash[:created_with_user] = (access_key_hash[:create_date] - access_key_hash[:user_created_date]).abs < 1.0/24.0 access_key_hash end From a558d8de4b9e873a9a38304c2d20e83dde60ee3d Mon Sep 17 00:00:00 2001 From: Amndeep Singh Mann Date: Thu, 29 Jun 2023 02:23:09 -0400 Subject: [PATCH 07/15] iam_access_keys - debugging + fixed last_used to stop using a global variable + made the ever/never funcs use ||= Signed-off-by: Amndeep Singh Mann --- libraries/aws_iam_access_keys.rb | 33 ++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/libraries/aws_iam_access_keys.rb b/libraries/aws_iam_access_keys.rb index 6b37e9ae8..47b047508 100644 --- a/libraries/aws_iam_access_keys.rb +++ b/libraries/aws_iam_access_keys.rb @@ -44,7 +44,10 @@ def to_s def fetch_data(username) @_users = get_users(username) + pp 'users', @_users @table = get_keys + pp 'table', @table + @table end # Get details of a single user, if provided. @@ -104,28 +107,40 @@ def fetch_keys(username) end def last_used(row, _condition, _table) - @last_used ||= catch_aws_errors do - iam_client.get_access_key_last_used(access_key_id: row[:access_key_id]) + pp 'row', row + a = catch_aws_errors do + iam_client.get_access_key_last_used({access_key_id: row[:access_key_id]}) .access_key_last_used end + pp 'last used', a + a end def lazy_load_last_used_date(row, condition, table) row[:last_used_date] ||= last_used(row, condition, table).last_used_date + pp 'row post last_used_date', row + row[:last_used_date] end - def lazy_load_ever_used(row, condition, table) - row[:ever_used] = !lazy_load_never_used_time(row, condition, table) + def lazy_load_never_used_time(row, condition, table) + row[:never_used] ||= lazy_load_last_used_date(row, condition, table).nil? + pp 'row post never_used', row + row[:never_used] end - def lazy_load_never_used_time(row, condition, table) - row[:never_used] = lazy_load_last_used_date(row, condition, table).nil? + def lazy_load_ever_used(row, condition, table) + row[:ever_used] ||= !lazy_load_never_used_time(row, condition, table) + pp 'row post ever_used', row + row[:ever_used] end def lazy_load_last_used_hours_ago(row, condition, table) return if lazy_load_never_used_time(row, condition, table) - row[:last_used_hours_ago] = ((Time.now - row[:last_used_date]) / (60*60)).to_i + pp 'math', Time.now, row[:last_used_date], Time.now - row[:last_used_date], ((Time.now - row[:last_used_date]) / (60*60)), ((Time.now - row[:last_used_date]) / (60*60)).to_i + row[:last_used_hours_ago] = ((Time.now - row[:last_used_date]) / (60*60)) #.to_i + pp 'row post last_used_hours_ago', row + row[:last_used_hours_ago] end def lazy_load_last_used_days_ago(row, condition, table) @@ -133,7 +148,9 @@ def lazy_load_last_used_days_ago(row, condition, table) if row[:last_used_hours_ago].nil? lazy_load_last_used_hours_ago(row, condition, table) end - row[:last_used_days_ago] = (row[:last_used_hours_ago]/24).to_i + row[:last_used_days_ago] = (row[:last_used_hours_ago]/24) #.to_i + pp 'row post last_used_days_ago', row + row[:last_used_days_ago] end def iam_client From 8161d70bf802e2d01d02419fdb9a3ceacc96e876 Mon Sep 17 00:00:00 2001 From: Amndeep Singh Mann Date: Thu, 6 Jul 2023 18:08:46 -0400 Subject: [PATCH 08/15] make sure to assign nil to attribute in row when it is nil Signed-off-by: Amndeep Singh Mann --- libraries/aws_iam_access_keys.rb | 28 +++++--------------------- libraries/aws_iam_credential_report.rb | 1 - 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/libraries/aws_iam_access_keys.rb b/libraries/aws_iam_access_keys.rb index 47b047508..fb04f6fe8 100644 --- a/libraries/aws_iam_access_keys.rb +++ b/libraries/aws_iam_access_keys.rb @@ -44,10 +44,7 @@ def to_s def fetch_data(username) @_users = get_users(username) - pp 'users', @_users @table = get_keys - pp 'table', @table - @table end # Get details of a single user, if provided. @@ -107,50 +104,35 @@ def fetch_keys(username) end def last_used(row, _condition, _table) - pp 'row', row - a = catch_aws_errors do + catch_aws_errors do iam_client.get_access_key_last_used({access_key_id: row[:access_key_id]}) .access_key_last_used end - pp 'last used', a - a end def lazy_load_last_used_date(row, condition, table) row[:last_used_date] ||= last_used(row, condition, table).last_used_date - pp 'row post last_used_date', row - row[:last_used_date] end def lazy_load_never_used_time(row, condition, table) row[:never_used] ||= lazy_load_last_used_date(row, condition, table).nil? - pp 'row post never_used', row - row[:never_used] end def lazy_load_ever_used(row, condition, table) row[:ever_used] ||= !lazy_load_never_used_time(row, condition, table) - pp 'row post ever_used', row - row[:ever_used] end def lazy_load_last_used_hours_ago(row, condition, table) - return if lazy_load_never_used_time(row, condition, table) - - pp 'math', Time.now, row[:last_used_date], Time.now - row[:last_used_date], ((Time.now - row[:last_used_date]) / (60*60)), ((Time.now - row[:last_used_date]) / (60*60)).to_i - row[:last_used_hours_ago] = ((Time.now - row[:last_used_date]) / (60*60)) #.to_i - pp 'row post last_used_hours_ago', row - row[:last_used_hours_ago] + return row[:last_used_hours_ago] = nil if lazy_load_never_used_time(row, condition, table) + row[:last_used_hours_ago] = ((Time.now - row[:last_used_date]) / (60*60)).to_i end def lazy_load_last_used_days_ago(row, condition, table) - return if lazy_load_never_used_time(row, condition, table) + return row[:last_used_days_ago] = nil if lazy_load_never_used_time(row, condition, table) if row[:last_used_hours_ago].nil? lazy_load_last_used_hours_ago(row, condition, table) end - row[:last_used_days_ago] = (row[:last_used_hours_ago]/24) #.to_i - pp 'row post last_used_days_ago', row - row[:last_used_days_ago] + row[:last_used_days_ago] = (row[:last_used_hours_ago]/24).to_i end def iam_client diff --git a/libraries/aws_iam_credential_report.rb b/libraries/aws_iam_credential_report.rb index 22c2b0f4e..66261e108 100644 --- a/libraries/aws_iam_credential_report.rb +++ b/libraries/aws_iam_credential_report.rb @@ -42,7 +42,6 @@ def initialize(opts = {}) super(opts) validate_parameters @table = fetch_data - pp ["table", @table] end def to_s From 64b9a70b69b2ec75289e5902e06e6213766986a6 Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Sat, 11 Nov 2023 13:06:17 -0500 Subject: [PATCH 09/15] adding new docs Signed-off-by: Aaron Lippold --- docs/resources/aws_cloudfront_distribution.md | 108 ++++++++++++++++++ .../resources/aws_cloudfront_distributions.md | 72 ++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 docs/resources/aws_cloudfront_distribution.md create mode 100644 docs/resources/aws_cloudfront_distributions.md diff --git a/docs/resources/aws_cloudfront_distribution.md b/docs/resources/aws_cloudfront_distribution.md new file mode 100644 index 000000000..59cd8688c --- /dev/null +++ b/docs/resources/aws_cloudfront_distribution.md @@ -0,0 +1,108 @@ +--- +title: About the aws_cloudfront_distribution Resource +platform: aws +--- + +# aws\_cloudfront\_distribution + +Use the `aws_cloudfront_distribution` InSpec audit resource to test properties of a single AWS CloudFront distribution. + +## Syntax + +Ensure that an `aws_cloudfront_distribution` exists: + + describe aws_cloudfront_distribution('DISTRIBUTION') do + it { should exist } + end + + describe aws_cloudfront_distribution(distribution_id: 'DISTRIBUTION') do + it { should exist } + end + +#### Parameters + +##### distribution\_id _(required)_ + +The ID of the CloudFront distribution. This can be passed either as a string or as a `name: 'value'` key-value entry in a hash. + +##### disallowed\_ssl\_protocols _(optional)_ + +If provided, this parameter is expected to be an array of strings identifying SSL/TLS protocols that you wish not to allow. + +Included in the array should be the union of disallowed identifiers for: +- custom origin SSL/TLS protocols (currently SSLv3 | TLSv1 | TLSv1.1 | TLSv1.2) +- identifiers for the minimum SSL/TLS protocol in the Viewer Certificate that CloudFront can use to communicate with viewers (currently SSLv3 | TLSv1 | TLSv1_1026 | TLSv1.1_2016 | TLSv1.2_2018 | TLSv1.2_2019 | TLSv1.2_2021). + +Newer protocol identification strings (when available) may be provided in the set, as validity is not checked. The default value for disallowed_ssl_protocols is `%w{SSLv3 TLSv1 TLSv1_2016}`. + +For additional information, see the [AWS API reference for CloudFront distributions](https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_distribution.html) documentation. For available SSL/TLS version identifiers, see [OriginSslProtocols](https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_OriginSslProtocols.html) and [AWS::CloudFront::distribution ViewerCertificate](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-viewercertificate.html) documentation. + +## Properties + +|Property | Description| +| --- | --- | +|distribution\_id | The identifier for the CloudFront distribution. | +|viewer\_protocol\_policies | An array of viewer protocol policies for all caches in this distribution; valid policy names are `allow-all` (which allows HTTP and HTTPS), `https-only` or `redirect-to-https`. | +|custom\_origin\_ssl\_protocols | An array containing SSL/TLS protocols allowed by custom origins in this distribution. Empty if there are no custom origins (one or more standard S3 bucket origins). Current valid values: `SSLv3`, `TLSv1`, `TLSv1.1`, `TLSv1.2`. | +|viewer\_certificate\_minimum\_ssl\_protocol | The minimum SSL/TLS protocol version in the Viewer Certificate. Current valid values: `SSLv3`, `TLSv1`, `TLSv1_2016`, `TLSv1.1_2016`, `TLSv1.2_2018`, `TLSv1.2_2019`, `TLSv1.2_2021`. | +|s3\_origin\_config | True if there are any S3 origin configs in the distribution (i.e. standard S3 bucket origins), else false. | + +## Examples + +### Test that a CloudFront distribution has secure protocols configured + + describe aws_cloudfront_distribution('DISTRIBUTION_ID') do + its('viewer_certificate_minimum_ssl_protocol') { should_not match /SSLv3|TLSv1$|TLSv1_2016/ } + its('viewer_protocol_policies') { should_not include 'allow-all' } + {SSLv3 TLSv1}.each do |protocol| + its('custom_origin_ssl_protocols') { should_not include protocol } + end + end + +## Matchers + +This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/). + +### have_viewer_protocol_policies_allowing_http + +The `have_viewer_protocol_policies_allowing_http` matcher tests if any of the caches for origins, including the default cache, has its viewer_protocol_policy set to 'allow-all'. + + it { should_not have_viewer_protocol_policies_allowing_http } + +### have\_disallowed\_custom\_origin\_ssl\_protocols + +The `have_disallowed_custom_origin_ssl_protocols` matcher tests whether any of the the SSL/TLS protocols defined in the ssl_protocols for all custom origins in the distribution are present in the `disallowed_ssl_protocols` parameter (if provided), or in the default disallowed SSL/TLS protocol list (if not). + + it { should_not have_disallowed_custom_origin_ssl_protocols } + +### have\_disallowed\_viewer\_certificate\_minimum\_ssl\_protocol + +The `have_disallowed_viewer_minimum_ssl_protocol` matcher tests whether the minimum SSL/TLS protocol for the distribution's Viewer Certificate is in the `disallowed_ssl_protocols` parameter (if provided), or in the default disallowed SSL/TLS protocol list (if not). + + it { should_not have_disallowed_viewer_certificate_minimum_ssl_protocol } + +### have\_s3\_origin\_configs + +The `have_s3_origin_configs` matcher tests whether the distribution has a non-nil s3_origin_configs setting in any of its origins. + + it { should_not have_s3_origin_configs } + +### exist + +The control will pass if the describe returns at least one result. + + describe aws_cloudfront_distribution('EXISTING_DISTRIBUTION_ID') do + it { should exist } + end + +Use `should_not` to test the entity should not exist. + + describe cloudfront_distribution('NONEXISTING_DISTRIBUTION_ID') do + it { should_not exist } + end + +## AWS Permissions + +Your [Principal](https://docs.aws.amazon.com/IAM/latest/UserGuide/intro-structure.html#intro-structure-principal) will need the `cloudfront:GetDistribution` action set to Allow. + +You can find detailed documentation at [Identity and Access Management (IAM) in CloudFront](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/auth-and-access-control.html). diff --git a/docs/resources/aws_cloudfront_distributions.md b/docs/resources/aws_cloudfront_distributions.md new file mode 100644 index 000000000..2d67776b2 --- /dev/null +++ b/docs/resources/aws_cloudfront_distributions.md @@ -0,0 +1,72 @@ +--- +title: About the aws_cloudfront_distributions Resource +platform: aws +--- + +# aws\_cloudfront\_distributions + +Use the `aws_cloudfront_distributions` InSpec audit resource to test properties of a collection of AWS CloudFront distributions. + +## Syntax + +Ensure that a particular CloudFront distribution exists in `aws_cloudfront_distributions`: + + describe aws_cloudfront_distributions do + its('distribution_ids') { should include 'DISTRIBUTION_ID' } + end + +## Parameters + +This resource does not expect any parameters. + +See also the [AWS API reference for CloudFront distributions](https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_distribution.html). + +## Properties + +|Property | Description| +| --- | --- | +|distribution_ids | The names of the CloudFront distributions. | +|distribution_arns | The Amazon Resource Name (ARN) of the CloudFront distributions. | +|statuses | The statuses of the CloudFront distributions (`InProgress` or `Deployed`). | +|domain_names | The domain names for the CloudFront distributions. | +|origin_domains_names | The domain names for the CloudFront distributions' origins (an array for each distribution). | +|default_cache_viewer_protocol_policies | The viewer protocol policy for the default cache for each of the CloudFront distributions. Values: `http-only`, `redirect-to-https` or `allow-all`. | +|cache_viewer_protocol_policies | The viewer protocol policy for all non-default caches for each of the CloudFront distributions (an array for each distribution). Values: `http-only`, `redirect-to-https` or `allow-all`. There may be an empty array for a distribution if no non-default caches are present.| +|custom_origin_ssl_protocols | An array for each CloudFront distribution containing SSL/TLS protocols allowed by all of the custom origins in that distribution, empty where no custom origins exist for a distribution. Current SSL/TLS protocol identifiers: `SSLv3`, `TLSv1`, `TLSv1_1026`, `TLSv1.1_2016`, `TLSv1.2_2018`, `TLSv1.2_2019` and `TLSv1.2_2021`. | +|s3_origin_config | Booleans indicating whether there are any S3 origin configs in a particular distribution (non-custom S3 bucket origins). | +|price_classes | The price classes for distributions, which corresponds with the maximum price that you want to pay for CloudFront service. Valid Values: `PriceClass_100`, `PriceClass_200`, `PriceClass_All`. | +|enabled | Booleans indicating whether the distributions are enabled. | +|viewer_certificate_ssl_support_methods | The SSL support methods for Viewer Certificates for the distributions, only set for distributions with aliases. Valid values: `sni-only`, `vip` or `static-ip`. | +|viewer_certificate_minimum_ssl_protocols | The minimum SSL/TLS protocol allowed by the Viewer Certificate in each distribution. Current valid values: `SSLv3`, `TLSv1`, `TLSv1_2016`, `TLSv1.1_2016`, `TLSv1.2_2018`, `TLSv1.2_2019`, `TLSv1.2_2021`. | +|http_versions | The maximum HTTP versions that viewers may to use to communicate with CloudFront distributions. Valid values: `http1.1` or `http2`. | +|ipv6_enabled | Booleans indicating whether IPv6 is enabled for CloudFront distributions. | + +## Examples + +### Test that a particular CloudFront distribution exists, and that no cache viewer protocol policies allow HTTP + + describe aws_cloudfront_distributions do + its('distribution_ids') { should include 'DISTRIBUTION_ID' } + its('default_cache_viewer_protocol_policies') { should_not include 'allow-all' } + its('cache_viewer_protocol_policies') { should_not include 'allow-all' } + end + +## Matchers + +This InSpec audit resource has no special matchers. For a full list of available matchers, please visit our [Universal Matchers page](https://www.inspec.io/docs/reference/matchers/). + +### exist + +The control will pass if the describe returns at least one result. + +Use `should_not` to test the entity should not exist. + + describe aws_cloudfront_distributions do + it { should exist } + end + +## AWS Permissions + +Your [Principal](https://docs.aws.amazon.com/IAM/latest/UserGuide/intro-structure.html#intro-structure-principal) will need the `cloudfront:Listdistributions` action set to Allow. + +You can find detailed documentation at [Identity and Access Management (IAM) in CloudFront](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/auth-and-access-control.html). From edbf49e92af99643f1dddae9a324c56e4f0e4e11 Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Sat, 11 Nov 2023 13:18:16 -0500 Subject: [PATCH 10/15] added fix for presence error issue Signed-off-by: Aaron Lippold --- libraries/aws_backend.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/aws_backend.rb b/libraries/aws_backend.rb index e7a9c8172..5d2bd7c0b 100644 --- a/libraries/aws_backend.rb +++ b/libraries/aws_backend.rb @@ -368,8 +368,7 @@ def initialize(opts) client_args[:client_args][:retry_backoff] = "lambda { |c| sleep(#{opts[:aws_retry_backoff]}) }" if opts[:aws_retry_backoff] # this catches the stub_data true option for unit testing - and others that could be useful for consumers client_args[:client_args].update(opts[:client_args]) if opts[:client_args] - - @resource_data = opts[:resource_data].presence&.to_h + @resource_data = opts[:resource_data].presence&.to_h if opts[:resource_data] end @aws = AwsConnection.new(client_args) # N.B. if/when we migrate AwsConnection to train, can update above and inject args via: From a200543be5caf15b4eef562fe9093bb10a15bc38 Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Sun, 12 Nov 2023 20:55:24 -0500 Subject: [PATCH 11/15] Fixes and Linting * updated and fixed the aws_accounts.rb resources to use standard styles and filterTable * Linted with 'cookstyle -A libraries/*.rb' * renamed the 'aws_account' resource to: - aws_primary_contact - aws_billing_contact - aws_operations_contact - aws_security_contact Signed-off-by: Aaron Lippold --- libraries/aws_account.rb | 247 ++++++++++++++++-- libraries/aws_alb.rb | 12 +- libraries/aws_albs.rb | 34 +-- libraries/aws_ami.rb | 6 +- libraries/aws_amis.rb | 66 ++--- libraries/aws_amplify_app.rb | 8 +- libraries/aws_amplify_apps.rb | 30 +-- libraries/aws_amplify_branch.rb | 8 +- libraries/aws_amplify_branches.rb | 26 +- libraries/aws_api_gateway_deployment.rb | 8 +- libraries/aws_api_gateway_deployments.rb | 16 +- .../aws_api_gateway_documentation_part.rb | 8 +- .../aws_api_gateway_documentation_parts.rb | 22 +- .../aws_api_gateway_documentation_version.rb | 8 +- .../aws_api_gateway_documentation_versions.rb | 14 +- libraries/aws_api_gateway_domain_name.rb | 10 +- libraries/aws_api_gateway_domain_names.rb | 6 +- libraries/aws_api_gateway_method.rb | 8 +- libraries/aws_api_gateway_methods.rb | 30 +-- libraries/aws_api_gateway_model.rb | 8 +- libraries/aws_api_gateway_models.rb | 18 +- .../aws_api_gateway_request_validator.rb | 6 +- .../aws_api_gateway_request_validators.rb | 6 +- libraries/aws_api_gateway_resource.rb | 6 +- libraries/aws_api_gateway_resources.rb | 6 +- libraries/aws_api_gateway_response.rb | 8 +- libraries/aws_api_gateway_responses.rb | 22 +- libraries/aws_api_gateway_restapi.rb | 8 +- libraries/aws_api_gateway_restapis.rb | 34 +-- libraries/aws_api_gateway_stage.rb | 8 +- libraries/aws_api_gateway_stages.rb | 16 +- libraries/aws_api_gateway_usage_plan.rb | 8 +- libraries/aws_api_gateway_usage_plan_key.rb | 10 +- libraries/aws_api_gateway_usage_plan_keys.rb | 6 +- libraries/aws_api_gateway_usage_plans.rb | 4 +- libraries/aws_api_gateway_v2_api.rb | 8 +- libraries/aws_api_gateway_v2_api_mapping.rb | 8 +- libraries/aws_api_gateway_v2_api_mappings.rb | 6 +- libraries/aws_api_gateway_v2_apis.rb | 6 +- libraries/aws_api_gateway_v2_authorizer.rb | 8 +- libraries/aws_api_gateway_v2_authorizers.rb | 6 +- libraries/aws_api_gateway_v2_deployment.rb | 8 +- libraries/aws_api_gateway_v2_deployments.rb | 6 +- libraries/aws_api_gateway_v2_domain_name.rb | 8 +- libraries/aws_api_gateway_v2_domain_names.rb | 6 +- libraries/aws_api_gateway_v2_integration.rb | 8 +- ...aws_api_gateway_v2_integration_response.rb | 8 +- ...ws_api_gateway_v2_integration_responses.rb | 6 +- libraries/aws_api_gateway_v2_integrations.rb | 6 +- libraries/aws_api_gateway_v2_model.rb | 8 +- libraries/aws_api_gateway_v2_models.rb | 6 +- libraries/aws_api_gateway_v2_route.rb | 8 +- libraries/aws_api_gateway_v2_routes.rb | 6 +- libraries/aws_api_gateway_vpc_link.rb | 8 +- libraries/aws_api_gateway_vpc_links.rb | 6 +- libraries/aws_apigateway_account.rb | 8 +- libraries/aws_apigateway_api_key.rb | 8 +- libraries/aws_apigateway_api_keys.rb | 28 +- libraries/aws_apigateway_authorizer.rb | 8 +- libraries/aws_apigateway_authorizers.rb | 28 +- libraries/aws_apigateway_base_path_mapping.rb | 8 +- .../aws_apigateway_base_path_mappings.rb | 14 +- .../aws_apigateway_client_certificate.rb | 8 +- .../aws_apigateway_client_certificates.rb | 20 +- ...application_autoscaling_scalable_target.rb | 10 +- ...pplication_autoscaling_scalable_targets.rb | 24 +- ...pplication_autoscaling_scaling_policies.rb | 28 +- ..._application_autoscaling_scaling_policy.rb | 10 +- libraries/aws_athena_work_group.rb | 8 +- libraries/aws_athena_work_groups.rb | 16 +- libraries/aws_auto_scaling_group.rb | 10 +- libraries/aws_auto_scaling_groups.rb | 26 +- libraries/aws_autoscaling_scaling_policies.rb | 34 +-- libraries/aws_autoscaling_scaling_policy.rb | 8 +- libraries/aws_backend.rb | 205 ++++++++------- libraries/aws_batch_compute_environment.rb | 8 +- libraries/aws_batch_compute_environments.rb | 26 +- libraries/aws_batch_job_definition.rb | 8 +- libraries/aws_batch_job_definitions.rb | 26 +- libraries/aws_batch_job_queue.rb | 8 +- libraries/aws_batch_job_queues.rb | 22 +- libraries/aws_cloud_formation_stack_set.rb | 8 +- libraries/aws_cloud_formation_stack_sets.rb | 24 +- libraries/aws_cloudformation_stack.rb | 8 +- libraries/aws_cloudformation_stacks.rb | 22 +- libraries/aws_cloudformation_template.rb | 10 +- libraries/aws_cloudfront_cache_policies.rb | 34 +-- libraries/aws_cloudfront_cache_policy.rb | 8 +- libraries/aws_cloudfront_distribution.rb | 10 +- libraries/aws_cloudfront_distributions.rb | 36 +-- libraries/aws_cloudfront_key_group.rb | 8 +- libraries/aws_cloudfront_key_groups.rb | 18 +- ...aws_cloudfront_origin_access_identities.rb | 14 +- .../aws_cloudfront_origin_access_identity.rb | 8 +- .../aws_cloudfront_origin_request_policy.rb | 8 +- libraries/aws_cloudfront_public_key.rb | 8 +- libraries/aws_cloudfront_public_keys.rb | 18 +- .../aws_cloudfront_realtime_log_config.rb | 8 +- .../aws_cloudfront_realtime_log_configs.rb | 18 +- .../aws_cloudfront_streaming_distribution.rb | 8 +- .../aws_cloudfront_streaming_distributions.rb | 30 +-- libraries/aws_cloudtrail_trail.rb | 20 +- libraries/aws_cloudtrail_trails.rb | 12 +- libraries/aws_cloudwatch_alarm.rb | 10 +- libraries/aws_cloudwatch_anomaly_detector.rb | 10 +- libraries/aws_cloudwatch_anomaly_detectors.rb | 20 +- libraries/aws_cloudwatch_composite_alarm.rb | 10 +- libraries/aws_cloudwatch_composite_alarms.rb | 36 +-- libraries/aws_cloudwatch_dashboard.rb | 8 +- libraries/aws_cloudwatch_dashboards.rb | 16 +- libraries/aws_cloudwatch_insight_rules.rb | 16 +- libraries/aws_cloudwatch_log_group.rb | 8 +- libraries/aws_cloudwatch_log_metric_filter.rb | 8 +- libraries/aws_cloudwatch_metric_stream.rb | 8 +- libraries/aws_cloudwatch_metric_streams.rb | 22 +- libraries/aws_cloudwatchlogs_destinantion.rb | 8 +- libraries/aws_cloudwatchlogs_destinantions.rb | 20 +- libraries/aws_cloudwatchlogs_log_stream.rb | 8 +- libraries/aws_cloudwatchlogs_log_streams.rb | 24 +- .../aws_cloudwatchlogs_subscription_filter.rb | 8 +- ...aws_cloudwatchlogs_subscription_filters.rb | 22 +- libraries/aws_cognito_identity_pool.rb | 8 +- libraries/aws_cognito_identity_pools.rb | 12 +- libraries/aws_cognito_userpool.rb | 8 +- libraries/aws_cognito_userpool_client.rb | 8 +- libraries/aws_cognito_userpool_clients.rb | 14 +- libraries/aws_cognito_userpools.rb | 20 +- libraries/aws_config_delivery_channel.rb | 16 +- libraries/aws_config_recorder.rb | 6 +- libraries/aws_db_parameter_group.rb | 6 +- libraries/aws_db_parameter_groups.rb | 16 +- libraries/aws_db_subnet_group.rb | 6 +- libraries/aws_db_subnet_groups.rb | 20 +- libraries/aws_dhcp_options.rb | 16 +- libraries/aws_dms_endpoint.rb | 10 +- libraries/aws_dms_endpoints.rb | 74 +++--- libraries/aws_dms_replication_instance.rb | 10 +- libraries/aws_dms_replication_instances.rb | 26 +- libraries/aws_dms_replication_subnet_group.rb | 10 +- .../aws_dms_replication_subnet_groups.rb | 18 +- libraries/aws_dynamodb_table.rb | 12 +- libraries/aws_dynamodb_tables.rb | 10 +- libraries/aws_ebs_snapshot.rb | 14 +- libraries/aws_ebs_snapshots.rb | 16 +- libraries/aws_ebs_volume.rb | 10 +- libraries/aws_ebs_volumes.rb | 38 +-- libraries/aws_ec2_capacity_reservation.rb | 8 +- libraries/aws_ec2_capacity_reservations.rb | 48 ++-- libraries/aws_ec2_carrier_gateway.rb | 8 +- libraries/aws_ec2_carrier_gateways.rb | 18 +- .../aws_ec2_client_vpn_authorization_rule.rb | 12 +- .../aws_ec2_client_vpn_authorization_rules.rb | 22 +- libraries/aws_ec2_client_vpn_endpoint.rb | 10 +- libraries/aws_ec2_client_vpn_endpoints.rb | 30 +-- libraries/aws_ec2_client_vpn_route.rb | 12 +- libraries/aws_ec2_client_vpn_routes.rb | 24 +- ...2_client_vpn_target_network_association.rb | 12 +- ..._client_vpn_target_network_associations.rb | 22 +- libraries/aws_ec2_customer_gateway.rb | 8 +- libraries/aws_ec2_customer_gateways.rb | 24 +- libraries/aws_ec2_dhcp_option.rb | 14 +- libraries/aws_ec2_dhcp_options.rb | 30 +-- .../aws_ec2_egress_only_internet_gateway.rb | 8 +- .../aws_ec2_egress_only_internet_gateways.rb | 14 +- libraries/aws_ec2_eip.rb | 8 +- libraries/aws_ec2_eip_association.rb | 10 +- libraries/aws_ec2_eip_associations.rb | 10 +- libraries/aws_ec2_eips.rb | 28 +- libraries/aws_ec2_fleet.rb | 8 +- libraries/aws_ec2_fleets.rb | 50 ++-- libraries/aws_ec2_host.rb | 8 +- libraries/aws_ec2_hosts.rb | 38 +-- libraries/aws_ec2_instance.rb | 28 +- libraries/aws_ec2_instances.rb | 26 +- libraries/aws_ec2_internet_gateway.rb | 8 +- libraries/aws_ec2_internet_gateways.rb | 20 +- libraries/aws_ec2_launch_template.rb | 6 +- libraries/aws_ec2_launch_templates.rb | 24 +- .../aws_ec2_network_insights_analysis.rb | 8 +- ...ws_ec2_network_insights_analysis_plural.rb | 34 +-- libraries/aws_ec2_network_insights_path.rb | 8 +- libraries/aws_ec2_network_insights_paths.rb | 28 +- libraries/aws_ec2_network_interface.rb | 8 +- .../aws_ec2_network_interface_attachment.rb | 8 +- .../aws_ec2_network_interface_attachments.rb | 24 +- libraries/aws_ec2_network_interfaces.rb | 48 ++-- libraries/aws_ec2_placement_group.rb | 8 +- libraries/aws_ec2_placement_groups.rb | 48 ++-- libraries/aws_ec2_prefix_list.rb | 8 +- libraries/aws_ec2_prefix_lists.rb | 28 +- libraries/aws_ec2_spot_fleet.rb | 8 +- libraries/aws_ec2_spot_fleets.rb | 20 +- libraries/aws_ec2_traffic_mirror_filter.rb | 8 +- libraries/aws_ec2_traffic_mirror_filters.rb | 14 +- libraries/aws_ec2_traffic_mirror_session.rb | 6 +- libraries/aws_ec2_traffic_mirror_sessions.rb | 28 +- libraries/aws_ec2_traffic_mirror_target.rb | 6 +- libraries/aws_ec2_traffic_mirror_targets.rb | 22 +- .../aws_ec2_transit_gateway_attachment.rb | 8 +- .../aws_ec2_transit_gateway_attachments.rb | 28 +- .../aws_ec2_transit_gateway_route_table.rb | 8 +- ...transit_gateway_route_table_association.rb | 8 +- ...ransit_gateway_route_table_associations.rb | 16 +- ...transit_gateway_route_table_propagation.rb | 10 +- ...ransit_gateway_route_table_propagations.rb | 16 +- .../aws_ec2_transit_gateway_route_tables.rb | 22 +- libraries/aws_ec2_volume_attachment.rb | 8 +- libraries/aws_ec2_volume_attachments.rb | 20 +- libraries/aws_ec2_vpc_peering_connection.rb | 8 +- libraries/aws_ec2_vpc_peering_connections.rb | 20 +- libraries/aws_ec2_vpn_connection_routes.rb | 14 +- .../aws_ec2_vpn_gateway_route_propagation.rb | 8 +- .../aws_ec2_vpn_gateway_route_propagations.rb | 14 +- libraries/aws_ecr.rb | 10 +- libraries/aws_ecr_image.rb | 16 +- libraries/aws_ecr_images.rb | 24 +- libraries/aws_ecr_repositories.rb | 20 +- libraries/aws_ecr_repository.rb | 10 +- libraries/aws_ecr_repository_policy.rb | 6 +- libraries/aws_ecrpublic_repositories.rb | 16 +- libraries/aws_ecrpublic_repository.rb | 10 +- libraries/aws_ecs_cluster.rb | 6 +- libraries/aws_ecs_clusters.rb | 24 +- libraries/aws_ecs_service.rb | 8 +- libraries/aws_ecs_services.rb | 28 +- libraries/aws_ecs_task_definition.rb | 8 +- libraries/aws_ecs_task_definitions.rb | 10 +- libraries/aws_efs_file_system.rb | 6 +- libraries/aws_efs_file_systems.rb | 32 +-- libraries/aws_efs_mount_target.rb | 8 +- libraries/aws_efs_mount_targets.rb | 28 +- libraries/aws_eks_cluster.rb | 16 +- libraries/aws_eks_clusters.rb | 14 +- libraries/aws_elasticache_cluster.rb | 8 +- libraries/aws_elasticache_cluster_node.rb | 8 +- libraries/aws_elasticache_clusters.rb | 24 +- .../aws_elasticache_replication_group.rb | 6 +- .../aws_elasticache_replication_groups.rb | 18 +- .../aws_elasticloadbalancingv2_listener.rb | 8 +- ...ticloadbalancingv2_listener_certificate.rb | 8 +- ...icloadbalancingv2_listener_certificates.rb | 12 +- ...ws_elasticloadbalancingv2_listener_rule.rb | 8 +- ...s_elasticloadbalancingv2_listener_rules.rb | 18 +- .../aws_elasticloadbalancingv2_listeners.rb | 24 +- ...aws_elasticloadbalancingv2_target_group.rb | 8 +- ...ws_elasticloadbalancingv2_target_groups.rb | 42 +-- libraries/aws_elasticsearchservice_domain.rb | 10 +- libraries/aws_elasticsearchservice_domains.rb | 10 +- libraries/aws_elb.rb | 10 +- libraries/aws_elbs.rb | 26 +- libraries/aws_emr_cluster.rb | 12 +- libraries/aws_emr_clusters.rb | 44 ++-- libraries/aws_emr_security_configuration.rb | 18 +- libraries/aws_emr_security_configurations.rb | 28 +- libraries/aws_eventbridge_rule.rb | 8 +- libraries/aws_eventbridge_rules.rb | 26 +- libraries/aws_flow_log.rb | 24 +- libraries/aws_glue_crawler.rb | 8 +- libraries/aws_glue_crawlers.rb | 44 ++-- libraries/aws_glue_database.rb | 8 +- libraries/aws_glue_databases.rb | 24 +- libraries/aws_guardduty_detector.rb | 10 +- libraries/aws_guardduty_detectors.rb | 10 +- libraries/aws_hosted_zone.rb | 20 +- libraries/aws_hosted_zones.rb | 20 +- libraries/aws_iam_access_key.rb | 18 +- libraries/aws_iam_access_keys.rb | 52 ++-- libraries/aws_iam_account_alias.rb | 6 +- libraries/aws_iam_credential_report.rb | 65 ++--- libraries/aws_iam_group.rb | 8 +- libraries/aws_iam_groups.rb | 20 +- libraries/aws_iam_inline_policy.rb | 6 +- libraries/aws_iam_instance_profile.rb | 8 +- libraries/aws_iam_instance_profiles.rb | 20 +- libraries/aws_iam_managed_policies.rb | 28 +- libraries/aws_iam_managed_policy.rb | 6 +- libraries/aws_iam_oidc_provider.rb | 8 +- libraries/aws_iam_oidc_providers.rb | 10 +- libraries/aws_iam_password_policy.rb | 18 +- libraries/aws_iam_policies.rb | 24 +- libraries/aws_iam_policy.rb | 6 +- libraries/aws_iam_role.rb | 6 +- libraries/aws_iam_roles.rb | 28 +- libraries/aws_iam_root_user.rb | 14 +- libraries/aws_iam_saml_provider.rb | 8 +- libraries/aws_iam_saml_providers.rb | 16 +- libraries/aws_iam_server_certificate.rb | 6 +- libraries/aws_iam_server_certificates.rb | 20 +- ...iam_service_linked_role_deletion_status.rb | 10 +- libraries/aws_iam_ssh_public_key.rb | 10 +- libraries/aws_iam_ssh_public_keys.rb | 16 +- libraries/aws_iam_user.rb | 6 +- libraries/aws_iam_users.rb | 44 ++-- libraries/aws_iam_virtual_mfa_devices.rb | 24 +- libraries/aws_internet_gateway.rb | 18 +- libraries/aws_internet_gateways.rb | 24 +- libraries/aws_kms_key.rb | 18 +- libraries/aws_kms_keys.rb | 12 +- libraries/aws_lambda.rb | 6 +- libraries/aws_lambda_alias.rb | 8 +- libraries/aws_lambda_aliases.rb | 20 +- libraries/aws_lambda_code_signing_config.rb | 8 +- libraries/aws_lambda_code_signing_configs.rb | 20 +- libraries/aws_lambda_event_invoke_config.rb | 8 +- libraries/aws_lambda_event_invoke_configs.rb | 18 +- libraries/aws_lambda_event_source_mapping.rb | 10 +- libraries/aws_lambda_event_source_mappings.rb | 46 ++-- .../aws_lambda_layer_version_permission.rb | 8 +- libraries/aws_lambda_permission.rb | 20 +- libraries/aws_lambda_permissions.rb | 30 +-- libraries/aws_lambda_version.rb | 8 +- libraries/aws_lambda_versions.rb | 22 +- libraries/aws_lambdas.rb | 14 +- libraries/aws_launch_configuration.rb | 10 +- libraries/aws_launch_configurations.rb | 34 +-- libraries/aws_logs_metric_filter.rb | 8 +- libraries/aws_logs_metric_filters.rb | 18 +- libraries/aws_mq_broker.rb | 8 +- libraries/aws_mq_brokers.rb | 26 +- libraries/aws_mq_configuration.rb | 8 +- libraries/aws_mq_configurations.rb | 26 +- libraries/aws_nat_gateway.rb | 16 +- libraries/aws_nat_gateways.rb | 24 +- libraries/aws_network_acl.rb | 18 +- libraries/aws_network_acls.rb | 40 +-- libraries/aws_network_firewall_firewall.rb | 8 +- .../aws_network_firewall_firewall_policies.rb | 12 +- .../aws_network_firewall_firewall_policy.rb | 8 +- libraries/aws_network_firewall_firewalls.rb | 12 +- ..._network_firewall_logging_configuration.rb | 10 +- libraries/aws_network_firewall_rule_group.rb | 8 +- libraries/aws_network_firewall_rule_groups.rb | 12 +- ...rk_manager_customer_gateway_association.rb | 8 +- ...k_manager_customer_gateway_associations.rb | 20 +- libraries/aws_network_manager_device.rb | 8 +- libraries/aws_network_manager_devices.rb | 42 +-- .../aws_network_manager_global_network.rb | 8 +- .../aws_network_manager_global_networks.rb | 20 +- libraries/aws_organizations_member.rb | 14 +- libraries/aws_ram_resource_share.rb | 8 +- libraries/aws_ram_resource_shares.rb | 28 +- libraries/aws_rds_cluster.rb | 6 +- libraries/aws_rds_clusters.rb | 30 +-- libraries/aws_rds_db_cluster_snapshot.rb | 10 +- libraries/aws_rds_db_cluster_snapshots.rb | 52 ++-- libraries/aws_rds_db_proxy.rb | 8 +- libraries/aws_rds_db_proxy_endpoint.rb | 8 +- libraries/aws_rds_db_proxy_endpoints.rb | 30 +-- libraries/aws_rds_db_security_group.rb | 8 +- libraries/aws_rds_db_security_groups.rb | 22 +- libraries/aws_rds_event_subscription.rb | 10 +- libraries/aws_rds_event_subscriptions.rb | 28 +- libraries/aws_rds_global_cluster.rb | 8 +- libraries/aws_rds_global_clusters.rb | 28 +- libraries/aws_rds_instance.rb | 8 +- libraries/aws_rds_instances.rb | 6 +- libraries/aws_rds_option_group.rb | 8 +- libraries/aws_rds_option_groups.rb | 22 +- libraries/aws_rds_snapshot.rb | 8 +- libraries/aws_rds_snapshot_attributes.rb | 16 +- libraries/aws_rds_snapshots.rb | 6 +- libraries/aws_redshift_cluster.rb | 6 +- .../aws_redshift_cluster_parameter_group.rb | 8 +- .../aws_redshift_cluster_parameter_groups.rb | 16 +- libraries/aws_redshift_clusters.rb | 36 +-- libraries/aws_region.rb | 6 +- libraries/aws_regions.rb | 12 +- libraries/aws_route53_record_set.rb | 10 +- libraries/aws_route53_record_sets.rb | 34 +-- .../aws_route53resolver_resolver_endpoint.rb | 8 +- .../aws_route53resolver_resolver_endpoints.rb | 32 +-- .../aws_route53resolver_resolver_rule.rb | 8 +- ...ute53resolver_resolver_rule_association.rb | 8 +- ...te53resolver_resolver_rule_associations.rb | 20 +- .../aws_route53resolver_resolver_rules.rb | 36 +-- libraries/aws_route_table.rb | 14 +- libraries/aws_route_tables.rb | 100 +++---- libraries/aws_s3_access_point.rb | 8 +- libraries/aws_s3_access_points.rb | 14 +- libraries/aws_s3_bucket.rb | 20 +- libraries/aws_s3_bucket_object.rb | 10 +- libraries/aws_s3_bucket_objects.rb | 38 +-- libraries/aws_s3_bucket_policy.rb | 8 +- libraries/aws_s3_buckets.rb | 12 +- libraries/aws_sdb_domains.rb | 10 +- libraries/aws_secretsmanager_secret.rb | 8 +- libraries/aws_secretsmanager_secrets.rb | 40 +-- libraries/aws_security_group.rb | 28 +- libraries/aws_security_groups.rb | 6 +- libraries/aws_securityhub_hub.rb | 8 +- ..._servicecatalog_cloud_formation_product.rb | 8 +- ...s_servicecatalog_launch_role_constraint.rb | 8 +- ..._servicecatalog_launch_role_constraints.rb | 20 +- ...catalog_portfolio_principal_association.rb | 8 +- ...atalog_portfolio_principal_associations.rb | 12 +- ...cecatalog_portfolio_product_association.rb | 8 +- ...ecatalog_portfolio_product_associations.rb | 20 +- libraries/aws_ses_receipt_rule.rb | 8 +- libraries/aws_ses_receipt_rule_set.rb | 8 +- libraries/aws_ses_receipt_rule_sets.rb | 12 +- libraries/aws_ses_template.rb | 8 +- libraries/aws_ses_templates.rb | 12 +- libraries/aws_shield_subscription.rb | 6 +- libraries/aws_signer_profile_permissions.rb | 16 +- libraries/aws_signer_signing_profile.rb | 8 +- libraries/aws_signer_signing_profiles.rb | 30 +-- libraries/aws_sns_subscription.rb | 18 +- libraries/aws_sns_subscriptions.rb | 18 +- libraries/aws_sns_topic.rb | 10 +- libraries/aws_sns_topics.rb | 10 +- libraries/aws_sqs_queue.rb | 40 +-- libraries/aws_sqs_queues.rb | 44 ++-- libraries/aws_ssm_activation.rb | 8 +- libraries/aws_ssm_activations.rb | 28 +- libraries/aws_ssm_association.rb | 6 +- libraries/aws_ssm_associations.rb | 28 +- libraries/aws_ssm_document.rb | 6 +- libraries/aws_ssm_documents.rb | 26 +- libraries/aws_ssm_maintenance_window.rb | 8 +- .../aws_ssm_maintenance_window_target.rb | 10 +- .../aws_ssm_maintenance_window_targets.rb | 22 +- libraries/aws_ssm_maintenance_window_task.rb | 10 +- libraries/aws_ssm_maintenance_window_tasks.rb | 36 +-- libraries/aws_ssm_maintenance_windows.rb | 32 +-- libraries/aws_ssm_parameter.rb | 6 +- libraries/aws_ssm_parameters.rb | 24 +- libraries/aws_ssm_patch_baseline.rb | 8 +- libraries/aws_ssm_patch_baselines.rb | 18 +- .../aws_ssm_resource_compliance_summaries.rb | 28 +- .../aws_ssm_resource_compliance_summary.rb | 14 +- libraries/aws_ssm_resource_data_syncs.rb | 28 +- libraries/aws_stepfunctions_activities.rb | 14 +- libraries/aws_stepfunctions_activity.rb | 8 +- libraries/aws_stepfunctions_state_machine.rb | 8 +- libraries/aws_stepfunctions_state_machines.rb | 16 +- libraries/aws_sts_caller_identity.rb | 10 +- libraries/aws_subnet.rb | 10 +- libraries/aws_subnets.rb | 22 +- libraries/aws_synthetics_canaries.rb | 42 +-- libraries/aws_synthetics_canary.rb | 8 +- libraries/aws_transfer_user.rb | 8 +- libraries/aws_transfer_users.rb | 20 +- libraries/aws_transit_gateway.rb | 8 +- libraries/aws_transit_gateway_connect.rb | 8 +- libraries/aws_transit_gateway_connects.rb | 24 +- .../aws_transit_gateway_multicast_domain.rb | 8 +- ...it_gateway_multicast_domain_association.rb | 8 +- ...t_gateway_multicast_domain_associations.rb | 18 +- .../aws_transit_gateway_multicast_domains.rb | 24 +- ..._transit_gateway_multicast_group_member.rb | 8 +- ...transit_gateway_multicast_group_members.rb | 30 +-- ..._transit_gateway_multicast_group_source.rb | 8 +- ...transit_gateway_multicast_group_sources.rb | 30 +-- libraries/aws_transit_gateway_route.rb | 14 +- libraries/aws_transit_gateway_routes.rb | 46 ++-- libraries/aws_vpc.rb | 18 +- libraries/aws_vpc_endpoint.rb | 14 +- ...ws_vpc_endpoint_connection_notification.rb | 8 +- ...s_vpc_endpoint_connection_notifications.rb | 22 +- libraries/aws_vpc_endpoint_service.rb | 8 +- .../aws_vpc_endpoint_service_permission.rb | 10 +- .../aws_vpc_endpoint_service_permissions.rb | 12 +- libraries/aws_vpc_endpoint_services.rb | 32 +-- libraries/aws_vpc_endpoints.rb | 26 +- libraries/aws_vpcs.rb | 56 ++-- libraries/aws_vpn_connection.rb | 8 +- libraries/aws_vpn_connections.rb | 22 +- libraries/aws_vpn_gateway.rb | 14 +- libraries/aws_vpn_gateways.rb | 22 +- libraries/aws_waf_byte_match_set.rb | 8 +- libraries/aws_waf_byte_match_sets.rb | 12 +- libraries/aws_waf_ip_set.rb | 8 +- libraries/aws_waf_ip_sets.rb | 12 +- libraries/aws_waf_rule.rb | 8 +- libraries/aws_waf_rules.rb | 12 +- libraries/aws_waf_size_constraint_set.rb | 8 +- libraries/aws_waf_size_constraint_sets.rb | 12 +- libraries/aws_waf_sql_injection_match_set.rb | 8 +- libraries/aws_waf_sql_injection_match_sets.rb | 12 +- libraries/aws_waf_web_acl.rb | 8 +- libraries/aws_waf_web_acls.rb | 12 +- libraries/aws_waf_xss_match_set.rb | 8 +- libraries/aws_waf_xss_match_sets.rb | 12 +- 483 files changed, 4198 insertions(+), 3987 deletions(-) diff --git a/libraries/aws_account.rb b/libraries/aws_account.rb index fe769a6e4..8f4e3ce29 100644 --- a/libraries/aws_account.rb +++ b/libraries/aws_account.rb @@ -1,48 +1,249 @@ -require "aws_backend" +require 'aws_backend' +require 'pry' -class AwsAccount < AwsResourceBase - name "aws_account" - desc "Verifies contact information for an AWS Account." - example " - addr = { 'address_line_1' => '42 Wallaby Way', ... } - describe aws_account.contact_information do - it { should cmp addr } +class AwsPrimaryAccount < AwsResourceBase + name 'aws_primary_contact' + desc 'Verifies the primary contact information for an AWS Account.' + example <<~EXAMPLE + describe aws_primary_account do + it { should be_configured } + its('full_name') { should cmp 'John Smith' } + its('address_line_1') { should cmp '42 Wallaby Way' } end - " + EXAMPLE + + attr_reader :table, :raw_data + + FilterTable.create + .register_column(:address_line_1, field: :address_line_1, style: :simple) + .register_column(:adress_line_2, field: :adress_line_2, style: :simple) + .register_column(:address_line_3, field: :address_line_3, style: :simple) + .register_column(:city, field: :city, style: :simple) + .register_column(:company_name, field: :company_name, style: :simple) + .register_column(:country_code, field: :country_code, style: :simple) + .register_column(:district_or_county, field: :district_or_county, style: :simple) + .register_column(:full_name, field: :full_name, style: :simple) + .register_column(:phone_number, field: :phone_number, style: :simple) + .register_column(:postal_code, field: :postal_code, style: :simple) + .register_column(:state_or_region, field: :state_or_region, style: :simple) + .register_column(:website_url, field: :website_url, style: :simple) + .register_custom_matcher(:configured?) { |x| x.entries.any? } + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) + validate_parameters + # binding.pry + @table = fetch_data end def resource_id - "AWS Account Contact Information" + "AWS Account for #{@table[0][:full_name]}" || 'AWS Account Contact Information' end def to_s - "AWS Account Contact Information" + 'AWS Account Primary Contact' end - def contact_information - @contact_information ||= catch_aws_errors do - @aws.account_client.get_contact_information.contact_information.to_h.transform_keys(&:to_s) + def fetch_data + @raw_data = [] + loop do + catch_aws_errors do + @api_response = @aws.account_client.get_contact_information.contact_information + end + return [] if !@api_response || @api_response.empty? + + @raw_data << { + address_line_1: @api_response.address_line_1, + address_line_2: @api_response.address_line_2, + address_line_3: @api_response.address_line_3, + city: @api_response.city, + company_name: @api_response.company_name, + country_code: @api_response.country_code, + district_or_county: @api_response.district_or_county, + full_name: @api_response.full_name, + phone_number: @api_response.phone_number, + postal_code: @api_response.postal_code, + state_or_region: @api_response.state_or_region, + website_url: @api_response.website_url, + } + break end + @raw_data end - def billing_contact_information - @billing_contact_information ||= catch_aws_errors do - @aws.account_client.get_alternate_contact({alternate_contact_type: "BILLING"}).alternate_contact.to_h.transform_keys(&:to_s) + # @aws.account_client.get_alternate_contact({alternate_contact_type: "BILLING"}).alternate_contact.to_h.transform_keys(&:to_s) + # resp.alternate_contact.alternate_contact_type #=> String, one of "BILLING", "OPERATIONS", "SECURITY" + # resp.alternate_contact.email_address #=> String + # resp.alternate_contact.name #=> String + # resp.alternate_contact.phone_number #=> String + # resp.alternate_contact.title #=> String + + class AwsBillingAccount < AwsResourceBase + name 'aws_billing_contact' + desc 'Verifies the billing contact information for an AWS Account.' + example <<~EXAMPLE + describe aws_billing_account do + it { should be_configured } + its('name') { should cmp 'John Smith' } + its('email_address') { should cmp 'jsmith@acme.com' } + end + EXAMPLE + + attr_reader :table, :raw_data + + FilterTable.create + .register_column(:email_address, field: :email_address, style: :simple) + .register_column(:name, field: :name, style: :simple) + .register_column(:phone_number, field: :phone_number, style: :simple) + .register_column(:title, field: :title, style: :simple) + .register_custom_matcher(:configured?) { |x| x.entries.any? } + .install_filter_methods_on_resource(self, :table) + + def initialize(opts = {}) + super(opts) + validate_parameters + @table = fetch_data + end + + def resource_id + "AWS Billing for #{@table[0][:name]}" || 'AWS Account Billing Information' + end + + def to_s + 'AWS Account Billing Contact' + end + + def fetch_data + @raw_data = [] + loop do + catch_aws_errors do + @api_response = @aws.account_client.get_alternate_contact({ alternate_contact_type: 'BILLING' }).alternate_contact + end + return [] if !@api_response || @api_response.empty? + + @raw_data << { + email_address: @api_response.email_address, + name: @api_response.name, + phone_number: @api_response.phone_number, + title: @api_response.title, + } + break + end + @raw_data end end - def operations_contact_information - @operations_contact_information ||= catch_aws_errors do - @aws.account_client.get_alternate_contact({alternate_contact_type: "OPERATIONS"}).alternate_contact.to_h.transform_keys(&:to_s) + # @aws.account_client.get_alternate_contact({alternate_contact_type: "OPERATIONS"}).alternate_contact.to_h.transform_keys(&:to_s) + + class AwsAccountOperationsContact < AwsResourceBase + name 'aws_operations_contact' + desc 'Verifies the operations contact information for an AWS Account.' + example <<~EXAMPLE + describe aws_operations_account do + it { should be_configured } + its('name') { should cmp 'John Smith' } + its('email_address') { should cmp 'jsmith@acme.com' } + end + EXAMPLE + + attr_reader :table, :raw_data + + FilterTable.create + .register_column(:email_address, field: :email_address, style: :simple) + .register_column(:name, field: :name, style: :simple) + .register_column(:phone_number, field: :phone_number, style: :simple) + .register_column(:title, field: :title, style: :simple) + .register_custom_matcher(:configured?) { |x| x.entries.any? } + .install_filter_methods_on_resource(self, :table) + + def initialize(opts = {}) + super(opts) + validate_parameters + @table = fetch_data + end + + def resource_id + "AWS Operations Contact for #{@table[0][:name]}" || 'AWS Account Operations Contact Information' + end + + def to_s + 'AWS Account Operations Contact Information' + end + + def fetch_data + @raw_data = [] + loop do + catch_aws_errors do + @api_response = @aws.account_client.get_alternate_contact({ alternate_contact_type: 'OPERATIONS' }).alternate_contact + end + return [] if !@api_response || @api_response.empty? + + @raw_data << { + email_address: @api_response.email_address, + name: @api_response.name, + phone_number: @api_response.phone_number, + title: @api_response.title, + } + break + end + @raw_data end end - def security_contact_information - @security_contact_information ||= catch_aws_errors do - @aws.account_client.get_alternate_contact({alternate_contact_type: "SECURITY"}).alternate_contact.to_h.transform_keys(&:to_s) + # @aws.account_client.get_alternate_contact({alternate_contact_type: "SECURITY"}).alternate_contact.to_h.transform_keys(&:to_s) + class AwsAccountSecurityContact < AwsResourceBase + name 'aws_security_contact' + desc 'Verifies the security contact information for an AWS Account.' + example <<~EXAMPLE + describe aws_security_account do + it { should be_configured } + its('name') { should cmp 'John Smith' } + its('email_address') { should cmp 'jsmith@acme.com' } + end + EXAMPLE + + attr_reader :table, :raw_data + + FilterTable.create + .register_column(:email_address, field: :email_address, style: :simple) + .register_column(:name, field: :name, style: :simple) + .register_column(:phone_number, field: :phone_number, style: :simple) + .register_column(:title, field: :title, style: :simple) + .register_custom_matcher(:configured?) { |x| x.entries.any? } + .install_filter_methods_on_resource(self, :table) + + def initialize(opts = {}) + super(opts) + validate_parameters + @table = fetch_data + end + + def resource_id + "AWS Security Contact for #{@table[0][:name]}" || 'AWS Account Security Contact Information' + end + + def to_s + 'AWS Account Security Contact' + end + + def fetch_data + @raw_data = [] + loop do + catch_aws_errors do + @api_response = @aws.account_client.get_alternate_contact({ alternate_contact_type: 'SECURITY' }).alternate_contact + end + return [] if !@api_response || @api_response.empty? + + @raw_data << { + email_address: @api_response.email_address, + name: @api_response.name, + phone_number: @api_response.phone_number, + title: @api_response.title, + } + break + end + @raw_data end end end diff --git a/libraries/aws_alb.rb b/libraries/aws_alb.rb index 315b24b35..d64f8e6b2 100644 --- a/libraries/aws_alb.rb +++ b/libraries/aws_alb.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsAlb < AwsResourceBase - name "aws_alb" - desc "Verifies settings for an Application Load Balancer." + name 'aws_alb' + desc 'Verifies settings for an Application Load Balancer.' example <<-EXAMPLE describe aws_alb('arn:aws:elasticloadbalancing') do it { should exist } @@ -45,8 +45,8 @@ def resource_id def access_log_enabled return unless alb_attributes - s3_enabled_attr = alb_attributes.find { |attr| attr.key.eql?("access_logs.s3.enabled") } - @access_log_enabled = s3_enabled_attr&.value == "true" + s3_enabled_attr = alb_attributes.find { |attr| attr.key.eql?('access_logs.s3.enabled') } + @access_log_enabled = s3_enabled_attr&.value == 'true' end def listeners @@ -56,7 +56,7 @@ def listeners end def ssl_policies - @ssl_policies ||= listeners.filter_map { |listener| listener.ssl_policy if listener.protocol == "HTTPS" }.uniq + @ssl_policies ||= listeners.filter_map { |listener| listener.ssl_policy if listener.protocol == 'HTTPS' }.uniq end def external_ports diff --git a/libraries/aws_albs.rb b/libraries/aws_albs.rb index d61197377..5fce9771c 100644 --- a/libraries/aws_albs.rb +++ b/libraries/aws_albs.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsAlbs < AwsResourceBase - name "aws_albs" - desc "Verifies settings for a collection AWS Application Load Balancers." + name 'aws_albs' + desc 'Verifies settings for a collection AWS Application Load Balancers.' example <<-EXAMPLE describe aws_albs do it { should exist } @@ -12,20 +12,20 @@ class AwsAlbs < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:availability_zones, field: :availability_zones) - .register_column(:canonical_hosted_zone_ids, field: :canonical_hosted_zone_id) - .register_column(:dns_names, field: :dns_name) - .register_column(:load_balancer_arns, field: :load_balancer_arn) - .register_column(:load_balancer_names, field: :load_balancer_name) - .register_column(:load_balancer_addresses, field: :load_balancer_addresses) - .register_column(:schemes, field: :scheme) - .register_column(:security_groups, field: :security_groups) - .register_column(:states, field: :state) - .register_column(:subnets, field: :subnets) - .register_column(:types, field: :type) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:zone_names, field: :zone_names) - .install_filter_methods_on_resource(self, :table) + .register_column(:availability_zones, field: :availability_zones) + .register_column(:canonical_hosted_zone_ids, field: :canonical_hosted_zone_id) + .register_column(:dns_names, field: :dns_name) + .register_column(:load_balancer_arns, field: :load_balancer_arn) + .register_column(:load_balancer_names, field: :load_balancer_name) + .register_column(:load_balancer_addresses, field: :load_balancer_addresses) + .register_column(:schemes, field: :scheme) + .register_column(:security_groups, field: :security_groups) + .register_column(:states, field: :state) + .register_column(:subnets, field: :subnets) + .register_column(:types, field: :type) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:zone_names, field: :zone_names) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ami.rb b/libraries/aws_ami.rb index e39dadcd0..1e9e28209 100644 --- a/libraries/aws_ami.rb +++ b/libraries/aws_ami.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsAmi < AwsResourceBase - name "aws_ami" - desc "Verifies settings for an AWS AMI." + name 'aws_ami' + desc 'Verifies settings for an AWS AMI.' example <<-EXAMPLE describe aws_ami(image_id: 'ami-12345678') do it { should exist } diff --git a/libraries/aws_amis.rb b/libraries/aws_amis.rb index 33298c87a..e1de85c10 100644 --- a/libraries/aws_amis.rb +++ b/libraries/aws_amis.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsAmis < AwsResourceBase - name "aws_amis" - desc "Verifies settings for a collection of AWS AMIs." + name 'aws_amis' + desc 'Verifies settings for a collection of AWS AMIs.' example <<-EXAMPLE describe aws_amis(all_amis: 'true') do it { should exist } @@ -12,33 +12,33 @@ class AwsAmis < AwsResourceBase attr_reader :table, :api_response FilterTable.create - .register_column(:architectures, field: :architecture) - .register_column(:creation_dates, field: :creation_date) - .register_column(:image_ids, field: :image_id) - .register_column(:image_locations, field: :image_location) - .register_column(:image_types, field: :image_type) - .register_column(:public, field: :public) - .register_column(:kernel_ids, field: :kernel_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:platforms, field: :platform) - .register_column(:platform_details, field: :platform_details) - .register_column(:usage_operations, field: :usage_operation) - .register_column(:product_codes, field: :product_codes) - .register_column(:ramdisk_ids, field: :ramdisk_id) - .register_column(:states, field: :state) - .register_column(:block_device_mappings, field: :block_device_mappings) - .register_column(:descriptions, field: :description) - .register_column(:ena_support, field: :ena_support) - .register_column(:hypervisors, field: :hypervisor) - .register_column(:image_owner_alias, field: :image_owner_alias) - .register_column(:names, field: :name) - .register_column(:root_device_names, field: :root_device_name) - .register_column(:root_device_types, field: :root_device_type) - .register_column(:sriov_net_support, field: :sriov_net_support) - .register_column(:state_reasons, field: :state_reason) - .register_column(:tags, field: :tags) - .register_column(:virtualization_types, field: :virtualization_type) - .install_filter_methods_on_resource(self, :table) + .register_column(:architectures, field: :architecture) + .register_column(:creation_dates, field: :creation_date) + .register_column(:image_ids, field: :image_id) + .register_column(:image_locations, field: :image_location) + .register_column(:image_types, field: :image_type) + .register_column(:public, field: :public) + .register_column(:kernel_ids, field: :kernel_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:platforms, field: :platform) + .register_column(:platform_details, field: :platform_details) + .register_column(:usage_operations, field: :usage_operation) + .register_column(:product_codes, field: :product_codes) + .register_column(:ramdisk_ids, field: :ramdisk_id) + .register_column(:states, field: :state) + .register_column(:block_device_mappings, field: :block_device_mappings) + .register_column(:descriptions, field: :description) + .register_column(:ena_support, field: :ena_support) + .register_column(:hypervisors, field: :hypervisor) + .register_column(:image_owner_alias, field: :image_owner_alias) + .register_column(:names, field: :name) + .register_column(:root_device_names, field: :root_device_name) + .register_column(:root_device_types, field: :root_device_type) + .register_column(:sriov_net_support, field: :sriov_net_support) + .register_column(:state_reasons, field: :state_reason) + .register_column(:tags, field: :tags) + .register_column(:virtualization_types, field: :virtualization_type) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -50,7 +50,7 @@ def initialize(opts = {}) query_params = {} filter = [] owners = [] - if @opts[:all_amis] == "true" + if @opts[:all_amis] == 'true' filter = [] elsif @opts @opts.each do |k, v| @@ -67,11 +67,11 @@ def initialize(opts = {}) raise ArgumentError, "The owners parameter should be a String or an Array of String. Found: #{v.class}" end else - filter << { name: k.to_s.tr("_", "-"), values: [v] } + filter << { name: k.to_s.tr('_', '-'), values: [v] } end end else - raise ArgumentError, "Either all_amis or filter option must be provided." + raise ArgumentError, 'Either all_amis or filter option must be provided.' end query_params = { filters: filter } unless filter.empty? diff --git a/libraries/aws_amplify_app.rb b/libraries/aws_amplify_app.rb index 93afac3fd..4943b9f43 100644 --- a/libraries/aws_amplify_app.rb +++ b/libraries/aws_amplify_app.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSAmplifyApp < AwsResourceBase - name "aws_amplify_app" - desc "Describes a Amplify App." + name 'aws_amplify_app' + desc 'Describes a Amplify App.' example <<-EXAMPLE describe aws_amplify_app(app_id: 'APP_ID') do it { should exist } @@ -22,7 +22,7 @@ def initialize(opts = {}) end def app_id - return nil unless exists? + return unless exists? @apps[:app_id] end diff --git a/libraries/aws_amplify_apps.rb b/libraries/aws_amplify_apps.rb index 7c3b61423..3215ebcb0 100644 --- a/libraries/aws_amplify_apps.rb +++ b/libraries/aws_amplify_apps.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSAmplifyApps < AwsResourceBase - name "aws_amplify_apps" - desc "Describes a list of Amplify App." + name 'aws_amplify_apps' + desc 'Describes a list of Amplify App.' example <<-EXAMPLE describe aws_amplify_apps do it { should exist } @@ -12,18 +12,18 @@ class AWSAmplifyApps < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:app_ids, field: :app_id) - .register_column(:app_arns, field: :app_arn) - .register_column(:names, field: :name) - .register_column(:tags, field: :tags) - .register_column(:description, field: :description) - .register_column(:repositories, field: :repository) - .register_column(:platforms, field: :platform) - .register_column(:create_time, field: :create_time) - .register_column(:host_instance_types, field: :host_instance_type) - .register_column(:update_time, field: :update_time) - .register_column(:iam_service_role_arns, field: :iam_service_role_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:app_ids, field: :app_id) + .register_column(:app_arns, field: :app_arn) + .register_column(:names, field: :name) + .register_column(:tags, field: :tags) + .register_column(:description, field: :description) + .register_column(:repositories, field: :repository) + .register_column(:platforms, field: :platform) + .register_column(:create_time, field: :create_time) + .register_column(:host_instance_types, field: :host_instance_type) + .register_column(:update_time, field: :update_time) + .register_column(:iam_service_role_arns, field: :iam_service_role_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_amplify_branch.rb b/libraries/aws_amplify_branch.rb index a7a5dab5c..84021d005 100644 --- a/libraries/aws_amplify_branch.rb +++ b/libraries/aws_amplify_branch.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSAmplifyBranch < AwsResourceBase - name "aws_amplify_branch" - desc "Describes a branch for an Amplify app." + name 'aws_amplify_branch' + desc 'Describes a branch for an Amplify app.' example <<-EXAMPLE describe aws_amplify_branch(app_id: 'APP_ID', branch_name: 'BRANCH_NAME') do it { should exist } @@ -22,7 +22,7 @@ def initialize(opts = {}) end def branch_name - return nil unless exists? + return unless exists? @apps[:branch_name] end diff --git a/libraries/aws_amplify_branches.rb b/libraries/aws_amplify_branches.rb index 5a8d3314a..2dc8f140f 100644 --- a/libraries/aws_amplify_branches.rb +++ b/libraries/aws_amplify_branches.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSAmplifyBranches < AwsResourceBase - name "aws_amplify_branches" - desc "Lists the branches of an Amplify app." + name 'aws_amplify_branches' + desc 'Lists the branches of an Amplify app.' example <<-EXAMPLE describe aws_amplify_branches(app_id: 'APP_ID') do it { should exist } @@ -12,16 +12,16 @@ class AWSAmplifyBranches < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:branch_arns, field: :branch_arn) - .register_column(:branch_names, field: :branch_name) - .register_column(:stages, field: :stage) - .register_column(:tags, field: :tags) - .register_column(:descriptions, field: :description) - .register_column(:display_names, field: :display_name) - .register_column(:enable_notifications, field: :enable_notification) - .register_column(:create_time, field: :create_time) - .register_column(:update_time, field: :update_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:branch_arns, field: :branch_arn) + .register_column(:branch_names, field: :branch_name) + .register_column(:stages, field: :stage) + .register_column(:tags, field: :tags) + .register_column(:descriptions, field: :description) + .register_column(:display_names, field: :display_name) + .register_column(:enable_notifications, field: :enable_notification) + .register_column(:create_time, field: :create_time) + .register_column(:update_time, field: :update_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_deployment.rb b/libraries/aws_api_gateway_deployment.rb index fffda4a8e..827ea910b 100644 --- a/libraries/aws_api_gateway_deployment.rb +++ b/libraries/aws_api_gateway_deployment.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayDeployment < AwsResourceBase - name "aws_api_gateway_deployment" - desc "Gets information about a Deployment resource." + name 'aws_api_gateway_deployment' + desc 'Gets information about a Deployment resource.' example <<-EXAMPLE describe aws_api_gateway_deployment(rest_api_id: 'REST_API_ID', deployment_id: 'DEPLOYMENT_ID') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts = {}) end def rest_api_id - return nil unless exists? + return unless exists? @res[:rest_api_id] end diff --git a/libraries/aws_api_gateway_deployments.rb b/libraries/aws_api_gateway_deployments.rb index 36d581c9b..bcd4fcbde 100644 --- a/libraries/aws_api_gateway_deployments.rb +++ b/libraries/aws_api_gateway_deployments.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayDeployments < AwsResourceBase - name "aws_api_gateway_deployments" - desc "Gets information about a Deployments collection." + name 'aws_api_gateway_deployments' + desc 'Gets information about a Deployments collection.' example <<-EXAMPLE describe aws_api_gateway_deployments(rest_api_id: 'REST_API_ID') do it { should exist } @@ -12,11 +12,11 @@ class AWSApiGatewayDeployments < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:descriptions, field: :description) - .register_column(:created_dates, field: :created_date) - .register_column(:api_summaries, field: :api_summary) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:descriptions, field: :description) + .register_column(:created_dates, field: :created_date) + .register_column(:api_summaries, field: :api_summary) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_documentation_part.rb b/libraries/aws_api_gateway_documentation_part.rb index a09dc248c..87e8fea08 100644 --- a/libraries/aws_api_gateway_documentation_part.rb +++ b/libraries/aws_api_gateway_documentation_part.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayDocumentationPart < AwsResourceBase - name "aws_api_gateway_documentation_part" - desc "Retrieves API Gateway Documentation part." + name 'aws_api_gateway_documentation_part' + desc 'Retrieves API Gateway Documentation part.' example <<-EXAMPLE describe aws_api_gateway_documentation_part(rest_api_id: 'REST_API_ID', documentation_part_id: 'DOCUMENTATION_PART_ID') do it { should exist } @@ -27,7 +27,7 @@ def exists? end def documentation_part_id - return nil unless exists? + return unless exists? @res[:documentation_part_id] end diff --git a/libraries/aws_api_gateway_documentation_parts.rb b/libraries/aws_api_gateway_documentation_parts.rb index fdf449f52..bc3f495fa 100644 --- a/libraries/aws_api_gateway_documentation_parts.rb +++ b/libraries/aws_api_gateway_documentation_parts.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayDocumentationParts < AwsResourceBase - name "aws_api_gateway_documentation_parts" - desc "Lists all the API Gateway documentation parts." + name 'aws_api_gateway_documentation_parts' + desc 'Lists all the API Gateway documentation parts.' example <<-EXAMPLE describe aws_api_gateway_documentation_parts(rest_api_id: 'REST_API_ID') do it { should exist } @@ -13,14 +13,14 @@ class AWSApiGatewayDocumentationParts < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:types, field: :type) - .register_column(:paths, field: :path) - .register_column(:methods, field: :method) - .register_column(:status_codes, field: :status_code) - .register_column(:names, field: :name) - .register_column(:properties, field: :properties) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:types, field: :type) + .register_column(:paths, field: :path) + .register_column(:methods, field: :method) + .register_column(:status_codes, field: :status_code) + .register_column(:names, field: :name) + .register_column(:properties, field: :properties) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_documentation_version.rb b/libraries/aws_api_gateway_documentation_version.rb index 31dbc0ef0..ebd85fbe1 100644 --- a/libraries/aws_api_gateway_documentation_version.rb +++ b/libraries/aws_api_gateway_documentation_version.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayDocumentationVersion < AwsResourceBase - name "aws_api_gateway_documentation_version" - desc "Retrieves API Gateway Documentation Version." + name 'aws_api_gateway_documentation_version' + desc 'Retrieves API Gateway Documentation Version.' example <<-EXAMPLE describe aws_api_gateway_documentation_version(rest_api_id: 'REST_API_ID', documentation_version: 'DOCUMENTATION_VERSION') do it { should exist } @@ -31,7 +31,7 @@ def resource_id end def documentation_version - return nil unless exists? + return unless exists? @res[:documentation_version] end diff --git a/libraries/aws_api_gateway_documentation_versions.rb b/libraries/aws_api_gateway_documentation_versions.rb index ed6f94422..af895717c 100644 --- a/libraries/aws_api_gateway_documentation_versions.rb +++ b/libraries/aws_api_gateway_documentation_versions.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayDocumentationVersions < AwsResourceBase - name "aws_api_gateway_documentation_versions" - desc "Lists all the API Gateway documentation Version." + name 'aws_api_gateway_documentation_versions' + desc 'Lists all the API Gateway documentation Version.' example <<-EXAMPLE describe aws_api_gateway_documentation_versions(rest_api_id: 'REST_API_ID') do it { should exist } @@ -16,10 +16,10 @@ class AWSApiGatewayDocumentationVersions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:versions, field: :version) - .register_column(:created_dates, field: :created_date) - .register_column(:descriptions, field: :description) - .install_filter_methods_on_resource(self, :table) + .register_column(:versions, field: :version) + .register_column(:created_dates, field: :created_date) + .register_column(:descriptions, field: :description) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_domain_name.rb b/libraries/aws_api_gateway_domain_name.rb index 0aaf0c980..e5de61e80 100644 --- a/libraries/aws_api_gateway_domain_name.rb +++ b/libraries/aws_api_gateway_domain_name.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayDomainName < AwsResourceBase - name "aws_api_gateway_domain_name" - desc "Represents a domain name that is contained in a simpler, more intuitive URL that can be called." + name 'aws_api_gateway_domain_name' + desc 'Represents a domain name that is contained in a simpler, more intuitive URL that can be called.' example <<-EXAMPLE describe aws_api_gateway_domain_name(domain_name: 'DOMAIN_NAME') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts = {}) end def resource_id - @res? "#{@res[:domain_name]}_#{@res[:certificate_arn]}" : "" + @res? "#{@res[:domain_name]}_#{@res[:certificate_arn]}" : '' end def exists? @@ -31,7 +31,7 @@ def exists? end def domain_name - return nil unless exists? + return unless exists? @res[:domain_name] end diff --git a/libraries/aws_api_gateway_domain_names.rb b/libraries/aws_api_gateway_domain_names.rb index 2a45e4553..749fdb6d7 100644 --- a/libraries/aws_api_gateway_domain_names.rb +++ b/libraries/aws_api_gateway_domain_names.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayDomainNames < AwsCollectionResourceBase - name "aws_api_gateway_domain_names" - desc "Represents a collection of DomainName resources." + name 'aws_api_gateway_domain_names' + desc 'Represents a collection of DomainName resources.' example <<-EXAMPLE describe aws_api_gateway_domain_names do it { should exist } diff --git a/libraries/aws_api_gateway_method.rb b/libraries/aws_api_gateway_method.rb index 47f6a2436..45368be11 100644 --- a/libraries/aws_api_gateway_method.rb +++ b/libraries/aws_api_gateway_method.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayMethod < AwsResourceBase - name "aws_api_gateway_method" - desc "Describe an existing Method resource." + name 'aws_api_gateway_method' + desc 'Describe an existing Method resource.' example <<-EXAMPLE describe aws_api_gateway_method(rest_api_id: 'REST_API_ID', resource_id: 'RESOURCE_ID', http_method: 'GET') do it { should exist } @@ -25,7 +25,7 @@ def initialize(opts = {}) end def rest_api_id - return nil unless exists? + return unless exists? @res[:rest_api_id] end diff --git a/libraries/aws_api_gateway_methods.rb b/libraries/aws_api_gateway_methods.rb index e9e4142ec..5a9c64f30 100644 --- a/libraries/aws_api_gateway_methods.rb +++ b/libraries/aws_api_gateway_methods.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayMethods < AwsResourceBase - name "aws_api_gateway_methods" - desc "Describe an existing Method resource." + name 'aws_api_gateway_methods' + desc 'Describe an existing Method resource.' example <<-EXAMPLE describe aws_api_gateway_methods(rest_api_id: 'REST_API_ID', resource_id: 'RESOURCE_ID', http_method: 'GET') do it { should exist } @@ -12,18 +12,18 @@ class AWSApiGatewayMethods < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:http_methods, field: :http_method) - .register_column(:authorization_types, field: :authorization_type) - .register_column(:authorizer_ids, field: :authorizer_id) - .register_column(:api_key_required, field: :api_key_required) - .register_column(:request_validator_ids, field: :request_validator_id) - .register_column(:operation_names, field: :operation_name) - .register_column(:request_parameters, field: :request_parameters) - .register_column(:request_models, field: :request_models) - .register_column(:method_responses, field: :method_responses) - .register_column(:method_integrations, field: :method_integration) - .register_column(:authorization_scopes, field: :authorization_scopes) - .install_filter_methods_on_resource(self, :table) + .register_column(:http_methods, field: :http_method) + .register_column(:authorization_types, field: :authorization_type) + .register_column(:authorizer_ids, field: :authorizer_id) + .register_column(:api_key_required, field: :api_key_required) + .register_column(:request_validator_ids, field: :request_validator_id) + .register_column(:operation_names, field: :operation_name) + .register_column(:request_parameters, field: :request_parameters) + .register_column(:request_models, field: :request_models) + .register_column(:method_responses, field: :method_responses) + .register_column(:method_integrations, field: :method_integration) + .register_column(:authorization_scopes, field: :authorization_scopes) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_model.rb b/libraries/aws_api_gateway_model.rb index f3ad3b6ba..20108cad1 100644 --- a/libraries/aws_api_gateway_model.rb +++ b/libraries/aws_api_gateway_model.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayModel < AwsResourceBase - name "aws_api_gateway_model" - desc "Retrieves an API Gateway Model." + name 'aws_api_gateway_model' + desc 'Retrieves an API Gateway Model.' example <<-EXAMPLE describe aws_api_gateway_model(rest_api_id: 'REST_API_ID', model_name: 'MODEL_NAME') do it { should exist } @@ -27,7 +27,7 @@ def exists? end def model_name - return nil unless exists? + return unless exists? @res[:model_name] end diff --git a/libraries/aws_api_gateway_models.rb b/libraries/aws_api_gateway_models.rb index a82692d50..abb496ab5 100644 --- a/libraries/aws_api_gateway_models.rb +++ b/libraries/aws_api_gateway_models.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayModels < AwsResourceBase - name "aws_api_gateway_models" - desc "Lists all the API Gateway models." + name 'aws_api_gateway_models' + desc 'Lists all the API Gateway models.' example <<-EXAMPLE describe aws_api_gateway_models(rest_api_id: 'REST_API_ID') do it { should exist } @@ -12,12 +12,12 @@ class AWSApiGatewayModels < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:content_types, field: :content_type) - .register_column(:descriptions, field: :description) - .register_column(:names, field: :name) - .register_column(:schemas, field: :schema) - .register_column(:ids, field: :id) - .install_filter_methods_on_resource(self, :table) + .register_column(:content_types, field: :content_type) + .register_column(:descriptions, field: :description) + .register_column(:names, field: :name) + .register_column(:schemas, field: :schema) + .register_column(:ids, field: :id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_request_validator.rb b/libraries/aws_api_gateway_request_validator.rb index d2b4f087f..548c05398 100644 --- a/libraries/aws_api_gateway_request_validator.rb +++ b/libraries/aws_api_gateway_request_validator.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayRequestValidator < AwsResourceBase - name "aws_api_gateway_request_validator" - desc "Gets a RequestValidator of a given RestAPI." + name 'aws_api_gateway_request_validator' + desc 'Gets a RequestValidator of a given RestAPI.' example <<-EXAMPLE describe aws_api_gateway_request_validator(rest_api_id: 'REST_API_ID', request_validator_id: 'REQUEST_VALIDATOR_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_request_validators.rb b/libraries/aws_api_gateway_request_validators.rb index 430e4248b..de743eacc 100644 --- a/libraries/aws_api_gateway_request_validators.rb +++ b/libraries/aws_api_gateway_request_validators.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayRequestValidators < AwsCollectionResourceBase - name "aws_api_gateway_request_validators" - desc "Gets the Request Validators collection of a given RestAPI." + name 'aws_api_gateway_request_validators' + desc 'Gets the Request Validators collection of a given RestAPI.' example <<-EXAMPLE describe aws_api_gateway_request_validators(rest_api_id: 'REST_API_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_resource.rb b/libraries/aws_api_gateway_resource.rb index a206084e5..d195d093f 100644 --- a/libraries/aws_api_gateway_resource.rb +++ b/libraries/aws_api_gateway_resource.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayResource < AwsResourceBase - name "aws_api_gateway_resource" - desc "Gets information about a Resource." + name 'aws_api_gateway_resource' + desc 'Gets information about a Resource.' example <<-EXAMPLE describe aws_api_gateway_resource(rest_api_id: 'REST_API_ID', resource_id: 'RESOURCE_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_resources.rb b/libraries/aws_api_gateway_resources.rb index 1779ce798..84e76c782 100644 --- a/libraries/aws_api_gateway_resources.rb +++ b/libraries/aws_api_gateway_resources.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayResources < AwsCollectionResourceBase - name "aws_api_gateway_resources" - desc "Lists information about a collection of Resource resources." + name 'aws_api_gateway_resources' + desc 'Lists information about a collection of Resource resources.' example <<-EXAMPLE describe aws_api_gateway_resources(rest_api_id: 'REST_API_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_response.rb b/libraries/aws_api_gateway_response.rb index d5acc093a..d3ada4c95 100644 --- a/libraries/aws_api_gateway_response.rb +++ b/libraries/aws_api_gateway_response.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayResponse < AwsResourceBase - name "aws_api_gateway_response" - desc "Retrieves API Gateway Response." + name 'aws_api_gateway_response' + desc 'Retrieves API Gateway Response.' example <<-EXAMPLE describe aws_api_gateway_response(rest_api_id: 'REST_API_ID', response_type: 'RESPONSE_TYPE') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts = {}) end def response_type - return nil unless exists? + return unless exists? @res[:response_type] end diff --git a/libraries/aws_api_gateway_responses.rb b/libraries/aws_api_gateway_responses.rb index 873b80ff5..5e61b55ac 100644 --- a/libraries/aws_api_gateway_responses.rb +++ b/libraries/aws_api_gateway_responses.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayResponses < AwsResourceBase - name "aws_api_gateway_responses" - desc "Retrieves API Gateway Responses." + name 'aws_api_gateway_responses' + desc 'Retrieves API Gateway Responses.' example <<-EXAMPLE describe aws_api_gateway_documentation_part(rest_api_id: 'REST_API_ID') do it { should exist } @@ -12,12 +12,12 @@ class AWSApiGatewayResponses < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:response_types, field: :response_type) - .register_column(:status_codes, field: :status_code) - .register_column(:response_parameters, field: :response_parameters) - .register_column(:response_templates, field: :response_templates) - .register_column(:default_responses, field: :default_response) - .install_filter_methods_on_resource(self, :table) + .register_column(:response_types, field: :response_type) + .register_column(:status_codes, field: :status_code) + .register_column(:response_parameters, field: :response_parameters) + .register_column(:response_templates, field: :response_templates) + .register_column(:default_responses, field: :default_response) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -32,8 +32,8 @@ def fetch_data table.items.map { |table_name| { response_type: table_name.response_type, status_code: table_name.status_code, - response_parameters: table_name.response_parameters["String"], - response_templates: table_name.response_templates["String"], + response_parameters: table_name.response_parameters['String'], + response_templates: table_name.response_templates['String'], default_response: table_name.default_response, } } diff --git a/libraries/aws_api_gateway_restapi.rb b/libraries/aws_api_gateway_restapi.rb index abf13d6b8..69866aafd 100644 --- a/libraries/aws_api_gateway_restapi.rb +++ b/libraries/aws_api_gateway_restapi.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayRestApi < AwsResourceBase - name "aws_api_gateway_restapi" - desc "Lists the RestApi resource in the collection." + name 'aws_api_gateway_restapi' + desc 'Lists the RestApi resource in the collection.' example <<-EXAMPLE describe aws_api_gateway_restapi(rest_api_id: 'REST_API_ID') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts = {}) end def rest_api_id - return nil unless exists? + return unless exists? @res[:rest_api_id] end diff --git a/libraries/aws_api_gateway_restapis.rb b/libraries/aws_api_gateway_restapis.rb index 6e54764f4..d1e362f3e 100644 --- a/libraries/aws_api_gateway_restapis.rb +++ b/libraries/aws_api_gateway_restapis.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayRestApis < AwsResourceBase - name "aws_api_gateway_restapis" - desc "Lists the RestApis resources for your collection." + name 'aws_api_gateway_restapis' + desc 'Lists the RestApis resources for your collection.' example <<-EXAMPLE describe aws_api_gateway_restapis do it { should exist } @@ -12,20 +12,20 @@ class AWSApiGatewayRestApis < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:descriptions, field: :description) - .register_column(:created_dates, field: :created_date) - .register_column(:versions, field: :version) - .register_column(:warnings, field: :warnings) - .register_column(:binary_media_types, field: :binary_media_types) - .register_column(:minimum_compression_sizes, field: :minimum_compression_size) - .register_column(:api_key_sources, field: :api_key_source) - .register_column(:endpoint_configurations, field: :endpoint_configuration) - .register_column(:policies, field: :policy) - .register_column(:tags, field: :tags) - .register_column(:disable_execute_api_endpoints, field: :disable_execute_api_endpoint) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:descriptions, field: :description) + .register_column(:created_dates, field: :created_date) + .register_column(:versions, field: :version) + .register_column(:warnings, field: :warnings) + .register_column(:binary_media_types, field: :binary_media_types) + .register_column(:minimum_compression_sizes, field: :minimum_compression_size) + .register_column(:api_key_sources, field: :api_key_source) + .register_column(:endpoint_configurations, field: :endpoint_configuration) + .register_column(:policies, field: :policy) + .register_column(:tags, field: :tags) + .register_column(:disable_execute_api_endpoints, field: :disable_execute_api_endpoint) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_stage.rb b/libraries/aws_api_gateway_stage.rb index 916c768f7..6b37f5b7e 100644 --- a/libraries/aws_api_gateway_stage.rb +++ b/libraries/aws_api_gateway_stage.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayStage < AwsResourceBase - name "aws_api_gateway_stage" - desc "Gets information about a Stage resource." + name 'aws_api_gateway_stage' + desc 'Gets information about a Stage resource.' example <<-EXAMPLE describe aws_api_gateway_stage(rest_api_id: 'REST_API_ID', stage_name: 'STAGE_NAME') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts = {}) end def stage_name - return nil unless exists? + return unless exists? @res[:stage_name] end diff --git a/libraries/aws_api_gateway_stages.rb b/libraries/aws_api_gateway_stages.rb index 935fd6bfb..6d589daa6 100644 --- a/libraries/aws_api_gateway_stages.rb +++ b/libraries/aws_api_gateway_stages.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayStages < AwsResourceBase - name "aws_api_gateway_stages" - desc "Gets information about a Stages collection." + name 'aws_api_gateway_stages' + desc 'Gets information about a Stages collection.' example <<-EXAMPLE describe aws_api_gateway_stages(rest_api_id: 'REST_API_ID') do it { should exist } @@ -12,11 +12,11 @@ class AWSApiGatewayStages < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:stage_names, field: :stage_name) - .register_column(:deployment_ids, field: :deployment_id) - .register_column(:created_dates, field: :created_date) - .register_column(:descriptions, field: :description) - .install_filter_methods_on_resource(self, :table) + .register_column(:stage_names, field: :stage_name) + .register_column(:deployment_ids, field: :deployment_id) + .register_column(:created_dates, field: :created_date) + .register_column(:descriptions, field: :description) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_usage_plan.rb b/libraries/aws_api_gateway_usage_plan.rb index b1b887c15..b3b4f8464 100644 --- a/libraries/aws_api_gateway_usage_plan.rb +++ b/libraries/aws_api_gateway_usage_plan.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayUsagePlan < AwsResourceBase - name "aws_api_gateway_usage_plan" - desc "Gets a usage plan of a given plan identifier." + name 'aws_api_gateway_usage_plan' + desc 'Gets a usage plan of a given plan identifier.' example <<-EXAMPLE describe aws_api_gateway_usage_plan(usage_plan_id: 'USAGE_PLAN_ID') do it { should exist } @@ -31,7 +31,7 @@ def exists? end def usage_plan_id - return nil unless exists? + return unless exists? @res[:id] end diff --git a/libraries/aws_api_gateway_usage_plan_key.rb b/libraries/aws_api_gateway_usage_plan_key.rb index 6d5ec413f..a6f165a37 100644 --- a/libraries/aws_api_gateway_usage_plan_key.rb +++ b/libraries/aws_api_gateway_usage_plan_key.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayUsagePlanKey < AwsResourceBase - name "aws_api_gateway_usage_plan_key" - desc "Gets a usage plan key of a given key identifier." + name 'aws_api_gateway_usage_plan_key' + desc 'Gets a usage plan key of a given key identifier.' example <<-EXAMPLE describe aws_api_gateway_usage_plan_key(usage_plan_id: 'USAGE_PLAN_ID', key_id: 'USAGE_PLAN_KEY_ID') do it { should exist } @@ -27,7 +27,7 @@ def initialize(opts = {}) end def resource_id - "#{@res? @usage_plan_key_id: @display_name}_#{@res? @usage_plan_key_name: ""}" + "#{@res? @usage_plan_key_id: @display_name}_#{@res? @usage_plan_key_name: ''}" end def exists? @@ -35,7 +35,7 @@ def exists? end def key_id - return nil unless exists? + return unless exists? @res[:id] end diff --git a/libraries/aws_api_gateway_usage_plan_keys.rb b/libraries/aws_api_gateway_usage_plan_keys.rb index 6a6c3992f..75cf9380c 100644 --- a/libraries/aws_api_gateway_usage_plan_keys.rb +++ b/libraries/aws_api_gateway_usage_plan_keys.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayUsagePlanKeys < AwsCollectionResourceBase - name "aws_api_gateway_usage_plan_keys" - desc "Gets all the usage plan keys representing the API keys added to a specified usage plan." + name 'aws_api_gateway_usage_plan_keys' + desc 'Gets all the usage plan keys representing the API keys added to a specified usage plan.' example <<-EXAMPLE describe aws_api_gateway_usage_plan_keys(usage_plan_id: 'USAGE_PLAN_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_usage_plans.rb b/libraries/aws_api_gateway_usage_plans.rb index 58320903e..843864d6f 100644 --- a/libraries/aws_api_gateway_usage_plans.rb +++ b/libraries/aws_api_gateway_usage_plans.rb @@ -1,7 +1,7 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayUsagePlans < AwsCollectionResourceBase - name "aws_api_gateway_usage_plans" + name 'aws_api_gateway_usage_plans' desc "Gets all the usage plans of the caller's account." example <<-EXAMPLE describe aws_api_gateway_usage_plans do diff --git a/libraries/aws_api_gateway_v2_api.rb b/libraries/aws_api_gateway_v2_api.rb index d734fcedc..1f3149078 100644 --- a/libraries/aws_api_gateway_v2_api.rb +++ b/libraries/aws_api_gateway_v2_api.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2Api < AwsResourceBase - name "aws_api_gateway_v2_api" - desc "Gets information about the current ApiKey resource." + name 'aws_api_gateway_v2_api' + desc 'Gets information about the current ApiKey resource.' example <<-EXAMPLE describe aws_api_gateway_v2_api(api_id: 'REST_API_ID') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts = {}) end def api_id - return nil unless exists? + return unless exists? @res[:api_id] end diff --git a/libraries/aws_api_gateway_v2_api_mapping.rb b/libraries/aws_api_gateway_v2_api_mapping.rb index 82ee3dfcb..40ae79415 100644 --- a/libraries/aws_api_gateway_v2_api_mapping.rb +++ b/libraries/aws_api_gateway_v2_api_mapping.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2ApiMapping < AwsResourceBase - name "aws_api_gateway_v2_api_mapping" - desc "Gets an API mapping." + name 'aws_api_gateway_v2_api_mapping' + desc 'Gets an API mapping.' example <<-EXAMPLE describe aws_api_gateway_v2_api_mapping(api_mapping_id: 'API_MAPPING_ID', domain_name: 'DOMAIN_NAME') do it { should exist } @@ -24,7 +24,7 @@ def initialize(opts = {}) end def api_mapping_id - return nil unless exists? + return unless exists? @res[:api_mapping_id] end diff --git a/libraries/aws_api_gateway_v2_api_mappings.rb b/libraries/aws_api_gateway_v2_api_mappings.rb index b357ba793..899cef267 100644 --- a/libraries/aws_api_gateway_v2_api_mappings.rb +++ b/libraries/aws_api_gateway_v2_api_mappings.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2ApiMappings < AwsCollectionResourceBase - name "aws_api_gateway_v2_api_mappings" - desc "Gets API mappings." + name 'aws_api_gateway_v2_api_mappings' + desc 'Gets API mappings.' example <<-EXAMPLE describe aws_api_gateway_v2_api_mappings(domain_name: 'DOMAIN_NAME') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_apis.rb b/libraries/aws_api_gateway_v2_apis.rb index 966b7741a..8e07965ad 100644 --- a/libraries/aws_api_gateway_v2_apis.rb +++ b/libraries/aws_api_gateway_v2_apis.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2Apis < AwsCollectionResourceBase - name "aws_api_gateway_v2_apis" - desc "Gets information about the current ApiKeys resource." + name 'aws_api_gateway_v2_apis' + desc 'Gets information about the current ApiKeys resource.' example <<-EXAMPLE describe aws_api_gateway_v2_apis do it { should exist } diff --git a/libraries/aws_api_gateway_v2_authorizer.rb b/libraries/aws_api_gateway_v2_authorizer.rb index 1e733825a..7730efbb7 100644 --- a/libraries/aws_api_gateway_v2_authorizer.rb +++ b/libraries/aws_api_gateway_v2_authorizer.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2Authorizer < AwsResourceBase - name "aws_api_gateway_v2_authorizer" - desc "Gets an Authorizer." + name 'aws_api_gateway_v2_authorizer' + desc 'Gets an Authorizer.' example <<-EXAMPLE describe aws_api_gateway_v2_authorizer(api_id: 'API_ID', authorizer_id: 'AUTHORIZER_ID') do it { should exist } @@ -26,7 +26,7 @@ def initialize(opts = {}) end def authorizer_id - return nil unless exists? + return unless exists? @res[:authorizer_id] end diff --git a/libraries/aws_api_gateway_v2_authorizers.rb b/libraries/aws_api_gateway_v2_authorizers.rb index fe4330755..f8dea5636 100644 --- a/libraries/aws_api_gateway_v2_authorizers.rb +++ b/libraries/aws_api_gateway_v2_authorizers.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2Authorizers < AwsCollectionResourceBase - name "aws_api_gateway_v2_authorizers" - desc "Gets the Authorizers for an API." + name 'aws_api_gateway_v2_authorizers' + desc 'Gets the Authorizers for an API.' example <<-EXAMPLE describe aws_api_gateway_v2_authorizers(api_id: 'APP_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_deployment.rb b/libraries/aws_api_gateway_v2_deployment.rb index 9084d6480..d3fc6bc27 100644 --- a/libraries/aws_api_gateway_v2_deployment.rb +++ b/libraries/aws_api_gateway_v2_deployment.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2Deployment < AwsResourceBase - name "aws_api_gateway_v2_deployment" - desc "Gets a Deployment." + name 'aws_api_gateway_v2_deployment' + desc 'Gets a Deployment.' example <<-EXAMPLE describe aws_api_gateway_v2_deployment(api_id: 'APP_ID', deployment_id: 'DEPLOYMENT_ID') do it { should exist } @@ -27,7 +27,7 @@ def initialize(opts = {}) end def deployment_id - return nil unless exists? + return unless exists? @res[:deployment_id] end diff --git a/libraries/aws_api_gateway_v2_deployments.rb b/libraries/aws_api_gateway_v2_deployments.rb index 47b013a24..e54d310b3 100644 --- a/libraries/aws_api_gateway_v2_deployments.rb +++ b/libraries/aws_api_gateway_v2_deployments.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2Deployments < AwsCollectionResourceBase - name "aws_api_gateway_v2_deployments" - desc "Gets the Deployments for an API." + name 'aws_api_gateway_v2_deployments' + desc 'Gets the Deployments for an API.' example <<-EXAMPLE describe aws_api_gateway_v2_deployments(api_id: 'APP_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_domain_name.rb b/libraries/aws_api_gateway_v2_domain_name.rb index ea08faef5..5e4a65e0b 100644 --- a/libraries/aws_api_gateway_v2_domain_name.rb +++ b/libraries/aws_api_gateway_v2_domain_name.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2DomainName < AwsResourceBase - name "aws_api_gateway_v2_domain_name" - desc "Gets a domain name." + name 'aws_api_gateway_v2_domain_name' + desc 'Gets a domain name.' example <<-EXAMPLE describe aws_api_gateway_v2_domain_name(domain_name: 'DOMAIN_NAME') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts = {}) end def domain_name - return nil unless exists? + return unless exists? @res[:domain_name] end diff --git a/libraries/aws_api_gateway_v2_domain_names.rb b/libraries/aws_api_gateway_v2_domain_names.rb index 0b144ff8d..3953ec1a1 100644 --- a/libraries/aws_api_gateway_v2_domain_names.rb +++ b/libraries/aws_api_gateway_v2_domain_names.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2DomainNames < AwsCollectionResourceBase - name "aws_api_gateway_v2_domain_names" - desc "Gets the domain names for an AWS account." + name 'aws_api_gateway_v2_domain_names' + desc 'Gets the domain names for an AWS account.' example <<-EXAMPLE describe aws_api_gateway_v2_domain_names do it { should exist } diff --git a/libraries/aws_api_gateway_v2_integration.rb b/libraries/aws_api_gateway_v2_integration.rb index 792581681..96b03bafb 100644 --- a/libraries/aws_api_gateway_v2_integration.rb +++ b/libraries/aws_api_gateway_v2_integration.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2Integration < AwsResourceBase - name "aws_api_gateway_v2_integration" - desc "Gets an Integration." + name 'aws_api_gateway_v2_integration' + desc 'Gets an Integration.' example <<-EXAMPLE describe aws_api_gateway_v2_integration(api_id: 'APP_ID', integration_id: 'INTEGRATION_ID') do it { should exist } @@ -27,7 +27,7 @@ def initialize(opts = {}) end def integration_id - return nil unless exists? + return unless exists? @res[:integration_id] end diff --git a/libraries/aws_api_gateway_v2_integration_response.rb b/libraries/aws_api_gateway_v2_integration_response.rb index a88d58ba1..ef189c69c 100644 --- a/libraries/aws_api_gateway_v2_integration_response.rb +++ b/libraries/aws_api_gateway_v2_integration_response.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2IntegrationResponse < AwsResourceBase - name "aws_api_gateway_v2_integration_response" - desc "Gets an IntegrationResponse for an Integration." + name 'aws_api_gateway_v2_integration_response' + desc 'Gets an IntegrationResponse for an Integration.' example <<-EXAMPLE describe aws_api_gateway_v2_integration_response(api_id: 'APP_ID', integration_id: 'INTEGRATION_ID', integration_response_id: 'INTEGRATION_RESPONSE_ID') do it { should exist } @@ -25,7 +25,7 @@ def initialize(opts = {}) end def integration_response_id - return nil unless exists? + return unless exists? @res[:integration_response_id] end diff --git a/libraries/aws_api_gateway_v2_integration_responses.rb b/libraries/aws_api_gateway_v2_integration_responses.rb index a40c8b1ff..59e85c9fe 100644 --- a/libraries/aws_api_gateway_v2_integration_responses.rb +++ b/libraries/aws_api_gateway_v2_integration_responses.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2IntegrationResponses < AwsCollectionResourceBase - name "aws_api_gateway_v2_integration_responses" - desc "Gets the IntegrationResponses for an Integration." + name 'aws_api_gateway_v2_integration_responses' + desc 'Gets the IntegrationResponses for an Integration.' example <<-EXAMPLE describe aws_api_gateway_v2_integration_responses(api_id: 'APP_ID', integration_id: 'INTEGRATION_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_integrations.rb b/libraries/aws_api_gateway_v2_integrations.rb index 7e41262a1..c1ea46010 100644 --- a/libraries/aws_api_gateway_v2_integrations.rb +++ b/libraries/aws_api_gateway_v2_integrations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2Integrations < AwsCollectionResourceBase - name "aws_api_gateway_v2_integrations" - desc "Gets the Integrations for an API." + name 'aws_api_gateway_v2_integrations' + desc 'Gets the Integrations for an API.' example <<-EXAMPLE describe aws_api_gateway_v2_integrations(api_id: 'APP_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_model.rb b/libraries/aws_api_gateway_v2_model.rb index 9abd7d964..b6a9bd3c0 100644 --- a/libraries/aws_api_gateway_v2_model.rb +++ b/libraries/aws_api_gateway_v2_model.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2Model < AwsResourceBase - name "aws_api_gateway_v2_model" - desc "Gets a Model." + name 'aws_api_gateway_v2_model' + desc 'Gets a Model.' example <<-EXAMPLE describe aws_api_gateway_v2_model(api_id: 'APP_ID', model_id: 'MODEL_ID') do it { should exist } @@ -26,7 +26,7 @@ def initialize(opts = {}) end def model_id - return nil unless exists? + return unless exists? @res[:model_id] end diff --git a/libraries/aws_api_gateway_v2_models.rb b/libraries/aws_api_gateway_v2_models.rb index b74775ced..980964961 100644 --- a/libraries/aws_api_gateway_v2_models.rb +++ b/libraries/aws_api_gateway_v2_models.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2Models < AwsCollectionResourceBase - name "aws_api_gateway_v2_models" - desc "Gets the Models for an API." + name 'aws_api_gateway_v2_models' + desc 'Gets the Models for an API.' example <<-EXAMPLE describe aws_api_gateway_v2_models(api_id: 'APP_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_route.rb b/libraries/aws_api_gateway_v2_route.rb index 0557b0cb2..6432b02d9 100644 --- a/libraries/aws_api_gateway_v2_route.rb +++ b/libraries/aws_api_gateway_v2_route.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2Route < AwsResourceBase - name "aws_api_gateway_v2_route" - desc "Gets a Route." + name 'aws_api_gateway_v2_route' + desc 'Gets a Route.' example <<-EXAMPLE describe aws_api_gateway_v2_route(api_id: 'APP_ID', route_id: 'ROUTE_ID') do it { should exist } @@ -24,7 +24,7 @@ def initialize(opts = {}) end def route_id - return nil unless exists? + return unless exists? @res[:route_id] end diff --git a/libraries/aws_api_gateway_v2_routes.rb b/libraries/aws_api_gateway_v2_routes.rb index 6dd37b937..d55296fca 100644 --- a/libraries/aws_api_gateway_v2_routes.rb +++ b/libraries/aws_api_gateway_v2_routes.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsApiGatewayV2Routes < AwsCollectionResourceBase - name "aws_api_gateway_v2_routes" - desc "Gets the Routes for an API." + name 'aws_api_gateway_v2_routes' + desc 'Gets the Routes for an API.' example <<-EXAMPLE describe aws_api_gateway_v2_routes(api_id: 'APP_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_vpc_link.rb b/libraries/aws_api_gateway_vpc_link.rb index 18d06982e..e3d820973 100644 --- a/libraries/aws_api_gateway_vpc_link.rb +++ b/libraries/aws_api_gateway_vpc_link.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayVPCLink < AwsResourceBase - name "aws_api_gateway_vpc_link" - desc "Gets a specified VPC link under the callers account in a region." + name 'aws_api_gateway_vpc_link' + desc 'Gets a specified VPC link under the callers account in a region.' example <<-EXAMPLE describe aws_api_gateway_vpc_link(vpc_link_id: 'VPC_LINK_ID') do it { should exist } @@ -31,7 +31,7 @@ def exists? end def vpc_link_id - return nil unless exists? + return unless exists? @res[:id] end diff --git a/libraries/aws_api_gateway_vpc_links.rb b/libraries/aws_api_gateway_vpc_links.rb index e374f9858..783582514 100644 --- a/libraries/aws_api_gateway_vpc_links.rb +++ b/libraries/aws_api_gateway_vpc_links.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayVPCLinks < AwsCollectionResourceBase - name "aws_api_gateway_vpc_links" - desc "Gets the VpcLinks collection under the callers account in a selected region." + name 'aws_api_gateway_vpc_links' + desc 'Gets the VpcLinks collection under the callers account in a selected region.' example <<-EXAMPLE describe aws_api_gateway_vpc_links do it { should exist } diff --git a/libraries/aws_apigateway_account.rb b/libraries/aws_apigateway_account.rb index a55aeaa0f..50e2058a1 100644 --- a/libraries/aws_apigateway_account.rb +++ b/libraries/aws_apigateway_account.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayAccount < AwsResourceBase - name "aws_apigateway_account" - desc "Gets information about the current Account resource." + name 'aws_apigateway_account' + desc 'Gets information about the current Account resource.' example <<-EXAMPLE describe aws_apigateway_account do it { should exist } @@ -20,7 +20,7 @@ def initialize(opts = {}) end def resource_id - @res? @res[:cloudwatch_role_arn] : "" + @res? @res[:cloudwatch_role_arn] : '' end def exists? diff --git a/libraries/aws_apigateway_api_key.rb b/libraries/aws_apigateway_api_key.rb index f6157f96e..96e96d378 100644 --- a/libraries/aws_apigateway_api_key.rb +++ b/libraries/aws_apigateway_api_key.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayAPIKey < AwsResourceBase - name "aws_apigateway_api_key" - desc "Gets information about the current ApiKey resource." + name 'aws_apigateway_api_key' + desc 'Gets information about the current ApiKey resource.' example <<-EXAMPLE describe aws_apigateway_api_key(api_key: 'API_ID') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts = {}) end def api_key - return nil unless exists? + return unless exists? @res[:api_key] end diff --git a/libraries/aws_apigateway_api_keys.rb b/libraries/aws_apigateway_api_keys.rb index 5816c8cdc..40cbebcdf 100644 --- a/libraries/aws_apigateway_api_keys.rb +++ b/libraries/aws_apigateway_api_keys.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayAPIKeys < AwsResourceBase - name "aws_apigateway_api_keys" - desc "Gets information about the current ApiKeys resource." + name 'aws_apigateway_api_keys' + desc 'Gets information about the current ApiKeys resource.' example <<-EXAMPLE describe aws_apigateway_api_keys do it { should exist } @@ -12,17 +12,17 @@ class AWSApiGatewayAPIKeys < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:values, field: :value) - .register_column(:names, field: :name) - .register_column(:customer_ids, field: :customer_id) - .register_column(:descriptions, field: :description) - .register_column(:enabled, field: :enabled) - .register_column(:created_dates, field: :created_date) - .register_column(:last_updated_dates, field: :last_updated_date) - .register_column(:stage_keys, field: :stage_keys) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:values, field: :value) + .register_column(:names, field: :name) + .register_column(:customer_ids, field: :customer_id) + .register_column(:descriptions, field: :description) + .register_column(:enabled, field: :enabled) + .register_column(:created_dates, field: :created_date) + .register_column(:last_updated_dates, field: :last_updated_date) + .register_column(:stage_keys, field: :stage_keys) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_apigateway_authorizer.rb b/libraries/aws_apigateway_authorizer.rb index c1b510420..05b6a16a8 100644 --- a/libraries/aws_apigateway_authorizer.rb +++ b/libraries/aws_apigateway_authorizer.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayAuthorizer < AwsResourceBase - name "aws_apigateway_authorizer" - desc "Describe an existing Authorizer resource." + name 'aws_apigateway_authorizer' + desc 'Describe an existing Authorizer resource.' example <<-EXAMPLE describe aws_apigateway_authorizer(rest_api_id: 'REST_API_ID', authorizer_id: 'AUTHORIZER_ID') do it { should exist } @@ -25,7 +25,7 @@ def initialize(opts = {}) end def authorizer_id - return nil unless exists? + return unless exists? @res[:authorizer_id] end diff --git a/libraries/aws_apigateway_authorizers.rb b/libraries/aws_apigateway_authorizers.rb index e7154002c..f5995ae1f 100644 --- a/libraries/aws_apigateway_authorizers.rb +++ b/libraries/aws_apigateway_authorizers.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayAuthorizers < AwsResourceBase - name "aws_apigateway_authorizers" - desc "Describes the list of Authorizers resource." + name 'aws_apigateway_authorizers' + desc 'Describes the list of Authorizers resource.' example <<-EXAMPLE describe aws_apigateway_authorizers(rest_api_id: 'REST_API_ID') do it { should exist } @@ -12,17 +12,17 @@ class AWSApiGatewayAuthorizers < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:types, field: :type) - .register_column(:provider_arns, field: :provider_arns) - .register_column(:auth_types, field: :auth_type) - .register_column(:authorizer_uris, field: :authorizer_uri) - .register_column(:authorizer_credentials, field: :authorizer_credentials) - .register_column(:identity_sources, field: :identity_source) - .register_column(:identity_validation_expressions, field: :identity_validation_expression) - .register_column(:authorizer_result_ttl_in_seconds, field: :authorizer_result_ttl_in_seconds) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:types, field: :type) + .register_column(:provider_arns, field: :provider_arns) + .register_column(:auth_types, field: :auth_type) + .register_column(:authorizer_uris, field: :authorizer_uri) + .register_column(:authorizer_credentials, field: :authorizer_credentials) + .register_column(:identity_sources, field: :identity_source) + .register_column(:identity_validation_expressions, field: :identity_validation_expression) + .register_column(:authorizer_result_ttl_in_seconds, field: :authorizer_result_ttl_in_seconds) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_apigateway_base_path_mapping.rb b/libraries/aws_apigateway_base_path_mapping.rb index 237e71d2e..dab3554d4 100644 --- a/libraries/aws_apigateway_base_path_mapping.rb +++ b/libraries/aws_apigateway_base_path_mapping.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayBasePathMapping < AwsResourceBase - name "aws_apigateway_base_path_mapping" - desc "Describe a BasePathMapping resource." + name 'aws_apigateway_base_path_mapping' + desc 'Describe a BasePathMapping resource.' example <<-EXAMPLE describe aws_apigateway_base_path_mapping(domain_name: 'DOMAIN_NAME', base_path: 'BASE_PATH') do it { should exist } @@ -25,7 +25,7 @@ def initialize(opts = {}) end def base_path - return nil unless exists? + return unless exists? @res[:base_path] end diff --git a/libraries/aws_apigateway_base_path_mappings.rb b/libraries/aws_apigateway_base_path_mappings.rb index ab17b3c1b..d5f6354e7 100644 --- a/libraries/aws_apigateway_base_path_mappings.rb +++ b/libraries/aws_apigateway_base_path_mappings.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayBasePathMappings < AwsResourceBase - name "aws_apigateway_base_path_mappings" - desc "Represents a collection of BasePathMapping resources." + name 'aws_apigateway_base_path_mappings' + desc 'Represents a collection of BasePathMapping resources.' example <<-EXAMPLE describe aws_apigateway_base_path_mappings(domain_name: 'DOMAIN_NAME') do it { should exist } @@ -12,10 +12,10 @@ class AWSApiGatewayBasePathMappings < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:base_paths, field: :base_path) - .register_column(:rest_api_ids, field: :rest_api_id) - .register_column(:stages, field: :stage) - .install_filter_methods_on_resource(self, :table) + .register_column(:base_paths, field: :base_path) + .register_column(:rest_api_ids, field: :rest_api_id) + .register_column(:stages, field: :stage) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_apigateway_client_certificate.rb b/libraries/aws_apigateway_client_certificate.rb index ebf695ef8..825dac38a 100644 --- a/libraries/aws_apigateway_client_certificate.rb +++ b/libraries/aws_apigateway_client_certificate.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayClientCertificate < AwsResourceBase - name "aws_apigateway_client_certificate" - desc "Gets information about the current ClientCertificate resource." + name 'aws_apigateway_client_certificate' + desc 'Gets information about the current ClientCertificate resource.' example <<-EXAMPLE describe aws_apigateway_client_certificate(client_certificate_id: 'CLIENT_CERTIFICATE_ID') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts = {}) end def client_certificate_id - return nil unless exists? + return unless exists? @res[:client_certificate_id] end diff --git a/libraries/aws_apigateway_client_certificates.rb b/libraries/aws_apigateway_client_certificates.rb index e588190b4..218c5a127 100644 --- a/libraries/aws_apigateway_client_certificates.rb +++ b/libraries/aws_apigateway_client_certificates.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApiGatewayClientCertificates < AwsResourceBase - name "aws_apigateway_client_certificates" - desc "Gets a collection of Client Certificate resources." + name 'aws_apigateway_client_certificates' + desc 'Gets a collection of Client Certificate resources.' example <<-EXAMPLE describe aws_apigateway_client_certificates do it { should exist } @@ -12,13 +12,13 @@ class AWSApiGatewayClientCertificates < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:client_certificate_ids, field: :client_certificate_id) - .register_column(:descriptions, field: :description) - .register_column(:pem_encoded_certificates, field: :pem_encoded_certificate) - .register_column(:created_dates, field: :created_date) - .register_column(:expiration_dates, field: :expiration_date) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:client_certificate_ids, field: :client_certificate_id) + .register_column(:descriptions, field: :description) + .register_column(:pem_encoded_certificates, field: :pem_encoded_certificate) + .register_column(:created_dates, field: :created_date) + .register_column(:expiration_dates, field: :expiration_date) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_application_autoscaling_scalable_target.rb b/libraries/aws_application_autoscaling_scalable_target.rb index 971dad38a..8db662cf6 100644 --- a/libraries/aws_application_autoscaling_scalable_target.rb +++ b/libraries/aws_application_autoscaling_scalable_target.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApplicationAutoScalingScalableTarget < AwsResourceBase - name "aws_application_autoscaling_scalable_target" - desc "Gets information about the scalable targets in the specified namespace." + name 'aws_application_autoscaling_scalable_target' + desc 'Gets information about the scalable targets in the specified namespace.' example <<-EXAMPLE describe aws_application_autoscaling_scalable_target(service_namespace: 'ec2') do it { should exist } @@ -23,12 +23,12 @@ def initialize(opts = {}) end def service_namespace - return nil unless exists? + return unless exists? @scalable_targets[:service_namespace] end def resource_id - @scalable_targets? @scalable_targets[:resource_id]: "" + @scalable_targets? @scalable_targets[:resource_id]: '' end def exists? diff --git a/libraries/aws_application_autoscaling_scalable_targets.rb b/libraries/aws_application_autoscaling_scalable_targets.rb index 21df3fd57..394016f9f 100644 --- a/libraries/aws_application_autoscaling_scalable_targets.rb +++ b/libraries/aws_application_autoscaling_scalable_targets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApplicationAutoScalingScalableTargets < AwsResourceBase - name "aws_application_autoscaling_scalable_targets" - desc "Gets information about the scalable targets in the specified namespace." + name 'aws_application_autoscaling_scalable_targets' + desc 'Gets information about the scalable targets in the specified namespace.' example <<-EXAMPLE describe aws_application_autoscaling_scalable_targets(service_namespace: 'ec2') do it { should exist } @@ -12,15 +12,15 @@ class AWSApplicationAutoScalingScalableTargets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:service_namespaces, field: :service_namespace) - .register_column(:resource_ids, field: :resource_id) - .register_column(:scalable_dimensions, field: :scalable_dimension) - .register_column(:min_capacities, field: :min_capacity) - .register_column(:max_capacities, field: :max_capacity) - .register_column(:role_arns, field: :role_arn) - .register_column(:creation_times, field: :creation_time) - .register_column(:suspended_states, field: :suspended_state) - .install_filter_methods_on_resource(self, :table) + .register_column(:service_namespaces, field: :service_namespace) + .register_column(:resource_ids, field: :resource_id) + .register_column(:scalable_dimensions, field: :scalable_dimension) + .register_column(:min_capacities, field: :min_capacity) + .register_column(:max_capacities, field: :max_capacity) + .register_column(:role_arns, field: :role_arn) + .register_column(:creation_times, field: :creation_time) + .register_column(:suspended_states, field: :suspended_state) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_application_autoscaling_scaling_policies.rb b/libraries/aws_application_autoscaling_scaling_policies.rb index 40c00f94e..f0aaf39e0 100644 --- a/libraries/aws_application_autoscaling_scaling_policies.rb +++ b/libraries/aws_application_autoscaling_scaling_policies.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApplicationAutoScalingScalingPolicies < AwsResourceBase - name "aws_application_autoscaling_scaling_policies" - desc "Describes the Application AutoScaling scaling policies for the specified service namespace." + name 'aws_application_autoscaling_scaling_policies' + desc 'Describes the Application AutoScaling scaling policies for the specified service namespace.' example <<-EXAMPLE describe aws_application_autoscaling_scaling_policies(service_namespace: 'ec2') do it { should exist } @@ -12,17 +12,17 @@ class AWSApplicationAutoScalingScalingPolicies < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:policy_arns, field: :policy_arn) - .register_column(:policy_names, field: :policy_name) - .register_column(:service_namespaces, field: :service_namespace) - .register_column(:resource_ids, field: :resource_id) - .register_column(:scalable_dimensions, field: :scalable_dimension) - .register_column(:policy_types, field: :policy_type) - .register_column(:step_scaling_policy_configurations, field: :step_scaling_policy_configuration) - .register_column(:target_tracking_scaling_policy_configurations, field: :target_tracking_scaling_policy_configuration) - .register_column(:alarms, field: :alarms) - .register_column(:creation_times, field: :creation_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:policy_arns, field: :policy_arn) + .register_column(:policy_names, field: :policy_name) + .register_column(:service_namespaces, field: :service_namespace) + .register_column(:resource_ids, field: :resource_id) + .register_column(:scalable_dimensions, field: :scalable_dimension) + .register_column(:policy_types, field: :policy_type) + .register_column(:step_scaling_policy_configurations, field: :step_scaling_policy_configuration) + .register_column(:target_tracking_scaling_policy_configurations, field: :target_tracking_scaling_policy_configuration) + .register_column(:alarms, field: :alarms) + .register_column(:creation_times, field: :creation_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_application_autoscaling_scaling_policy.rb b/libraries/aws_application_autoscaling_scaling_policy.rb index 7f07583b5..294f5f178 100644 --- a/libraries/aws_application_autoscaling_scaling_policy.rb +++ b/libraries/aws_application_autoscaling_scaling_policy.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSApplicationAutoScalingScalingPolicy < AwsResourceBase - name "aws_application_autoscaling_scaling_policy" - desc "Describes the Application AutoScaling scaling policies for the specified service namespace." + name 'aws_application_autoscaling_scaling_policy' + desc 'Describes the Application AutoScaling scaling policies for the specified service namespace.' example <<-EXAMPLE describe aws_application_autoscaling_scaling_policy(service_namespace: 'ec2') do it { should exist } @@ -24,12 +24,12 @@ def initialize(opts = {}) end def service_namespace - return nil unless exists? + return unless exists? @scaling_policies[:service_namespace] end def resource_id - @scaling_policies ? @scaling_policies[:resource_id]: "" + @scaling_policies ? @scaling_policies[:resource_id]: '' end def exists? diff --git a/libraries/aws_athena_work_group.rb b/libraries/aws_athena_work_group.rb index a92f95613..5f5255b87 100644 --- a/libraries/aws_athena_work_group.rb +++ b/libraries/aws_athena_work_group.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSAthenaWorkGroup < AwsResourceBase - name "aws_athena_work_group" - desc "Returns information about the workgroup with the specified name." + name 'aws_athena_work_group' + desc 'Returns information about the workgroup with the specified name.' example <<-EXAMPLE describe aws_athena_work_group(work_group: 'ATHENA_WORK_GROUP') do it { should exist } @@ -24,7 +24,7 @@ def initialize(opts = {}) end def work_group - return nil unless exists? + return unless exists? @work_group[:work_group] end diff --git a/libraries/aws_athena_work_groups.rb b/libraries/aws_athena_work_groups.rb index ea2bdb479..915433d8e 100644 --- a/libraries/aws_athena_work_groups.rb +++ b/libraries/aws_athena_work_groups.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSAthenaWorkGroups < AwsResourceBase - name "aws_athena_work_groups" - desc "Lists available workgroups for the account." + name 'aws_athena_work_groups' + desc 'Lists available workgroups for the account.' example <<-EXAMPLE describe aws_athena_work_groups do it { should exist } @@ -12,11 +12,11 @@ class AWSAthenaWorkGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:states, field: :state) - .register_column(:descriptions, field: :description) - .register_column(:creation_times, field: :creation_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:states, field: :state) + .register_column(:descriptions, field: :description) + .register_column(:creation_times, field: :creation_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_auto_scaling_group.rb b/libraries/aws_auto_scaling_group.rb index 3450bb79c..2642d585a 100644 --- a/libraries/aws_auto_scaling_group.rb +++ b/libraries/aws_auto_scaling_group.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsAutoScalingGroup < AwsResourceBase - name "aws_auto_scaling_group" - desc "Verifies settings for an AWS Auto Scaling Group." + name 'aws_auto_scaling_group' + desc 'Verifies settings for an AWS Auto Scaling Group.' example <<-EXAMPLE describe aws_auto_scaling_group('AUTO_SCALING_GROUP_NAME') do it { should exist } @@ -19,13 +19,13 @@ def initialize(opts = {}) catch_aws_errors do resp = @aws.service_client.describe_auto_scaling_groups(auto_scaling_group_names: [opts[:auto_scaling_group_name]]) - return nil if resp.auto_scaling_groups.nil? || resp.auto_scaling_groups.empty? + return if resp.auto_scaling_groups.nil? || resp.auto_scaling_groups.empty? auto_scaling_group = resp.auto_scaling_groups[0] @name = auto_scaling_group[:auto_scaling_group_name] @min_size = auto_scaling_group[:min_size].to_i @max_size = auto_scaling_group[:max_size].to_i @desired_capacity = auto_scaling_group[:desired_capacity].to_i - @vpc_zone_identifier = auto_scaling_group[:vpc_zone_identifier].split(",") + @vpc_zone_identifier = auto_scaling_group[:vpc_zone_identifier].split(',') @launch_configuration_name = auto_scaling_group[:launch_configuration_name] @health_check_type = auto_scaling_group[:health_check_type] @tags = [] diff --git a/libraries/aws_auto_scaling_groups.rb b/libraries/aws_auto_scaling_groups.rb index 5f03f3bac..5d44c923f 100644 --- a/libraries/aws_auto_scaling_groups.rb +++ b/libraries/aws_auto_scaling_groups.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsAutoScalingGroups < AwsResourceBase - name "aws_auto_scaling_groups" - desc "Verifies settings for a collection AWS Auto Scaling Groups." + name 'aws_auto_scaling_groups' + desc 'Verifies settings for a collection AWS Auto Scaling Groups.' example <<-EXAMPLE describe aws_auto_scaling_groups do it { should exist } @@ -12,15 +12,15 @@ class AwsAutoScalingGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:min_sizes, field: :min_size) - .register_column(:max_sizes, field: :max_size) - .register_column(:desired_capacities, field: :desired_capacity) - .register_column(:vpc_zone_identifiers, field: :vpc_zone_identifier) - .register_column(:launch_configuration_names, field: :launch_configuration_name) - .register_column(:health_check_types, field: :health_check_type) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:min_sizes, field: :min_size) + .register_column(:max_sizes, field: :max_size) + .register_column(:desired_capacities, field: :desired_capacity) + .register_column(:vpc_zone_identifiers, field: :vpc_zone_identifier) + .register_column(:launch_configuration_names, field: :launch_configuration_name) + .register_column(:health_check_types, field: :health_check_type) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -38,7 +38,7 @@ def fetch_data min_size: group[:min_size].to_i, max_size: group[:max_size].to_i, desired_capacity: group[:desired_capacity].to_i, - vpc_zone_identifier: group[:vpc_zone_identifier].split(","), + vpc_zone_identifier: group[:vpc_zone_identifier].split(','), launch_configuration_name: group[:launch_configuration_name], health_check_type: group[:health_check_type], tags: group[:tags].map { |tag| diff --git a/libraries/aws_autoscaling_scaling_policies.rb b/libraries/aws_autoscaling_scaling_policies.rb index 1f12267d1..edefd456a 100644 --- a/libraries/aws_autoscaling_scaling_policies.rb +++ b/libraries/aws_autoscaling_scaling_policies.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSAutoScalingScalingPolicies < AwsResourceBase - name "aws_autoscaling_scaling_policies" - desc "Describes the policies for the specified Auto Scaling group." + name 'aws_autoscaling_scaling_policies' + desc 'Describes the policies for the specified Auto Scaling group.' example <<-EXAMPLE describe aws_autoscaling_scaling_policies do it { should exist } @@ -12,20 +12,20 @@ class AWSAutoScalingScalingPolicies < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:auto_scaling_group_names, field: :auto_scaling_group_name) - .register_column(:policy_names, field: :policy_name) - .register_column(:policy_arns, field: :policy_arn) - .register_column(:policy_types, field: :policy_type) - .register_column(:adjustment_types, field: :adjustment_type) - .register_column(:min_adjustment_steps, field: :min_adjustment_step) - .register_column(:min_adjustment_magnitudes, field: :min_adjustment_magnitude) - .register_column(:scaling_adjustments, field: :scaling_adjustment) - .register_column(:cooldowns, field: :cooldown) - .register_column(:step_adjustments, field: :step_adjustments) - .register_column(:metric_aggregation_types, field: :metric_aggregation_type) - .register_column(:estimated_instance_warmups, field: :estimated_instance_warmup) - .register_column(:target_tracking_configurations, field: :target_tracking_configuration) - .install_filter_methods_on_resource(self, :table) + .register_column(:auto_scaling_group_names, field: :auto_scaling_group_name) + .register_column(:policy_names, field: :policy_name) + .register_column(:policy_arns, field: :policy_arn) + .register_column(:policy_types, field: :policy_type) + .register_column(:adjustment_types, field: :adjustment_type) + .register_column(:min_adjustment_steps, field: :min_adjustment_step) + .register_column(:min_adjustment_magnitudes, field: :min_adjustment_magnitude) + .register_column(:scaling_adjustments, field: :scaling_adjustment) + .register_column(:cooldowns, field: :cooldown) + .register_column(:step_adjustments, field: :step_adjustments) + .register_column(:metric_aggregation_types, field: :metric_aggregation_type) + .register_column(:estimated_instance_warmups, field: :estimated_instance_warmup) + .register_column(:target_tracking_configurations, field: :target_tracking_configuration) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_autoscaling_scaling_policy.rb b/libraries/aws_autoscaling_scaling_policy.rb index 80e63fbcc..df22febe8 100644 --- a/libraries/aws_autoscaling_scaling_policy.rb +++ b/libraries/aws_autoscaling_scaling_policy.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSAutoScalingScalingPolicy < AwsResourceBase - name "aws_autoscaling_scaling_policy" - desc "Describes the policies for the specified Auto Scaling group." + name 'aws_autoscaling_scaling_policy' + desc 'Describes the policies for the specified Auto Scaling group.' example <<-EXAMPLE describe aws_autoscaling_scaling_policy(auto_scaling_group_name: 'AUTO_SCALING_GROUP_NAME') do it { should exist } @@ -25,7 +25,7 @@ def initialize(opts = {}) end def auto_scaling_group_name - return nil unless exists? + return unless exists? @scaling_policies[:auto_scaling_group_name] end diff --git a/libraries/aws_backend.rb b/libraries/aws_backend.rb index 5d2bd7c0b..48f661611 100644 --- a/libraries/aws_backend.rb +++ b/libraries/aws_backend.rb @@ -1,67 +1,67 @@ -require "active_support" -require "active_support/core_ext/string" - -require "aws-sdk-autoscaling" -require "aws-sdk-batch" -require "aws-sdk-cloudformation" -require "aws-sdk-cloudfront" -require "aws-sdk-cloudtrail" -require "aws-sdk-cloudwatch" -require "aws-sdk-cloudwatchlogs" -require "aws-sdk-configservice" -require "aws-sdk-core" -require "aws-sdk-dynamodb" -require "aws-sdk-ec2" -require "aws-sdk-ecr" -require "aws-sdk-ecrpublic" -require "aws-sdk-ecs" -require "aws-sdk-eks" -require "aws-sdk-elasticache" -require "aws-sdk-elasticloadbalancing" -require "aws-sdk-elasticloadbalancingv2" -require "aws-sdk-guardduty" -require "aws-sdk-iam" -require "aws-sdk-kms" -require "aws-sdk-lambda" -require "aws-sdk-organizations" -require "aws-sdk-rds" -require "aws-sdk-route53" -require "aws-sdk-s3" -require "aws-sdk-shield" -require "aws-sdk-sns" -require "aws-sdk-sqs" -require "aws-sdk-efs" -require "aws-sdk-ssm" -require "rspec/expectations" -require "aws-sdk-transfer" -require "aws-sdk-elasticsearchservice" -require "aws-sdk-cognitoidentity" -require "aws-sdk-redshift" -require "aws-sdk-athena" -require "aws-sdk-applicationautoscaling" -require "aws-sdk-cognitoidentityprovider" -require "aws-sdk-apigateway" -require "aws-sdk-databasemigrationservice" -require "aws-sdk-route53resolver" -require "aws-sdk-servicecatalog" -require "aws-sdk-glue" -require "aws-sdk-eventbridge" -require "aws-sdk-states" -require "aws-sdk-ram" -require "aws-sdk-secretsmanager" -require "aws-sdk-networkfirewall" -require "aws-sdk-mq" -require "aws-sdk-networkmanager" -require "aws-sdk-signer" -require "aws-sdk-amplify" -require "aws-sdk-simpledb" -require "aws-sdk-emr" -require "aws-sdk-securityhub" -require "aws-sdk-ses" -require "aws-sdk-waf" -require "aws-sdk-synthetics" -require "aws-sdk-apigatewayv2" -require "aws-sdk-account" +require 'active_support' +require 'active_support/core_ext/string' + +require 'aws-sdk-autoscaling' +require 'aws-sdk-batch' +require 'aws-sdk-cloudformation' +require 'aws-sdk-cloudfront' +require 'aws-sdk-cloudtrail' +require 'aws-sdk-cloudwatch' +require 'aws-sdk-cloudwatchlogs' +require 'aws-sdk-configservice' +require 'aws-sdk-core' +require 'aws-sdk-dynamodb' +require 'aws-sdk-ec2' +require 'aws-sdk-ecr' +require 'aws-sdk-ecrpublic' +require 'aws-sdk-ecs' +require 'aws-sdk-eks' +require 'aws-sdk-elasticache' +require 'aws-sdk-elasticloadbalancing' +require 'aws-sdk-elasticloadbalancingv2' +require 'aws-sdk-guardduty' +require 'aws-sdk-iam' +require 'aws-sdk-kms' +require 'aws-sdk-lambda' +require 'aws-sdk-organizations' +require 'aws-sdk-rds' +require 'aws-sdk-route53' +require 'aws-sdk-s3' +require 'aws-sdk-shield' +require 'aws-sdk-sns' +require 'aws-sdk-sqs' +require 'aws-sdk-efs' +require 'aws-sdk-ssm' +require 'rspec/expectations' +require 'aws-sdk-transfer' +require 'aws-sdk-elasticsearchservice' +require 'aws-sdk-cognitoidentity' +require 'aws-sdk-redshift' +require 'aws-sdk-athena' +require 'aws-sdk-applicationautoscaling' +require 'aws-sdk-cognitoidentityprovider' +require 'aws-sdk-apigateway' +require 'aws-sdk-databasemigrationservice' +require 'aws-sdk-route53resolver' +require 'aws-sdk-servicecatalog' +require 'aws-sdk-glue' +require 'aws-sdk-eventbridge' +require 'aws-sdk-states' +require 'aws-sdk-ram' +require 'aws-sdk-secretsmanager' +require 'aws-sdk-networkfirewall' +require 'aws-sdk-mq' +require 'aws-sdk-networkmanager' +require 'aws-sdk-signer' +require 'aws-sdk-amplify' +require 'aws-sdk-simpledb' +require 'aws-sdk-emr' +require 'aws-sdk-securityhub' +require 'aws-sdk-ses' +require 'aws-sdk-waf' +require 'aws-sdk-synthetics' +require 'aws-sdk-apigatewayv2' +require 'aws-sdk-account' # AWS Inspec Backend Classes # @@ -362,8 +362,8 @@ def initialize(opts) client_args[:client_args][:endpoint] = opts[:aws_endpoint] if opts[:aws_endpoint] # below allows each resource to optionally and conveniently set max_retries and retry_backoff env_hash = ENV.map { |k, v| [k.downcase, v] }.to_h - opts[:aws_retry_limit]= env_hash["aws_retry_limit"].to_i if !opts[:aws_retry_limit] && env_hash["aws_retry_limit"] - opts[:aws_retry_backoff]= env_hash["aws_retry_backoff"].to_i if !opts[:aws_retry_backoff] && env_hash["aws_retry_backoff"] + opts[:aws_retry_limit]= env_hash['aws_retry_limit'].to_i if !opts[:aws_retry_limit] && env_hash['aws_retry_limit'] + opts[:aws_retry_backoff]= env_hash['aws_retry_backoff'].to_i if !opts[:aws_retry_backoff] && env_hash['aws_retry_backoff'] client_args[:client_args][:retry_limit] = opts[:aws_retry_limit] if opts[:aws_retry_limit] client_args[:client_args][:retry_backoff] = "lambda { |c| sleep(#{opts[:aws_retry_backoff]}) }" if opts[:aws_retry_backoff] # this catches the stub_data true option for unit testing - and others that could be useful for consumers @@ -378,9 +378,9 @@ def initialize(opts) # here we might want to inject stub data for testing, let's use an option for that return if !defined?(@opts.keys) || !@opts.include?(:stub_data) - raise ArgumentError, "Expected stub data to be an array" if !opts[:stub_data].is_a?(Array) + raise ArgumentError, 'Expected stub data to be an array' if !opts[:stub_data].is_a?(Array) opts[:stub_data].each do |stub| - raise ArgumentError, "Expect each stub_data hash to have :client, :method and :data keys" if !stub.keys.all? { |a| %i(method data client).include?(a) } + raise ArgumentError, 'Expect each stub_data hash to have :client, :method and :data keys' if !stub.keys.all? { |a| %i(method data client).include?(a) } @aws.aws_client(stub[:client]).stub_responses(stub[:method], stub[:data]) end end @@ -393,20 +393,20 @@ def initialize(opts) def validate_parameters(allow: [], required: nil, require_any_of: nil) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity if required raise ArgumentError, "Expected required parameters as Array of Symbols, got #{required}" unless required.is_a?(Array) && required.all? { |r| r.is_a?(Symbol) } - raise ArgumentError, "#{@__resource_name__}: `#{required}` must be provided" unless @opts.is_a?(Hash) && required.all? { |req| @opts.key?(req) && !@opts[req].nil? && @opts[req] != "" } + raise ArgumentError, "#{@__resource_name__}: `#{required}` must be provided" unless @opts.is_a?(Hash) && required.all? { |req| @opts.key?(req) && !@opts[req].nil? && @opts[req] != '' } allow += required end if require_any_of raise ArgumentError, "Expected required parameters as Array of Symbols, got #{require_any_of}" unless require_any_of.is_a?(Array) && require_any_of.all? { |r| r.is_a?(Symbol) } - raise ArgumentError, "#{@__resource_name__}: One of `#{require_any_of}` must be provided." unless @opts.is_a?(Hash) && require_any_of.any? { |req| @opts.key?(req) && !@opts[req].nil? && @opts[req] != "" } + raise ArgumentError, "#{@__resource_name__}: One of `#{require_any_of}` must be provided." unless @opts.is_a?(Hash) && require_any_of.any? { |req| @opts.key?(req) && !@opts[req].nil? && @opts[req] != '' } allow += require_any_of end allow += %i(client_args stub_data aws_region aws_endpoint aws_retry_limit aws_retry_backoff resource_data) - raise ArgumentError, "Scalar arguments not supported" unless defined?(@opts.keys) - raise ArgumentError, "Unexpected arguments found" unless @opts.keys.all? { |a| allow.include?(a) } - raise ArgumentError, "Provided parameter should not be empty" unless @opts.values.all? do |a| + raise ArgumentError, 'Scalar arguments not supported' unless defined?(@opts.keys) + raise ArgumentError, 'Unexpected arguments found' unless @opts.keys.all? { |a| allow.include?(a) } + raise ArgumentError, 'Provided parameter should not be empty' unless @opts.values.all? do |a| return true if a.instance_of?(Integer) return true if [TrueClass, FalseClass].include?(a.class) !a.empty? @@ -427,34 +427,39 @@ def tags def name return unless tags - return tags["Name"] if tags.is_a?(Hash) + return tags['Name'] if tags.is_a?(Hash) # tags might be in the original format: [{:key=>"Name", :value=>"aws-linux-ubuntu-vm"}], e.g in EC2 - tags.select { |tag| tag[:key] == "Name" }.first&.dig(:value) + tags.select { |tag| tag[:key] == 'Name' }.first&.dig(:value) end # Intercept AWS exceptions def catch_aws_errors yield # Catch and create custom messages as needed rescue Aws::Errors::MissingCredentialsError - Inspec::Log.error "It appears that you have not set your AWS credentials. See https://www.inspec.io/docs/reference/platforms for details." - fail_resource("No AWS credentials available") + Inspec::Log.error 'It appears that you have not set your AWS credentials. See https://www.inspec.io/docs/reference/platforms for details.' + fail_resource('No AWS credentials available') + nil + rescue Aws::Account::Errors::ResourceNotFoundException => e + # require 'pry';binding.pry + Inspec::Log.error "#{e.message}" + fail_resource("#{e.message}") nil rescue Aws::Errors::NoSuchEndpointError - Inspec::Log.error "The endpoint that is trying to be accessed does not exist." - fail_resource("Invalid Endpoint error") + Inspec::Log.error 'The endpoint that is trying to be accessed does not exist.' + fail_resource('Invalid Endpoint error') nil rescue Aws::Errors::ServiceError => e if is_permissions_error(e) - advice = "" - error_type = e.class.to_s.split("::").last + advice = '' + error_type = e.class.to_s.split('::').last case error_type - when "InvalidAccessKeyId" - advice = "Please ensure your AWS Access Key ID is set correctly." - when "InvalidClientTokenId" - advice = "Please ensure that the aws access key, aws secret access key, and the aws session token are correct." - when "AccessDenied" - advice = "Please check the IAM permissions required for this Resource in the documentation, " \ - "and ensure your Service Principal has these permissions set." + when 'InvalidAccessKeyId' + advice = 'Please ensure your AWS Access Key ID is set correctly.' + when 'InvalidClientTokenId' + advice = 'Please ensure that the aws access key, aws secret access key, and the aws session token are correct.' + when 'AccessDenied' + advice = 'Please check the IAM permissions required for this Resource in the documentation, ' \ + 'and ensure your Service Principal has these permissions set.' end error_message = "#{e.message}: #{advice}" @@ -462,7 +467,7 @@ def catch_aws_errors else Inspec::Log.warn "AWS Service Error encountered running a control with Resource #{@__resource_name__}. " \ "Error message: #{e.message}. You should address this error to ensure your controls are " \ - "behaving as expected." + 'behaving as expected.' @failed_resource = true end nil @@ -513,8 +518,8 @@ def respond_to_missing?(*several_variants) # This method should be used when AWS API returns multiple resources for the provided criteria. def resource_fail(message = nil) message ||= "#{@__resource_name__}: #{@display_name}. Multiple AWS resources were returned for the provided criteria. "\ - "If you wish to test multiple entities, please use the plural resource. "\ - "Otherwise, please provide more specific criteria to lookup the resource." + 'If you wish to test multiple entities, please use the plural resource. '\ + 'Otherwise, please provide more specific criteria to lookup the resource.' # Fail resource in resource pack. `exists?` method will return `false`. @failed_resource = true # Fail resource in InSpec core. Tests in InSpec profile will return the message. @@ -549,7 +554,7 @@ def self.populate_filter_table(raw_data, table_scheme) end def fetch(client:, operation:, kwargs: {}) - raise ArgumentError, "Valid Client not found!" unless @aws.respond_to?(client) + raise ArgumentError, 'Valid Client not found!' unless @aws.respond_to?(client) client_obj = @aws.send(client) raise ArgumentError, "#{client} does not support #{operation}" unless client_obj.respond_to?(operation) @@ -586,11 +591,11 @@ def create_methods(object, data) when /Aws::.*/ # iterate around the instance variables data.instance_variables.each do |var| - create_method(object, var.to_s.delete("@"), data.instance_variable_get(var)) + create_method(object, var.to_s.delete('@'), data.instance_variable_get(var)) end # When the data is a Hash object iterate around each of the key value pairs and # create a method for each one. - when "Hash" + when 'Hash' data.each do |key, value| create_method(object, key, value) end @@ -608,11 +613,11 @@ def create_method(object, name, value) # Create the necessary method based on the var that has been passed # Test the value for its type so that the method can be setup correctly case value.class.to_s - when "String", "Integer", "TrueClass", "FalseClass", "Fixnum", "Time" + when 'String', 'Integer', 'TrueClass', 'FalseClass', 'Fixnum', 'Time' object.define_singleton_method name do value end - when "Hash" + when 'Hash' value.count == 0 ? return_value = value : return_value = AwsResourceProbe.new(value) object.define_singleton_method name do return_value @@ -623,7 +628,7 @@ def create_method(object, name, value) value = value.to_h if value.respond_to? :to_h AwsResourceProbe.new(value) end - when "Array" + when 'Array' # Some things are just string or integer arrays # Check this by seeing if the first element is a string / integer / boolean or # a hashtable @@ -631,7 +636,7 @@ def create_method(object, name, value) # the quickest test # p value[0].class.to_s case value[0].class.to_s - when "String", "Integer", "TrueClass", "FalseClass", "Fixnum", "Time" + when 'String', 'Integer', 'TrueClass', 'FalseClass', 'Fixnum', 'Time' probes = value else if name.eql?(:tags) @@ -694,10 +699,10 @@ def initialize(item) # Hash: Key=>Value pair to look for in the @item property def include?(opt) unless opt.is_a?(Symbol) || opt.is_a?(Hash) || opt.is_a?(String) - raise ArgumentError, "Key or Key:Value pair should be provided." + raise ArgumentError, 'Key or Key:Value pair should be provided.' end if opt.is_a?(Hash) - raise ArgumentError, "Only one item can be provided" if opt.keys.size > 1 + raise ArgumentError, 'Only one item can be provided' if opt.keys.size > 1 return @item[opt.keys.first] == opt.values.first end @item.key?(opt.to_sym) diff --git a/libraries/aws_batch_compute_environment.rb b/libraries/aws_batch_compute_environment.rb index 951dea9d4..cfc5d04c0 100644 --- a/libraries/aws_batch_compute_environment.rb +++ b/libraries/aws_batch_compute_environment.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSBatchComputeEnvironment < AwsResourceBase - name "aws_batch_compute_environment" - desc "Describes one or more of your compute environments." + name 'aws_batch_compute_environment' + desc 'Describes one or more of your compute environments.' example <<-EXAMPLE describe aws_batch_compute_environment(compute_environment_name: 'BATCH_COMPUTE_ENVIRONMENT_NAME') do it { should exist } @@ -24,7 +24,7 @@ def initialize(opts = {}) end def compute_environment_name - return nil unless exists? + return unless exists? @compute_environments[:compute_environment_name] end diff --git a/libraries/aws_batch_compute_environments.rb b/libraries/aws_batch_compute_environments.rb index 756423495..7cdf1cf96 100644 --- a/libraries/aws_batch_compute_environments.rb +++ b/libraries/aws_batch_compute_environments.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSBatchComputeEnvironments < AwsResourceBase - name "aws_batch_compute_environments" - desc "Describes one or more of your compute environments." + name 'aws_batch_compute_environments' + desc 'Describes one or more of your compute environments.' example <<-EXAMPLE describe aws_batch_compute_environments do it { should exist } @@ -12,16 +12,16 @@ class AWSBatchComputeEnvironments < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:compute_environment_names, field: :compute_environment_name) - .register_column(:compute_environment_arns, field: :compute_environment_arn) - .register_column(:ecs_cluster_arns, field: :ecs_cluster_arn) - .register_column(:tags, field: :tags) - .register_column(:types, field: :type) - .register_column(:states, field: :state) - .register_column(:statuses, field: :status) - .register_column(:status_reasons, field: :status_reason) - .register_column(:service_roles, field: :service_role) - .install_filter_methods_on_resource(self, :table) + .register_column(:compute_environment_names, field: :compute_environment_name) + .register_column(:compute_environment_arns, field: :compute_environment_arn) + .register_column(:ecs_cluster_arns, field: :ecs_cluster_arn) + .register_column(:tags, field: :tags) + .register_column(:types, field: :type) + .register_column(:states, field: :state) + .register_column(:statuses, field: :status) + .register_column(:status_reasons, field: :status_reason) + .register_column(:service_roles, field: :service_role) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_batch_job_definition.rb b/libraries/aws_batch_job_definition.rb index ff1b2f750..06da0fd36 100644 --- a/libraries/aws_batch_job_definition.rb +++ b/libraries/aws_batch_job_definition.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSBatchJobDefinition < AwsResourceBase - name "aws_batch_job_definition" - desc "Describes a list of job definitions." + name 'aws_batch_job_definition' + desc 'Describes a list of job definitions.' example <<-EXAMPLE describe aws_batch_job_definition(job_definition_name: 'JOB_DEFINITION_NAME') do it { should exist } @@ -22,7 +22,7 @@ def initialize(opts = {}) end def job_definition_name - return nil unless exists? + return unless exists? @job_definitions[:job_definition_name] end diff --git a/libraries/aws_batch_job_definitions.rb b/libraries/aws_batch_job_definitions.rb index 2436f79c7..8a0462e22 100644 --- a/libraries/aws_batch_job_definitions.rb +++ b/libraries/aws_batch_job_definitions.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSBatchJobDefinitions < AwsResourceBase - name "aws_batch_job_definitions" - desc "Describes a list of job definitions." + name 'aws_batch_job_definitions' + desc 'Describes a list of job definitions.' example <<-EXAMPLE describe aws_batch_job_definitions do it { should exist } @@ -12,16 +12,16 @@ class AWSBatchJobDefinitions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:job_definition_names, field: :job_definition_name) - .register_column(:job_definition_arns, field: :job_definition_arn) - .register_column(:revisions, field: :revision) - .register_column(:statuses, field: :status) - .register_column(:types, field: :type) - .register_column(:parameters, field: :parameters) - .register_column(:tags, field: :tags) - .register_column(:propagate_tags, field: :propagate_tags) - .register_column(:platform_capabilities, field: :platform_capabilities) - .install_filter_methods_on_resource(self, :table) + .register_column(:job_definition_names, field: :job_definition_name) + .register_column(:job_definition_arns, field: :job_definition_arn) + .register_column(:revisions, field: :revision) + .register_column(:statuses, field: :status) + .register_column(:types, field: :type) + .register_column(:parameters, field: :parameters) + .register_column(:tags, field: :tags) + .register_column(:propagate_tags, field: :propagate_tags) + .register_column(:platform_capabilities, field: :platform_capabilities) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_batch_job_queue.rb b/libraries/aws_batch_job_queue.rb index 1519fd72a..08c8eb78d 100644 --- a/libraries/aws_batch_job_queue.rb +++ b/libraries/aws_batch_job_queue.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSBatchJobQueue < AwsResourceBase - name "aws_batch_job_queue" - desc "Describes one or more of your job queues." + name 'aws_batch_job_queue' + desc 'Describes one or more of your job queues.' example <<-EXAMPLE describe aws_batch_job_queue(job_queue_name: 'JOB_QUEUE_NAME') do it { should exist } @@ -24,7 +24,7 @@ def initialize(opts = {}) end def job_queue_name - return nil unless exists? + return unless exists? @job_queues[:job_queue_name] end diff --git a/libraries/aws_batch_job_queues.rb b/libraries/aws_batch_job_queues.rb index b63c13bec..41de1b9d3 100644 --- a/libraries/aws_batch_job_queues.rb +++ b/libraries/aws_batch_job_queues.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSBatchJobQueues < AwsResourceBase - name "aws_batch_job_queues" - desc "Describes one or more of your job queues." + name 'aws_batch_job_queues' + desc 'Describes one or more of your job queues.' example <<-EXAMPLE describe aws_batch_job_queues do it { should exist } @@ -12,14 +12,14 @@ class AWSBatchJobQueues < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:job_queue_names, field: :job_queue_name) - .register_column(:job_queue_arns, field: :job_queue_arn) - .register_column(:states, field: :state) - .register_column(:statuses, field: :status) - .register_column(:status_reasons, field: :status_reason) - .register_column(:priorities, field: :priority) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:job_queue_names, field: :job_queue_name) + .register_column(:job_queue_arns, field: :job_queue_arn) + .register_column(:states, field: :state) + .register_column(:statuses, field: :status) + .register_column(:status_reasons, field: :status_reason) + .register_column(:priorities, field: :priority) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloud_formation_stack_set.rb b/libraries/aws_cloud_formation_stack_set.rb index e3e8bb8c2..10e80e0c3 100644 --- a/libraries/aws_cloud_formation_stack_set.rb +++ b/libraries/aws_cloud_formation_stack_set.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudFormationStackSet < AwsResourceBase - name "aws_cloud_formation_stack_set" - desc "Describes the specified stack set." + name 'aws_cloud_formation_stack_set' + desc 'Describes the specified stack set.' example <<-EXAMPLE describe aws_cloud_formation_stack_set(stack_set_name: 'STACK_SET_NAME') do it { should exist } @@ -26,7 +26,7 @@ def resource_id end def stack_set_name - return nil unless exists? + return unless exists? @resp[:stack_set_name] end diff --git a/libraries/aws_cloud_formation_stack_sets.rb b/libraries/aws_cloud_formation_stack_sets.rb index 8b34ce329..32824718e 100644 --- a/libraries/aws_cloud_formation_stack_sets.rb +++ b/libraries/aws_cloud_formation_stack_sets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudFormationStackSets < AwsResourceBase - name "aws_cloud_formation_stack_sets" - desc "Describes all the specified stack set." + name 'aws_cloud_formation_stack_sets' + desc 'Describes all the specified stack set.' example <<-EXAMPLE describe aws_cloud_formation_stack_sets do it { should exist } @@ -18,15 +18,15 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:stack_set_names, field: :stack_set_name) - .register_column(:stack_set_ids, field: :stack_set_id) - .register_column(:descriptions, field: :description) - .register_column(:statuses, field: :status) - .register_column(:auto_deployments, field: :auto_deployment) - .register_column(:permission_models, field: :permission_model) - .register_column(:drift_statuses, field: :drift_status) - .register_column(:last_drift_check_timestamps, field: :last_drift_check_timestamp) - .install_filter_methods_on_resource(self, :table) + .register_column(:stack_set_names, field: :stack_set_name) + .register_column(:stack_set_ids, field: :stack_set_id) + .register_column(:descriptions, field: :description) + .register_column(:statuses, field: :status) + .register_column(:auto_deployments, field: :auto_deployment) + .register_column(:permission_models, field: :permission_model) + .register_column(:drift_statuses, field: :drift_status) + .register_column(:last_drift_check_timestamps, field: :last_drift_check_timestamp) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_cloudformation_stack.rb b/libraries/aws_cloudformation_stack.rb index 13f158492..db8246a50 100644 --- a/libraries/aws_cloudformation_stack.rb +++ b/libraries/aws_cloudformation_stack.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudformationStack < AwsResourceBase - name "aws_cloudformation_stack" - desc "Verifies settings for an aws CloudFormation Stack." + name 'aws_cloudformation_stack' + desc 'Verifies settings for an aws CloudFormation Stack.' example <<-EXAMPLE describe aws_cloudformation_stack('STACK_NAME') do it { should exist } @@ -21,7 +21,7 @@ def initialize(opts = {}) catch_aws_errors do name = { stack_name: opts[:stack_name] } resp = @aws.cloudformation_client.describe_stacks(name) - return nil if resp.stacks.nil? || resp.stacks.empty? + return if resp.stacks.nil? || resp.stacks.empty? stack = resp.stacks.first @stack_id = stack.stack_id @stack_name = stack.stack_name diff --git a/libraries/aws_cloudformation_stacks.rb b/libraries/aws_cloudformation_stacks.rb index afd4db397..ca47d55c4 100644 --- a/libraries/aws_cloudformation_stacks.rb +++ b/libraries/aws_cloudformation_stacks.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudformationStacks < AwsResourceBase - name "aws_cloudformation_stacks" - desc "Verifies settings for aws CloudFormation Stacks." + name 'aws_cloudformation_stacks' + desc 'Verifies settings for aws CloudFormation Stacks.' example <<-EXAMPLE describe aws_cloudformation_stacks do it { should exist } @@ -12,14 +12,14 @@ class AwsCloudformationStacks < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:creation_times, field: :creation_time) - .register_column(:stack_ids, field: :stack_id) - .register_column(:notification_arns, field: :notification_arn) - .register_column(:role_arns, field: :role_arn) - .register_column(:parent_ids, field: :parent_id) - .register_column(:root_ids, field: :root_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:creation_times, field: :creation_time) + .register_column(:stack_ids, field: :stack_id) + .register_column(:notification_arns, field: :notification_arn) + .register_column(:role_arns, field: :role_arn) + .register_column(:parent_ids, field: :parent_id) + .register_column(:root_ids, field: :root_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudformation_template.rb b/libraries/aws_cloudformation_template.rb index 85c4c9af9..e2ed154ab 100644 --- a/libraries/aws_cloudformation_template.rb +++ b/libraries/aws_cloudformation_template.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudFormationTemplate < AwsResourceBase - name "aws_cloudformation_template" - desc "Returns information about a new or existing template." + name 'aws_cloudformation_template' + desc 'Returns information about a new or existing template.' example <<-EXAMPLE describe aws_cloudformation_template(stack_name: 'STACK_NAME') do it { should exist } @@ -40,14 +40,14 @@ def resource_id end def template_body - return nil unless exists? + return unless exists? catch_aws_errors do @template_body ||= @aws.cloudformation_client.get_template(@query_stack_name) end end def stack_name - return nil unless exists? + return unless exists? @res[:stack_name] end diff --git a/libraries/aws_cloudfront_cache_policies.rb b/libraries/aws_cloudfront_cache_policies.rb index cc6e57d06..4929a0d5e 100644 --- a/libraries/aws_cloudfront_cache_policies.rb +++ b/libraries/aws_cloudfront_cache_policies.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudFrontCachePolicies < AwsResourceBase - name "aws_cloudfront_cache_policies" - desc "Gets a list of cache policies." + name 'aws_cloudfront_cache_policies' + desc 'Gets a list of cache policies.' example <<-EXAMPLE describe aws_cloudfront_cache_policies do it { should exist } @@ -12,20 +12,20 @@ class AWSCloudFrontCachePolicies < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:types, field: :type) - .register_column(:ids, field: :id) - .register_column(:last_modified_times, field: :last_modified_time) - .register_column(:comments, field: :comment) - .register_column(:names, field: :name) - .register_column(:default_ttls, field: :default_ttl) - .register_column(:max_ttls, field: :max_ttl) - .register_column(:min_ttls, field: :min_ttl) - .register_column(:enable_accept_encoding_gzips, field: :enable_accept_encoding_gzip) - .register_column(:enable_accept_encoding_brotlis, field: :enable_accept_encoding_brotli) - .register_column(:header_behaviors, field: :header_behavior) - .register_column(:cookie_behaviors, field: :cookie_behavior) - .register_column(:query_string_behaviors, field: :query_string_behavior) - .install_filter_methods_on_resource(self, :table) + .register_column(:types, field: :type) + .register_column(:ids, field: :id) + .register_column(:last_modified_times, field: :last_modified_time) + .register_column(:comments, field: :comment) + .register_column(:names, field: :name) + .register_column(:default_ttls, field: :default_ttl) + .register_column(:max_ttls, field: :max_ttl) + .register_column(:min_ttls, field: :min_ttl) + .register_column(:enable_accept_encoding_gzips, field: :enable_accept_encoding_gzip) + .register_column(:enable_accept_encoding_brotlis, field: :enable_accept_encoding_brotli) + .register_column(:header_behaviors, field: :header_behavior) + .register_column(:cookie_behaviors, field: :cookie_behavior) + .register_column(:query_string_behaviors, field: :query_string_behavior) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudfront_cache_policy.rb b/libraries/aws_cloudfront_cache_policy.rb index 5c2baa70a..b6b87b04f 100644 --- a/libraries/aws_cloudfront_cache_policy.rb +++ b/libraries/aws_cloudfront_cache_policy.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudFrontCachePolicy < AwsResourceBase - name "aws_cloudfront_cache_policy" - desc "Gets a cache policy." + name 'aws_cloudfront_cache_policy' + desc 'Gets a cache policy.' example <<-EXAMPLE describe aws_cloudfront_cache_policy(id: 'CLOUDFRONT_CACHE_POLICY_ID') do it { should exist } @@ -27,7 +27,7 @@ def resource_id end def id - return nil unless exists? + return unless exists? @res[:id] end diff --git a/libraries/aws_cloudfront_distribution.rb b/libraries/aws_cloudfront_distribution.rb index e42999dfd..b8a762ff2 100644 --- a/libraries/aws_cloudfront_distribution.rb +++ b/libraries/aws_cloudfront_distribution.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudFrontDistribution < AwsResourceBase - name "aws_cloudfront_distribution" - desc "Verifies settings for a CloudFront Distribution." + name 'aws_cloudfront_distribution' + desc 'Verifies settings for a CloudFront Distribution.' example <<-EXAMPLE describe aws_cloudfront_distribution('CLOUDFRONT_DISTRIBUTION_ID') do it { should exist } @@ -92,7 +92,7 @@ def resource_id end def exists? - !@distribution_arn.nil? && @distribution_arn.start_with?("arn") + !@distribution_arn.nil? && @distribution_arn.start_with?('arn') end def has_access_logging_enabled? @@ -100,7 +100,7 @@ def has_access_logging_enabled? end def has_viewer_protocol_policies_allowing_http? - @viewer_protocol_policies.include? "allow-all" + @viewer_protocol_policies.include? 'allow-all' end def has_disallowed_viewer_certificate_minimum_ssl_protocol? diff --git a/libraries/aws_cloudfront_distributions.rb b/libraries/aws_cloudfront_distributions.rb index 7d0eb2829..8aaccfdd0 100644 --- a/libraries/aws_cloudfront_distributions.rb +++ b/libraries/aws_cloudfront_distributions.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudFrontDistributions < AwsResourceBase - name "aws_cloudfront_distributions" - desc "Verifies settings for a collection AWS CloudFront Distributions." + name 'aws_cloudfront_distributions' + desc 'Verifies settings for a collection AWS CloudFront Distributions.' example <<-EXAMPLE describe aws_cloudfront_distributions do it { should exist } @@ -12,21 +12,21 @@ class AwsCloudFrontDistributions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:distribution_ids, field: :distribution_ids) - .register_column(:distribution_arns, field: :distribution_arns) - .register_column(:statuses, field: :statuses) - .register_column(:domain_names, field: :domain_names) - .register_column(:origin_domain_names, field: :origin_domain_names) - .register_column(:default_cache_viewer_protocol_policies, field: :default_cache_viewer_protocol_policies) - .register_column(:cache_viewer_protocol_policies, field: :cache_viewer_protocol_policies) - .register_column(:custom_origin_ssl_protocols, field: :custom_origin_ssl_protocols) - .register_column(:price_classes, field: :price_classes) - .register_column(:enabled, field: :enabled) - .register_column(:viewer_certificate_ssl_support_methods, field: :viewer_certificate_ssl_support_methods) - .register_column(:viewer_certificate_minimum_ssl_protocols, field: :viewer_certificate_minimum_ssl_protocols) - .register_column(:http_versions, field: :http_version) - .register_column(:ipv6_enabled, field: :ipv6_enabled) - .install_filter_methods_on_resource(self, :table) + .register_column(:distribution_ids, field: :distribution_ids) + .register_column(:distribution_arns, field: :distribution_arns) + .register_column(:statuses, field: :statuses) + .register_column(:domain_names, field: :domain_names) + .register_column(:origin_domain_names, field: :origin_domain_names) + .register_column(:default_cache_viewer_protocol_policies, field: :default_cache_viewer_protocol_policies) + .register_column(:cache_viewer_protocol_policies, field: :cache_viewer_protocol_policies) + .register_column(:custom_origin_ssl_protocols, field: :custom_origin_ssl_protocols) + .register_column(:price_classes, field: :price_classes) + .register_column(:enabled, field: :enabled) + .register_column(:viewer_certificate_ssl_support_methods, field: :viewer_certificate_ssl_support_methods) + .register_column(:viewer_certificate_minimum_ssl_protocols, field: :viewer_certificate_minimum_ssl_protocols) + .register_column(:http_versions, field: :http_version) + .register_column(:ipv6_enabled, field: :ipv6_enabled) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudfront_key_group.rb b/libraries/aws_cloudfront_key_group.rb index 743386290..2e934d4a9 100644 --- a/libraries/aws_cloudfront_key_group.rb +++ b/libraries/aws_cloudfront_key_group.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudFrontKeyGroup < AwsResourceBase - name "aws_cloudfront_key_group" - desc "Describes one Key Group." + name 'aws_cloudfront_key_group' + desc 'Describes one Key Group.' example <<-EXAMPLE describe aws_cloudfront_key_group(id: 'KEY_GROUP_ID') do it { should exist } @@ -27,7 +27,7 @@ def resource_id end def id - return nil unless exists? + return unless exists? @resp[:id] end diff --git a/libraries/aws_cloudfront_key_groups.rb b/libraries/aws_cloudfront_key_groups.rb index ad32642b5..d5e14abb7 100644 --- a/libraries/aws_cloudfront_key_groups.rb +++ b/libraries/aws_cloudfront_key_groups.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudFrontKeyGroups < AwsResourceBase - name "aws_cloudfront_key_groups" - desc "Describes one or more of Key Group." + name 'aws_cloudfront_key_groups' + desc 'Describes one or more of Key Group.' example <<-EXAMPLE describe aws_cloudfront_key_groups do it { should exist } @@ -12,12 +12,12 @@ class AwsCloudFrontKeyGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:last_modified_time, field: :last_modified_time) - .register_column(:key_group_config_names, field: :key_group_config_name) - .register_column(:key_group_config_items, field: :key_group_config_items, style: :simple) - .register_column(:key_group_config_comments, field: :key_group_config_comment, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:last_modified_time, field: :last_modified_time) + .register_column(:key_group_config_names, field: :key_group_config_name) + .register_column(:key_group_config_items, field: :key_group_config_items, style: :simple) + .register_column(:key_group_config_comments, field: :key_group_config_comment, style: :simple) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudfront_origin_access_identities.rb b/libraries/aws_cloudfront_origin_access_identities.rb index fc8c997f7..b1cc6af9f 100644 --- a/libraries/aws_cloudfront_origin_access_identities.rb +++ b/libraries/aws_cloudfront_origin_access_identities.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudFrontOriginAccessIdentities < AwsResourceBase - name "aws_cloudfront_origin_access_identities" - desc "Lists origin access identities." + name 'aws_cloudfront_origin_access_identities' + desc 'Lists origin access identities.' example <<-EXAMPLE describe aws_cloudfront_origin_access_identities do it { should exist } @@ -12,10 +12,10 @@ class AWSCloudFrontOriginAccessIdentities < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:s3_canonical_user_ids, field: :s3_canonical_user_id) - .register_column(:comments, field: :comment) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:s3_canonical_user_ids, field: :s3_canonical_user_id) + .register_column(:comments, field: :comment) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudfront_origin_access_identity.rb b/libraries/aws_cloudfront_origin_access_identity.rb index e9e8e478c..b2e0f04ea 100644 --- a/libraries/aws_cloudfront_origin_access_identity.rb +++ b/libraries/aws_cloudfront_origin_access_identity.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudFrontOriginAccessIdentity < AwsResourceBase - name "aws_cloudfront_origin_access_identity" - desc "Get the information about an origin access identity." + name 'aws_cloudfront_origin_access_identity' + desc 'Get the information about an origin access identity.' example <<-EXAMPLE describe aws_cloudfront_origin_access_identity(id: 'ID') do it { should exist } @@ -27,7 +27,7 @@ def resource_id end def id - return nil unless exists? + return unless exists? @res[:id] end diff --git a/libraries/aws_cloudfront_origin_request_policy.rb b/libraries/aws_cloudfront_origin_request_policy.rb index ed536cd43..de7e3dbf1 100644 --- a/libraries/aws_cloudfront_origin_request_policy.rb +++ b/libraries/aws_cloudfront_origin_request_policy.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudFrontOriginRequestPolicy < AwsResourceBase - name "aws_cloudfront_origin_request_policy" - desc "Describes an origin request policy." + name 'aws_cloudfront_origin_request_policy' + desc 'Describes an origin request policy.' example <<-EXAMPLE describe aws_cloudfront_origin_request_policy(id: 'ID') do it { should exist } @@ -26,7 +26,7 @@ def resource_id end def id - return nil unless exists? + return unless exists? @origin_request_policy_id end diff --git a/libraries/aws_cloudfront_public_key.rb b/libraries/aws_cloudfront_public_key.rb index b5681f003..d3f38b94b 100644 --- a/libraries/aws_cloudfront_public_key.rb +++ b/libraries/aws_cloudfront_public_key.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudFrontPublicKey < AwsResourceBase - name "aws_cloudfront_public_key" - desc "Get the information about a Public Key." + name 'aws_cloudfront_public_key' + desc 'Get the information about a Public Key.' example <<-EXAMPLE describe aws_cloudfront_public_key(id: 'ID') do it { should exist } @@ -27,7 +27,7 @@ def resource_id end def id - return nil unless exists? + return unless exists? @res[:id] end diff --git a/libraries/aws_cloudfront_public_keys.rb b/libraries/aws_cloudfront_public_keys.rb index cc15a4dc0..e4ff3c1e4 100644 --- a/libraries/aws_cloudfront_public_keys.rb +++ b/libraries/aws_cloudfront_public_keys.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudFrontPublicKeys < AwsResourceBase - name "aws_cloudfront_public_keys" - desc "Lists all Public Keys." + name 'aws_cloudfront_public_keys' + desc 'Lists all Public Keys.' example <<-EXAMPLE describe aws_cloudfront_public_keys do it { should exist } @@ -12,12 +12,12 @@ class AWSCloudFrontPublicKeys < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:created_time, field: :created_time) - .register_column(:encoded_keys, field: :encoded_key) - .register_column(:comments, field: :comment) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:created_time, field: :created_time) + .register_column(:encoded_keys, field: :encoded_key) + .register_column(:comments, field: :comment) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudfront_realtime_log_config.rb b/libraries/aws_cloudfront_realtime_log_config.rb index 4646ce511..526631d55 100644 --- a/libraries/aws_cloudfront_realtime_log_config.rb +++ b/libraries/aws_cloudfront_realtime_log_config.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudFrontRealtimeLogConfig < AwsResourceBase - name "aws_cloudfront_realtime_log_config" - desc "Gets a real-time log configuration." + name 'aws_cloudfront_realtime_log_config' + desc 'Gets a real-time log configuration.' example <<-EXAMPLE describe aws_cloudfront_realtime_log_config(name: 'CONFIG_NAME') do it { should exist } @@ -24,7 +24,7 @@ def initialize(opts = {}) end def name - return nil unless exists? + return unless exists? @res[:name] end diff --git a/libraries/aws_cloudfront_realtime_log_configs.rb b/libraries/aws_cloudfront_realtime_log_configs.rb index 196b9edeb..d3ef59927 100644 --- a/libraries/aws_cloudfront_realtime_log_configs.rb +++ b/libraries/aws_cloudfront_realtime_log_configs.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudFrontRealtimeLogConfigs < AwsResourceBase - name "aws_cloudfront_realtime_log_configs" - desc "Gets a list of real-time log configurations." + name 'aws_cloudfront_realtime_log_configs' + desc 'Gets a list of real-time log configurations.' example <<-EXAMPLE describe aws_cloudfront_realtime_log_configs do it { should exist } @@ -12,12 +12,12 @@ class AwsCloudFrontRealtimeLogConfigs < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:names, field: :name) - .register_column(:sampling_rates, field: :sampling_rate) - .register_column(:end_points, field: :end_points) - .register_column(:fields, field: :fields) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:names, field: :name) + .register_column(:sampling_rates, field: :sampling_rate) + .register_column(:end_points, field: :end_points) + .register_column(:fields, field: :fields) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudfront_streaming_distribution.rb b/libraries/aws_cloudfront_streaming_distribution.rb index 74ab8186c..69e0fba30 100644 --- a/libraries/aws_cloudfront_streaming_distribution.rb +++ b/libraries/aws_cloudfront_streaming_distribution.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudFrontStreamingDistribution < AwsResourceBase - name "aws_cloudfront_streaming_distribution" - desc "Get the information about a distribution." + name 'aws_cloudfront_streaming_distribution' + desc 'Get the information about a distribution.' example <<-EXAMPLE describe aws_cloudfront_streaming_distribution(id: 'ID') do it { should exist } @@ -28,7 +28,7 @@ def resource_id end def id - return nil unless exists? + return unless exists? @res[:id] end diff --git a/libraries/aws_cloudfront_streaming_distributions.rb b/libraries/aws_cloudfront_streaming_distributions.rb index 93dd65ac5..6df1e0aa0 100644 --- a/libraries/aws_cloudfront_streaming_distributions.rb +++ b/libraries/aws_cloudfront_streaming_distributions.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudFrontStreamingDistributions < AwsResourceBase - name "aws_cloudfront_streaming_distributions" - desc "List streaming distributions." + name 'aws_cloudfront_streaming_distributions' + desc 'List streaming distributions.' example <<-EXAMPLE describe aws_cloudfront_streaming_distributions do it { should exist } @@ -12,18 +12,18 @@ class AWSCloudFrontStreamingDistributions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:arns, field: :arn) - .register_column(:statuses, field: :status) - .register_column(:last_modified_time, field: :last_modified_time) - .register_column(:domain_names, field: :domain_name) - .register_column(:s3_origins, field: :s3_origin) - .register_column(:aliases, field: :aliases) - .register_column(:trusted_signers, field: :trusted_signers) - .register_column(:comments, field: :comment) - .register_column(:price_classes, field: :price_class) - .register_column(:enabled, field: :enabled) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:arns, field: :arn) + .register_column(:statuses, field: :status) + .register_column(:last_modified_time, field: :last_modified_time) + .register_column(:domain_names, field: :domain_name) + .register_column(:s3_origins, field: :s3_origin) + .register_column(:aliases, field: :aliases) + .register_column(:trusted_signers, field: :trusted_signers) + .register_column(:comments, field: :comment) + .register_column(:price_classes, field: :price_class) + .register_column(:enabled, field: :enabled) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudtrail_trail.rb b/libraries/aws_cloudtrail_trail.rb index bb55764c8..f790778e4 100644 --- a/libraries/aws_cloudtrail_trail.rb +++ b/libraries/aws_cloudtrail_trail.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudTrailTrail < AwsResourceBase - name "aws_cloudtrail_trail" - desc "Verifies settings for an individual AWS CloudTrail Trail." + name 'aws_cloudtrail_trail' + desc 'Verifies settings for an individual AWS CloudTrail Trail.' example <<-EXAMPLE describe aws_cloudtrail_trail('TRIAL_NAME') do it { should exist } @@ -45,7 +45,7 @@ def resource_id end def delivered_logs_days_ago - return nil unless exists? + return unless exists? catch_aws_errors do begin trail_status = @aws.cloudtrail_client.get_trail_status({ name: @trail_name }).to_h @@ -71,19 +71,19 @@ def encrypted? end def get_log_group_for_multi_region_active_mgmt_rw_all - return nil unless exists? - return nil unless @cloud_watch_logs_log_group_arn - return nil if @cloud_watch_logs_log_group_arn.split(":").count < 6 - return @cloud_watch_logs_log_group_arn.split(":")[6] if has_event_selector_mgmt_events_rw_type_all? && logging? + return unless exists? + return unless @cloud_watch_logs_log_group_arn + return if @cloud_watch_logs_log_group_arn.split(':').count < 6 + return @cloud_watch_logs_log_group_arn.split(':')[6] if has_event_selector_mgmt_events_rw_type_all? && logging? end def has_event_selector_mgmt_events_rw_type_all? - return nil unless exists? + return unless exists? event_selector_found = false begin event_selectors = @aws.cloudtrail_client.get_event_selectors(trail_name: @trail_name) event_selectors.event_selectors.each do |es| - event_selector_found = true if es.read_write_type == "All" && es.include_management_events == true + event_selector_found = true if es.read_write_type == 'All' && es.include_management_events == true end rescue Aws::CloudTrail::Errors::TrailNotFoundException event_selector_found diff --git a/libraries/aws_cloudtrail_trails.rb b/libraries/aws_cloudtrail_trails.rb index d32543abd..6cc7738fd 100644 --- a/libraries/aws_cloudtrail_trails.rb +++ b/libraries/aws_cloudtrail_trails.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudTrailTrails < AwsResourceBase - name "aws_cloudtrail_trails" - desc "Verifies settings for AWS CloudTrail Trails in bulk." + name 'aws_cloudtrail_trails' + desc 'Verifies settings for AWS CloudTrail Trails in bulk.' example <<-EXAMPLE describe aws_cloudtrail_trails do it { should exist } @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:trail_arns, field: :trail_arn) - .register_column(:names, field: :name) - .install_filter_methods_on_resource(self, :table) + .register_column(:trail_arns, field: :trail_arn) + .register_column(:names, field: :name) + .install_filter_methods_on_resource(self, :table) def fetch_data cloudtrail_rows = [] diff --git a/libraries/aws_cloudwatch_alarm.rb b/libraries/aws_cloudwatch_alarm.rb index 4def6985b..c0bd3c14c 100644 --- a/libraries/aws_cloudwatch_alarm.rb +++ b/libraries/aws_cloudwatch_alarm.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudwatchAlarm < AwsResourceBase - name "aws_cloudwatch_alarm" - desc "Verifies settings for an AWS CloudWatch Alarm." + name 'aws_cloudwatch_alarm' + desc 'Verifies settings for an AWS CloudWatch Alarm.' example <<-EXAMPLE # Look for a specific alarm describe aws_cloudwatch_alarm(metric_name: 'METRIC_NAME', metric_namespace: 'METRIV_NAMESPACE') do @@ -39,14 +39,14 @@ def initialize(opts = {}) return false if @metric_alarms.empty? - raise "Found multiple CloudWatch Alarms. The following matched: #{@metric_alarms.join(", ")}. Try to restrict your resource criteria." if @metric_alarms.count > 1 + raise "Found multiple CloudWatch Alarms. The following matched: #{@metric_alarms.join(', ')}. Try to restrict your resource criteria." if @metric_alarms.count > 1 @alarm_actions = @metric_alarms.first.alarm_actions @alarm_name = @metric_alarms.first.alarm_name end def resource_id - "#{@metric_alarms? @metric_name: ""}_#{@metric_alarms? @metric_namespace: ""}" + "#{@metric_alarms? @metric_name: ''}_#{@metric_alarms? @metric_namespace: ''}" end def exists? diff --git a/libraries/aws_cloudwatch_anomaly_detector.rb b/libraries/aws_cloudwatch_anomaly_detector.rb index 2b5e26db5..46610d750 100644 --- a/libraries/aws_cloudwatch_anomaly_detector.rb +++ b/libraries/aws_cloudwatch_anomaly_detector.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudwatchAnomalyDetector < AwsResourceBase - name "aws_cloudwatch_anomaly_detector" - desc "Lists the anomaly detection models that you have created in your account." + name 'aws_cloudwatch_anomaly_detector' + desc 'Lists the anomaly detection models that you have created in your account.' example <<-EXAMPLE describe aws_cloudwatch_anomaly_detector(metric_name: 'METRIC_NAME') do it { should exist } @@ -23,11 +23,11 @@ def initialize(opts = {}) end def resource_id - "#{@res? @res[:metric_name]: ""}_#{@res? @res[:namespace]: ""}" + "#{@res? @res[:metric_name]: ''}_#{@res? @res[:namespace]: ''}" end def metric_name - return nil unless exists? + return unless exists? @res[:metric_name] end diff --git a/libraries/aws_cloudwatch_anomaly_detectors.rb b/libraries/aws_cloudwatch_anomaly_detectors.rb index 2b2651dcd..a981a21a4 100644 --- a/libraries/aws_cloudwatch_anomaly_detectors.rb +++ b/libraries/aws_cloudwatch_anomaly_detectors.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudwatchAnomalyDetectors < AwsResourceBase - name "aws_cloudwatch_anomaly_detectors" - desc "Lists the anomaly detection models that you have created in your account." + name 'aws_cloudwatch_anomaly_detectors' + desc 'Lists the anomaly detection models that you have created in your account.' example <<-EXAMPLE describe aws_cloudwatch_anomaly_detectors do it { should exist } @@ -12,13 +12,13 @@ class AwsCloudwatchAnomalyDetectors < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:namespaces, field: :namespace) - .register_column(:metric_names, field: :metric_name) - .register_column(:dimensions, field: :dimensions) - .register_column(:stats, field: :stat) - .register_column(:configurations, field: :configuration) - .register_column(:state_values, field: :state_value) - .install_filter_methods_on_resource(self, :table) + .register_column(:namespaces, field: :namespace) + .register_column(:metric_names, field: :metric_name) + .register_column(:dimensions, field: :dimensions) + .register_column(:stats, field: :stat) + .register_column(:configurations, field: :configuration) + .register_column(:state_values, field: :state_value) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudwatch_composite_alarm.rb b/libraries/aws_cloudwatch_composite_alarm.rb index b59638e18..0b970980e 100644 --- a/libraries/aws_cloudwatch_composite_alarm.rb +++ b/libraries/aws_cloudwatch_composite_alarm.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudwatchCompositeAlarm < AwsResourceBase - name "aws_cloudwatch_composite_alarm" - desc "Gets a composite alarm." + name 'aws_cloudwatch_composite_alarm' + desc 'Gets a composite alarm.' example <<-EXAMPLE describe aws_cloudwatch_composite_alarm(alarm_name: 'COMPOSITE_ALARM_NAME') do it { should exist } @@ -16,7 +16,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: alarm_name must be provided" unless opts[:alarm_name] && !opts[:alarm_name].empty? @display_name = opts[:alarm_name] catch_aws_errors do - resp = @aws.cloudwatch_client.describe_alarms({ alarm_names: [opts[:alarm_name]], alarm_types: ["CompositeAlarm"] }) + resp = @aws.cloudwatch_client.describe_alarms({ alarm_names: [opts[:alarm_name]], alarm_types: ['CompositeAlarm'] }) @res = resp.composite_alarms[0].to_h @alarm_arn = @res[:alarm_arn] create_resource_methods(@res) @@ -28,7 +28,7 @@ def resource_id end def alarm_name - return nil unless exists? + return unless exists? @res[:alarm_name] end diff --git a/libraries/aws_cloudwatch_composite_alarms.rb b/libraries/aws_cloudwatch_composite_alarms.rb index 59ab4f5e6..a179d4c83 100644 --- a/libraries/aws_cloudwatch_composite_alarms.rb +++ b/libraries/aws_cloudwatch_composite_alarms.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudwatchCompositeAlarms < AwsResourceBase - name "aws_cloudwatch_composite_alarms" - desc "Lists all composite alarms." + name 'aws_cloudwatch_composite_alarms' + desc 'Lists all composite alarms.' example <<-EXAMPLE describe aws_cloudwatch_composite_alarms do it { should exist } @@ -12,20 +12,20 @@ class AwsCloudwatchCompositeAlarms < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:actions_enabled, field: :actions_enabled) - .register_column(:alarm_actions, field: :alarm_actions) - .register_column(:alarm_arns, field: :alarm_arn) - .register_column(:alarm_configuration_updated_timestamp, field: :alarm_configuration_updated_timestamp) - .register_column(:alarm_descriptions, field: :alarm_description) - .register_column(:alarm_names, field: :alarm_name) - .register_column(:alarm_rules, field: :alarm_rule) - .register_column(:insufficient_data_actions, field: :insufficient_data_actions) - .register_column(:ok_actions, field: :ok_actions) - .register_column(:state_reasons, field: :state_reason) - .register_column(:state_reason_data, field: :state_reason_data) - .register_column(:state_updated_timestamp, field: :state_updated_timestamp) - .register_column(:state_values, field: :state_value) - .install_filter_methods_on_resource(self, :table) + .register_column(:actions_enabled, field: :actions_enabled) + .register_column(:alarm_actions, field: :alarm_actions) + .register_column(:alarm_arns, field: :alarm_arn) + .register_column(:alarm_configuration_updated_timestamp, field: :alarm_configuration_updated_timestamp) + .register_column(:alarm_descriptions, field: :alarm_description) + .register_column(:alarm_names, field: :alarm_name) + .register_column(:alarm_rules, field: :alarm_rule) + .register_column(:insufficient_data_actions, field: :insufficient_data_actions) + .register_column(:ok_actions, field: :ok_actions) + .register_column(:state_reasons, field: :state_reason) + .register_column(:state_reason_data, field: :state_reason_data) + .register_column(:state_updated_timestamp, field: :state_updated_timestamp) + .register_column(:state_values, field: :state_value) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -35,7 +35,7 @@ def initialize(opts = {}) def fetch_data catch_aws_errors do - @table = @aws.cloudwatch_client.describe_alarms(alarm_types: ["CompositeAlarm"]).map do |table| + @table = @aws.cloudwatch_client.describe_alarms(alarm_types: ['CompositeAlarm']).map do |table| table.composite_alarms.map { |table_name| { actions_enabled: table_name.actions_enabled, alarm_actions: table_name.alarm_actions, diff --git a/libraries/aws_cloudwatch_dashboard.rb b/libraries/aws_cloudwatch_dashboard.rb index b3ca0f962..13e45fe88 100644 --- a/libraries/aws_cloudwatch_dashboard.rb +++ b/libraries/aws_cloudwatch_dashboard.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudwatchDashboard < AwsResourceBase - name "aws_cloudwatch_dashboard " - desc "Returns the configuration information and metadata of the specified cloudwatch dashboard." + name 'aws_cloudwatch_dashboard ' + desc 'Returns the configuration information and metadata of the specified cloudwatch dashboard.' example <<-EXAMPLE describe aws_cloudwatch_dashboard(dashboard_name: 'DASHBOARD_NAME') do it { should exist } @@ -28,7 +28,7 @@ def resource_id end def dashboard_name - return nil unless exists? + return unless exists? @dashboard[:dashboard_name] end diff --git a/libraries/aws_cloudwatch_dashboards.rb b/libraries/aws_cloudwatch_dashboards.rb index a5ac58aa7..81084e262 100644 --- a/libraries/aws_cloudwatch_dashboards.rb +++ b/libraries/aws_cloudwatch_dashboards.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudwatchDashboards < AwsResourceBase - name "aws_cloudwatch_dashboards" - desc "Verifies settings for Cloudwatch Dashboard in bulk." + name 'aws_cloudwatch_dashboards' + desc 'Verifies settings for Cloudwatch Dashboard in bulk.' example <<-EXAMPLE describe aws_cloudwatch_dashboards do it { should exist } @@ -18,11 +18,11 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:dashboard_names, field: :dashboard_name) - .register_column(:dashboard_arns, field: :dashboard_arn) - .register_column(:last_modified, field: :last_modified) - .register_column(:sizes, field: :size) - .install_filter_methods_on_resource(self, :table) + .register_column(:dashboard_names, field: :dashboard_name) + .register_column(:dashboard_arns, field: :dashboard_arn) + .register_column(:last_modified, field: :last_modified) + .register_column(:sizes, field: :size) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_cloudwatch_insight_rules.rb b/libraries/aws_cloudwatch_insight_rules.rb index 9cfcd403b..9616561f7 100644 --- a/libraries/aws_cloudwatch_insight_rules.rb +++ b/libraries/aws_cloudwatch_insight_rules.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudwatchInsightRules < AwsResourceBase - name "aws_cloudwatch_insight_rules" - desc "Verifies settings for Cloudwatch insight rules in bulk." + name 'aws_cloudwatch_insight_rules' + desc 'Verifies settings for Cloudwatch insight rules in bulk.' example <<-EXAMPLE describe aws_cloudwatch_insight_rules do it { should exist } @@ -18,11 +18,11 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:names, field: :name) - .register_column(:states, field: :state) - .register_column(:schemas, field: :schema) - .register_column(:definitions, field: :definition) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:states, field: :state) + .register_column(:schemas, field: :schema) + .register_column(:definitions, field: :definition) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_cloudwatch_log_group.rb b/libraries/aws_cloudwatch_log_group.rb index f35886711..1282663dc 100644 --- a/libraries/aws_cloudwatch_log_group.rb +++ b/libraries/aws_cloudwatch_log_group.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudWatchLogGroup < AwsResourceBase - name "aws_cloudwatch_log_group" - desc "Verifies settings for an AWS CloudWatch Log Group." + name 'aws_cloudwatch_log_group' + desc 'Verifies settings for an AWS CloudWatch Log Group.' example <<-EXAMPLE describe aws_cloudwatch_log_group(log_group_name: 'LOG_GROUP_NAME') do it { should exist } @@ -30,7 +30,7 @@ def initialize(opts = {}) return false if @log_groups.empty? - raise "Found multiple CloudWatch Log Groups. The following matched: #{@log_groups.join(", ")}. Try to restrict your resource criteria." if @log_groups.count > 1 + raise "Found multiple CloudWatch Log Groups. The following matched: #{@log_groups.join(', ')}. Try to restrict your resource criteria." if @log_groups.count > 1 @retention_in_days = @log_groups.first.retention_in_days @metric_filter_count = @log_groups.first.metric_filter_count diff --git a/libraries/aws_cloudwatch_log_metric_filter.rb b/libraries/aws_cloudwatch_log_metric_filter.rb index 6c01f6d17..39688db7a 100644 --- a/libraries/aws_cloudwatch_log_metric_filter.rb +++ b/libraries/aws_cloudwatch_log_metric_filter.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsCloudwatchLogMetricFilter < AwsResourceBase - name "aws_cloudwatch_log_metric_filter" - desc "Verifies individual Cloudwatch Log Metric Filters." + name 'aws_cloudwatch_log_metric_filter' + desc 'Verifies individual Cloudwatch Log Metric Filters.' example <<-EXAMPLE # Look for a Log Metric Filter. Results may be narrowed by a combination of filter name, log group name, or pattern. # If more than one Filter is returned, an error will be raised. @@ -36,7 +36,7 @@ def initialize(opts = {}) return false if @metric_filters.empty? if @metric_filters.count > 1 - raise "More than one result was returned. Consider passing more parameters or a more specific pattern to narrow down results." + raise 'More than one result was returned. Consider passing more parameters or a more specific pattern to narrow down results.' end @filter_name = @metric_filters.first.filter_name diff --git a/libraries/aws_cloudwatch_metric_stream.rb b/libraries/aws_cloudwatch_metric_stream.rb index 80e07b0a7..d0b08464e 100644 --- a/libraries/aws_cloudwatch_metric_stream.rb +++ b/libraries/aws_cloudwatch_metric_stream.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudwatchMetricStream < AwsResourceBase - name "aws_cloudwatch_metric_stream" - desc "Returns the configuration information and metadata of the specified cloudwatch stream." + name 'aws_cloudwatch_metric_stream' + desc 'Returns the configuration information and metadata of the specified cloudwatch stream.' example <<-EXAMPLE describe aws_cloudwatch_metric_stream (metric_stream_name: 'METRIC_STREAM_NAME') do it { should exist } @@ -29,7 +29,7 @@ def resource_id end def metric_stream_name - return nil unless exists? + return unless exists? @stream[:name] end diff --git a/libraries/aws_cloudwatch_metric_streams.rb b/libraries/aws_cloudwatch_metric_streams.rb index b93573ede..02015a0bf 100644 --- a/libraries/aws_cloudwatch_metric_streams.rb +++ b/libraries/aws_cloudwatch_metric_streams.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudwatchMetricStreams < AwsResourceBase - name "aws_cloudwatch_metric_streams" - desc "Returns a list of metric streams in this account." + name 'aws_cloudwatch_metric_streams' + desc 'Returns a list of metric streams in this account.' example <<-EXAMPLE describe aws_cloudwatch_metric_streams do it { should exist } @@ -18,14 +18,14 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:creation_date, field: :creation_date) - .register_column(:last_update_date, field: :last_update_date) - .register_column(:names, field: :name) - .register_column(:firehose_arns, field: :firehose_arn) - .register_column(:states, field: :state) - .register_column(:output_formats, field: :output_format) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:creation_date, field: :creation_date) + .register_column(:last_update_date, field: :last_update_date) + .register_column(:names, field: :name) + .register_column(:firehose_arns, field: :firehose_arn) + .register_column(:states, field: :state) + .register_column(:output_formats, field: :output_format) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_cloudwatchlogs_destinantion.rb b/libraries/aws_cloudwatchlogs_destinantion.rb index 25a4182d0..81fb2481b 100644 --- a/libraries/aws_cloudwatchlogs_destinantion.rb +++ b/libraries/aws_cloudwatchlogs_destinantion.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudWatchLogsDestination < AwsResourceBase - name "aws_cloudwatchlogs_destination" - desc "Describes a log destination." + name 'aws_cloudwatchlogs_destination' + desc 'Describes a log destination.' example <<-EXAMPLE describe aws_cloudwatchlogs_destination(destination_name_prefix: 'DESTINATION_NAME') do it { should exist } @@ -29,7 +29,7 @@ def resource_id end def destination_name_prefix - return nil unless exists? + return unless exists? @destinations[:destination_name_prefix] end diff --git a/libraries/aws_cloudwatchlogs_destinantions.rb b/libraries/aws_cloudwatchlogs_destinantions.rb index 8e7b0bdd5..c49e7f238 100644 --- a/libraries/aws_cloudwatchlogs_destinantions.rb +++ b/libraries/aws_cloudwatchlogs_destinantions.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudWatchLogsDestinations < AwsResourceBase - name "aws_cloudwatchlogs_destinations" - desc "Lists all cloudwatchlogs destinations." + name 'aws_cloudwatchlogs_destinations' + desc 'Lists all cloudwatchlogs destinations.' example <<-EXAMPLE describe aws_cloudwatchlogs_destinations do it { should exist } @@ -12,13 +12,13 @@ class AWSCloudWatchLogsDestinations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:destination_names, field: :destination_name) - .register_column(:target_arns, field: :target_arn) - .register_column(:role_arns, field: :role_arn) - .register_column(:access_policies, field: :access_policy) - .register_column(:arns, field: :arn) - .register_column(:creation_time, field: :creation_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:destination_names, field: :destination_name) + .register_column(:target_arns, field: :target_arn) + .register_column(:role_arns, field: :role_arn) + .register_column(:access_policies, field: :access_policy) + .register_column(:arns, field: :arn) + .register_column(:creation_time, field: :creation_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudwatchlogs_log_stream.rb b/libraries/aws_cloudwatchlogs_log_stream.rb index 6aa2cdc1b..4bfb0fb1c 100644 --- a/libraries/aws_cloudwatchlogs_log_stream.rb +++ b/libraries/aws_cloudwatchlogs_log_stream.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudWatchLogsLogStream < AwsResourceBase - name "aws_cloudwatchlogs_log_stream" - desc "Describes one or more of your logs Stream." + name 'aws_cloudwatchlogs_log_stream' + desc 'Describes one or more of your logs Stream.' example <<-EXAMPLE describe aws_cloudwatch_logs_log_stream(log_stream_name_prefix: 'LOG_STREAM_NAME', log_group_name: 'LOG_GROUP_NAME') do it { should exist } @@ -30,7 +30,7 @@ def resource_id end def log_stream_name_prefix - return nil unless exists? + return unless exists? @log_streams[:log_stream_name_prefix] end diff --git a/libraries/aws_cloudwatchlogs_log_streams.rb b/libraries/aws_cloudwatchlogs_log_streams.rb index e0470015a..7b3ac169e 100644 --- a/libraries/aws_cloudwatchlogs_log_streams.rb +++ b/libraries/aws_cloudwatchlogs_log_streams.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudWatchLogsLogStreams < AwsResourceBase - name "aws_cloudwatchlogs_log_streams" - desc "Lists all Log Streams." + name 'aws_cloudwatchlogs_log_streams' + desc 'Lists all Log Streams.' example <<-EXAMPLE describe aws_cloudwatch_logs_log_streams(log_group_name: 'LOG_GROUP_NAME') do it { should exist } @@ -12,15 +12,15 @@ class AWSCloudWatchLogsLogStreams < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:log_stream_names, field: :log_stream_name) - .register_column(:creation_time, field: :creation_time) - .register_column(:first_event_timestamps, field: :first_event_timestamp) - .register_column(:last_event_timestamps, field: :last_event_timestamp) - .register_column(:last_ingestion_time, field: :last_ingestion_time) - .register_column(:upload_sequence_tokens, field: :upload_sequence_token) - .register_column(:arns, field: :arn) - .register_column(:stored_bytes, field: :stored_bytes) - .install_filter_methods_on_resource(self, :table) + .register_column(:log_stream_names, field: :log_stream_name) + .register_column(:creation_time, field: :creation_time) + .register_column(:first_event_timestamps, field: :first_event_timestamp) + .register_column(:last_event_timestamps, field: :last_event_timestamp) + .register_column(:last_ingestion_time, field: :last_ingestion_time) + .register_column(:upload_sequence_tokens, field: :upload_sequence_token) + .register_column(:arns, field: :arn) + .register_column(:stored_bytes, field: :stored_bytes) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudwatchlogs_subscription_filter.rb b/libraries/aws_cloudwatchlogs_subscription_filter.rb index 809ac2564..e685be88d 100644 --- a/libraries/aws_cloudwatchlogs_subscription_filter.rb +++ b/libraries/aws_cloudwatchlogs_subscription_filter.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudWatchLogsSubscriptionFilter < AwsResourceBase - name "aws_cloudwatchlogs_subscription_filter" - desc "Describes single subscription filter." + name 'aws_cloudwatchlogs_subscription_filter' + desc 'Describes single subscription filter.' example <<-EXAMPLE describe aws_cloudwatchlogs_subscription_filter(log_group_name: 'LOG_GROUP_NAME', filter_name_prefix: 'FILTER_NAME') do it { should exist } @@ -31,7 +31,7 @@ def resource_id end def filter_name_prefix - return nil unless exists? + return unless exists? @filter[:filter_name_prefix] end diff --git a/libraries/aws_cloudwatchlogs_subscription_filters.rb b/libraries/aws_cloudwatchlogs_subscription_filters.rb index 8aedf2b03..510ce6a01 100644 --- a/libraries/aws_cloudwatchlogs_subscription_filters.rb +++ b/libraries/aws_cloudwatchlogs_subscription_filters.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCloudWatchLogsSubscriptionFilters < AwsResourceBase - name "aws_cloudwatchlogs_subscription_filters" - desc "Describes multiple subscription filter." + name 'aws_cloudwatchlogs_subscription_filters' + desc 'Describes multiple subscription filter.' example <<-EXAMPLE describe aws_cloudwatchlogs_subscription_filters(log_group_name: 'LOG_GROUP_NAME') do it { should exist } @@ -12,14 +12,14 @@ class AWSCloudWatchLogsSubscriptionFilters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:filter_names, field: :filter_name) - .register_column(:log_group_names, field: :log_group_name) - .register_column(:filter_patterns, field: :filter_pattern) - .register_column(:destination_arns, field: :destination_arn) - .register_column(:role_arns, field: :role_arn) - .register_column(:distributions, field: :distribution) - .register_column(:creation_time, field: :creation_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:filter_names, field: :filter_name) + .register_column(:log_group_names, field: :log_group_name) + .register_column(:filter_patterns, field: :filter_pattern) + .register_column(:destination_arns, field: :destination_arn) + .register_column(:role_arns, field: :role_arn) + .register_column(:distributions, field: :distribution) + .register_column(:creation_time, field: :creation_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cognito_identity_pool.rb b/libraries/aws_cognito_identity_pool.rb index ff05ce71d..cd7315dcc 100644 --- a/libraries/aws_cognito_identity_pool.rb +++ b/libraries/aws_cognito_identity_pool.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCognitoIdentityPool < AwsResourceBase - name "aws_cognito_identity_pool" - desc "Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users." + name 'aws_cognito_identity_pool' + desc 'Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users.' example <<-EXAMPLE describe aws_cognito_identity_pool(identity_pool_id: 'IDENTIRY_POOL_ID') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts = {}) end def identity_pool_id - return nil unless exists? + return unless exists? @res[:identity_pool_id] end diff --git a/libraries/aws_cognito_identity_pools.rb b/libraries/aws_cognito_identity_pools.rb index 81b566ac2..53e530de1 100644 --- a/libraries/aws_cognito_identity_pools.rb +++ b/libraries/aws_cognito_identity_pools.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCognitoIdentityPools < AwsResourceBase - name "aws_cognito_identity_pools" - desc "Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users." + name 'aws_cognito_identity_pools' + desc 'Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users.' example <<-EXAMPLE describe aws_cognito_identity_pools do it { should exist } @@ -12,9 +12,9 @@ class AWSCognitoIdentityPools < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:identity_pool_ids, field: :identity_pool_id) - .register_column(:identity_pool_names, field: :identity_pool_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:identity_pool_ids, field: :identity_pool_id) + .register_column(:identity_pool_names, field: :identity_pool_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cognito_userpool.rb b/libraries/aws_cognito_userpool.rb index fb4ad0141..a66137a3a 100644 --- a/libraries/aws_cognito_userpool.rb +++ b/libraries/aws_cognito_userpool.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCognitoUserPool < AwsResourceBase - name "aws_cognito_userpool" - desc "Returns the configuration information and metadata of the specified user pool." + name 'aws_cognito_userpool' + desc 'Returns the configuration information and metadata of the specified user pool.' example <<-EXAMPLE describe aws_cognito_userpool(user_pool_id: 'USER_POOL_ID') do it { should exist } @@ -24,7 +24,7 @@ def initialize(opts = {}) end def job_queue_name - return nil unless exists? + return unless exists? @user_pool[:job_queue_name] end diff --git a/libraries/aws_cognito_userpool_client.rb b/libraries/aws_cognito_userpool_client.rb index 477a57463..de7fdf576 100644 --- a/libraries/aws_cognito_userpool_client.rb +++ b/libraries/aws_cognito_userpool_client.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCognitoUserPoolClient < AwsResourceBase - name "aws_cognito_userpool_client" - desc "Client method for returning the configuration information and metadata of the specified user pool app client." + name 'aws_cognito_userpool_client' + desc 'Client method for returning the configuration information and metadata of the specified user pool app client.' example <<-EXAMPLE describe aws_cognito_userpool_client(user_pool_id: 'USER_POOL_ID', client_id: 'CLIENT_ID') do it { should exist } @@ -21,7 +21,7 @@ def initialize(opts = {}) end def id - return nil unless exists? + return unless exists? @user_pool_client[:user_pool_id, :client_id] end diff --git a/libraries/aws_cognito_userpool_clients.rb b/libraries/aws_cognito_userpool_clients.rb index 581be4063..941007adb 100644 --- a/libraries/aws_cognito_userpool_clients.rb +++ b/libraries/aws_cognito_userpool_clients.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCognitoUserPoolClients < AwsResourceBase - name "aws_cognito_userpool_clients" - desc "Lists the clients that have been created for the specified user pool." + name 'aws_cognito_userpool_clients' + desc 'Lists the clients that have been created for the specified user pool.' example <<-EXAMPLE describe aws_cognito_userpool_clients(user_pool_id: 'USER_POOL_ID') do its('count') { should eq 3 } @@ -12,10 +12,10 @@ class AWSCognitoUserPoolClients < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:client_ids, field: :client_id) - .register_column(:user_pool_ids, field: :user_pool_id) - .register_column(:client_names, field: :client_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:client_ids, field: :client_id) + .register_column(:user_pool_ids, field: :user_pool_id) + .register_column(:client_names, field: :client_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cognito_userpools.rb b/libraries/aws_cognito_userpools.rb index 18d36365f..a63ffbe83 100644 --- a/libraries/aws_cognito_userpools.rb +++ b/libraries/aws_cognito_userpools.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSCognitoUserPools < AwsResourceBase - name "aws_cognito_userpools" - desc "Lists the user pools associated with an AWS account." + name 'aws_cognito_userpools' + desc 'Lists the user pools associated with an AWS account.' example <<-EXAMPLE describe aws_cognito_userpools do it { should exist } @@ -12,13 +12,13 @@ class AWSCognitoUserPools < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:lambda_configs, field: :lambda_config) - .register_column(:statuses, field: :status) - .register_column(:last_modified_dates, field: :last_modified_date) - .register_column(:creation_dates, field: :creation_date) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:lambda_configs, field: :lambda_config) + .register_column(:statuses, field: :status) + .register_column(:last_modified_dates, field: :last_modified_date) + .register_column(:creation_dates, field: :creation_date) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_config_delivery_channel.rb b/libraries/aws_config_delivery_channel.rb index 9f33e5cdf..c13c4fd89 100644 --- a/libraries/aws_config_delivery_channel.rb +++ b/libraries/aws_config_delivery_channel.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsConfigDeliveryChannel < AwsResourceBase - name "aws_config_delivery_channel" - desc "Verifies settings for AWS Config Delivery Channel." + name 'aws_config_delivery_channel' + desc 'Verifies settings for AWS Config Delivery Channel.' example <<-EXAMPLE describe aws_config_delivery_channel do it { should exist } @@ -34,11 +34,11 @@ def initialize(opts = {}) @sns_topic_arn = channel[:sns_topic_arn] @delivery_frequency_in_hours = channel.dig(:config_snapshot_delivery_properties, :delivery_frequency) frequencies = { - "One_Hour" => 1, - "TwentyFour_Hours" => 24, - "Three_Hours" => 3, - "Six_Hours" => 6, - "Twelve_Hours" => 12, + 'One_Hour' => 1, + 'TwentyFour_Hours' => 24, + 'Three_Hours' => 3, + 'Six_Hours' => 6, + 'Twelve_Hours' => 12, } @delivery_frequency_in_hours = frequencies[@delivery_frequency_in_hours] end diff --git a/libraries/aws_config_recorder.rb b/libraries/aws_config_recorder.rb index ea7c3b1a7..28fff92f0 100644 --- a/libraries/aws_config_recorder.rb +++ b/libraries/aws_config_recorder.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsConfigurationRecorder < AwsResourceBase - name "aws_config_recorder" - desc "Verifies settings for AWS Configuration Recorder." + name 'aws_config_recorder' + desc 'Verifies settings for AWS Configuration Recorder.' example <<-EXAMPLE describe aws_config_recorder('CONFIG_RECORDER_NAME') do it { should exist } diff --git a/libraries/aws_db_parameter_group.rb b/libraries/aws_db_parameter_group.rb index 88d459c36..5b8d921a2 100644 --- a/libraries/aws_db_parameter_group.rb +++ b/libraries/aws_db_parameter_group.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsDbParameterGroup < AwsResourceBase - name "aws_db_parameter_group" - desc "Verifies settings for a Parameter Group." + name 'aws_db_parameter_group' + desc 'Verifies settings for a Parameter Group.' example <<-EXAMPLE describe aws_db_parameter_group(db_parameter_group_name: 'DB_PARAMETER_GROUP_NAME') do it { should exist } diff --git a/libraries/aws_db_parameter_groups.rb b/libraries/aws_db_parameter_groups.rb index 2a7a7b6ef..d3170abf6 100644 --- a/libraries/aws_db_parameter_groups.rb +++ b/libraries/aws_db_parameter_groups.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsDbParameterGroups < AwsResourceBase - name "aws_db_parameter_groups" - desc "Verifies settings for a Parameter Group in bulk." + name 'aws_db_parameter_groups' + desc 'Verifies settings for a Parameter Group in bulk.' example <<-EXAMPLE describe aws_db_parameter_groups do it { should exist } @@ -12,11 +12,11 @@ class AwsDbParameterGroups < AwsResourceBase attr_reader :table, :api_response FilterTable.create - .register_column(:db_parameter_group_names, field: :db_parameter_group_name) - .register_column(:db_parameter_group_families, field: :db_parameter_group_family) - .register_column(:descriptions, field: :description) - .register_column(:db_parameter_group_arns, field: :db_parameter_group_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:db_parameter_group_names, field: :db_parameter_group_name) + .register_column(:db_parameter_group_families, field: :db_parameter_group_family) + .register_column(:descriptions, field: :description) + .register_column(:db_parameter_group_arns, field: :db_parameter_group_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_db_subnet_group.rb b/libraries/aws_db_subnet_group.rb index 088b16596..d13e683aa 100644 --- a/libraries/aws_db_subnet_group.rb +++ b/libraries/aws_db_subnet_group.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsDbSubnetGroup < AwsResourceBase - name "aws_db_subnet_group" - desc "Verifies settings for a Subnet Group." + name 'aws_db_subnet_group' + desc 'Verifies settings for a Subnet Group.' example <<-EXAMPLE describe aws_subnet_group(db_subnet_group_name: 'DB_SUBNET_GROUP_NAME') do it { should exist } diff --git a/libraries/aws_db_subnet_groups.rb b/libraries/aws_db_subnet_groups.rb index 56373f772..b05c31262 100644 --- a/libraries/aws_db_subnet_groups.rb +++ b/libraries/aws_db_subnet_groups.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsDbSubnetGroups < AwsResourceBase - name "aws_db_subnet_groups" - desc "Verifies settings for a Subnet Group in bulk." + name 'aws_db_subnet_groups' + desc 'Verifies settings for a Subnet Group in bulk.' example <<-EXAMPLE describe aws_db_subnet_groups do it { should exist } @@ -12,13 +12,13 @@ class AwsDbSubnetGroups < AwsResourceBase attr_reader :table, :subnet_rows, :api_response FilterTable.create - .register_column(:db_subnet_group_names, field: :db_subnet_group_name) - .register_column(:db_subnet_group_descriptions, field: :db_subnet_group_description) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:subnet_group_status, field: :subnet_group_status) - .register_column(:subnets, field: :subnets) - .register_column(:db_subnet_group_arns, field: :db_subnet_group_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:db_subnet_group_names, field: :db_subnet_group_name) + .register_column(:db_subnet_group_descriptions, field: :db_subnet_group_description) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:subnet_group_status, field: :subnet_group_status) + .register_column(:subnets, field: :subnets) + .register_column(:db_subnet_group_arns, field: :db_subnet_group_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_dhcp_options.rb b/libraries/aws_dhcp_options.rb index cb6cbec5e..5dd82abb1 100644 --- a/libraries/aws_dhcp_options.rb +++ b/libraries/aws_dhcp_options.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsDhcpOptions < AwsResourceBase - name "aws_dhcp_options" - desc "Verifies settings for an AWS DHCP Options." + name 'aws_dhcp_options' + desc 'Verifies settings for an AWS DHCP Options.' example <<-EXAMPLE describe aws_dhcp_options(dhcp_options_id: 'DHCP_OPTIONS_ID) do it { should exist } @@ -20,7 +20,7 @@ def initialize(opts = {}) end @display_name = opts[:dhcp_options_id] - filter = { name: "dhcp-options-id", values: [opts[:dhcp_options_id]] } + filter = { name: 'dhcp-options-id', values: [opts[:dhcp_options_id]] } catch_aws_errors do resp = @aws.compute_client.describe_dhcp_options({ filters: [filter] }) @@ -34,11 +34,11 @@ def exists? end def domain_name_servers - _dhcp_config("domain-name-servers") + _dhcp_config('domain-name-servers') end def ntp_servers - _dhcp_config("ntp-servers") + _dhcp_config('ntp-servers') end def resource_id @@ -58,7 +58,7 @@ def _dhcp_config(key) end def deprecation_notice - "DEPRECATION: `aws_dhcp_options` will be deprecated soon and it is advised to switch to the new resource `aws_ec2_dhcp_option`. "\ - "Please see the documentation for the additional features available." + 'DEPRECATION: `aws_dhcp_options` will be deprecated soon and it is advised to switch to the new resource `aws_ec2_dhcp_option`. '\ + 'Please see the documentation for the additional features available.' end end diff --git a/libraries/aws_dms_endpoint.rb b/libraries/aws_dms_endpoint.rb index d355de63c..0a3e8e7dc 100644 --- a/libraries/aws_dms_endpoint.rb +++ b/libraries/aws_dms_endpoint.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSDMSEndpoint < AwsResourceBase - name "aws_dms_endpoint" - desc "Returns information about the endpoints for your account in the current region." + name 'aws_dms_endpoint' + desc 'Returns information about the endpoints for your account in the current region.' example <<-EXAMPLE describe aws_dms_endpoint(endpoint_arn: 'DMS_ENDPOINT_ARN') do it { should exist } @@ -17,7 +17,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: endpoint_arn must be provided" unless opts[:endpoint_arn] && !opts[:endpoint_arn].empty? @display_name = opts[:endpoint_arn] - filter = { name: "endpoint-arn", values: [opts[:endpoint_arn]] } + filter = { name: 'endpoint-arn', values: [opts[:endpoint_arn]] } catch_aws_errors do resp = @aws.dmsmigrationservice_client.describe_endpoints({ filters: [filter] }) @endpoints = resp.endpoints[0].to_h @@ -30,7 +30,7 @@ def resource_id end def endpoint_arn - return nil unless exists? + return unless exists? @endpoints[:endpoint_arn] end diff --git a/libraries/aws_dms_endpoints.rb b/libraries/aws_dms_endpoints.rb index 5d8b1bdad..66b0c16a2 100644 --- a/libraries/aws_dms_endpoints.rb +++ b/libraries/aws_dms_endpoints.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSDMSEndpoints < AwsResourceBase - name "aws_dms_endpoints" - desc "Returns information about the endpoints for your account in the current region." + name 'aws_dms_endpoints' + desc 'Returns information about the endpoints for your account in the current region.' example <<-EXAMPLE describe aws_dms_endpoints do it { should exist } @@ -12,40 +12,40 @@ class AWSDMSEndpoints < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:endpoint_identifiers, field: :endpoint_identifier) - .register_column(:endpoint_types, field: :endpoint_type) - .register_column(:engine_names, field: :engine_name) - .register_column(:engine_display_names, field: :engine_display_name) - .register_column(:usernames, field: :username) - .register_column(:server_names, field: :server_name) - .register_column(:ports, field: :port) - .register_column(:database_names, field: :database_name) - .register_column(:extra_connection_attributes, field: :extra_connection_attributes) - .register_column(:statuses, field: :status) - .register_column(:kms_key_ids, field: :kms_key_id) - .register_column(:endpoint_arns, field: :endpoint_arn) - .register_column(:certificate_arns, field: :certificate_arn) - .register_column(:ssl_modes, field: :ssl_mode) - .register_column(:service_access_role_arns, field: :service_access_role_arn) - .register_column(:external_table_definitions, field: :external_table_definition) - .register_column(:external_ids, field: :external_id) - .register_column(:dynamo_db_settings, field: :dynamo_db_settings) - .register_column(:s3_settings, field: :s3_settings) - .register_column(:dms_transfer_settings, field: :dms_transfer_settings) - .register_column(:mongo_db_settings, field: :mongo_db_settings) - .register_column(:kinesis_settings, field: :kinesis_settings) - .register_column(:kafka_settings, field: :kafka_settings) - .register_column(:elasticsearch_settings, field: :elasticsearch_settings) - .register_column(:neptune_settings, field: :neptune_settings) - .register_column(:redshift_settings, field: :redshift_settings) - .register_column(:postgre_sql_settings, field: :postgre_sql_settings) - .register_column(:my_sql_settings, field: :my_sql_settings) - .register_column(:oracle_settings, field: :oracle_settings) - .register_column(:sybase_settings, field: :sybase_settings) - .register_column(:microsoft_sql_server_settings, field: :microsoft_sql_server_settings) - .register_column(:ibm_db_2_settings, field: :ibm_db_2_settings) - .register_column(:doc_db_settings, field: :doc_db_settings) - .install_filter_methods_on_resource(self, :table) + .register_column(:endpoint_identifiers, field: :endpoint_identifier) + .register_column(:endpoint_types, field: :endpoint_type) + .register_column(:engine_names, field: :engine_name) + .register_column(:engine_display_names, field: :engine_display_name) + .register_column(:usernames, field: :username) + .register_column(:server_names, field: :server_name) + .register_column(:ports, field: :port) + .register_column(:database_names, field: :database_name) + .register_column(:extra_connection_attributes, field: :extra_connection_attributes) + .register_column(:statuses, field: :status) + .register_column(:kms_key_ids, field: :kms_key_id) + .register_column(:endpoint_arns, field: :endpoint_arn) + .register_column(:certificate_arns, field: :certificate_arn) + .register_column(:ssl_modes, field: :ssl_mode) + .register_column(:service_access_role_arns, field: :service_access_role_arn) + .register_column(:external_table_definitions, field: :external_table_definition) + .register_column(:external_ids, field: :external_id) + .register_column(:dynamo_db_settings, field: :dynamo_db_settings) + .register_column(:s3_settings, field: :s3_settings) + .register_column(:dms_transfer_settings, field: :dms_transfer_settings) + .register_column(:mongo_db_settings, field: :mongo_db_settings) + .register_column(:kinesis_settings, field: :kinesis_settings) + .register_column(:kafka_settings, field: :kafka_settings) + .register_column(:elasticsearch_settings, field: :elasticsearch_settings) + .register_column(:neptune_settings, field: :neptune_settings) + .register_column(:redshift_settings, field: :redshift_settings) + .register_column(:postgre_sql_settings, field: :postgre_sql_settings) + .register_column(:my_sql_settings, field: :my_sql_settings) + .register_column(:oracle_settings, field: :oracle_settings) + .register_column(:sybase_settings, field: :sybase_settings) + .register_column(:microsoft_sql_server_settings, field: :microsoft_sql_server_settings) + .register_column(:ibm_db_2_settings, field: :ibm_db_2_settings) + .register_column(:doc_db_settings, field: :doc_db_settings) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_dms_replication_instance.rb b/libraries/aws_dms_replication_instance.rb index bd8b7a45c..11e868c4e 100644 --- a/libraries/aws_dms_replication_instance.rb +++ b/libraries/aws_dms_replication_instance.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSDMSReplicationInstance < AwsResourceBase - name "aws_dms_replication_instance" - desc "Returns information about the replication instance types that can be created in the specified region." + name 'aws_dms_replication_instance' + desc 'Returns information about the replication instance types that can be created in the specified region.' example <<-EXAMPLE describe aws_dms_replication_instance do it { should exist } @@ -20,11 +20,11 @@ def initialize(opts = {}) end def resource_id - "#{@orderable_replication_instances? @orderable_replication_instances[:replication_instance_class]: ""}_#{@orderable_replication_instances? @orderable_replication_instances[:engine_version]: ""}" + "#{@orderable_replication_instances? @orderable_replication_instances[:replication_instance_class]: ''}_#{@orderable_replication_instances? @orderable_replication_instances[:engine_version]: ''}" end def replication_instance_class - return nil unless exists? + return unless exists? @orderable_replication_instances[:replication_instance_class] end diff --git a/libraries/aws_dms_replication_instances.rb b/libraries/aws_dms_replication_instances.rb index 98a885021..8eb78bfb4 100644 --- a/libraries/aws_dms_replication_instances.rb +++ b/libraries/aws_dms_replication_instances.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSDMSReplicationInstances < AwsResourceBase - name "aws_dms_replication_instances" - desc "Returns information about the replication instance types that can be created in the specified region." + name 'aws_dms_replication_instances' + desc 'Returns information about the replication instance types that can be created in the specified region.' example <<-EXAMPLE describe aws_dms_replication_instances do it { should exist } @@ -12,16 +12,16 @@ class AWSDMSReplicationInstances < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:engine_versions, field: :engine_version) - .register_column(:replication_instance_classes, field: :replication_instance_class) - .register_column(:storage_types, field: :storage_type) - .register_column(:min_allocated_storages, field: :min_allocated_storage) - .register_column(:max_allocated_storages, field: :max_allocated_storage) - .register_column(:default_allocated_storages, field: :default_allocated_storage) - .register_column(:included_allocated_storages, field: :included_allocated_storage) - .register_column(:availability_zones, field: :availability_zones) - .register_column(:release_statuses, field: :release_status) - .install_filter_methods_on_resource(self, :table) + .register_column(:engine_versions, field: :engine_version) + .register_column(:replication_instance_classes, field: :replication_instance_class) + .register_column(:storage_types, field: :storage_type) + .register_column(:min_allocated_storages, field: :min_allocated_storage) + .register_column(:max_allocated_storages, field: :max_allocated_storage) + .register_column(:default_allocated_storages, field: :default_allocated_storage) + .register_column(:included_allocated_storages, field: :included_allocated_storage) + .register_column(:availability_zones, field: :availability_zones) + .register_column(:release_statuses, field: :release_status) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_dms_replication_subnet_group.rb b/libraries/aws_dms_replication_subnet_group.rb index 137c8e785..4becc12dc 100644 --- a/libraries/aws_dms_replication_subnet_group.rb +++ b/libraries/aws_dms_replication_subnet_group.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSDMSReplicationSubnetGroup < AwsResourceBase - name "aws_dms_replication_subnet_group" - desc "Returns information about the replication subnet groups." + name 'aws_dms_replication_subnet_group' + desc 'Returns information about the replication subnet groups.' example <<-EXAMPLE describe aws_dms_replication_subnet_group(replication_subnet_group_identifier: 'REPLICATION_SUBNET_GROUP_IDENTIFIER') do it { should exits } @@ -20,7 +20,7 @@ def initialize(opts = {}) { filters: [ { - name: "replication-subnet-group-id", + name: 'replication-subnet-group-id', values: [opts[:replication_subnet_group_identifier]], }, ], @@ -36,7 +36,7 @@ def resource_id end def replication_subnet_group_identifier - return nil unless exists? + return unless exists? @replication_subnet_groups[:replication_subnet_group_identifier] end diff --git a/libraries/aws_dms_replication_subnet_groups.rb b/libraries/aws_dms_replication_subnet_groups.rb index b40c20d57..f2c2ec96a 100644 --- a/libraries/aws_dms_replication_subnet_groups.rb +++ b/libraries/aws_dms_replication_subnet_groups.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSDMSReplicationSubnetGroups < AwsResourceBase - name "aws_dms_replication_subnet_groups" - desc "Returns information about the replication subnet groups." + name 'aws_dms_replication_subnet_groups' + desc 'Returns information about the replication subnet groups.' example <<-EXAMPLE describe aws_dms_replication_subnet_groups do it { should exist } @@ -12,12 +12,12 @@ class AWSDMSReplicationSubnetGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:replication_subnet_group_identifiers, field: :replication_subnet_group_identifier) - .register_column(:replication_subnet_group_descriptions, field: :replication_subnet_group_description) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:subnet_group_statuses, field: :subnet_group_status) - .register_column(:subnets, field: :subnets) - .install_filter_methods_on_resource(self, :table) + .register_column(:replication_subnet_group_identifiers, field: :replication_subnet_group_identifier) + .register_column(:replication_subnet_group_descriptions, field: :replication_subnet_group_description) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:subnet_group_statuses, field: :subnet_group_status) + .register_column(:subnets, field: :subnets) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_dynamodb_table.rb b/libraries/aws_dynamodb_table.rb index 328f9baf9..5c9cfe3dd 100644 --- a/libraries/aws_dynamodb_table.rb +++ b/libraries/aws_dynamodb_table.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsDynamoDbTable < AwsResourceBase - name "aws_dynamodb_table" - desc "Verifies the settings for a DynamoDB table." + name 'aws_dynamodb_table' + desc 'Verifies the settings for a DynamoDB table.' example <<-EXAMPLE describe aws_dynamodb_table(table_name: 'DYNAMODB_TABLE_NAME') do it { should exist } @@ -21,7 +21,7 @@ def initialize(opts = {}) catch_aws_errors do begin resp = @aws.dynamodb_client.describe_table(table_name: opts[:table_name]) - return nil if resp[0].nil? || resp[0].empty? + return if resp[0].nil? || resp[0].empty? rescue Aws::DynamoDB::Errors::ResourceNotFoundException return end @@ -29,7 +29,7 @@ def initialize(opts = {}) @table_name = @dynamodb_table[:table_name] @table_status = @dynamodb_table[:table_status] @table_arn = @dynamodb_table[:table_arn] - @creation_date = @dynamodb_table[:creation_date_time].strftime("%m/%d/%Y") + @creation_date = @dynamodb_table[:creation_date_time].strftime('%m/%d/%Y') @number_of_decreases_today = @dynamodb_table[:provisioned_throughput][:number_of_decreases_today] @write_capacity_units = @dynamodb_table[:provisioned_throughput][:write_capacity_units] @read_capacity_units = @dynamodb_table[:provisioned_throughput][:read_capacity_units] @@ -68,7 +68,7 @@ def resource_id end def encrypted? - @dynamodb_table.dig(:sse_description, :status)&.upcase == "ENABLED" || false + @dynamodb_table.dig(:sse_description, :status)&.upcase == 'ENABLED' || false end def exists? diff --git a/libraries/aws_dynamodb_tables.rb b/libraries/aws_dynamodb_tables.rb index 05a7f4b08..3f8053dab 100644 --- a/libraries/aws_dynamodb_tables.rb +++ b/libraries/aws_dynamodb_tables.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsDynamoDbTables < AwsResourceBase - name "aws_dynamodb_tables" - desc "Verifies settings for a DynamoDB table in bulk." + name 'aws_dynamodb_tables' + desc 'Verifies settings for a DynamoDB table in bulk.' example <<-EXAMPLE describe aws_dynamodb_tables do it { should exist } @@ -19,8 +19,8 @@ class AwsDynamoDbTables < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:table_names, field: :table_names) - .install_filter_methods_on_resource(self, :table) + .register_column(:table_names, field: :table_names) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ebs_snapshot.rb b/libraries/aws_ebs_snapshot.rb index 2be593f1c..a9789ef87 100644 --- a/libraries/aws_ebs_snapshot.rb +++ b/libraries/aws_ebs_snapshot.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEbsSnapshot < AwsResourceBase - name "aws_ebs_snapshot" - desc "Verifies settings for an EBS snapshot." + name 'aws_ebs_snapshot' + desc 'Verifies settings for an EBS snapshot.' example <<-EXAMPLE describe aws_ebs_snapshot('SNAPSHOT_ID') do it { should_not be_public } @@ -51,7 +51,7 @@ def exists? end def public? - (@group == "all") + (@group == 'all') end def private? @@ -76,7 +76,7 @@ def fetch_snapshot_properties if opts[:snapshot_id] && !opts[:snapshot_id].empty? snapshot_arguments = { snapshot_ids: [opts[:snapshot_id]] } elsif opts[:name] && !opts[:name].empty? - snapshot_arguments = { filters: [{ name: "tag:Name", values: [opts[:name]] }] } + snapshot_arguments = { filters: [{ name: 'tag:Name', values: [opts[:name]] }] } end catch_aws_errors do @@ -90,7 +90,7 @@ def fetch_snapshot_properties # Getting snapshot's attribute required for checking its accessiblility (using createVolumePermission) - public/private catch_aws_errors do @resp_snapshot_attributes = @aws.compute_client.describe_snapshot_attribute( - attribute: "createVolumePermission", + attribute: 'createVolumePermission', snapshot_id: @snapshot_id, ) @snapshot_attributes_hash = @resp_snapshot_attributes.to_h @@ -99,7 +99,7 @@ def fetch_snapshot_properties @group = nil @user_ids = [] @create_volume_permissions.each do |perms| - @group = "all" if perms[:group] == "all" + @group = 'all' if perms[:group] == 'all' @user_ids << perms[:user_id] unless perms[:user_id].nil? end end diff --git a/libraries/aws_ebs_snapshots.rb b/libraries/aws_ebs_snapshots.rb index 3a063ba4c..92513e602 100644 --- a/libraries/aws_ebs_snapshots.rb +++ b/libraries/aws_ebs_snapshots.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEbsSnapshots < AwsResourceBase - name "aws_ebs_snapshots" - desc "Verifies settings for a collection of AWS EBS Snapshots." + name 'aws_ebs_snapshots' + desc 'Verifies settings for a collection of AWS EBS Snapshots.' example <<-EXAMPLE describe aws_ebs_snapshots do it { should exist } @@ -12,11 +12,11 @@ class AwsEbsSnapshots < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:snapshot_ids, field: :snapshot_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:encrypted, field: :encrypted) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:snapshot_ids, field: :snapshot_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:encrypted, field: :encrypted) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ebs_volume.rb b/libraries/aws_ebs_volume.rb index 5a1de8730..04112b9a6 100644 --- a/libraries/aws_ebs_volume.rb +++ b/libraries/aws_ebs_volume.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEbsVolume < AwsResourceBase - name "aws_ebs_volume" - desc "Verifies settings for an EBS volume." + name 'aws_ebs_volume' + desc 'Verifies settings for an EBS volume.' example <<-EXAMPLE describe aws_ebs_volume('EBS_VOLUME_ID') do it { should be_encrypted } @@ -26,7 +26,7 @@ def initialize(opts = {}) volume_arguments = { volume_ids: [opts[:volume_id]] } elsif opts[:name] && !opts[:name].empty? @display_name = opts[:name] - filter = { name: "tag:Name", values: [opts[:name]] } + filter = { name: 'tag:Name', values: [opts[:name]] } volume_arguments = { filters: [filter] } else raise ArgumentError, "#{@__resource_name__}: `volume_id` or `name` must be provided" @@ -48,7 +48,7 @@ def tags end def id - return nil unless exists? + return unless exists? @volume[:volume_id] end diff --git a/libraries/aws_ebs_volumes.rb b/libraries/aws_ebs_volumes.rb index 754b835e6..7a97f7073 100644 --- a/libraries/aws_ebs_volumes.rb +++ b/libraries/aws_ebs_volumes.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEbsVolumes < AwsResourceBase - name "aws_ebs_volumes" - desc "Verifies settings for a collection of AWS EBS Volumes." + name 'aws_ebs_volumes' + desc 'Verifies settings for a collection of AWS EBS Volumes.' example <<-EXAMPLE describe aws_ebs_volumes do it { should exist } @@ -12,22 +12,22 @@ class AwsEbsVolumes < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:attachments, field: :attachments) - .register_column(:availability_zones, field: :availability_zone) - .register_column(:create_times, field: :create_time) - .register_column(:encrypted, field: :encrypted) - .register_column(:kms_key_ids, field: :kms_key_id) - .register_column(:outpost_arns, field: :outpost_arn) - .register_column(:sizes, field: :size) - .register_column(:snapshot_ids, field: :snapshot_id) - .register_column(:states, field: :state) - .register_column(:volume_ids, field: :volume_id) - .register_column(:iops, field: :iops) - .register_column(:tags, field: :tags) - .register_column(:volume_types, field: :volume_type) - .register_column(:fast_restored, field: :fast_restored) - .register_column(:multi_attach_enabled, field: :multi_attach_enabled) - .install_filter_methods_on_resource(self, :table) + .register_column(:attachments, field: :attachments) + .register_column(:availability_zones, field: :availability_zone) + .register_column(:create_times, field: :create_time) + .register_column(:encrypted, field: :encrypted) + .register_column(:kms_key_ids, field: :kms_key_id) + .register_column(:outpost_arns, field: :outpost_arn) + .register_column(:sizes, field: :size) + .register_column(:snapshot_ids, field: :snapshot_id) + .register_column(:states, field: :state) + .register_column(:volume_ids, field: :volume_id) + .register_column(:iops, field: :iops) + .register_column(:tags, field: :tags) + .register_column(:volume_types, field: :volume_type) + .register_column(:fast_restored, field: :fast_restored) + .register_column(:multi_attach_enabled, field: :multi_attach_enabled) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_capacity_reservation.rb b/libraries/aws_ec2_capacity_reservation.rb index 1fbfc6d21..2a532c1cd 100644 --- a/libraries/aws_ec2_capacity_reservation.rb +++ b/libraries/aws_ec2_capacity_reservation.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2CapacityReservation < AwsResourceBase - name "aws_ec2_capacity_reservation" - desc "Describes one Capacity Reservations." + name 'aws_ec2_capacity_reservation' + desc 'Describes one Capacity Reservations.' example <<-EXAMPLE describe aws_ec2_capacity_reservation(capacity_reservation_id: 'CAPACITY_RESERVATION_ID') do it { should exist } @@ -24,7 +24,7 @@ def initialize(opts = {}) end def capacity_reservation_id - return nil unless exists? + return unless exists? @resp[:capacity_reservation_id] end diff --git a/libraries/aws_ec2_capacity_reservations.rb b/libraries/aws_ec2_capacity_reservations.rb index c135c40a8..5f32ed139 100644 --- a/libraries/aws_ec2_capacity_reservations.rb +++ b/libraries/aws_ec2_capacity_reservations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2CapacityReservations < AwsResourceBase - name "aws_ec2_capacity_reservations" - desc "Describes one or more of your Capacity Reservations." + name 'aws_ec2_capacity_reservations' + desc 'Describes one or more of your Capacity Reservations.' example <<-EXAMPLE describe aws_ec2_capacity_reservations do it { should exist } @@ -12,27 +12,27 @@ class AWSEC2CapacityReservations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:capacity_reservation_ids, field: :capacity_reservation_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:capacity_reservation_arns, field: :capacity_reservation_arn) - .register_column(:availability_zone_ids, field: :availability_zone_id) - .register_column(:instance_types, field: :instance_type) - .register_column(:instance_platforms, field: :instance_platform) - .register_column(:availability_zones, field: :availability_zone) - .register_column(:tenancies, field: :tenancy) - .register_column(:total_instance_counts, field: :total_instance_count) - .register_column(:available_instance_counts, field: :available_instance_count) - .register_column(:ebs_optimized, field: :ebs_optimized) - .register_column(:ephemeral_storages, field: :ephemeral_storage) - .register_column(:states, field: :state) - .register_column(:start_dates, field: :start_date) - .register_column(:end_dates, field: :end_date) - .register_column(:end_date_types, field: :end_date_type) - .register_column(:instance_match_criterias, field: :instance_match_criteria) - .register_column(:create_dates, field: :create_date) - .register_column(:tags, field: :tags) - .register_column(:outpost_arns, field: :outpost_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:capacity_reservation_ids, field: :capacity_reservation_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:capacity_reservation_arns, field: :capacity_reservation_arn) + .register_column(:availability_zone_ids, field: :availability_zone_id) + .register_column(:instance_types, field: :instance_type) + .register_column(:instance_platforms, field: :instance_platform) + .register_column(:availability_zones, field: :availability_zone) + .register_column(:tenancies, field: :tenancy) + .register_column(:total_instance_counts, field: :total_instance_count) + .register_column(:available_instance_counts, field: :available_instance_count) + .register_column(:ebs_optimized, field: :ebs_optimized) + .register_column(:ephemeral_storages, field: :ephemeral_storage) + .register_column(:states, field: :state) + .register_column(:start_dates, field: :start_date) + .register_column(:end_dates, field: :end_date) + .register_column(:end_date_types, field: :end_date_type) + .register_column(:instance_match_criterias, field: :instance_match_criteria) + .register_column(:create_dates, field: :create_date) + .register_column(:tags, field: :tags) + .register_column(:outpost_arns, field: :outpost_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_carrier_gateway.rb b/libraries/aws_ec2_carrier_gateway.rb index 5a51a1ca1..f318b443d 100644 --- a/libraries/aws_ec2_carrier_gateway.rb +++ b/libraries/aws_ec2_carrier_gateway.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2CarrierGateway < AwsResourceBase - name "aws_ec2_carrier_gateway" - desc "Describes single carrier gateway." + name 'aws_ec2_carrier_gateway' + desc 'Describes single carrier gateway.' example <<-EXAMPLE describe aws_ec2_carrier_gateway(carrier_gateway_id: 'CARRIER_GATEWAY_ID') do it { should exist } @@ -24,7 +24,7 @@ def initialize(opts = {}) end def carrier_gateway_id - return nil unless exists? + return unless exists? @resp[:carrier_gateway_id] end diff --git a/libraries/aws_ec2_carrier_gateways.rb b/libraries/aws_ec2_carrier_gateways.rb index 649f8524c..15703b2c9 100644 --- a/libraries/aws_ec2_carrier_gateways.rb +++ b/libraries/aws_ec2_carrier_gateways.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2CarrierGateways < AwsResourceBase - name "aws_ec2_carrier_gateways" - desc "Describes multiple carrier gateways." + name 'aws_ec2_carrier_gateways' + desc 'Describes multiple carrier gateways.' example <<-EXAMPLE describe aws_ec2_carrier_gateways do it { should exist } @@ -12,12 +12,12 @@ class AWSEC2CarrierGateways < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:carrier_gateway_ids, field: :carrier_gateway_id) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:states, field: :state) - .register_column(:owner_ids, field: :owner_id) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:carrier_gateway_ids, field: :carrier_gateway_id) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:states, field: :state) + .register_column(:owner_ids, field: :owner_id) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_client_vpn_authorization_rule.rb b/libraries/aws_ec2_client_vpn_authorization_rule.rb index 61314127a..fa3973537 100644 --- a/libraries/aws_ec2_client_vpn_authorization_rule.rb +++ b/libraries/aws_ec2_client_vpn_authorization_rule.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2ClientVPNAuthorizationRule < AwsResourceBase - name "aws_ec2_client_vpn_authorization_rule" - desc "Describes a VPN authorization rule." + name 'aws_ec2_client_vpn_authorization_rule' + desc 'Describes a VPN authorization rule.' example <<-EXAMPLE describe aws_ec2_client_vpn_authorization_rule(client_vpn_endpoint_id: 'CLIENT_VPN_ENDPOINT_ID', group_id: 'GROUP_ID') do it { should exist } @@ -16,7 +16,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: client_vpn_endpoint_id must be provided" unless opts[:client_vpn_endpoint_id] && !opts[:client_vpn_endpoint_id].empty? raise ArgumentError, "#{@__resource_name__}: group_id must be provided" unless opts[:group_id] && !opts[:group_id].empty? @display_name = opts[:client_vpn_endpoint_id] - filter = [{ name: "group-id", + filter = [{ name: 'group-id', values: [opts[:group_id]] }] catch_aws_errors do resp = @aws.compute_client.describe_client_vpn_authorization_rules({ client_vpn_endpoint_id: opts[:client_vpn_endpoint_id], filters: filter }) @@ -26,7 +26,7 @@ def initialize(opts = {}) end def client_vpn_endpoint_id - return nil unless exists? + return unless exists? @res[:client_vpn_endpoint_id] end @@ -35,7 +35,7 @@ def exists? end def resource_id - "#{@res ? @res[:client_vpn_endpoint_id] : ""}_#{@res ? @res[:group_id] : ""}" + "#{@res ? @res[:client_vpn_endpoint_id] : ''}_#{@res ? @res[:group_id] : ''}" end def to_s diff --git a/libraries/aws_ec2_client_vpn_authorization_rules.rb b/libraries/aws_ec2_client_vpn_authorization_rules.rb index a6ba04c6b..7f8a73316 100644 --- a/libraries/aws_ec2_client_vpn_authorization_rules.rb +++ b/libraries/aws_ec2_client_vpn_authorization_rules.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2ClientVPNAuthorizationRules < AwsResourceBase - name "aws_ec2_client_vpn_authorization_rules" - desc "Describes all the VPN rules." + name 'aws_ec2_client_vpn_authorization_rules' + desc 'Describes all the VPN rules.' example <<-EXAMPLE describe aws_ec2_client_vpn_authorization_rules(client_vpn_endpoint_id: 'CLIENT_VPN_ENDPOINT_ID') do it { should exist } @@ -12,14 +12,14 @@ class AWSEC2ClientVPNAuthorizationRules < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) - .register_column(:destination_cidr, field: :destination_cidr) - .register_column(:group_ids, field: :group_id) - .register_column(:access_all, field: :access_all) - .register_column(:status_codes, field: :status_code) - .register_column(:status_messages, field: :status_message) - .register_column(:descriptions, field: :description) - .install_filter_methods_on_resource(self, :table) + .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) + .register_column(:destination_cidr, field: :destination_cidr) + .register_column(:group_ids, field: :group_id) + .register_column(:access_all, field: :access_all) + .register_column(:status_codes, field: :status_code) + .register_column(:status_messages, field: :status_message) + .register_column(:descriptions, field: :description) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_client_vpn_endpoint.rb b/libraries/aws_ec2_client_vpn_endpoint.rb index 7b7de6224..59224d7e6 100644 --- a/libraries/aws_ec2_client_vpn_endpoint.rb +++ b/libraries/aws_ec2_client_vpn_endpoint.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2ClientVPNEndpoint < AwsResourceBase - name "aws_ec2_client_vpn_endpoint" - desc "Describes a VPN endpoint." + name 'aws_ec2_client_vpn_endpoint' + desc 'Describes a VPN endpoint.' example <<-EXAMPLE describe aws_ec2_client_vpn_endpoint(client_vpn_endpoint_id: 'CLIENT_VPN_ENDPOINT_ID') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts = {}) end def client_vpn_endpoint_id - return nil unless exists? + return unless exists? @res[:client_vpn_endpoint_id] end @@ -32,7 +32,7 @@ def exists? end def resource_id - @res ? @res[:client_vpn_endpoint_id] : "" + @res ? @res[:client_vpn_endpoint_id] : '' end def to_s diff --git a/libraries/aws_ec2_client_vpn_endpoints.rb b/libraries/aws_ec2_client_vpn_endpoints.rb index 0cfa4f7b4..32e9bf0b0 100644 --- a/libraries/aws_ec2_client_vpn_endpoints.rb +++ b/libraries/aws_ec2_client_vpn_endpoints.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2ClientVPNEndpoints < AwsResourceBase - name "aws_ec2_client_vpn_endpoints" - desc "Describes all the VPN endpoint." + name 'aws_ec2_client_vpn_endpoints' + desc 'Describes all the VPN endpoint.' example <<-EXAMPLE describe aws_ec2_client_vpn_endpoints do it { should exist } @@ -12,18 +12,18 @@ class AWSEC2ClientVPNEndpoints < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) - .register_column(:descriptions, field: :description) - .register_column(:creation_time, field: :creation_time) - .register_column(:deletion_time, field: :deletion_time) - .register_column(:dns_names, field: :dns_name) - .register_column(:split_tunnels, field: :split_tunnel) - .register_column(:vpn_protocols, field: :vpn_protocol) - .register_column(:transport_protocols, field: :transport_protocol) - .register_column(:vpn_ports, field: :vpn_port) - .register_column(:server_certificate_arns, field: :server_certificate_arn) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) + .register_column(:descriptions, field: :description) + .register_column(:creation_time, field: :creation_time) + .register_column(:deletion_time, field: :deletion_time) + .register_column(:dns_names, field: :dns_name) + .register_column(:split_tunnels, field: :split_tunnel) + .register_column(:vpn_protocols, field: :vpn_protocol) + .register_column(:transport_protocols, field: :transport_protocol) + .register_column(:vpn_ports, field: :vpn_port) + .register_column(:server_certificate_arns, field: :server_certificate_arn) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_client_vpn_route.rb b/libraries/aws_ec2_client_vpn_route.rb index d42872cb6..f62bf5c58 100644 --- a/libraries/aws_ec2_client_vpn_route.rb +++ b/libraries/aws_ec2_client_vpn_route.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2ClientVPNRoute < AwsResourceBase - name "aws_ec2_client_vpn_route" - desc "Describes a VPN route." + name 'aws_ec2_client_vpn_route' + desc 'Describes a VPN route.' example <<-EXAMPLE describe aws_ec2_client_vpn_route(client_vpn_endpoint_id: 'CLIENT_VPN_ENDPOINT_ID', target_subnet: 'TARGET_SUBNET') do it { should exist } @@ -16,7 +16,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: client_vpn_endpoint_id must be provided" unless opts[:client_vpn_endpoint_id] && !opts[:client_vpn_endpoint_id].empty? raise ArgumentError, "#{@__resource_name__}: target_subnet must be provided" unless opts[:target_subnet] && !opts[:target_subnet].empty? @display_name = opts[:client_vpn_endpoint_id] - filter = [{ name: "target-subnet", + filter = [{ name: 'target-subnet', values: [opts[:target_subnet]] }] catch_aws_errors do resp = @aws.compute_client.describe_client_vpn_routes({ client_vpn_endpoint_id: opts[:client_vpn_endpoint_id], filters: filter }) @@ -26,7 +26,7 @@ def initialize(opts = {}) end def client_vpn_endpoint_id - return nil unless exists? + return unless exists? @res[:client_vpn_endpoint_id] end @@ -35,7 +35,7 @@ def exists? end def resource_id - "#{@res ? @res[:client_vpn_endpoint_id] : ""}_#{@res ? @res[:target_subnet] : ""}" + "#{@res ? @res[:client_vpn_endpoint_id] : ''}_#{@res ? @res[:target_subnet] : ''}" end def to_s diff --git a/libraries/aws_ec2_client_vpn_routes.rb b/libraries/aws_ec2_client_vpn_routes.rb index 1ec224d6a..f032c90d0 100644 --- a/libraries/aws_ec2_client_vpn_routes.rb +++ b/libraries/aws_ec2_client_vpn_routes.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2ClientVPNRoutes < AwsResourceBase - name "aws_ec2_client_vpn_routes" - desc "Describes all the VPN routes." + name 'aws_ec2_client_vpn_routes' + desc 'Describes all the VPN routes.' example <<-EXAMPLE describe aws_ec2_client_vpn_routes(client_vpn_endpoint_id: 'CLIENT_VPN_ENDPOINT_ID') do it { should exist } @@ -12,15 +12,15 @@ class AWSEC2ClientVPNRoutes < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) - .register_column(:destination_cidr, field: :destination_cidr) - .register_column(:target_subnets, field: :target_subnet) - .register_column(:types, field: :type) - .register_column(:origins, field: :origin) - .register_column(:status_codes, field: :status_code) - .register_column(:status_messages, field: :status_message) - .register_column(:descriptions, field: :description) - .install_filter_methods_on_resource(self, :table) + .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) + .register_column(:destination_cidr, field: :destination_cidr) + .register_column(:target_subnets, field: :target_subnet) + .register_column(:types, field: :type) + .register_column(:origins, field: :origin) + .register_column(:status_codes, field: :status_code) + .register_column(:status_messages, field: :status_message) + .register_column(:descriptions, field: :description) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_client_vpn_target_network_association.rb b/libraries/aws_ec2_client_vpn_target_network_association.rb index a9e854e66..207a62d5d 100644 --- a/libraries/aws_ec2_client_vpn_target_network_association.rb +++ b/libraries/aws_ec2_client_vpn_target_network_association.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2ClientVPNTargetNetworkAssociation < AwsResourceBase - name "aws_ec2_client_vpn_target_network_association" - desc "Describes a single AWS EC2 Client Vpn Target Network Association." + name 'aws_ec2_client_vpn_target_network_association' + desc 'Describes a single AWS EC2 Client Vpn Target Network Association.' example <<-EXAMPLE describe aws_ec2_client_vpn_target_network_association(client_vpn_endpoint_id: 'CLIENT_VPN_ENDPOINT_ID', association_id: 'ASSOCIATION_ID') do it { should exist } @@ -18,7 +18,7 @@ def initialize(opts = {}) @display_name = opts[:client_vpn_endpoint_id] filter = [ { - name: "association-id", + name: 'association-id', values: [opts[:association_id]], }, ] @@ -30,7 +30,7 @@ def initialize(opts = {}) end def association_id - return nil unless exists? + return unless exists? @res[:association_id] end @@ -39,7 +39,7 @@ def exists? end def resource_id - "#{@display_name}_#{@res ? @res[:association_id] : ""}" + "#{@display_name}_#{@res ? @res[:association_id] : ''}" end def to_s diff --git a/libraries/aws_ec2_client_vpn_target_network_associations.rb b/libraries/aws_ec2_client_vpn_target_network_associations.rb index d1762897e..071bec11a 100644 --- a/libraries/aws_ec2_client_vpn_target_network_associations.rb +++ b/libraries/aws_ec2_client_vpn_target_network_associations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2ClientVPNTargetNetworkAssociations < AwsResourceBase - name "aws_ec2_client_vpn_target_network_associations" - desc "Describes all the AWS EC2 Client Vpn Target Network Association." + name 'aws_ec2_client_vpn_target_network_associations' + desc 'Describes all the AWS EC2 Client Vpn Target Network Association.' example <<-EXAMPLE describe aws_ec2_client_vpn_target_network_associations(client_vpn_endpoint_id: 'CLIENT_VPN_ENDPOINT_ID') do it { should exist } @@ -12,14 +12,14 @@ class AWSEC2ClientVPNTargetNetworkAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:association_ids, field: :association_id) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:target_network_ids, field: :target_network_id) - .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) - .register_column(:status_codes, field: :status_code) - .register_column(:status_messages, field: :status_message) - .register_column(:security_groups, field: :security_groups, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:association_ids, field: :association_id) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:target_network_ids, field: :target_network_id) + .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) + .register_column(:status_codes, field: :status_code) + .register_column(:status_messages, field: :status_message) + .register_column(:security_groups, field: :security_groups, style: :simple) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_customer_gateway.rb b/libraries/aws_ec2_customer_gateway.rb index f94a4931d..f799b164b 100644 --- a/libraries/aws_ec2_customer_gateway.rb +++ b/libraries/aws_ec2_customer_gateway.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2CustomerGateway < AwsResourceBase - name "aws_ec2_customer_gateway" - desc "Describes one VPN customer gateways." + name 'aws_ec2_customer_gateway' + desc 'Describes one VPN customer gateways.' example <<-EXAMPLE describe aws_ec2_customer_gateway(customer_gateway_id: 'CUSTOMER_GATEWAY_ID') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts = {}) end def customer_gateway_id - return nil unless exists? + return unless exists? @resp[:customer_gateway_id] end diff --git a/libraries/aws_ec2_customer_gateways.rb b/libraries/aws_ec2_customer_gateways.rb index 8c72e71b6..d5ac40804 100644 --- a/libraries/aws_ec2_customer_gateways.rb +++ b/libraries/aws_ec2_customer_gateways.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2CustomerGateways < AwsResourceBase - name "aws_ec2_customer_gateways" - desc "Describes one or more of your VPN customer gateways." + name 'aws_ec2_customer_gateways' + desc 'Describes one or more of your VPN customer gateways.' example <<-EXAMPLE describe aws_ec2_customer_gateways do it { should exist } @@ -12,15 +12,15 @@ class AWSEC2CustomerGateways < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:bgp_asns, field: :bgp_asn) - .register_column(:customer_gateway_ids, field: :customer_gateway_id) - .register_column(:ip_addresses, field: :ip_address) - .register_column(:certificate_arns, field: :certificate_arn) - .register_column(:states, field: :state) - .register_column(:types, field: :type) - .register_column(:device_names, field: :device_name) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:bgp_asns, field: :bgp_asn) + .register_column(:customer_gateway_ids, field: :customer_gateway_id) + .register_column(:ip_addresses, field: :ip_address) + .register_column(:certificate_arns, field: :certificate_arn) + .register_column(:states, field: :state) + .register_column(:types, field: :type) + .register_column(:device_names, field: :device_name) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_dhcp_option.rb b/libraries/aws_ec2_dhcp_option.rb index 3ae31501f..cf6db2a41 100644 --- a/libraries/aws_ec2_dhcp_option.rb +++ b/libraries/aws_ec2_dhcp_option.rb @@ -1,9 +1,9 @@ -require "aws_backend" +require 'aws_backend' class AwsEc2DHCPOption < AwsResourceBase SERVER_TYPES = %w{domain-name-servers netbios-name-servers ntp-servers}.freeze - name "aws_ec2_dhcp_option" - desc "Verifies settings for an AWS EC2 DHCP Option." + name 'aws_ec2_dhcp_option' + desc 'Verifies settings for an AWS EC2 DHCP Option.' example " describe aws_ec2_dhcp_option('dotp-12345678') do @@ -46,14 +46,14 @@ def to_s end def netbios_node_type - netbios_node_type = config_for("netbios-node-type") + netbios_node_type = config_for('netbios-node-type') return NullResponse unless netbios_node_type netbios_node_type[:values].first[:value].to_i end def domain_name - domain_name = config_for("domain-name") + domain_name = config_for('domain-name') return NullResponse unless domain_name domain_name[:values].first[:value] @@ -65,7 +65,7 @@ def domain_name def define_server_types SERVER_TYPES.each do |server| - method_name = server.gsub("-", "_") + method_name = server.gsub('-', '_') define_singleton_method(method_name) do server_configuration = config_for(server) return [] unless server_configuration @@ -96,7 +96,7 @@ def instance_arguments end def build_filters_from(value) - { filters: [{ name: "tag:Name", values: [value] }] } + { filters: [{ name: 'tag:Name', values: [value] }] } end def validate_and_assign_from(opts) diff --git a/libraries/aws_ec2_dhcp_options.rb b/libraries/aws_ec2_dhcp_options.rb index 663be4173..3cdca3551 100644 --- a/libraries/aws_ec2_dhcp_options.rb +++ b/libraries/aws_ec2_dhcp_options.rb @@ -1,9 +1,9 @@ -require "aws_backend" +require 'aws_backend' class AwsEc2DHCPOptions< AwsResourceBase SERVER_TYPES = %w{domain-name-servers netbios-name-servers ntp-servers}.freeze - name "aws_ec2_dhcp_options" - desc "Verifies settings for AWS EC2 DHCP Options." + name 'aws_ec2_dhcp_options' + desc 'Verifies settings for AWS EC2 DHCP Options.' example " describe aws_ec2_dhcp_options do @@ -14,15 +14,15 @@ class AwsEc2DHCPOptions< AwsResourceBase attr_reader :table FilterTable.create - .register_column(:dhcp_options_ids, field: :dhcp_options_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:tags, field: :tags) - .register_column(:domain_names, field: :domain_name) - .register_column(:domain_name_servers, field: :domain_name_servers, style: :simple) - .register_column(:netbios_name_servers, field: :netbios_name_servers, style: :simple) - .register_column(:netbios_node_types, field: :netbios_node_type) - .register_column(:ntp_servers, field: :ntp_servers, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:dhcp_options_ids, field: :dhcp_options_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:tags, field: :tags) + .register_column(:domain_names, field: :domain_name) + .register_column(:domain_name_servers, field: :domain_name_servers, style: :simple) + .register_column(:netbios_name_servers, field: :netbios_name_servers, style: :simple) + .register_column(:netbios_node_types, field: :netbios_node_type) + .register_column(:ntp_servers, field: :ntp_servers, style: :simple) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -63,13 +63,13 @@ def flat_hash_from(dhcp_option) hash[:domain_name] = domain_name_for(dhcp_configs) hash[:netbios_node_type] = netbios_node_type_for(dhcp_configs) SERVER_TYPES.each do |server_type| - hash[server_type.gsub("-", "_").to_sym] = servers_for(dhcp_configs, type: server_type) + hash[server_type.gsub('-', '_').to_sym] = servers_for(dhcp_configs, type: server_type) end end end def domain_name_for(dhcp_configurations) - domain_name = find_config_for(dhcp_configurations, type: "domain-name") + domain_name = find_config_for(dhcp_configurations, type: 'domain-name') return NullResponse unless domain_name # this is not possible though! domain_name[:values].first[:value] @@ -83,7 +83,7 @@ def servers_for(dhcp_configurations, type:) end def netbios_node_type_for(dhcp_configurations) - netbios_node_type = find_config_for(dhcp_configurations, type: "netbios-node-type") + netbios_node_type = find_config_for(dhcp_configurations, type: 'netbios-node-type') return NullResponse unless netbios_node_type netbios_node_type[:values].first[:value].to_i diff --git a/libraries/aws_ec2_egress_only_internet_gateway.rb b/libraries/aws_ec2_egress_only_internet_gateway.rb index 0f973a24a..a545fb776 100644 --- a/libraries/aws_ec2_egress_only_internet_gateway.rb +++ b/libraries/aws_ec2_egress_only_internet_gateway.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2EgressOnlyInternetGateway < AwsResourceBase - name "aws_ec2_egress_only_internet_gateway" - desc "Describes one egress-only internet gateways." + name 'aws_ec2_egress_only_internet_gateway' + desc 'Describes one egress-only internet gateways.' example " describe aws_ec2_egress_only_internet_gateway(egress_only_internet_gateway_id: 'EGRESS_ONLY_INTERNET_GATEWAY_ID') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def egress_only_internet_gateway_id - return nil unless exists? + return unless exists? @resp[:egress_only_internet_gateway_id] end diff --git a/libraries/aws_ec2_egress_only_internet_gateways.rb b/libraries/aws_ec2_egress_only_internet_gateways.rb index 1156966a5..cd8103322 100644 --- a/libraries/aws_ec2_egress_only_internet_gateways.rb +++ b/libraries/aws_ec2_egress_only_internet_gateways.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2EgressOnlyInternetGateways < AwsResourceBase - name "aws_ec2_egress_only_internet_gateways" - desc "Describes one or more of your egress-only internet gateways." + name 'aws_ec2_egress_only_internet_gateways' + desc 'Describes one or more of your egress-only internet gateways.' example " describe aws_ec2_egress_only_internet_gateways do @@ -13,10 +13,10 @@ class AWSEC2EgressOnlyInternetGateways < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:attachments, field: :attachments) - .register_column(:egress_only_internet_gateway_ids, field: :egress_only_internet_gateway_id) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:attachments, field: :attachments) + .register_column(:egress_only_internet_gateway_ids, field: :egress_only_internet_gateway_id) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_eip.rb b/libraries/aws_ec2_eip.rb index c2bbcb5a3..b4f2f0c2a 100644 --- a/libraries/aws_ec2_eip.rb +++ b/libraries/aws_ec2_eip.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEc2Eip < AwsResourceBase - name "aws_ec2_eip" - desc "Specifies an Elastic IP (EIP) address and can, optionally, associate it with an Amazon EC2 instance." + name 'aws_ec2_eip' + desc 'Specifies an Elastic IP (EIP) address and can, optionally, associate it with an Amazon EC2 instance.' example " describe aws_ec2_eip(public_ip: '192.0.2.0') do @@ -29,7 +29,7 @@ def initialize(opts = {}) end def public_ip - return nil unless exists? + return unless exists? @addresses[:public_ip] end diff --git a/libraries/aws_ec2_eip_association.rb b/libraries/aws_ec2_eip_association.rb index 4257898ce..79a5a0ec1 100644 --- a/libraries/aws_ec2_eip_association.rb +++ b/libraries/aws_ec2_eip_association.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2EIPAssociation < AwsResourceBase - name "aws_ec2_eip_association" - desc "Describes the specified Elastic IP addresses or all of your Elastic IP addresses." + name 'aws_ec2_eip_association' + desc 'Describes the specified Elastic IP addresses or all of your Elastic IP addresses.' example " describe aws_ec2_eip_association(association_id: 'ASSOCIATION_ID') do @@ -17,7 +17,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: association_id must be provided" unless opts[:association_id] && !opts[:association_id].empty? filter = [ { - name: "association-id", + name: 'association-id', values: [opts[:association_id]], }, ] @@ -30,7 +30,7 @@ def initialize(opts = {}) end def association_id - return nil unless exists? + return unless exists? @resp[:association_id] end diff --git a/libraries/aws_ec2_eip_associations.rb b/libraries/aws_ec2_eip_associations.rb index 3e62b81c3..b846d8ddf 100644 --- a/libraries/aws_ec2_eip_associations.rb +++ b/libraries/aws_ec2_eip_associations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2EIPAssociations < AwsResourceBase - name "aws_ec2_eip_associations" - desc "Describes the specified Elastic IP addresses or all of your Elastic IP addresses." + name 'aws_ec2_eip_associations' + desc 'Describes the specified Elastic IP addresses or all of your Elastic IP addresses.' example " describe aws_ec2_eip_associations do @@ -13,8 +13,8 @@ class AWSEC2EIPAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:association_ids, field: :association_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:association_ids, field: :association_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_eips.rb b/libraries/aws_ec2_eips.rb index aaad48347..2a3dbcfa3 100644 --- a/libraries/aws_ec2_eips.rb +++ b/libraries/aws_ec2_eips.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEc2Eips < AwsResourceBase - name "aws_ec2_eips" - desc "Specifies an Elastic IP (EIP) address and can, optionally, associate it with an Amazon EC2 instance." + name 'aws_ec2_eips' + desc 'Specifies an Elastic IP (EIP) address and can, optionally, associate it with an Amazon EC2 instance.' example " describe aws_ec2_eips do @@ -12,17 +12,17 @@ class AwsEc2Eips < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:instance_ids, field: :instance_id) - .register_column(:public_ips, field: :public_ip) - .register_column(:allocation_ids, field: :allocation_id) - .register_column(:domains, field: :domain) - .register_column(:association_ids, field: :association_id) - .register_column(:network_interface_ids, field: :network_interface_id) - .register_column(:network_interface_owner_ids, field: :network_interface_owner_id) - .register_column(:private_ip_addresss, field: :private_ip_address) - .register_column(:public_ipv_4_pools, field: :public_ipv_4_pool) - .register_column(:network_border_groups, field: :network_border_group) - .install_filter_methods_on_resource(self, :table) + .register_column(:instance_ids, field: :instance_id) + .register_column(:public_ips, field: :public_ip) + .register_column(:allocation_ids, field: :allocation_id) + .register_column(:domains, field: :domain) + .register_column(:association_ids, field: :association_id) + .register_column(:network_interface_ids, field: :network_interface_id) + .register_column(:network_interface_owner_ids, field: :network_interface_owner_id) + .register_column(:private_ip_addresss, field: :private_ip_address) + .register_column(:public_ipv_4_pools, field: :public_ipv_4_pool) + .register_column(:network_border_groups, field: :network_border_group) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_fleet.rb b/libraries/aws_ec2_fleet.rb index fbc5b82be..1488119ec 100644 --- a/libraries/aws_ec2_fleet.rb +++ b/libraries/aws_ec2_fleet.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2Fleet < AwsResourceBase - name "aws_ec2_fleet" - desc "Describes the specified EC2 Fleets or all of your EC2 Fleets." + name 'aws_ec2_fleet' + desc 'Describes the specified EC2 Fleets or all of your EC2 Fleets.' example " describe aws_ec2_fleet(fleet_id: 'FLEET_ID') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def fleet_id - return nil unless exists? + return unless exists? @resp[:fleet_id] end diff --git a/libraries/aws_ec2_fleets.rb b/libraries/aws_ec2_fleets.rb index 940f22787..3dae5310f 100644 --- a/libraries/aws_ec2_fleets.rb +++ b/libraries/aws_ec2_fleets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2Fleets < AwsResourceBase - name "aws_ec2_fleets" - desc "Describes the specified EC2 Fleets or all of your EC2 Fleets." + name 'aws_ec2_fleets' + desc 'Describes the specified EC2 Fleets or all of your EC2 Fleets.' example " describe aws_ec2_fleets do @@ -13,28 +13,28 @@ class AWSEC2Fleets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:activity_statuses, field: :activity_status) - .register_column(:create_times, field: :create_time) - .register_column(:fleet_ids, field: :fleet_id) - .register_column(:fleet_states, field: :fleet_state) - .register_column(:client_tokens, field: :client_token) - .register_column(:excess_capacity_termination_policies, field: :excess_capacity_termination_policy) - .register_column(:fulfilled_capacities, field: :fulfilled_capacity) - .register_column(:fulfilled_on_demand_capacities, field: :fulfilled_on_demand_capacity) - .register_column(:launch_template_configs, field: :launch_template_configs) - .register_column(:target_capacity_specifications, field: :target_capacity_specification) - .register_column(:terminate_instances_with_expiration, field: :terminate_instances_with_expiration) - .register_column(:types, field: :type) - .register_column(:valid_from, field: :valid_from) - .register_column(:valid_until, field: :valid_until) - .register_column(:replace_unhealthy_instances, field: :replace_unhealthy_instances) - .register_column(:spot_options, field: :spot_options) - .register_column(:on_demand_options, field: :on_demand_options) - .register_column(:tags, field: :tags) - .register_column(:errors, field: :errors) - .register_column(:instances, field: :instances) - .register_column(:contexts, field: :context) - .install_filter_methods_on_resource(self, :table) + .register_column(:activity_statuses, field: :activity_status) + .register_column(:create_times, field: :create_time) + .register_column(:fleet_ids, field: :fleet_id) + .register_column(:fleet_states, field: :fleet_state) + .register_column(:client_tokens, field: :client_token) + .register_column(:excess_capacity_termination_policies, field: :excess_capacity_termination_policy) + .register_column(:fulfilled_capacities, field: :fulfilled_capacity) + .register_column(:fulfilled_on_demand_capacities, field: :fulfilled_on_demand_capacity) + .register_column(:launch_template_configs, field: :launch_template_configs) + .register_column(:target_capacity_specifications, field: :target_capacity_specification) + .register_column(:terminate_instances_with_expiration, field: :terminate_instances_with_expiration) + .register_column(:types, field: :type) + .register_column(:valid_from, field: :valid_from) + .register_column(:valid_until, field: :valid_until) + .register_column(:replace_unhealthy_instances, field: :replace_unhealthy_instances) + .register_column(:spot_options, field: :spot_options) + .register_column(:on_demand_options, field: :on_demand_options) + .register_column(:tags, field: :tags) + .register_column(:errors, field: :errors) + .register_column(:instances, field: :instances) + .register_column(:contexts, field: :context) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_host.rb b/libraries/aws_ec2_host.rb index 24d6d732e..72d50c8df 100644 --- a/libraries/aws_ec2_host.rb +++ b/libraries/aws_ec2_host.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2Host < AwsResourceBase - name "aws_ec2_host" - desc "Describes the specified Dedicated Host." + name 'aws_ec2_host' + desc 'Describes the specified Dedicated Host.' example " describe aws_ec2_host(host_id: 'DEDICATED_HOST_ID') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def host_id - return nil unless exists? + return unless exists? @resp[:host_id] end diff --git a/libraries/aws_ec2_hosts.rb b/libraries/aws_ec2_hosts.rb index 5054fd8d3..6a3ee4725 100644 --- a/libraries/aws_ec2_hosts.rb +++ b/libraries/aws_ec2_hosts.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2Hosts < AwsResourceBase - name "aws_ec2_hosts" - desc "Describes the specified Dedicated Hosts or all your Dedicated Hosts." + name 'aws_ec2_hosts' + desc 'Describes the specified Dedicated Hosts or all your Dedicated Hosts.' example " describe aws_ec2_hosts do @@ -13,22 +13,22 @@ class AWSEC2Hosts < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:auto_placements, field: :auto_placement) - .register_column(:availability_zones, field: :availability_zone) - .register_column(:available_capacities, field: :available_capacity) - .register_column(:client_tokens, field: :client_token) - .register_column(:host_ids, field: :host_id) - .register_column(:host_properties, field: :host_properties) - .register_column(:instances, field: :instances) - .register_column(:states, field: :state) - .register_column(:allocation_times, field: :allocation_time) - .register_column(:tags, field: :tags) - .register_column(:host_recoveries, field: :host_recovery) - .register_column(:allows_multiple_instance_types, field: :allows_multiple_instance_types) - .register_column(:owner_ids, field: :owner_id) - .register_column(:availability_zone_ids, field: :availability_zone_id) - .register_column(:member_of_service_linked_resource_groups, field: :member_of_service_linked_resource_group) - .install_filter_methods_on_resource(self, :table) + .register_column(:auto_placements, field: :auto_placement) + .register_column(:availability_zones, field: :availability_zone) + .register_column(:available_capacities, field: :available_capacity) + .register_column(:client_tokens, field: :client_token) + .register_column(:host_ids, field: :host_id) + .register_column(:host_properties, field: :host_properties) + .register_column(:instances, field: :instances) + .register_column(:states, field: :state) + .register_column(:allocation_times, field: :allocation_time) + .register_column(:tags, field: :tags) + .register_column(:host_recoveries, field: :host_recovery) + .register_column(:allows_multiple_instance_types, field: :allows_multiple_instance_types) + .register_column(:owner_ids, field: :owner_id) + .register_column(:availability_zone_ids, field: :availability_zone_id) + .register_column(:member_of_service_linked_resource_groups, field: :member_of_service_linked_resource_group) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_instance.rb b/libraries/aws_ec2_instance.rb index 4a511ed4b..ba2eeea42 100644 --- a/libraries/aws_ec2_instance.rb +++ b/libraries/aws_ec2_instance.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEc2Instance < AwsResourceBase - name "aws_ec2_instance" - desc "Verifies settings for an AWS EC2 instance." + name 'aws_ec2_instance' + desc 'Verifies settings for an AWS EC2 instance.' example " describe aws_ec2_instance('i-12345678') do @@ -29,7 +29,7 @@ def initialize(opts = {}) instance_arguments = { instance_ids: [opts[:instance_id]] } elsif opts[:name] && !opts[:name].empty? # Otherwise use name, if provided @display_name = opts[:name] - instance_arguments = { filters: [{ name: "tag:Name", values: [opts[:name]] }] } + instance_arguments = { filters: [{ name: 'tag:Name', values: [opts[:name]] }] } else raise ArgumentError, "#{@__resource_name__}: either instance_id or name must be provided." end @@ -52,7 +52,7 @@ def initialize(opts = {}) # Methods required to ensure backwards compatibility class << self def state - return nil unless @instance[:state] + return unless @instance[:state] @instance[:state][:name] end @@ -73,31 +73,31 @@ def exists? end def security_group_ids - return nil unless @instance[:security_groups] + return unless @instance[:security_groups] @instance[:security_groups].map { |sg| sg[:group_id] } end def availability_zone - return nil unless @instance[:placement] - return nil unless @instance[:placement].include?(:availability_zone) + return unless @instance[:placement] + return unless @instance[:placement].include?(:availability_zone) @instance[:placement][:availability_zone] end def ebs_volumes - return nil unless @instance[:block_device_mappings] - return nil if @instance[:block_device_mappings].count == 0 + return unless @instance[:block_device_mappings] + return if @instance[:block_device_mappings].count == 0 @instance[:block_device_mappings].map { |vol| { id: vol[:ebs][:volume_id], name: vol[:device_name] } } end def network_interface_ids - return nil unless @instance[:network_interfaces] - return nil if @instance[:network_interfaces].count == 0 + return unless @instance[:network_interfaces] + return if @instance[:network_interfaces].count == 0 @instance[:network_interfaces].map { |nic| nic[:network_interface_id] } end def has_roles? return false unless @instance[:iam_instance_profile] && @instance[:iam_instance_profile][:arn] - instance_profile = @instance[:iam_instance_profile][:arn].split("/").last + instance_profile = @instance[:iam_instance_profile][:arn].split('/').last @returned_roles = nil # Check if there is a role created at the attached profile catch_aws_errors do @@ -118,7 +118,7 @@ def role # Generate a matcher for each state %w{pending running shutting-down terminated stopping stopped unknown}.each do |state_name| - define_method "#{state_name.tr("-", "_")}?" do + define_method "#{state_name.tr('-', '_')}?" do state == state_name end end diff --git a/libraries/aws_ec2_instances.rb b/libraries/aws_ec2_instances.rb index 984071dc9..646ca99ab 100644 --- a/libraries/aws_ec2_instances.rb +++ b/libraries/aws_ec2_instances.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEc2Instances < AwsResourceBase - name "aws_ec2_instances" - desc "Verifies settings for a collection of AWS EC2 Instances." + name 'aws_ec2_instances' + desc 'Verifies settings for a collection of AWS EC2 Instances.' example " describe aws_ec2_instances do it { should exist } @@ -12,14 +12,14 @@ class AwsEc2Instances < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:instance_ids, field: :instance_id) - .register_column(:names, field: :name) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:subnet_ids, field: :subnet_id) - .register_column(:instance_types, field: :instance_type) - .register_column(:tags, field: :tags) - .register_column(:iam_profiles, field: :iam_profile) - .install_filter_methods_on_resource(self, :table) + .register_column(:instance_ids, field: :instance_id) + .register_column(:names, field: :name) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:subnet_ids, field: :subnet_id) + .register_column(:instance_types, field: :instance_type) + .register_column(:tags, field: :tags) + .register_column(:iam_profiles, field: :iam_profile) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -44,8 +44,8 @@ def fetch_data subnet_id: instance.subnet_id, instance_type: instance.instance_type, tags: instance_tags, - name: instance_tags["Name"], - iam_profile: instance.iam_instance_profile&.arn&.split("/")&.last, + name: instance_tags['Name'], + iam_profile: instance.iam_instance_profile&.arn&.split('/')&.last, }] end end diff --git a/libraries/aws_ec2_internet_gateway.rb b/libraries/aws_ec2_internet_gateway.rb index c20dd048a..b6915a4ef 100644 --- a/libraries/aws_ec2_internet_gateway.rb +++ b/libraries/aws_ec2_internet_gateway.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2InternetGateway < AwsResourceBase - name "aws_ec2_internet_gateway" - desc "Describes a ec2 internet gateway." + name 'aws_ec2_internet_gateway' + desc 'Describes a ec2 internet gateway.' example " describe aws_ec2_internet_gateway(internet_gateway_id: 'InternetGatewayId') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def internet_gateway_id - return nil unless exists? + return unless exists? @res[:internet_gateway_id] end diff --git a/libraries/aws_ec2_internet_gateways.rb b/libraries/aws_ec2_internet_gateways.rb index 0c9fad413..5a104fb7d 100644 --- a/libraries/aws_ec2_internet_gateways.rb +++ b/libraries/aws_ec2_internet_gateways.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2InternetGateways < AwsResourceBase - name "aws_ec2_internet_gateways" - desc "List all the internet gateways." + name 'aws_ec2_internet_gateways' + desc 'List all the internet gateways.' example " describe aws_ec2_internet_gateways do @@ -13,13 +13,13 @@ class AWSEC2InternetGateways < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:attachments, field: :attachments) - .register_column(:attachments_states, field: :attachments_states, style: :simple) - .register_column(:attachments_vpc_ids, field: :attachments_vpc_ids) - .register_column(:internet_gateway_ids, field: :internet_gateway_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:attachments, field: :attachments) + .register_column(:attachments_states, field: :attachments_states, style: :simple) + .register_column(:attachments_vpc_ids, field: :attachments_vpc_ids) + .register_column(:internet_gateway_ids, field: :internet_gateway_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_launch_template.rb b/libraries/aws_ec2_launch_template.rb index c8060ff25..67d53d184 100644 --- a/libraries/aws_ec2_launch_template.rb +++ b/libraries/aws_ec2_launch_template.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEc2LaunchTemplate < AwsResourceBase - name "aws_ec2_launch_template" - desc "Audits Launch Template." + name 'aws_ec2_launch_template' + desc 'Audits Launch Template.' example "describe aws_ec2_launch_template(launch_template_name: 'test-launch-temlate') do it { should exist } end diff --git a/libraries/aws_ec2_launch_templates.rb b/libraries/aws_ec2_launch_templates.rb index d9aa1fd57..3e0e6b4ab 100644 --- a/libraries/aws_ec2_launch_templates.rb +++ b/libraries/aws_ec2_launch_templates.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEc2LaunchTemplates < AwsResourceBase - name "aws_ec2_launch_templates" - desc "Verifies settings for a collection of launch templates." + name 'aws_ec2_launch_templates' + desc 'Verifies settings for a collection of launch templates.' example " describe aws_ec2_launch_templates do @@ -13,14 +13,14 @@ class AWSEc2LaunchTemplates < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:launch_template_ids, field: :launch_template_id) - .register_column(:launch_template_names, field: :launch_template_name) - .register_column(:create_time, field: :create_time) - .register_column(:created_by, field: :created_by) - .register_column(:default_version_number, field: :default_version_number) - .register_column(:tags, field: :tags) - .register_column(:latest_version_number, field: :launch_template_number) - .install_filter_methods_on_resource(self, :table) + .register_column(:launch_template_ids, field: :launch_template_id) + .register_column(:launch_template_names, field: :launch_template_name) + .register_column(:create_time, field: :create_time) + .register_column(:created_by, field: :created_by) + .register_column(:default_version_number, field: :default_version_number) + .register_column(:tags, field: :tags) + .register_column(:latest_version_number, field: :launch_template_number) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -44,7 +44,7 @@ def fetch_data create_time: launch_template.create_time, created_by: launch_template.created_by, tags: launch_template_tags, - launch_template_tags_name: launch_template_tags["Name"], + launch_template_tags_name: launch_template_tags['Name'], default_version_number: launch_template.default_version_number, latest_version_number: launch_template.latest_version_number, }] diff --git a/libraries/aws_ec2_network_insights_analysis.rb b/libraries/aws_ec2_network_insights_analysis.rb index b4a7e10f5..ef174d67b 100644 --- a/libraries/aws_ec2_network_insights_analysis.rb +++ b/libraries/aws_ec2_network_insights_analysis.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2NetworkInsightsAnalysis < AwsResourceBase - name "aws_ec2_network_insights_analysis" - desc "Describes one or more of your network insights analyses." + name 'aws_ec2_network_insights_analysis' + desc 'Describes one or more of your network insights analyses.' example " describe aws_ec2_network_insights_analysis(network_insights_analysis_id: 'NetworkInsightsAnalysisId') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def network_insights_analysis_id - return nil unless exists? + return unless exists? @res[:network_insights_analysis_id] end diff --git a/libraries/aws_ec2_network_insights_analysis_plural.rb b/libraries/aws_ec2_network_insights_analysis_plural.rb index 2c085085c..6d0a990b9 100644 --- a/libraries/aws_ec2_network_insights_analysis_plural.rb +++ b/libraries/aws_ec2_network_insights_analysis_plural.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2NetworkInsightsAnalysisPlural < AwsResourceBase - name "aws_ec2_network_insights_analysis_plural" - desc "List all the network insights analyses." + name 'aws_ec2_network_insights_analysis_plural' + desc 'List all the network insights analyses.' example " describe aws_ec2_network_insights_analysis_plural do @@ -13,20 +13,20 @@ class AWSEC2NetworkInsightsAnalysisPlural < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:network_insights_analysis_ids, field: :network_insights_analysis_id) - .register_column(:network_insights_analysis_arns, field: :network_insights_analysis_arn) - .register_column(:network_insights_path_ids, field: :network_insights_path_id) - .register_column(:filter_in_arns, field: :filter_in_arns) - .register_column(:start_dates, field: :start_date) - .register_column(:statuses, field: :status) - .register_column(:status_messages, field: :status_message) - .register_column(:network_path_found, field: :network_path_found) - .register_column(:forward_path_components, field: :forward_path_components) - .register_column(:return_path_components, field: :return_path_components) - .register_column(:explanations, field: :explanations) - .register_column(:alternate_path_hints, field: :alternate_path_hints) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:network_insights_analysis_ids, field: :network_insights_analysis_id) + .register_column(:network_insights_analysis_arns, field: :network_insights_analysis_arn) + .register_column(:network_insights_path_ids, field: :network_insights_path_id) + .register_column(:filter_in_arns, field: :filter_in_arns) + .register_column(:start_dates, field: :start_date) + .register_column(:statuses, field: :status) + .register_column(:status_messages, field: :status_message) + .register_column(:network_path_found, field: :network_path_found) + .register_column(:forward_path_components, field: :forward_path_components) + .register_column(:return_path_components, field: :return_path_components) + .register_column(:explanations, field: :explanations) + .register_column(:alternate_path_hints, field: :alternate_path_hints) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_network_insights_path.rb b/libraries/aws_ec2_network_insights_path.rb index 031489070..cad5c0870 100644 --- a/libraries/aws_ec2_network_insights_path.rb +++ b/libraries/aws_ec2_network_insights_path.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2NetworkInsightsPath < AwsResourceBase - name "aws_ec2_network_insights_path" - desc "Returns" + name 'aws_ec2_network_insights_path' + desc 'Returns' example " describe aws_ec2_network_insights_path(network_insights_path_id: 'NetworkInsightsPathId') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def network_insights_path_id - return nil unless exists? + return unless exists? @res[:network_insights_path_id] end diff --git a/libraries/aws_ec2_network_insights_paths.rb b/libraries/aws_ec2_network_insights_paths.rb index 69b432e6b..bc57cda2d 100644 --- a/libraries/aws_ec2_network_insights_paths.rb +++ b/libraries/aws_ec2_network_insights_paths.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2NetworkInsightsPaths < AwsResourceBase - name "aws_ec2_network_insights_paths" - desc "List all the network insights paths." + name 'aws_ec2_network_insights_paths' + desc 'List all the network insights paths.' example " describe aws_ec2_network_insights_paths do @@ -13,17 +13,17 @@ class AWSEC2NetworkInsightsPaths < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:network_insights_path_ids, field: :network_insights_path_id) - .register_column(:network_insights_path_arns, field: :network_insights_path_arn) - .register_column(:created_dates, field: :created_date) - .register_column(:sources, field: :source) - .register_column(:destinations, field: :destination) - .register_column(:source_ips, field: :source_ip) - .register_column(:destination_ips, field: :destination_ip) - .register_column(:protocols, field: :protocol) - .register_column(:destination_ports, field: :destination_port) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:network_insights_path_ids, field: :network_insights_path_id) + .register_column(:network_insights_path_arns, field: :network_insights_path_arn) + .register_column(:created_dates, field: :created_date) + .register_column(:sources, field: :source) + .register_column(:destinations, field: :destination) + .register_column(:source_ips, field: :source_ip) + .register_column(:destination_ips, field: :destination_ip) + .register_column(:protocols, field: :protocol) + .register_column(:destination_ports, field: :destination_port) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_network_interface.rb b/libraries/aws_ec2_network_interface.rb index 569cc151e..43675e1d9 100644 --- a/libraries/aws_ec2_network_interface.rb +++ b/libraries/aws_ec2_network_interface.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2NetworkInterface < AwsResourceBase - name "aws_ec2_network_interface" - desc "Describes one or more of your network interfaces." + name 'aws_ec2_network_interface' + desc 'Describes one or more of your network interfaces.' example " describe aws_ec2_network_interface(network_interface_id: 'NetworkInterfaceId') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def network_interface_id - return nil unless exists? + return unless exists? @res[:network_interface_id] end diff --git a/libraries/aws_ec2_network_interface_attachment.rb b/libraries/aws_ec2_network_interface_attachment.rb index 6bf481b60..b27e0d981 100644 --- a/libraries/aws_ec2_network_interface_attachment.rb +++ b/libraries/aws_ec2_network_interface_attachment.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2NetworkInterfaceAttachment < AwsResourceBase - name "aws_ec2_network_interface_attachment" - desc "Describes one or more of your network interface attachment." + name 'aws_ec2_network_interface_attachment' + desc 'Describes one or more of your network interface attachment.' example " describe aws_ec2_network_interface_attachment(network_interface_id: 'NetworkInterfaceId') do @@ -28,7 +28,7 @@ def exists? end def resource_id - @res ? @display_name : "" + @res ? @display_name : '' end def to_s diff --git a/libraries/aws_ec2_network_interface_attachments.rb b/libraries/aws_ec2_network_interface_attachments.rb index 6d3356730..2cdc494c2 100644 --- a/libraries/aws_ec2_network_interface_attachments.rb +++ b/libraries/aws_ec2_network_interface_attachments.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2NetworkInterfaceAttachments < AwsResourceBase - name "aws_ec2_network_interface_attachments" - desc "List all the network interface attachments." + name 'aws_ec2_network_interface_attachments' + desc 'List all the network interface attachments.' example " describe aws_ec2_network_interface_attachments do @@ -13,15 +13,15 @@ class AWSEC2NetworkInterfaceAttachments < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:attach_times, field: :attach_time) - .register_column(:attachment_ids, field: :attachment_id) - .register_column(:delete_on_terminations, field: :delete_on_termination) - .register_column(:device_indexes, field: :device_index) - .register_column(:network_card_indexes, field: :network_card_index) - .register_column(:instance_ids, field: :instance_id) - .register_column(:instance_owner_ids, field: :instance_owner_id) - .register_column(:statuses, field: :status) - .install_filter_methods_on_resource(self, :table) + .register_column(:attach_times, field: :attach_time) + .register_column(:attachment_ids, field: :attachment_id) + .register_column(:delete_on_terminations, field: :delete_on_termination) + .register_column(:device_indexes, field: :device_index) + .register_column(:network_card_indexes, field: :network_card_index) + .register_column(:instance_ids, field: :instance_id) + .register_column(:instance_owner_ids, field: :instance_owner_id) + .register_column(:statuses, field: :status) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_network_interfaces.rb b/libraries/aws_ec2_network_interfaces.rb index e6316ab26..68f90349c 100644 --- a/libraries/aws_ec2_network_interfaces.rb +++ b/libraries/aws_ec2_network_interfaces.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2NetworkInterfaces < AwsResourceBase - name "aws_ec2_network_interfaces" - desc "List all the network interfaces." + name 'aws_ec2_network_interfaces' + desc 'List all the network interfaces.' example " describe aws_ec2_network_interfaces do @@ -13,27 +13,27 @@ class AWSEC2NetworkInterfaces < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:associations, field: :association) - .register_column(:attachments, field: :attachment) - .register_column(:availability_zones, field: :availability_zone) - .register_column(:descriptions, field: :description) - .register_column(:groups, field: :groups) - .register_column(:interface_types, field: :interface_type) - .register_column(:ipv_6_addresses, field: :ipv_6_addresses) - .register_column(:mac_addresses, field: :mac_address) - .register_column(:network_interface_ids, field: :network_interface_id) - .register_column(:outpost_arns, field: :outpost_arn) - .register_column(:owner_ids, field: :owner_id) - .register_column(:private_dns_names, field: :private_dns_name) - .register_column(:private_ip_addresses, field: :private_ip_address) - .register_column(:requester_ids, field: :requester_id) - .register_column(:requester_managed, field: :requester_managed) - .register_column(:source_dest_checks, field: :source_dest_check) - .register_column(:statuses, field: :status) - .register_column(:subnet_ids, field: :subnet_id) - .register_column(:tag_sets, field: :tag_set) - .register_column(:vpc_ids, field: :vpc_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:associations, field: :association) + .register_column(:attachments, field: :attachment) + .register_column(:availability_zones, field: :availability_zone) + .register_column(:descriptions, field: :description) + .register_column(:groups, field: :groups) + .register_column(:interface_types, field: :interface_type) + .register_column(:ipv_6_addresses, field: :ipv_6_addresses) + .register_column(:mac_addresses, field: :mac_address) + .register_column(:network_interface_ids, field: :network_interface_id) + .register_column(:outpost_arns, field: :outpost_arn) + .register_column(:owner_ids, field: :owner_id) + .register_column(:private_dns_names, field: :private_dns_name) + .register_column(:private_ip_addresses, field: :private_ip_address) + .register_column(:requester_ids, field: :requester_id) + .register_column(:requester_managed, field: :requester_managed) + .register_column(:source_dest_checks, field: :source_dest_check) + .register_column(:statuses, field: :status) + .register_column(:subnet_ids, field: :subnet_id) + .register_column(:tag_sets, field: :tag_set) + .register_column(:vpc_ids, field: :vpc_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_placement_group.rb b/libraries/aws_ec2_placement_group.rb index 1666450de..d064c0e5b 100644 --- a/libraries/aws_ec2_placement_group.rb +++ b/libraries/aws_ec2_placement_group.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2PlacementGroup < AwsResourceBase - name "aws_ec2_placement_group" - desc "Describes the specified placement groups or all of your placement groups." + name 'aws_ec2_placement_group' + desc 'Describes the specified placement groups or all of your placement groups.' example " describe aws_ec2_placement_group(placement_group_name: 'PLACEMENT_GROUP_NAME') do @@ -25,7 +25,7 @@ def initialize(opts = {}) end def placement_group_name - return nil unless exists? + return unless exists? @resp[:group_name] end diff --git a/libraries/aws_ec2_placement_groups.rb b/libraries/aws_ec2_placement_groups.rb index 26b66671a..658fed84e 100644 --- a/libraries/aws_ec2_placement_groups.rb +++ b/libraries/aws_ec2_placement_groups.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2PlacementGroups < AwsResourceBase - name "aws_ec2_placement_groups" - desc "Describes the specified placement groups or all of your placement groups." + name 'aws_ec2_placement_groups' + desc 'Describes the specified placement groups or all of your placement groups.' example " describe aws_ec2_placement_groups do @@ -13,27 +13,27 @@ class AWSEC2PlacementGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:group_names, field: :group_name) - .register_column(:states, field: :state) - .register_column(:strategies, field: :strategy) - .register_column(:partition_counts, field: :partition_count) - .register_column(:group_ids, field: :group_id) - .register_column(:tags, field: :tags) - .register_column(:availability_zones, field: :availability_zone) - .register_column(:tenancies, field: :tenancy) - .register_column(:total_instance_counts, field: :total_instance_count) - .register_column(:available_instance_counts, field: :available_instance_count) - .register_column(:ebs_optimized, field: :ebs_optimized) - .register_column(:ephemeral_storages, field: :ephemeral_storage) - .register_column(:states, field: :state) - .register_column(:start_dates, field: :start_date) - .register_column(:end_dates, field: :end_date) - .register_column(:end_date_types, field: :end_date_type) - .register_column(:instance_match_criterias, field: :instance_match_criteria) - .register_column(:create_dates, field: :create_date) - .register_column(:tags, field: :tags) - .register_column(:outpost_arns, field: :outpost_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:group_names, field: :group_name) + .register_column(:states, field: :state) + .register_column(:strategies, field: :strategy) + .register_column(:partition_counts, field: :partition_count) + .register_column(:group_ids, field: :group_id) + .register_column(:tags, field: :tags) + .register_column(:availability_zones, field: :availability_zone) + .register_column(:tenancies, field: :tenancy) + .register_column(:total_instance_counts, field: :total_instance_count) + .register_column(:available_instance_counts, field: :available_instance_count) + .register_column(:ebs_optimized, field: :ebs_optimized) + .register_column(:ephemeral_storages, field: :ephemeral_storage) + .register_column(:states, field: :state) + .register_column(:start_dates, field: :start_date) + .register_column(:end_dates, field: :end_date) + .register_column(:end_date_types, field: :end_date_type) + .register_column(:instance_match_criterias, field: :instance_match_criteria) + .register_column(:create_dates, field: :create_date) + .register_column(:tags, field: :tags) + .register_column(:outpost_arns, field: :outpost_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_prefix_list.rb b/libraries/aws_ec2_prefix_list.rb index 4bc024a5c..797555d32 100644 --- a/libraries/aws_ec2_prefix_list.rb +++ b/libraries/aws_ec2_prefix_list.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2PrefixList < AwsResourceBase - name "aws_ec2_prefix_list" - desc "Describes your managed prefix lists and any Amazon Web Services-managed prefix lists." + name 'aws_ec2_prefix_list' + desc 'Describes your managed prefix lists and any Amazon Web Services-managed prefix lists.' example " describe aws_ec2_prefix_list(prefix_list_id: 'test1') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def prefix_list_id - return nil unless exists? + return unless exists? @res[:prefix_list_id] end diff --git a/libraries/aws_ec2_prefix_lists.rb b/libraries/aws_ec2_prefix_lists.rb index 919f80783..48919b96d 100644 --- a/libraries/aws_ec2_prefix_lists.rb +++ b/libraries/aws_ec2_prefix_lists.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2PrefixLists < AwsResourceBase - name "aws_ec2_prefix_lists" - desc "List all the prefix list." + name 'aws_ec2_prefix_lists' + desc 'List all the prefix list.' example " describe aws_ec2_prefix_lists do @@ -13,17 +13,17 @@ class AWSEC2PrefixLists < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:prefix_list_ids, field: :prefix_list_id) - .register_column(:address_families, field: :address_family) - .register_column(:states, field: :state) - .register_column(:state_messages, field: :state_message) - .register_column(:prefix_list_arns, field: :prefix_list_arn) - .register_column(:prefix_list_names, field: :prefix_list_name) - .register_column(:max_entries, field: :max_entries) - .register_column(:versions, field: :version) - .register_column(:tags, field: :tags) - .register_column(:owner_ids, field: :owner_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:prefix_list_ids, field: :prefix_list_id) + .register_column(:address_families, field: :address_family) + .register_column(:states, field: :state) + .register_column(:state_messages, field: :state_message) + .register_column(:prefix_list_arns, field: :prefix_list_arn) + .register_column(:prefix_list_names, field: :prefix_list_name) + .register_column(:max_entries, field: :max_entries) + .register_column(:versions, field: :version) + .register_column(:tags, field: :tags) + .register_column(:owner_ids, field: :owner_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_spot_fleet.rb b/libraries/aws_ec2_spot_fleet.rb index 7e38880b4..c1250c7cf 100644 --- a/libraries/aws_ec2_spot_fleet.rb +++ b/libraries/aws_ec2_spot_fleet.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2SpotFleet < AwsResourceBase - name "aws_ec2_spot_fleet" - desc "Describes your Spot Fleet requests." + name 'aws_ec2_spot_fleet' + desc 'Describes your Spot Fleet requests.' example " describe aws_ec2_spot_fleet(spot_fleet_request_id: 'SpotFleetRequestID') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def spot_fleet_request_id - return nil unless exists? + return unless exists? @res[:spot_fleet_request_id] end diff --git a/libraries/aws_ec2_spot_fleets.rb b/libraries/aws_ec2_spot_fleets.rb index 5398e758e..21aa0f470 100644 --- a/libraries/aws_ec2_spot_fleets.rb +++ b/libraries/aws_ec2_spot_fleets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2SpotFleets < AwsResourceBase - name "aws_ec2_spot_fleets" - desc "Describes your Spot Fleet requests." + name 'aws_ec2_spot_fleets' + desc 'Describes your Spot Fleet requests.' example " describe aws_ec2_spot_fleets do @@ -13,13 +13,13 @@ class AWSEC2SpotFleets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:activity_statuses, field: :activity_status) - .register_column(:create_times, field: :create_time) - .register_column(:spot_fleet_request_configs, field: :spot_fleet_request_config) - .register_column(:spot_fleet_request_ids, field: :spot_fleet_request_id) - .register_column(:spot_fleet_request_states, field: :spot_fleet_request_state) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:activity_statuses, field: :activity_status) + .register_column(:create_times, field: :create_time) + .register_column(:spot_fleet_request_configs, field: :spot_fleet_request_config) + .register_column(:spot_fleet_request_ids, field: :spot_fleet_request_id) + .register_column(:spot_fleet_request_states, field: :spot_fleet_request_state) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_traffic_mirror_filter.rb b/libraries/aws_ec2_traffic_mirror_filter.rb index d7dcce763..89caf4e50 100644 --- a/libraries/aws_ec2_traffic_mirror_filter.rb +++ b/libraries/aws_ec2_traffic_mirror_filter.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEc2TrafficMirrorFilter < AwsResourceBase - name "aws_ec2_traffic_mirror_filter.md" - desc "Describes one or more Traffic Mirror filters." + name 'aws_ec2_traffic_mirror_filter.md' + desc 'Describes one or more Traffic Mirror filters.' example " describe aws_ec2_traffic_mirror_filter_rule(traffic_mirror_filter_id: 'tmf-1234567890') do @@ -29,7 +29,7 @@ def initialize(opts = {}) end def traffic_mirror_filter_id - return nil unless exists? + return unless exists? @traffic_mirror_filters[:traffic_mirror_filter_id] end diff --git a/libraries/aws_ec2_traffic_mirror_filters.rb b/libraries/aws_ec2_traffic_mirror_filters.rb index d000249f4..6271aa15b 100644 --- a/libraries/aws_ec2_traffic_mirror_filters.rb +++ b/libraries/aws_ec2_traffic_mirror_filters.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEc2TrafficMirrorFilters < AwsResourceBase - name "aws_ec2_traffic_mirror_filters" - desc "Describes one or more Traffic Mirror filters." + name 'aws_ec2_traffic_mirror_filters' + desc 'Describes one or more Traffic Mirror filters.' example " describe aws_ec2_traffic_mirror_filters do @@ -13,10 +13,10 @@ class AWSEc2TrafficMirrorFilters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:traffic_mirror_filter_ids, field: :traffic_mirror_filter_id) - .register_column(:descriptions, field: :description) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:traffic_mirror_filter_ids, field: :traffic_mirror_filter_id) + .register_column(:descriptions, field: :description) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_traffic_mirror_session.rb b/libraries/aws_ec2_traffic_mirror_session.rb index a15a63a8c..19f0f83e0 100644 --- a/libraries/aws_ec2_traffic_mirror_session.rb +++ b/libraries/aws_ec2_traffic_mirror_session.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEc2TrafficMirrorSession < AwsResourceBase - name "aws_ec2_traffic_mirror_session" - desc "Describes one or more Traffic Mirror session." + name 'aws_ec2_traffic_mirror_session' + desc 'Describes one or more Traffic Mirror session.' example " describe aws_ec2_traffic_mirror_session(traffic_mirror_session_id: 'test-traffic_mirror_session_id') do diff --git a/libraries/aws_ec2_traffic_mirror_sessions.rb b/libraries/aws_ec2_traffic_mirror_sessions.rb index 20b2a0d6e..e216e31c8 100644 --- a/libraries/aws_ec2_traffic_mirror_sessions.rb +++ b/libraries/aws_ec2_traffic_mirror_sessions.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEc2TrafficMirrorSessions < AwsResourceBase - name "aws_ec2_traffic_mirror_sessions" - desc "Verifies settings for a collection of AWS EC2 Traffic Mirror Sessions." + name 'aws_ec2_traffic_mirror_sessions' + desc 'Verifies settings for a collection of AWS EC2 Traffic Mirror Sessions.' example " describe aws_ec2_traffic_mirror_sessions do @@ -13,17 +13,17 @@ class AWSEc2TrafficMirrorSessions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:traffic_mirror_session_ids, field: :traffic_mirror_session_id) - .register_column(:traffic_mirror_target_ids, field: :traffic_mirror_target_id) - .register_column(:descriptions, field: :description) - .register_column(:traffic_mirror_filter_ids, field: :traffic_mirror_filter_id) - .register_column(:network_interface_ids, field: :network_interface_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:packet_lengths, field: :packet_length) - .register_column(:session_numbers, field: :session_number) - .register_column(:virtual_network_ids, field: :virtual_network_id) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:traffic_mirror_session_ids, field: :traffic_mirror_session_id) + .register_column(:traffic_mirror_target_ids, field: :traffic_mirror_target_id) + .register_column(:descriptions, field: :description) + .register_column(:traffic_mirror_filter_ids, field: :traffic_mirror_filter_id) + .register_column(:network_interface_ids, field: :network_interface_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:packet_lengths, field: :packet_length) + .register_column(:session_numbers, field: :session_number) + .register_column(:virtual_network_ids, field: :virtual_network_id) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_traffic_mirror_target.rb b/libraries/aws_ec2_traffic_mirror_target.rb index 6ba6648d4..23b8344dc 100644 --- a/libraries/aws_ec2_traffic_mirror_target.rb +++ b/libraries/aws_ec2_traffic_mirror_target.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEc2TrafficMirrorTarget < AwsResourceBase - name "aws_ec2_traffic_mirror_target" - desc "Information about one or more Traffic Mirror targets." + name 'aws_ec2_traffic_mirror_target' + desc 'Information about one or more Traffic Mirror targets.' example " describe aws_ec2_traffic_mirror_target(traffic_mirror_target_id: 'TrafficMirrorTargetId') do diff --git a/libraries/aws_ec2_traffic_mirror_targets.rb b/libraries/aws_ec2_traffic_mirror_targets.rb index f7435f5b8..75c133b6b 100644 --- a/libraries/aws_ec2_traffic_mirror_targets.rb +++ b/libraries/aws_ec2_traffic_mirror_targets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEc2TrafficMirrorTargets < AwsResourceBase - name "aws_ec2_traffic_mirror_targets" - desc "Verifies settings for a collection of AWS EC2 Traffic Mirror targets" + name 'aws_ec2_traffic_mirror_targets' + desc 'Verifies settings for a collection of AWS EC2 Traffic Mirror targets' example " describe aws_ec2_traffic_mirror_targets do @@ -13,14 +13,14 @@ class AWSEc2TrafficMirrorTargets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:traffic_mirror_target_ids, field: :traffic_mirror_target_id) - .register_column(:network_interface_ids, field: :network_interface_id) - .register_column(:network_load_balancer_arns, field: :network_load_balancer_arn) - .register_column(:types, field: :type) - .register_column(:descriptions, field: :description) - .register_column(:owner_ids, field: :owner_id) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:traffic_mirror_target_ids, field: :traffic_mirror_target_id) + .register_column(:network_interface_ids, field: :network_interface_id) + .register_column(:network_load_balancer_arns, field: :network_load_balancer_arn) + .register_column(:types, field: :type) + .register_column(:descriptions, field: :description) + .register_column(:owner_ids, field: :owner_id) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_transit_gateway_attachment.rb b/libraries/aws_ec2_transit_gateway_attachment.rb index a6fa699fc..9068eff93 100644 --- a/libraries/aws_ec2_transit_gateway_attachment.rb +++ b/libraries/aws_ec2_transit_gateway_attachment.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEc2TransitGatewayAttachment < AwsResourceBase - name "aws_ec2_transit_gateway_attachment" - desc "Describes one or more attachments between resources and transit gateways. By default, all attachments are described. Alternatively, you can filter the results by attachment ID, attachment state, resource ID, or resource owner." + name 'aws_ec2_transit_gateway_attachment' + desc 'Describes one or more attachments between resources and transit gateways. By default, all attachments are described. Alternatively, you can filter the results by attachment ID, attachment state, resource ID, or resource owner.' example " describe aws_ec2_transit_gateway_attachment(transit_gateway_attachment_id: 'tgw-attach-0123456789') do @@ -28,7 +28,7 @@ def resource_id end def transit_gateway_attachment_id - return nil unless exists? + return unless exists? @transit_gateway_attachments[:transit_gateway_attachment_id] end diff --git a/libraries/aws_ec2_transit_gateway_attachments.rb b/libraries/aws_ec2_transit_gateway_attachments.rb index ee1cad8a1..e7b1ca70b 100644 --- a/libraries/aws_ec2_transit_gateway_attachments.rb +++ b/libraries/aws_ec2_transit_gateway_attachments.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEc2TransitGatewayAttachments < AwsResourceBase - name "aws_ec2_transit_gateway_attachments" - desc "Describes one or more attachments between resources and transit gateways. By default, all attachments are described. Alternatively, you can filter the results by attachment ID, attachment state, resource ID, or resource owner." + name 'aws_ec2_transit_gateway_attachments' + desc 'Describes one or more attachments between resources and transit gateways. By default, all attachments are described. Alternatively, you can filter the results by attachment ID, attachment state, resource ID, or resource owner.' example " describe aws_ec2_transit_gateway_attachements do it { should exist } @@ -12,17 +12,17 @@ class AwsEc2TransitGatewayAttachments < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) - .register_column(:transit_gateway_ids, field: :transit_gateway_id) - .register_column(:transit_gateway_owner_ids, field: :transit_gateway_owner_id) - .register_column(:resource_owner_ids, field: :resource_owner_id) - .register_column(:resource_types, field: :resource_type) - .register_column(:resource_ids, field: :resource_id) - .register_column(:states, field: :state) - .register_column(:associations, field: :association) - .register_column(:creation_times, field: :creation_time) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) + .register_column(:transit_gateway_ids, field: :transit_gateway_id) + .register_column(:transit_gateway_owner_ids, field: :transit_gateway_owner_id) + .register_column(:resource_owner_ids, field: :resource_owner_id) + .register_column(:resource_types, field: :resource_type) + .register_column(:resource_ids, field: :resource_id) + .register_column(:states, field: :state) + .register_column(:associations, field: :association) + .register_column(:creation_times, field: :creation_time) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_transit_gateway_route_table.rb b/libraries/aws_ec2_transit_gateway_route_table.rb index e6a734a90..8332380b8 100644 --- a/libraries/aws_ec2_transit_gateway_route_table.rb +++ b/libraries/aws_ec2_transit_gateway_route_table.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEc2TransitGatewayRouteTable < AwsResourceBase - name "aws_ec2_transit_gateway_route_table" - desc "Describes one or more transit gateway route tables. By default, all transit gateway route tables are described. Alternatively, you can filter the results." + name 'aws_ec2_transit_gateway_route_table' + desc 'Describes one or more transit gateway route tables. By default, all transit gateway route tables are described. Alternatively, you can filter the results.' example " describe aws_ec2_transit_gateway_route_table(transit_gateway_route_table_id: 'tgw-rtb-0123456789') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def transit_gateway_route_table_id - return nil unless exists? + return unless exists? @transit_gateway_route_tables[:transit_gateway_route_table_id] end diff --git a/libraries/aws_ec2_transit_gateway_route_table_association.rb b/libraries/aws_ec2_transit_gateway_route_table_association.rb index 60bc9138c..f2502d2a2 100644 --- a/libraries/aws_ec2_transit_gateway_route_table_association.rb +++ b/libraries/aws_ec2_transit_gateway_route_table_association.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEc2TransitGatewayRouteTableAssociation < AwsResourceBase - name "aws_ec2_transit_gateway_route_table_association" - desc "Gets information about the associations for the specified transit gateway route table." + name 'aws_ec2_transit_gateway_route_table_association' + desc 'Gets information about the associations for the specified transit gateway route table.' example " describe aws_ec2_transit_gateway_route_table_association(transit_gateway_route_table_id: 'tgw-attach-0123456789') do @@ -30,7 +30,7 @@ def resource_id end def transit_gateway_route_table_id - return nil unless exists? + return unless exists? @association[:transit_gateway_route_table_id] end diff --git a/libraries/aws_ec2_transit_gateway_route_table_associations.rb b/libraries/aws_ec2_transit_gateway_route_table_associations.rb index db5dc0d3b..4fd6f9e5e 100644 --- a/libraries/aws_ec2_transit_gateway_route_table_associations.rb +++ b/libraries/aws_ec2_transit_gateway_route_table_associations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEc2TransitGatewayRouteTableAssociations < AwsResourceBase - name "aws_ec2_transit_gateway_route_table_associations" - desc "Gets information about the associations for the specified transit gateway route table." + name 'aws_ec2_transit_gateway_route_table_associations' + desc 'Gets information about the associations for the specified transit gateway route table.' example " describe aws_ec2_transit_gateway_route_table_associations(transit_gateway_route_table_id: 'tgw-attach-0123456789') do it { should exist } @@ -12,11 +12,11 @@ class AwsEc2TransitGatewayRouteTableAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) - .register_column(:resource_ids, field: :resource_id) - .register_column(:resource_types, field: :resource_type) - .register_column(:states, field: :state) - .install_filter_methods_on_resource(self, :table) + .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) + .register_column(:resource_ids, field: :resource_id) + .register_column(:resource_types, field: :resource_type) + .register_column(:states, field: :state) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_transit_gateway_route_table_propagation.rb b/libraries/aws_ec2_transit_gateway_route_table_propagation.rb index 6b6c5b74d..501524072 100644 --- a/libraries/aws_ec2_transit_gateway_route_table_propagation.rb +++ b/libraries/aws_ec2_transit_gateway_route_table_propagation.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEc2TransitGatewayRouteTablePropagation < AwsResourceBase - name "aws_ec2_transit_gateway_route_table_propagation" - desc "Describes information about the route table propagations for the specified transit gateway route table." + name 'aws_ec2_transit_gateway_route_table_propagation' + desc 'Describes information about the route table propagations for the specified transit gateway route table.' example " describe aws_ec2_transit_gateway_route_table_propagation(transit_gateway_route_table_id: 'test1') do it { should exist } @@ -21,7 +21,7 @@ def initialize(opts = {}) @display_name = opts[:transit_gateway_attachment_id] filter = [ { - name: "transit-gateway-attachment-id", + name: 'transit-gateway-attachment-id', values: [opts[:transit_gateway_attachment_id]], }, ] @@ -38,7 +38,7 @@ def resource_id end def transit_gateway_attachment_id - return nil unless exists? + return unless exists? @resp[:transit_gateway_attachment_id] end diff --git a/libraries/aws_ec2_transit_gateway_route_table_propagations.rb b/libraries/aws_ec2_transit_gateway_route_table_propagations.rb index cf63d2dd7..17f3d2627 100644 --- a/libraries/aws_ec2_transit_gateway_route_table_propagations.rb +++ b/libraries/aws_ec2_transit_gateway_route_table_propagations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEc2TransitGatewayRouteTablePropagations < AwsResourceBase - name "aws_ec2_transit_gateway_route_table_propagations" - desc "List information about the route table propagations for the specified transit gateway route table." + name 'aws_ec2_transit_gateway_route_table_propagations' + desc 'List information about the route table propagations for the specified transit gateway route table.' example " describe aws_ec2_transit_gateway_route_table_propagations(transit_gateway_route_table_id: 'test1') do @@ -13,11 +13,11 @@ class AWSEc2TransitGatewayRouteTablePropagations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) - .register_column(:resource_ids, field: :resource_id) - .register_column(:resource_types, field: :resource_type) - .register_column(:states, field: :state) - .install_filter_methods_on_resource(self, :table) + .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) + .register_column(:resource_ids, field: :resource_id) + .register_column(:resource_types, field: :resource_type) + .register_column(:states, field: :state) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_transit_gateway_route_tables.rb b/libraries/aws_ec2_transit_gateway_route_tables.rb index cc6a765bc..19f60fe90 100644 --- a/libraries/aws_ec2_transit_gateway_route_tables.rb +++ b/libraries/aws_ec2_transit_gateway_route_tables.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEc2TransitGatewayRouteTables < AwsResourceBase - name "aws_ec2_transit_gateway_route_tables" - desc "Describes one or more transit gateway route tables. By default, all transit gateway route tables are described. Alternatively, you can filter the results." + name 'aws_ec2_transit_gateway_route_tables' + desc 'Describes one or more transit gateway route tables. By default, all transit gateway route tables are described. Alternatively, you can filter the results.' example " describe aws_ec2_transit_gateway_route_tables do @@ -13,14 +13,14 @@ class AwsEc2TransitGatewayRouteTables < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:transit_gateway_route_table_ids, field: :transit_gateway_route_table_id) - .register_column(:transit_gateway_ids, field: :transit_gateway_id) - .register_column(:states, field: :state) - .register_column(:default_association_route_tables, field: :default_association_route_table) - .register_column(:default_propagation_route_tables, field: :default_propagation_route_table) - .register_column(:creation_times, field: :creation_time) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:transit_gateway_route_table_ids, field: :transit_gateway_route_table_id) + .register_column(:transit_gateway_ids, field: :transit_gateway_id) + .register_column(:states, field: :state) + .register_column(:default_association_route_tables, field: :default_association_route_table) + .register_column(:default_propagation_route_tables, field: :default_propagation_route_table) + .register_column(:creation_times, field: :creation_time) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_volume_attachment.rb b/libraries/aws_ec2_volume_attachment.rb index e3e4cbafe..6edfc0657 100644 --- a/libraries/aws_ec2_volume_attachment.rb +++ b/libraries/aws_ec2_volume_attachment.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2VolumeAttachment < AwsResourceBase - name "aws_ec2_volume_attachment" - desc "Describes the specified EBS volumes attachments or all of your EBS volumes attachments." + name 'aws_ec2_volume_attachment' + desc 'Describes the specified EBS volumes attachments or all of your EBS volumes attachments.' example " describe aws_ec2_volume_attachment(volume_id: 'VolumeID') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def volume_id - return nil unless exists? + return unless exists? @res[:volume_id] end diff --git a/libraries/aws_ec2_volume_attachments.rb b/libraries/aws_ec2_volume_attachments.rb index e10d986cd..d4fc60c90 100644 --- a/libraries/aws_ec2_volume_attachments.rb +++ b/libraries/aws_ec2_volume_attachments.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2VolumeAttachments < AwsResourceBase - name "aws_ec2_volume_attachments" - desc "Describes the specified EBS volumes attachments or all of your EBS volumes attachments." + name 'aws_ec2_volume_attachments' + desc 'Describes the specified EBS volumes attachments or all of your EBS volumes attachments.' example " describe aws_ec2_volume_attachments do @@ -13,13 +13,13 @@ class AWSEC2VolumeAttachments < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:attach_times, field: :attach_time) - .register_column(:devices, field: :device) - .register_column(:instance_ids, field: :instance_id) - .register_column(:states, field: :state) - .register_column(:volume_ids, field: :volume_id) - .register_column(:delete_on_terminations, field: :delete_on_termination) - .install_filter_methods_on_resource(self, :table) + .register_column(:attach_times, field: :attach_time) + .register_column(:devices, field: :device) + .register_column(:instance_ids, field: :instance_id) + .register_column(:states, field: :state) + .register_column(:volume_ids, field: :volume_id) + .register_column(:delete_on_terminations, field: :delete_on_termination) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_vpc_peering_connection.rb b/libraries/aws_ec2_vpc_peering_connection.rb index 29ceecc36..a8392a37e 100644 --- a/libraries/aws_ec2_vpc_peering_connection.rb +++ b/libraries/aws_ec2_vpc_peering_connection.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2VPCPeeringConnection < AwsResourceBase - name "aws_ec2_vpc_peering_connection" - desc "Describes a vpc peering connection." + name 'aws_ec2_vpc_peering_connection' + desc 'Describes a vpc peering connection.' example " describe aws_ec2_vpc_peering_connection(vpc_peering_connection_id: 'VpcPeeringConnectionId') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def vpc_peering_connection_id - return nil unless exists? + return unless exists? @res[:vpc_peering_connection_id] end diff --git a/libraries/aws_ec2_vpc_peering_connections.rb b/libraries/aws_ec2_vpc_peering_connections.rb index fc44b5121..c1391e4ba 100644 --- a/libraries/aws_ec2_vpc_peering_connections.rb +++ b/libraries/aws_ec2_vpc_peering_connections.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2VPCPeeringConnections < AwsResourceBase - name "aws_ec2_vpc_peering_connections" - desc "Describes a vpc peering connection." + name 'aws_ec2_vpc_peering_connections' + desc 'Describes a vpc peering connection.' example " describe aws_ec2_vpc_peering_connections do @@ -13,13 +13,13 @@ class AWSEC2VPCPeeringConnections < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:accepter_vpc_infos, field: :accepter_vpc_info) - .register_column(:expiration_times, field: :expiration_time) - .register_column(:requester_vpc_infos, field: :requester_vpc_info) - .register_column(:statuses, field: :status) - .register_column(:tags, field: :tags) - .register_column(:vpc_peering_connection_ids, field: :vpc_peering_connection_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:accepter_vpc_infos, field: :accepter_vpc_info) + .register_column(:expiration_times, field: :expiration_time) + .register_column(:requester_vpc_infos, field: :requester_vpc_info) + .register_column(:statuses, field: :status) + .register_column(:tags, field: :tags) + .register_column(:vpc_peering_connection_ids, field: :vpc_peering_connection_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_vpn_connection_routes.rb b/libraries/aws_ec2_vpn_connection_routes.rb index 8479c65f9..a754bdfcb 100644 --- a/libraries/aws_ec2_vpn_connection_routes.rb +++ b/libraries/aws_ec2_vpn_connection_routes.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEC2VPNConnectionRoutes < AwsResourceBase - name "aws_ec2_vpn_connection_routes" - desc "Describes one or more of your VPN connections route." + name 'aws_ec2_vpn_connection_routes' + desc 'Describes one or more of your VPN connections route.' example " describe aws_ec2_vpn_connection_routes(vpn_connection_id: 'VPNConnectionID') do @@ -13,10 +13,10 @@ class AWSEC2VPNConnectionRoutes < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:destination_cidr_blocks, field: :destination_cidr_block) - .register_column(:sources, field: :source) - .register_column(:states, field: :state) - .install_filter_methods_on_resource(self, :table) + .register_column(:destination_cidr_blocks, field: :destination_cidr_block) + .register_column(:sources, field: :source) + .register_column(:states, field: :state) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_vpn_gateway_route_propagation.rb b/libraries/aws_ec2_vpn_gateway_route_propagation.rb index 2ddfa3cc7..f94ce1252 100644 --- a/libraries/aws_ec2_vpn_gateway_route_propagation.rb +++ b/libraries/aws_ec2_vpn_gateway_route_propagation.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEc2VPNGatewayRoutePropagation < AwsResourceBase - name "aws_ec2_vpn_gateway_route_propagation" - desc "Describes virtual private gateway (VGW) to propagate routes to the specified route table of a VPC." + name 'aws_ec2_vpn_gateway_route_propagation' + desc 'Describes virtual private gateway (VGW) to propagate routes to the specified route table of a VPC.' example " describe aws_ec2_vpn_gateway_route_propagation(route_table_id: 'rtb-1234567890') do @@ -29,7 +29,7 @@ def initialize(opts = {}) end def id - return nil unless exists? + return unless exists? @route_tables[:route_table_id] end diff --git a/libraries/aws_ec2_vpn_gateway_route_propagations.rb b/libraries/aws_ec2_vpn_gateway_route_propagations.rb index ad23d85ec..48cc7c4da 100644 --- a/libraries/aws_ec2_vpn_gateway_route_propagations.rb +++ b/libraries/aws_ec2_vpn_gateway_route_propagations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEc2VPNGatewayRoutePropagations < AwsResourceBase - name "aws_ec2_vpn_gateway_route_propagations" - desc "List the properties." + name 'aws_ec2_vpn_gateway_route_propagations' + desc 'List the properties.' example " describe aws_ec2_vpn_gateway_route_propagations do @@ -16,9 +16,9 @@ class AWSEc2VPNGatewayRoutePropagations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:route_table_ids, field: :route_table_id) - .register_column(:propagating_vgws_gateway_ids, field: :propagating_vgws_gateway_ids, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:route_table_ids, field: :route_table_id) + .register_column(:propagating_vgws_gateway_ids, field: :propagating_vgws_gateway_ids, style: :simple) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -55,7 +55,7 @@ def flat_hash_from(route_table) propagating_vgws = route_table.propagating_vgws { route_table_id: route_table.route_table_id, - propagating_vgws_gateway_ids: map(propagating_vgws, "gateway_id"), + propagating_vgws_gateway_ids: map(propagating_vgws, 'gateway_id'), } end diff --git a/libraries/aws_ecr.rb b/libraries/aws_ecr.rb index 05931e5b3..49ac85a26 100644 --- a/libraries/aws_ecr.rb +++ b/libraries/aws_ecr.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEcr < AwsResourceBase - name "aws_ecr" - desc "Verifies settings for an Elastic Container Registry." + name 'aws_ecr' + desc 'Verifies settings for an Elastic Container Registry.' example " describe aws_ecr('container-registry') do @@ -20,7 +20,7 @@ def initialize(opts = {}) catch_aws_errors do resp = @aws.ecr_client.describe_repositories(repository_names: [opts[:repository_name]]) - return nil if resp.repositories.nil? || resp.repositories.empty? + return if resp.repositories.nil? || resp.repositories.empty? repository = resp.repositories.first @repository_name = repository.repository_name @repository_arn = repository.repository_arn @@ -31,7 +31,7 @@ def initialize(opts = {}) end def images - return nil if !exists? + return if !exists? resp = nil catch_aws_errors do resp = @aws.ecr_client.describe_images(repository_name: @repository_name).image_details.first diff --git a/libraries/aws_ecr_image.rb b/libraries/aws_ecr_image.rb index 33aa55dad..64d6b1db6 100644 --- a/libraries/aws_ecr_image.rb +++ b/libraries/aws_ecr_image.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEcrImage < AwsResourceBase - name "aws_ecr_image" - desc "Verifies settings for an AWS ECR Image." + name 'aws_ecr_image' + desc 'Verifies settings for an AWS ECR Image.' example " describe aws_ecr_image(repository_name: 'my-repo', image_tag: 'latest') do @@ -17,15 +17,15 @@ class AwsEcrImage < AwsResourceBase def initialize(opts = {}) super(opts) validate_parameters(required: %i(repository_name), require_any_of: %i(image_tag image_digest), allow: %i(registry_id)) - @display_name = opts.values.join(" ") + @display_name = opts.values.join(' ') # Validate repository_name. pattern = %r{(?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._\-][a-z0-9]+)*} matched_str = opts[:repository_name].match(pattern) unless (opts[:repository_name] == matched_str[0]) && (matched_str.length == 1) && opts[:repository_name].length.between?(2, 256) raise ArgumentError, "#{@__resource_name__}: `repository_name` is not in a valid format. " \ - "Please check the docs for more info "\ - "https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html" \ + 'Please check the docs for more info '\ + 'https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html' \ end # Validate image identifiers: @@ -37,7 +37,7 @@ def initialize(opts = {}) query_params = { repository_name: opts[:repository_name], image_ids: [ - opts.select { |k, _v| k.to_s.start_with?("image") }, + opts.select { |k, _v| k.to_s.start_with?('image') }, ], } @@ -67,7 +67,7 @@ def vulnerabilities # https://docs.aws.amazon.com/cli/latest/reference/ecr/describe-image-scan-findings.html query_params = { repository_name: @opts[:repository_name], - image_id: @opts.select { |k, _v| k.to_s.start_with?("image") }, + image_id: @opts.select { |k, _v| k.to_s.start_with?('image') }, max_results: 1000, } @scan_findings = [] diff --git a/libraries/aws_ecr_images.rb b/libraries/aws_ecr_images.rb index c22805762..b311e846f 100644 --- a/libraries/aws_ecr_images.rb +++ b/libraries/aws_ecr_images.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEcrImages < AwsResourceBase - name "aws_ecr_images" - desc "Verifies settings for a collection of AWS ECR Images in a repository." + name 'aws_ecr_images' + desc 'Verifies settings for a collection of AWS ECR Images in a repository.' example " describe aws_ecr_images(repository_name: 'my-repo') do @@ -13,13 +13,13 @@ class AwsEcrImages < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:digests, field: :digest) - .register_column(:tags, field: :tags) - .register_column(:size_in_bytes, field: :size_in_bytes) - .register_column(:pushed_at_dates, field: :pushed_at_date) - .register_column(:vulnerability_scan_status, field: :vulnerability_scan_status) - .register_column(:vulnerability_severity_counts, field: :vulnerability_severity_counts) - .install_filter_methods_on_resource(self, :table) + .register_column(:digests, field: :digest) + .register_column(:tags, field: :tags) + .register_column(:size_in_bytes, field: :size_in_bytes) + .register_column(:pushed_at_dates, field: :pushed_at_date) + .register_column(:vulnerability_scan_status, field: :vulnerability_scan_status) + .register_column(:vulnerability_severity_counts, field: :vulnerability_severity_counts) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -30,8 +30,8 @@ def initialize(opts = {}) matched_str = opts[:repository_name].match(pattern) unless (opts[:repository_name] == matched_str[0]) && (matched_str.length == 1) && opts[:repository_name].length.between?(2, 256) raise ArgumentError, "#{@__resource_name__}: `repository_name` is not in a valid format. " \ - "Please check the docs for more info "\ - "https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html" \ + 'Please check the docs for more info '\ + 'https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html' \ end @query_params[:repository_name] = opts[:repository_name] # Validate registry_id. (Optional. If not provided, AWS account ID will be used by the AWS API.) diff --git a/libraries/aws_ecr_repositories.rb b/libraries/aws_ecr_repositories.rb index d569d3b92..e19b5029e 100644 --- a/libraries/aws_ecr_repositories.rb +++ b/libraries/aws_ecr_repositories.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEcrRepositories < AwsResourceBase - name "aws_ecr_repositories" - desc "Verifies settings for a collection of AWS ECR Repositories." + name 'aws_ecr_repositories' + desc 'Verifies settings for a collection of AWS ECR Repositories.' example " describe aws_ecr_repositories do @@ -17,13 +17,13 @@ class AwsEcrRepositories < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:names, field: :name) - .register_column(:uris, field: :uri) - .register_column(:created_at_dates, field: :created_at) - .register_column(:image_tag_mutability_status, field: :image_tag_mutability) - .register_column(:image_scanning_on_push_status, field: :image_scanning_on_push_status) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:names, field: :name) + .register_column(:uris, field: :uri) + .register_column(:created_at_dates, field: :created_at) + .register_column(:image_tag_mutability_status, field: :image_tag_mutability) + .register_column(:image_scanning_on_push_status, field: :image_scanning_on_push_status) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ecr_repository.rb b/libraries/aws_ecr_repository.rb index d1309a73d..5512b882a 100644 --- a/libraries/aws_ecr_repository.rb +++ b/libraries/aws_ecr_repository.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEcrRepository < AwsResourceBase - name "aws_ecr_repository" - desc "Verifies settings for an AWS ECR Repository." + name 'aws_ecr_repository' + desc 'Verifies settings for an AWS ECR Repository.' example " describe aws_ecr_repository('my-repository') do @@ -24,8 +24,8 @@ def initialize(opts = {}) matched_str = opts[:repository_name].match(pattern) unless (opts[:repository_name] == matched_str[0]) && (matched_str.length == 1) && opts[:repository_name].length.between?(2, 256) raise ArgumentError, "#{@__resource_name__}: `repository_name` is not in a valid format. " \ - "Please check the docs for more info "\ - "https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html" \ + 'Please check the docs for more info '\ + 'https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html' \ end @display_name = opts[:repository_name] diff --git a/libraries/aws_ecr_repository_policy.rb b/libraries/aws_ecr_repository_policy.rb index 33e72212e..9ecea55b5 100644 --- a/libraries/aws_ecr_repository_policy.rb +++ b/libraries/aws_ecr_repository_policy.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEcrPolicy < AwsResourceBase - name "aws_ecr_repository_policy" - desc "Verifies policy settings for an AWS ECR Repository." + name 'aws_ecr_repository_policy' + desc 'Verifies policy settings for an AWS ECR Repository.' example " describe aws_ecr_repository_policy(repository_name: 'my-repository') do diff --git a/libraries/aws_ecrpublic_repositories.rb b/libraries/aws_ecrpublic_repositories.rb index 9a594fe80..3cd4ecac2 100644 --- a/libraries/aws_ecrpublic_repositories.rb +++ b/libraries/aws_ecrpublic_repositories.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEcrPublicRepositories < AwsResourceBase - name "aws_ecrpublic_repositories" - desc "Verifies settings for a collection of AWS ECR Public Repositories." + name 'aws_ecrpublic_repositories' + desc 'Verifies settings for a collection of AWS ECR Public Repositories.' example " describe aws_ecrpublic_repositories do @@ -17,11 +17,11 @@ class AwsEcrPublicRepositories < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:names, field: :name) - .register_column(:uris, field: :uri) - .register_column(:created_at_dates, field: :created_at) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:names, field: :name) + .register_column(:uris, field: :uri) + .register_column(:created_at_dates, field: :created_at) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ecrpublic_repository.rb b/libraries/aws_ecrpublic_repository.rb index 34804a14c..4b11624be 100644 --- a/libraries/aws_ecrpublic_repository.rb +++ b/libraries/aws_ecrpublic_repository.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEcrPublicRepository < AwsResourceBase - name "aws_ecrpublic_repository" - desc "Verifies settings for an AWS ECR Public Repository." + name 'aws_ecrpublic_repository' + desc 'Verifies settings for an AWS ECR Public Repository.' example " describe aws_ecrpublic_repository('my-public-repository') do @@ -24,8 +24,8 @@ def initialize(opts = {}) matched_str = opts[:repository_name].match(pattern) unless (opts[:repository_name] == matched_str[0]) && (matched_str.length == 1) && opts[:repository_name].length.between?(2, 256) raise ArgumentError, "#{@__resource_name__}: `repository_name` is not in a valid format. " \ - "Please check the docs for more info "\ - "https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html" \ + 'Please check the docs for more info '\ + 'https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html' \ end @display_name = opts[:repository_name] diff --git a/libraries/aws_ecs_cluster.rb b/libraries/aws_ecs_cluster.rb index 25e26fcc3..196475cdc 100644 --- a/libraries/aws_ecs_cluster.rb +++ b/libraries/aws_ecs_cluster.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEcsCluster < AwsResourceBase - name "aws_ecs_cluster" - desc "Verifies settings for an ECS cluster." + name 'aws_ecs_cluster' + desc 'Verifies settings for an ECS cluster.' example " describe aws_ecs_cluster('backup-cluster') do diff --git a/libraries/aws_ecs_clusters.rb b/libraries/aws_ecs_clusters.rb index 74f9781e2..6add5ae04 100644 --- a/libraries/aws_ecs_clusters.rb +++ b/libraries/aws_ecs_clusters.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEcsClusters < AwsResourceBase - name "aws_ecs_clusters" - desc "Verifies settings for a collection AWS ECS Clusters." + name 'aws_ecs_clusters' + desc 'Verifies settings for a collection AWS ECS Clusters.' example " describe aws_ecs_clusters do it { should exist } @@ -12,15 +12,15 @@ class AwsEcsClusters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:cluster_arns, field: :cluster_arn) - .register_column(:cluster_names, field: :cluster_name) - .register_column(:statuses, field: :status) - .register_column(:running_tasks_counts, field: :running_tasks_count) - .register_column(:pending_tasks_counts, field: :pending_tasks_count) - .register_column(:active_services_counts, field: :active_services_count) - .register_column(:statistics, field: :statistics) - .register_column(:registered_container_instances_counts, field: :registered_container_instances_count) - .install_filter_methods_on_resource(self, :table) + .register_column(:cluster_arns, field: :cluster_arn) + .register_column(:cluster_names, field: :cluster_name) + .register_column(:statuses, field: :status) + .register_column(:running_tasks_counts, field: :running_tasks_count) + .register_column(:pending_tasks_counts, field: :pending_tasks_count) + .register_column(:active_services_counts, field: :active_services_count) + .register_column(:statistics, field: :statistics) + .register_column(:registered_container_instances_counts, field: :registered_container_instances_count) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ecs_service.rb b/libraries/aws_ecs_service.rb index 41f885882..5133298a4 100644 --- a/libraries/aws_ecs_service.rb +++ b/libraries/aws_ecs_service.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSECSService < AwsResourceBase - name "aws_ecs_service" - desc "Describes the specified services running in your cluster." + name 'aws_ecs_service' + desc 'Describes the specified services running in your cluster.' example " describe aws_ecs_service(cluster: 'test-cluster', services: 'test1') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def services - return nil unless exists? + return unless exists? @services[:services] end diff --git a/libraries/aws_ecs_services.rb b/libraries/aws_ecs_services.rb index 888d03004..e22a89ff8 100644 --- a/libraries/aws_ecs_services.rb +++ b/libraries/aws_ecs_services.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSECSServices < AwsResourceBase - name "aws_ecs_services" - desc "Lists the services that are running in a specified cluster." + name 'aws_ecs_services' + desc 'Lists the services that are running in a specified cluster.' example " describe aws_ecs_services(cluster: 'cluster_name') do @@ -13,17 +13,17 @@ class AWSECSServices < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:service_arns, field: :service_arn) - .register_column(:service_names, field: :service_name) - .register_column(:cluster_arns, field: :cluster_arn) - .register_column(:status, field: :status) - .register_column(:desired_count, field: :desired_count) - .register_column(:running_count, field: :running_count) - .register_column(:pending_count, field: :pending_count) - .register_column(:launch_types, field: :launch_type) - .register_column(:task_definitions, field: :task_definition) - .register_column(:platform_versions, field: :platform_version) - .install_filter_methods_on_resource(self, :table) + .register_column(:service_arns, field: :service_arn) + .register_column(:service_names, field: :service_name) + .register_column(:cluster_arns, field: :cluster_arn) + .register_column(:status, field: :status) + .register_column(:desired_count, field: :desired_count) + .register_column(:running_count, field: :running_count) + .register_column(:pending_count, field: :pending_count) + .register_column(:launch_types, field: :launch_type) + .register_column(:task_definitions, field: :task_definition) + .register_column(:platform_versions, field: :platform_version) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ecs_task_definition.rb b/libraries/aws_ecs_task_definition.rb index 279f08a43..8f7c778da 100644 --- a/libraries/aws_ecs_task_definition.rb +++ b/libraries/aws_ecs_task_definition.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSECSTaskDefinition < AwsResourceBase - name "aws_ecs_task_definition" - desc "Describes a task definition." + name 'aws_ecs_task_definition' + desc 'Describes a task definition.' example " describe aws_ecs_task_definition(task_definition: 'hello_world:8') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def task_definition - return nil unless exists? + return unless exists? @task_definition[:task_definition] end diff --git a/libraries/aws_ecs_task_definitions.rb b/libraries/aws_ecs_task_definitions.rb index a1b235ae9..3ba20ae7f 100644 --- a/libraries/aws_ecs_task_definitions.rb +++ b/libraries/aws_ecs_task_definitions.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSECSTaskDefinitions < AwsResourceBase - name "aws_ecs_task_definitions" - desc "Returns a list of task definitions that are registered to your account." + name 'aws_ecs_task_definitions' + desc 'Returns a list of task definitions that are registered to your account.' example " describe aws_ecs_task_definitions do @@ -13,8 +13,8 @@ class AWSECSTaskDefinitions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:task_definition_arns, field: :task_definition_arns) - .install_filter_methods_on_resource(self, :table) + .register_column(:task_definition_arns, field: :task_definition_arns) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_efs_file_system.rb b/libraries/aws_efs_file_system.rb index fb7b0df2f..fd2d652b7 100644 --- a/libraries/aws_efs_file_system.rb +++ b/libraries/aws_efs_file_system.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEfsFileSystem < AwsResourceBase - name "aws_efs_file_system" - desc "Verifies settings for an EFS File System." + name 'aws_efs_file_system' + desc 'Verifies settings for an EFS File System.' example " describe aws_efs_file_system('fs-12345678') do diff --git a/libraries/aws_efs_file_systems.rb b/libraries/aws_efs_file_systems.rb index ed4d7d317..a61603088 100644 --- a/libraries/aws_efs_file_systems.rb +++ b/libraries/aws_efs_file_systems.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEfsFileSystems < AwsResourceBase - name "aws_efs_file_systems" - desc "Verifies settings for a collection of AWS EFS File Systems." + name 'aws_efs_file_systems' + desc 'Verifies settings for a collection of AWS EFS File Systems.' example " describe aws_efs_file_systems do its('count') { should eq 3 } @@ -21,19 +21,19 @@ class AwsEfsFileSystems < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:tags, field: :tags) - .register_column(:file_system_ids, field: :file_system_id) - .register_column(:creation_tokens, field: :creation_token) - .register_column(:owner_ids, field: :owner_id) - .register_column(:creation_times, field: :creation_time) - .register_column(:performance_modes, field: :performance_mode) - .register_column(:encryption_status, field: :encrypted) - .register_column(:throughput_modes, field: :throughput_mode) - .register_column(:kms_key_ids, field: :kms_key_id) - .register_column(:size_in_bytes, field: :size_in_bytes) - .register_column(:life_cycle_states, field: :life_cycle_state) - .register_column(:names, field: :name) - .install_filter_methods_on_resource(self, :table) + .register_column(:tags, field: :tags) + .register_column(:file_system_ids, field: :file_system_id) + .register_column(:creation_tokens, field: :creation_token) + .register_column(:owner_ids, field: :owner_id) + .register_column(:creation_times, field: :creation_time) + .register_column(:performance_modes, field: :performance_mode) + .register_column(:encryption_status, field: :encrypted) + .register_column(:throughput_modes, field: :throughput_mode) + .register_column(:kms_key_ids, field: :kms_key_id) + .register_column(:size_in_bytes, field: :size_in_bytes) + .register_column(:life_cycle_states, field: :life_cycle_state) + .register_column(:names, field: :name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_efs_mount_target.rb b/libraries/aws_efs_mount_target.rb index 4cfe2d1bf..bf5863fcc 100644 --- a/libraries/aws_efs_mount_target.rb +++ b/libraries/aws_efs_mount_target.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEFSMountTarget < AwsResourceBase - name "aws_efs_mount_target" - desc "Returns the descriptions of all the current mount targets, or a specific mount target, for a file system. When requesting all of the current mount targets, the order of mount targets returned in the response is unspecified." + name 'aws_efs_mount_target' + desc 'Returns the descriptions of all the current mount targets, or a specific mount target, for a file system. When requesting all of the current mount targets, the order of mount targets returned in the response is unspecified.' example " describe aws_efs_mount_target(mount_target_id: 'test') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts = {}) end def mount_target_id - return nil unless exists? + return unless exists? @mount_targets[:mount_target_id] end diff --git a/libraries/aws_efs_mount_targets.rb b/libraries/aws_efs_mount_targets.rb index 06b2ea483..33a04e13a 100644 --- a/libraries/aws_efs_mount_targets.rb +++ b/libraries/aws_efs_mount_targets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEFSMountTargets < AwsResourceBase - name "aws_efs_mount_targets" - desc "Returns the descriptions of all the current mount targets, or a specific mount target, for a file system. When requesting all of the current mount targets, the order of mount targets returned in the response is unspecified." + name 'aws_efs_mount_targets' + desc 'Returns the descriptions of all the current mount targets, or a specific mount target, for a file system. When requesting all of the current mount targets, the order of mount targets returned in the response is unspecified.' example " describe aws_efs_mount_targets(file_system_id: 'fs-01234567') do @@ -13,17 +13,17 @@ class AWSEFSMountTargets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:owner_ids, field: :owner_id) - .register_column(:mount_target_ids, field: :mount_target_id) - .register_column(:file_system_ids, field: :file_system_id) - .register_column(:subnet_ids, field: :subnet_id) - .register_column(:life_cycle_states, field: :life_cycle_state) - .register_column(:ip_addresses, field: :ip_address) - .register_column(:network_interface_ids, field: :network_interface_id) - .register_column(:availability_zone_ids, field: :availability_zone_id) - .register_column(:availability_zone_names, field: :availability_zone_name) - .register_column(:vpc_ids, field: :vpc_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:owner_ids, field: :owner_id) + .register_column(:mount_target_ids, field: :mount_target_id) + .register_column(:file_system_ids, field: :file_system_id) + .register_column(:subnet_ids, field: :subnet_id) + .register_column(:life_cycle_states, field: :life_cycle_state) + .register_column(:ip_addresses, field: :ip_address) + .register_column(:network_interface_ids, field: :network_interface_id) + .register_column(:availability_zone_ids, field: :availability_zone_id) + .register_column(:availability_zone_names, field: :availability_zone_name) + .register_column(:vpc_ids, field: :vpc_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_eks_cluster.rb b/libraries/aws_eks_cluster.rb index 90c7c3bcd..c2da7eb82 100644 --- a/libraries/aws_eks_cluster.rb +++ b/libraries/aws_eks_cluster.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEksCluster < AwsResourceBase - name "aws_eks_cluster" - desc "Verifies settings for an EKS cluster." + name 'aws_eks_cluster' + desc 'Verifies settings for an EKS cluster.' example " describe aws_eks_cluster('cluster-name') do @@ -29,10 +29,10 @@ def initialize(opts = {}) @security_group_ids = @resp[:resources_vpc_config][:security_group_ids] @security_groups_count = @resp[:resources_vpc_config][:security_group_ids].length @vpc_id = @resp[:resources_vpc_config][:vpc_id] - @active = @resp[:status] == "ACTIVE" - @failed = @resp[:status] == "FAILED" - @creating = @resp[:status] == "CREATING" - @deleting = @resp[:status] == "DELETING" + @active = @resp[:status] == 'ACTIVE' + @failed = @resp[:status] == 'FAILED' + @creating = @resp[:status] == 'CREATING' + @deleting = @resp[:status] == 'DELETING' @enabled_logging_types = @resp.dig(:logging, :cluster_logging)&.select { |log| log[:enabled] }&.map { |type| type[:types] }&.flatten @disabled_logging_types= @resp.dig(:logging, :cluster_logging)&.reject { |log| log[:enabled] }&.map { |type| type[:types] }&.flatten @@ -44,7 +44,7 @@ def resource_id end def exists? - arn.start_with?("arn:") + arn.start_with?('arn:') end def to_s diff --git a/libraries/aws_eks_clusters.rb b/libraries/aws_eks_clusters.rb index 13125483f..b2074a1ec 100644 --- a/libraries/aws_eks_clusters.rb +++ b/libraries/aws_eks_clusters.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEksClusters < AwsCollectionResourceBase - name "aws_eks_clusters" - desc "Verifies settings for a collection AWS EKS Clusters." + name 'aws_eks_clusters' + desc 'Verifies settings for a collection AWS EKS Clusters.' example " describe aws_eks_clusters do it { should exist } @@ -54,10 +54,10 @@ def cluster_attributes_from(cluster_name) role_arn: cluster.role_arn, vpc_id: cluster.resources_vpc_config.vpc_id, security_groups_count: cluster.resources_vpc_config.security_group_ids.length, - creating: cluster.status == "CREATING", - active: cluster.status == "ACTIVE", - failed: cluster.status == "FAILED", - deleting: cluster.status == "DELETING", + creating: cluster.status == 'CREATING', + active: cluster.status == 'ACTIVE', + failed: cluster.status == 'FAILED', + deleting: cluster.status == 'DELETING', }) end end diff --git a/libraries/aws_elasticache_cluster.rb b/libraries/aws_elasticache_cluster.rb index 43754fe73..dcf056814 100644 --- a/libraries/aws_elasticache_cluster.rb +++ b/libraries/aws_elasticache_cluster.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsElastiCacheCluster < AwsResourceBase - name "aws_elasticache_cluster" - desc "Verifies settings for an AWS Elasticache Cluster." + name 'aws_elasticache_cluster' + desc 'Verifies settings for an AWS Elasticache Cluster.' example " describe aws_elasticache_cluster('my-cluster-001') do @@ -62,7 +62,7 @@ def node_ids end def ports - return unless status == "available" + return unless status == 'available' # This will return a hash with `node_id : port` pairs. @cache_cluster[:cache_nodes].map { |node| [node[:cache_node_id], node[:endpoint][:port]] }.to_h end diff --git a/libraries/aws_elasticache_cluster_node.rb b/libraries/aws_elasticache_cluster_node.rb index 6b7d53834..81c9e3e47 100644 --- a/libraries/aws_elasticache_cluster_node.rb +++ b/libraries/aws_elasticache_cluster_node.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsElastiCacheClusterNode < AwsResourceBase - name "aws_elasticache_cluster_node" - desc "Verifies settings for an AWS Elasticache Cluster Node." + name 'aws_elasticache_cluster_node' + desc 'Verifies settings for an AWS Elasticache Cluster Node.' example " describe aws_elasticache_cluster_node(cache_cluster_id: 'my-elasticache-cluster', node_id: '0001') do @@ -22,7 +22,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: cache_cluster_id must contain between 1 and 50 alphanumeric characters or hyphens, should start with a letter, and cannot end with a hyphen or contain two consecutive hyphens." end # node_id constraints: https://docs.aws.amazon.com/cli/latest/reference/elasticache/describe-cache-clusters.html - error_message = "node_id must be a string containing 4 digits." + error_message = 'node_id must be a string containing 4 digits.' raise ArgumentError, "#{@__resource_name__}: #{error_message}" unless opts[:node_id].is_a?(String) unless /^[\d]{4}$/.match?(opts[:node_id]) raise ArgumentError, "#{@__resource_name__}: #{error_message}" diff --git a/libraries/aws_elasticache_clusters.rb b/libraries/aws_elasticache_clusters.rb index 2d4589c7f..51001166e 100644 --- a/libraries/aws_elasticache_clusters.rb +++ b/libraries/aws_elasticache_clusters.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsElastiCacheClusters < AwsResourceBase - name "aws_elasticache_clusters" - desc "Verifies settings for a collection of AWS Elasticache Clusters." + name 'aws_elasticache_clusters' + desc 'Verifies settings for a collection of AWS Elasticache Clusters.' example " describe aws_elasticache_clusters do its('count') { should eq 3 } @@ -20,15 +20,15 @@ class AwsElastiCacheClusters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:node_types, field: :node_type) - .register_column(:engines, field: :engine) - .register_column(:status, field: :status) - .register_column(:zones, field: :zone) - .register_column(:subnet_group_names, field: :subnet_group_name) - .register_column(:encrypted_at_rest, field: :encrypted_at_rest) - .register_column(:encrypted_at_transit, field: :encrypted_at_transit) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:node_types, field: :node_type) + .register_column(:engines, field: :engine) + .register_column(:status, field: :status) + .register_column(:zones, field: :zone) + .register_column(:subnet_group_names, field: :subnet_group_name) + .register_column(:encrypted_at_rest, field: :encrypted_at_rest) + .register_column(:encrypted_at_transit, field: :encrypted_at_transit) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_elasticache_replication_group.rb b/libraries/aws_elasticache_replication_group.rb index 706c6aa1c..ff0a96d8c 100644 --- a/libraries/aws_elasticache_replication_group.rb +++ b/libraries/aws_elasticache_replication_group.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsElastiCacheReplicationGroup < AwsResourceBase - name "aws_elasticache_replication_group" - desc "Verifies settings for an AWS Elasticache Replication Group" + name 'aws_elasticache_replication_group' + desc 'Verifies settings for an AWS Elasticache Replication Group' example " describe aws_elasticache_replication_group('my-replication_group-001') do diff --git a/libraries/aws_elasticache_replication_groups.rb b/libraries/aws_elasticache_replication_groups.rb index ff468f604..09787f0e4 100644 --- a/libraries/aws_elasticache_replication_groups.rb +++ b/libraries/aws_elasticache_replication_groups.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsElastiCacheReplicationGroups < AwsResourceBase - name "aws_elasticache_replication_groups" - desc "Verifies settings for a collection of AWS Replication Groups" + name 'aws_elasticache_replication_groups' + desc 'Verifies settings for a collection of AWS Replication Groups' example " describe aws_elasticache_replication_groups do its('count') { should eq 3 } @@ -20,12 +20,12 @@ class AwsElastiCacheReplicationGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:node_types, field: :node_type) - .register_column(:status, field: :status) - .register_column(:encrypted_at_rest, field: :encrypted_at_rest) - .register_column(:encrypted_at_transit, field: :encrypted_at_transit) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:node_types, field: :node_type) + .register_column(:status, field: :status) + .register_column(:encrypted_at_rest, field: :encrypted_at_rest) + .register_column(:encrypted_at_transit, field: :encrypted_at_transit) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_elasticloadbalancingv2_listener.rb b/libraries/aws_elasticloadbalancingv2_listener.rb index 8dc6df01c..676da7180 100644 --- a/libraries/aws_elasticloadbalancingv2_listener.rb +++ b/libraries/aws_elasticloadbalancingv2_listener.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSElasticLoadBalancingV2Listener < AwsResourceBase - name "aws_elasticloadbalancingv2_listener" - desc "Returns information about the endpoints for your account in the current region." + name 'aws_elasticloadbalancingv2_listener' + desc 'Returns information about the endpoints for your account in the current region.' example " describe aws_elasticloadbalancingv2_listener(listener_arn: 'test') do @@ -23,7 +23,7 @@ def initialize(opts = {}) end def listener_arn - return nil unless exists? + return unless exists? @listeners[:listener_arns] end diff --git a/libraries/aws_elasticloadbalancingv2_listener_certificate.rb b/libraries/aws_elasticloadbalancingv2_listener_certificate.rb index 9e569105b..860cb5afb 100644 --- a/libraries/aws_elasticloadbalancingv2_listener_certificate.rb +++ b/libraries/aws_elasticloadbalancingv2_listener_certificate.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSElasticLoadBalancingV2ListenerCertificate < AwsResourceBase - name "aws_elasticloadbalancingv2_listener_certificate" - desc "Describes the default certificate and the certificate list for the specified HTTPS or TLS listener" + name 'aws_elasticloadbalancingv2_listener_certificate' + desc 'Describes the default certificate and the certificate list for the specified HTTPS or TLS listener' example " describe aws_elasticloadbalancingv2_listener_certificate(listener_arn: 'test') do @@ -23,7 +23,7 @@ def initialize(opts = {}) end def listener_arn - return nil unless exists? + return unless exists? @listeners[:listener_arn] end diff --git a/libraries/aws_elasticloadbalancingv2_listener_certificates.rb b/libraries/aws_elasticloadbalancingv2_listener_certificates.rb index 3b3544086..5547e5c60 100644 --- a/libraries/aws_elasticloadbalancingv2_listener_certificates.rb +++ b/libraries/aws_elasticloadbalancingv2_listener_certificates.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSElasticLoadBalancingV2ListenerCertificates < AwsResourceBase - name "aws_elasticloadbalancingv2_listener_certificates" - desc "Describes the default certificate and the certificate list for the specified HTTPS or TLS listener" + name 'aws_elasticloadbalancingv2_listener_certificates' + desc 'Describes the default certificate and the certificate list for the specified HTTPS or TLS listener' example " describe aws_elasticloadbalancingv2_listener_certificates(listener_arn: 'test1') do @@ -16,9 +16,9 @@ class AWSElasticLoadBalancingV2ListenerCertificates < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:certificate_arns, field: :certificate_arn) - .register_column(:is_defaults, field: :is_default) - .install_filter_methods_on_resource(self, :table) + .register_column(:certificate_arns, field: :certificate_arn) + .register_column(:is_defaults, field: :is_default) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_elasticloadbalancingv2_listener_rule.rb b/libraries/aws_elasticloadbalancingv2_listener_rule.rb index c4bae49a9..86d5d295a 100644 --- a/libraries/aws_elasticloadbalancingv2_listener_rule.rb +++ b/libraries/aws_elasticloadbalancingv2_listener_rule.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSElasticLoadBalancingV2ListenerRule < AwsResourceBase - name "aws_elasticloadbalancingv2_listener_rule" - desc "Describes the specified rules or the rules for the specified listener. You must specify either a listener or one or more rules." + name 'aws_elasticloadbalancingv2_listener_rule' + desc 'Describes the specified rules or the rules for the specified listener. You must specify either a listener or one or more rules.' example " describe aws_elasticloadbalancingv2_listener_rule(rule_arn: 'test') do @@ -23,7 +23,7 @@ def initialize(opts = {}) end def listener_arns - return nil unless exists? + return unless exists? @listeners[:listener_arns] end diff --git a/libraries/aws_elasticloadbalancingv2_listener_rules.rb b/libraries/aws_elasticloadbalancingv2_listener_rules.rb index e14be8f50..73d1d14b1 100644 --- a/libraries/aws_elasticloadbalancingv2_listener_rules.rb +++ b/libraries/aws_elasticloadbalancingv2_listener_rules.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSElasticLoadBalancingV2ListenerRules < AwsResourceBase - name "aws_elasticloadbalancingv2_listener_rules" - desc "Describes the specified rules or the rules for the specified listener. You must specify either a listener or one or more rules." + name 'aws_elasticloadbalancingv2_listener_rules' + desc 'Describes the specified rules or the rules for the specified listener. You must specify either a listener or one or more rules.' example " describe aws_elasticloadbalancingv2_listener_rules(listener_arn: 'test1') do @@ -12,12 +12,12 @@ class AWSElasticLoadBalancingV2ListenerRules < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:rule_arns, field: :rule_arn) - .register_column(:priorities, field: :priority) - .register_column(:conditions, field: :conditions) - .register_column(:actions, field: :actions) - .register_column(:is_defaults, field: :is_default) - .install_filter_methods_on_resource(self, :table) + .register_column(:rule_arns, field: :rule_arn) + .register_column(:priorities, field: :priority) + .register_column(:conditions, field: :conditions) + .register_column(:actions, field: :actions) + .register_column(:is_defaults, field: :is_default) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_elasticloadbalancingv2_listeners.rb b/libraries/aws_elasticloadbalancingv2_listeners.rb index 4d50f3c35..f26de9173 100644 --- a/libraries/aws_elasticloadbalancingv2_listeners.rb +++ b/libraries/aws_elasticloadbalancingv2_listeners.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSElasticLoadBalancingV2Listeners < AwsResourceBase - name "aws_elasticloadbalancingv2_listeners" - desc "Lists the clients that have been created for the specified user pool." + name 'aws_elasticloadbalancingv2_listeners' + desc 'Lists the clients that have been created for the specified user pool.' example " describe aws_elasticloadbalancingv2_listeners(load_balancer_arn: 'test1') do @@ -12,15 +12,15 @@ class AWSElasticLoadBalancingV2Listeners < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:listener_arns, field: :listener_arn) - .register_column(:load_balancer_arns, field: :load_balancer_arn) - .register_column(:ports, field: :port) - .register_column(:protocols, field: :protocol) - .register_column(:certificates, field: :certificates) - .register_column(:ssl_policies, field: :ssl_policy) - .register_column(:default_actions, field: :default_actions) - .register_column(:alpn_policies, field: :alpn_policy) - .install_filter_methods_on_resource(self, :table) + .register_column(:listener_arns, field: :listener_arn) + .register_column(:load_balancer_arns, field: :load_balancer_arn) + .register_column(:ports, field: :port) + .register_column(:protocols, field: :protocol) + .register_column(:certificates, field: :certificates) + .register_column(:ssl_policies, field: :ssl_policy) + .register_column(:default_actions, field: :default_actions) + .register_column(:alpn_policies, field: :alpn_policy) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_elasticloadbalancingv2_target_group.rb b/libraries/aws_elasticloadbalancingv2_target_group.rb index 1a7d1780d..b42a0152b 100644 --- a/libraries/aws_elasticloadbalancingv2_target_group.rb +++ b/libraries/aws_elasticloadbalancingv2_target_group.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSElasticLoadBalancingV2TargetGroup < AwsResourceBase - name "aws_elasticloadbalancingv2_target_group" - desc "Describes the specified target groups or all of your target groups. By default, all target groups are described. Alternatively, you can specify one of the following to filter the results: the ARN of the load balancer, the names of one or more target groups, or the ARNs of one or more target groups." + name 'aws_elasticloadbalancingv2_target_group' + desc 'Describes the specified target groups or all of your target groups. By default, all target groups are described. Alternatively, you can specify one of the following to filter the results: the ARN of the load balancer, the names of one or more target groups, or the ARNs of one or more target groups.' example " describe aws_elasticloadbalancingv2_target_group(target_group_arn: 'test-arn') do @@ -23,7 +23,7 @@ def initialize(opts = {}) end def target_group_arn - return nil unless exists? + return unless exists? @target_groups[:target_group_arn] end diff --git a/libraries/aws_elasticloadbalancingv2_target_groups.rb b/libraries/aws_elasticloadbalancingv2_target_groups.rb index 4b8649362..3bc5d22dc 100644 --- a/libraries/aws_elasticloadbalancingv2_target_groups.rb +++ b/libraries/aws_elasticloadbalancingv2_target_groups.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSElasticLoadBalancingV2TargetGroups < AwsResourceBase - name "aws_elasticloadbalancingv2_target_groups" - desc "Describes the specified target groups or all of your target groups. By default, all target groups are described. Alternatively, you can specify one of the following to filter the results: the ARN of the load balancer, the names of one or more target groups, or the ARNs of one or more target groups." + name 'aws_elasticloadbalancingv2_target_groups' + desc 'Describes the specified target groups or all of your target groups. By default, all target groups are described. Alternatively, you can specify one of the following to filter the results: the ARN of the load balancer, the names of one or more target groups, or the ARNs of one or more target groups.' example " describe aws_elasticloadbalancingv2_target_groups do @@ -12,24 +12,24 @@ class AWSElasticLoadBalancingV2TargetGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:target_group_arns, field: :target_group_arn) - .register_column(:target_group_names, field: :target_group_name) - .register_column(:protocols, field: :protocol) - .register_column(:ports, field: :port) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:health_check_protocols, field: :health_check_protocol) - .register_column(:health_check_ports, field: :health_check_port) - .register_column(:health_check_enableds, field: :health_check_enabled) - .register_column(:health_check_interval_seconds, field: :health_check_interval_seconds) - .register_column(:health_check_timeout_seconds, field: :health_check_timeout_seconds) - .register_column(:healthy_threshold_counts, field: :healthy_threshold_count) - .register_column(:unhealthy_threshold_counts, field: :unhealthy_threshold_count) - .register_column(:health_check_paths, field: :health_check_path) - .register_column(:matchers, field: :matcher) - .register_column(:load_balancer_arns, field: :load_balancer_arns) - .register_column(:target_types, field: :target_type) - .register_column(:protocol_versions, field: :protocol_version) - .install_filter_methods_on_resource(self, :table) + .register_column(:target_group_arns, field: :target_group_arn) + .register_column(:target_group_names, field: :target_group_name) + .register_column(:protocols, field: :protocol) + .register_column(:ports, field: :port) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:health_check_protocols, field: :health_check_protocol) + .register_column(:health_check_ports, field: :health_check_port) + .register_column(:health_check_enableds, field: :health_check_enabled) + .register_column(:health_check_interval_seconds, field: :health_check_interval_seconds) + .register_column(:health_check_timeout_seconds, field: :health_check_timeout_seconds) + .register_column(:healthy_threshold_counts, field: :healthy_threshold_count) + .register_column(:unhealthy_threshold_counts, field: :unhealthy_threshold_count) + .register_column(:health_check_paths, field: :health_check_path) + .register_column(:matchers, field: :matcher) + .register_column(:load_balancer_arns, field: :load_balancer_arns) + .register_column(:target_types, field: :target_type) + .register_column(:protocol_versions, field: :protocol_version) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_elasticsearchservice_domain.rb b/libraries/aws_elasticsearchservice_domain.rb index ff3fcfded..5877a41cf 100644 --- a/libraries/aws_elasticsearchservice_domain.rb +++ b/libraries/aws_elasticsearchservice_domain.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSElasticSearchServiceDomain < AwsResourceBase - name "aws_elasticsearchservice_domain" - desc "Returns domain configuration information about the specified Elasticsearch domain, including the domain ID, domain endpoint, and domain ARN." + name 'aws_elasticsearchservice_domain' + desc 'Returns domain configuration information about the specified Elasticsearch domain, including the domain ID, domain endpoint, and domain ARN.' example " describe aws_elasticsearchservice_domain(domain_name: 'DomainName') do @@ -24,12 +24,12 @@ def initialize(opts = {}) end def domain_name - return nil unless exists? + return unless exists? @domain_status[:domain_name] end def resource_id - @domain_status? @domain_status[:domain_id]: "" + @domain_status? @domain_status[:domain_id]: '' end def exists? diff --git a/libraries/aws_elasticsearchservice_domains.rb b/libraries/aws_elasticsearchservice_domains.rb index 3784e3add..d63c4bb3a 100644 --- a/libraries/aws_elasticsearchservice_domains.rb +++ b/libraries/aws_elasticsearchservice_domains.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSElasticSearchServiceDomains < AwsResourceBase - name "aws_elasticsearchservice_domains" - desc "Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users." + name 'aws_elasticsearchservice_domains' + desc 'Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users.' example " describe aws_elasticsearchservice_domains do @@ -13,8 +13,8 @@ class AWSElasticSearchServiceDomains < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:domain_names, field: :domain_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:domain_names, field: :domain_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_elb.rb b/libraries/aws_elb.rb index 0af0d3edf..8b9afd62f 100644 --- a/libraries/aws_elb.rb +++ b/libraries/aws_elb.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsElb < AwsResourceBase - name "aws_elb" - desc "Verifies settings for an Elastic Load Balancer." + name 'aws_elb' + desc 'Verifies settings for an Elastic Load Balancer.' example " describe aws_elb('load-balancer-1') do @@ -51,12 +51,12 @@ def access_log_enabled? def ssl_policies @ssl_policies ||= catch_aws_errors do elb_client.describe_load_balancer_policies(load_balancer_name: opts[:load_balancer_name]) - .policy_descriptions.select { |p| policies_in_use.include?(p.policy_name) } + .policy_descriptions.select { |p| policies_in_use.include?(p.policy_name) } end end def resource_id - @load_balancer_description? "#{@load_balancer_name}_#{@load_balancer_description[:availability_zones]}" : "" + @load_balancer_description? "#{@load_balancer_name}_#{@load_balancer_description[:availability_zones]}" : '' end private diff --git a/libraries/aws_elbs.rb b/libraries/aws_elbs.rb index ea07f33b9..ec06f5c39 100644 --- a/libraries/aws_elbs.rb +++ b/libraries/aws_elbs.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsElbs < AwsResourceBase - name "aws_elbs" - desc "Verifies settings for a collection AWS Elastic Load Balancers." + name 'aws_elbs' + desc 'Verifies settings for a collection AWS Elastic Load Balancers.' example " describe aws_elbs do it { should exist } @@ -12,16 +12,16 @@ class AwsElbs < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:availability_zones, field: :availability_zones) - .register_column(:dns_names, field: :dns_name) - .register_column(:load_balancer_names, field: :load_balancer_name) - .register_column(:external_ports, field: :external_ports) - .register_column(:instance_ids, field: :instance_ids) - .register_column(:internal_ports, field: :internal_ports) - .register_column(:security_group_ids, field: :security_group_ids) - .register_column(:subnet_ids, field: :subnet_ids) - .register_column(:vpc_ids, field: :vpc_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:availability_zones, field: :availability_zones) + .register_column(:dns_names, field: :dns_name) + .register_column(:load_balancer_names, field: :load_balancer_name) + .register_column(:external_ports, field: :external_ports) + .register_column(:instance_ids, field: :instance_ids) + .register_column(:internal_ports, field: :internal_ports) + .register_column(:security_group_ids, field: :security_group_ids) + .register_column(:subnet_ids, field: :subnet_ids) + .register_column(:vpc_ids, field: :vpc_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_emr_cluster.rb b/libraries/aws_emr_cluster.rb index b8dc38452..9f4e201f3 100644 --- a/libraries/aws_emr_cluster.rb +++ b/libraries/aws_emr_cluster.rb @@ -1,9 +1,9 @@ -require "aws_backend" -require "json" +require 'aws_backend' +require 'json' class AwsEmrCluster < AwsResourceBase - name "aws_emr_cluster" - desc "Verifies settings for an EMR cluster." + name 'aws_emr_cluster' + desc 'Verifies settings for an EMR cluster.' example " describe aws_emr_cluster('CLUSTER_ID') do @@ -75,11 +75,11 @@ def exists? end def running? - !@status_state.nil? && @status_state == "RUNNING" + !@status_state.nil? && @status_state == 'RUNNING' end def waiting? - !@status_state.nil? && @status_state == "WAITING" + !@status_state.nil? && @status_state == 'WAITING' end def resource_id diff --git a/libraries/aws_emr_clusters.rb b/libraries/aws_emr_clusters.rb index 17ac1d4fd..b5a8ecab6 100644 --- a/libraries/aws_emr_clusters.rb +++ b/libraries/aws_emr_clusters.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsEmrClusters < AwsResourceBase - name "aws_emr_clusters" - desc "Verifies settings for a collection of AWS EMR Clusters." + name 'aws_emr_clusters' + desc 'Verifies settings for a collection of AWS EMR Clusters.' example " describe aws_emr_clusters do it { should exist } @@ -11,25 +11,25 @@ class AwsEmrClusters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:cluster_ids, field: :cluster_id) - .register_column(:cluster_names, field: :cluster_name) - .register_column(:cluster_arns, field: :cluster_arn) - .register_column(:application_names, field: :application_names, style: :simple) # TODO: to be tested - .register_column(:status_states, field: :status_state) - .register_column(:auto_scaling_roles, field: :auto_scaling_role) - .register_column(:custom_ami_ids, field: :custom_ami_id) - .register_column(:ebs_root_volume_sizes, field: :ebs_root_volume_size) - .register_column(:kerberos_attributes_realms, field: :kerberos_attributes_realm) - .register_column(:kerberos_attributes_realm_ad_domain_join_users, field: :kerberos_attributes_realm_ad_domain_join_user) - .register_column(:log_encryption_kms_key_ids, field: :log_encryption_kms_key_id) - .register_column(:log_uris, field: :log_uri) - .register_column(:release_labels, field: :release_label) - .register_column(:scale_down_behaviors, field: :scale_down_behavior) - .register_column(:service_roles, field: :service_role) - .register_column(:step_concurrency_levels, field: :step_concurrency_level) - .register_column(:visible_to_all_users, field: :visible_to_all_users) - .register_column(:security_configuration_names, field: :security_configuration_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:cluster_ids, field: :cluster_id) + .register_column(:cluster_names, field: :cluster_name) + .register_column(:cluster_arns, field: :cluster_arn) + .register_column(:application_names, field: :application_names, style: :simple) # TODO: to be tested + .register_column(:status_states, field: :status_state) + .register_column(:auto_scaling_roles, field: :auto_scaling_role) + .register_column(:custom_ami_ids, field: :custom_ami_id) + .register_column(:ebs_root_volume_sizes, field: :ebs_root_volume_size) + .register_column(:kerberos_attributes_realms, field: :kerberos_attributes_realm) + .register_column(:kerberos_attributes_realm_ad_domain_join_users, field: :kerberos_attributes_realm_ad_domain_join_user) + .register_column(:log_encryption_kms_key_ids, field: :log_encryption_kms_key_id) + .register_column(:log_uris, field: :log_uri) + .register_column(:release_labels, field: :release_label) + .register_column(:scale_down_behaviors, field: :scale_down_behavior) + .register_column(:service_roles, field: :service_role) + .register_column(:step_concurrency_levels, field: :step_concurrency_level) + .register_column(:visible_to_all_users, field: :visible_to_all_users) + .register_column(:security_configuration_names, field: :security_configuration_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_emr_security_configuration.rb b/libraries/aws_emr_security_configuration.rb index b52396d48..2c9f9b60b 100644 --- a/libraries/aws_emr_security_configuration.rb +++ b/libraries/aws_emr_security_configuration.rb @@ -1,9 +1,9 @@ -require "aws_backend" -require "json" +require 'aws_backend' +require 'json' class AwsEmrClusterSecurityConfiguration < AwsResourceBase - name "aws_emr_security_configuration" - desc "Verifies security configuration for an EMR cluster." + name 'aws_emr_security_configuration' + desc 'Verifies security configuration for an EMR cluster.' example " describe aws_emr_security_configuration('SECURITY_CONFIGURATION_NAME') do @@ -28,11 +28,11 @@ def initialize(opts = {}) json_security_configuration = resp.security_configuration return if json_security_configuration.nil? || json_security_configuration.empty? parsed_json = JSON.parse(json_security_configuration) - @encryption_at_rest = !parsed_json["EncryptionConfiguration"]["EnableAtRestEncryption"].nil? && parsed_json["EncryptionConfiguration"]["EnableAtRestEncryption"] - @encryption_in_transit = !parsed_json["EncryptionConfiguration"]["EnableInTransitEncryption"].nil? && parsed_json["EncryptionConfiguration"]["EnableInTransitEncryption"] - @local_disk_encryption = !parsed_json["EncryptionConfiguration"]["AtRestEncryptionConfiguration"].nil? && - !parsed_json["EncryptionConfiguration"]["AtRestEncryptionConfiguration"]["LocalDiskEncryptionConfiguration"].nil? && - !parsed_json["EncryptionConfiguration"]["AtRestEncryptionConfiguration"]["LocalDiskEncryptionConfiguration"].empty? + @encryption_at_rest = !parsed_json['EncryptionConfiguration']['EnableAtRestEncryption'].nil? && parsed_json['EncryptionConfiguration']['EnableAtRestEncryption'] + @encryption_in_transit = !parsed_json['EncryptionConfiguration']['EnableInTransitEncryption'].nil? && parsed_json['EncryptionConfiguration']['EnableInTransitEncryption'] + @local_disk_encryption = !parsed_json['EncryptionConfiguration']['AtRestEncryptionConfiguration'].nil? && + !parsed_json['EncryptionConfiguration']['AtRestEncryptionConfiguration']['LocalDiskEncryptionConfiguration'].nil? && + !parsed_json['EncryptionConfiguration']['AtRestEncryptionConfiguration']['LocalDiskEncryptionConfiguration'].empty? end end diff --git a/libraries/aws_emr_security_configurations.rb b/libraries/aws_emr_security_configurations.rb index 26efdc7a8..6e9e36064 100644 --- a/libraries/aws_emr_security_configurations.rb +++ b/libraries/aws_emr_security_configurations.rb @@ -1,9 +1,9 @@ -require "aws_backend" -require "json" +require 'aws_backend' +require 'json' class AwsEmrClusterSecurityConfigurations < AwsResourceBase - name "aws_emr_security_configurations" - desc "Verifies collection of security configuration for an EMR cluster." + name 'aws_emr_security_configurations' + desc 'Verifies collection of security configuration for an EMR cluster.' example " describe aws_emr_security_configurations do it { should exist } @@ -12,11 +12,11 @@ class AwsEmrClusterSecurityConfigurations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:security_configuration_names, field: :security_configuration_name) - .register_column(:encryption_at_rests, field: :encryption_at_rest) - .register_column(:encryption_in_transits, field: :encryption_in_transit) - .register_column(:local_disk_encryptions, field: :local_disk_encryption) - .install_filter_methods_on_resource(self, :table) + .register_column(:security_configuration_names, field: :security_configuration_name) + .register_column(:encryption_at_rests, field: :encryption_at_rest) + .register_column(:encryption_in_transits, field: :encryption_in_transit) + .register_column(:local_disk_encryptions, field: :local_disk_encryption) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -37,11 +37,11 @@ def fetch_data resp_security_configurations.security_configurations.each do |s| resp_security_configuration = @aws.emr_client.describe_security_configuration({ name: s.name }) parsed_json = JSON.parse(resp_security_configuration.security_configuration) - encryption_at_rest = !parsed_json["EncryptionConfiguration"]["EnableAtRestEncryption"].nil? && parsed_json["EncryptionConfiguration"]["EnableAtRestEncryption"] - encryption_in_transit = !parsed_json["EncryptionConfiguration"]["EnableInTransitEncryption"].nil? && parsed_json["EncryptionConfiguration"]["EnableInTransitEncryption"] - local_disk_encryption = !parsed_json["EncryptionConfiguration"]["AtRestEncryptionConfiguration"].nil? && - !parsed_json["EncryptionConfiguration"]["AtRestEncryptionConfiguration"]["LocalDiskEncryptionConfiguration"].nil? && - !parsed_json["EncryptionConfiguration"]["AtRestEncryptionConfiguration"]["LocalDiskEncryptionConfiguration"].empty? + encryption_at_rest = !parsed_json['EncryptionConfiguration']['EnableAtRestEncryption'].nil? && parsed_json['EncryptionConfiguration']['EnableAtRestEncryption'] + encryption_in_transit = !parsed_json['EncryptionConfiguration']['EnableInTransitEncryption'].nil? && parsed_json['EncryptionConfiguration']['EnableInTransitEncryption'] + local_disk_encryption = !parsed_json['EncryptionConfiguration']['AtRestEncryptionConfiguration'].nil? && + !parsed_json['EncryptionConfiguration']['AtRestEncryptionConfiguration']['LocalDiskEncryptionConfiguration'].nil? && + !parsed_json['EncryptionConfiguration']['AtRestEncryptionConfiguration']['LocalDiskEncryptionConfiguration'].empty? security_configuration_rows += [{ security_configuration_name: s.name, encryption_at_rest: encryption_at_rest, diff --git a/libraries/aws_eventbridge_rule.rb b/libraries/aws_eventbridge_rule.rb index 693147e64..bc9d3ac80 100644 --- a/libraries/aws_eventbridge_rule.rb +++ b/libraries/aws_eventbridge_rule.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEventBridgeRule < AwsResourceBase - name "aws_eventbridge_rule" - desc "Describes the specified rule." + name 'aws_eventbridge_rule' + desc 'Describes the specified rule.' example " describe aws_eventbridge_rule(name: 'test_rule') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def name - return nil unless exists? + return unless exists? @res[:name] end diff --git a/libraries/aws_eventbridge_rules.rb b/libraries/aws_eventbridge_rules.rb index f9abc8e1e..8901449df 100644 --- a/libraries/aws_eventbridge_rules.rb +++ b/libraries/aws_eventbridge_rules.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSEventBridgeRules < AwsResourceBase - name "aws_eventbridge_rules" - desc "Lists your Amazon EventBridge rules." + name 'aws_eventbridge_rules' + desc 'Lists your Amazon EventBridge rules.' example " describe aws_eventbridge_rules do @@ -13,16 +13,16 @@ class AWSEventBridgeRules < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:arns, field: :arn) - .register_column(:event_patterns, field: :event_pattern) - .register_column(:states, field: :state) - .register_column(:descriptions, field: :description) - .register_column(:schedule_expressions, field: :schedule_expression) - .register_column(:role_arns, field: :role_arn) - .register_column(:managed_bys, field: :managed_by) - .register_column(:event_bus_names, field: :event_bus_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:arns, field: :arn) + .register_column(:event_patterns, field: :event_pattern) + .register_column(:states, field: :state) + .register_column(:descriptions, field: :description) + .register_column(:schedule_expressions, field: :schedule_expression) + .register_column(:role_arns, field: :role_arn) + .register_column(:managed_bys, field: :managed_by) + .register_column(:event_bus_names, field: :event_bus_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_flow_log.rb b/libraries/aws_flow_log.rb index 62fa2d60f..49c44286d 100644 --- a/libraries/aws_flow_log.rb +++ b/libraries/aws_flow_log.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsFlowLog < AwsResourceBase - name "aws_flow_log" - desc "Verifies settings for an AWS VPC flow logs." + name 'aws_flow_log' + desc 'Verifies settings for an AWS VPC flow logs.' example " describe aws_flow_log('fl-9c718cf5') do @@ -16,9 +16,9 @@ def initialize(opts = {}) super(opts) validate_parameters(require_any_of: %i(flow_log_id subnet_id vpc_id)) - query = { filter: [{ name: "flow-log-id", values: [opts[:flow_log_id]] }] } if opts[:flow_log_id] - query = { filter: [{ name: "resource-id", values: [opts[:subnet_id]] }] } if opts[:subnet_id] - query = { filter: [{ name: "resource-id", values: [opts[:vpc_id]] }] } if opts[:vpc_id] + query = { filter: [{ name: 'flow-log-id', values: [opts[:flow_log_id]] }] } if opts[:flow_log_id] + query = { filter: [{ name: 'resource-id', values: [opts[:subnet_id]] }] } if opts[:subnet_id] + query = { filter: [{ name: 'resource-id', values: [opts[:vpc_id]] }] } if opts[:vpc_id] catch_aws_errors do resp = @aws.compute_client.describe_flow_logs(query) @@ -35,24 +35,24 @@ def initialize(opts = {}) def resource_type case @resource_id when /^eni/ - @resource_type = "eni" + @resource_type = 'eni' when /^subnet/ - @resource_type = "subnet" + @resource_type = 'subnet' when /^vpc/ - @resource_type = "vpc" + @resource_type = 'vpc' end end def attached_to_eni? - resource_type.eql?("eni") + resource_type.eql?('eni') end def attached_to_subnet? - resource_type.eql?("subnet") + resource_type.eql?('subnet') end def attached_to_vpc? - resource_type.eql?("vpc") + resource_type.eql?('vpc') end def exists? diff --git a/libraries/aws_glue_crawler.rb b/libraries/aws_glue_crawler.rb index 2fac8adee..f5b1b3433 100644 --- a/libraries/aws_glue_crawler.rb +++ b/libraries/aws_glue_crawler.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSGlueCrawler < AwsResourceBase - name "aws_glue_crawler" - desc "Retrieves metadata for a crawler defined in the customer account." + name 'aws_glue_crawler' + desc 'Retrieves metadata for a crawler defined in the customer account.' example " describe aws_glue_crawler(name: 'crawler_name') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def name - return nil unless exists? + return unless exists? @res[:name] end diff --git a/libraries/aws_glue_crawlers.rb b/libraries/aws_glue_crawlers.rb index 3d60ee7aa..b47ed559e 100644 --- a/libraries/aws_glue_crawlers.rb +++ b/libraries/aws_glue_crawlers.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSGlueCrawlers < AwsResourceBase - name "aws_glue_crawlers" - desc "Retrieves metadata for all crawlers defined in the customer account." + name 'aws_glue_crawlers' + desc 'Retrieves metadata for all crawlers defined in the customer account.' example " describe aws_glue_crawlers do @@ -13,25 +13,25 @@ class AWSGlueCrawlers < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:roles, field: :role) - .register_column(:targets, field: :targets) - .register_column(:database_names, field: :database_name) - .register_column(:descriptions, field: :description) - .register_column(:classifiers, field: :classifiers) - .register_column(:recrawl_policies, field: :recrawl_policy) - .register_column(:schema_change_policies, field: :schema_change_policy) - .register_column(:states, field: :state) - .register_column(:table_prefixes, field: :table_prefix) - .register_column(:schedules, field: :schedule) - .register_column(:crawl_elapsed_times, field: :crawl_elapsed_time) - .register_column(:creation_times, field: :creation_time) - .register_column(:last_updated, field: :last_updated) - .register_column(:last_crawls, field: :last_crawl) - .register_column(:versions, field: :version) - .register_column(:configurations, field: :configuration) - .register_column(:crawler_security_configuration, field: :crawler_security_configuration) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:roles, field: :role) + .register_column(:targets, field: :targets) + .register_column(:database_names, field: :database_name) + .register_column(:descriptions, field: :description) + .register_column(:classifiers, field: :classifiers) + .register_column(:recrawl_policies, field: :recrawl_policy) + .register_column(:schema_change_policies, field: :schema_change_policy) + .register_column(:states, field: :state) + .register_column(:table_prefixes, field: :table_prefix) + .register_column(:schedules, field: :schedule) + .register_column(:crawl_elapsed_times, field: :crawl_elapsed_time) + .register_column(:creation_times, field: :creation_time) + .register_column(:last_updated, field: :last_updated) + .register_column(:last_crawls, field: :last_crawl) + .register_column(:versions, field: :version) + .register_column(:configurations, field: :configuration) + .register_column(:crawler_security_configuration, field: :crawler_security_configuration) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_glue_database.rb b/libraries/aws_glue_database.rb index 6f9077bd4..66e0eb550 100644 --- a/libraries/aws_glue_database.rb +++ b/libraries/aws_glue_database.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSGlueDatabase < AwsResourceBase - name "aws_glue_database" - desc "Retrieves the definition of a specified database." + name 'aws_glue_database' + desc 'Retrieves the definition of a specified database.' example " describe aws_glue_database(name: 'db_name') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def name - return nil unless exists? + return unless exists? @res[:name] end diff --git a/libraries/aws_glue_databases.rb b/libraries/aws_glue_databases.rb index f82ab8b88..36258474f 100644 --- a/libraries/aws_glue_databases.rb +++ b/libraries/aws_glue_databases.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSGlueDatabases < AwsResourceBase - name "aws_glue_databases" - desc "Retrieves all databases defined in a given Data Catalog." + name 'aws_glue_databases' + desc 'Retrieves all databases defined in a given Data Catalog.' example " describe aws_glue_databases do @@ -13,15 +13,15 @@ class AWSGlueDatabases < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:descriptions, field: :description) - .register_column(:location_uris, field: :location_uri) - .register_column(:parameters, field: :parameters) - .register_column(:create_times, field: :create_time) - .register_column(:create_table_default_permissions, field: :create_table_default_permissions) - .register_column(:target_databases, field: :target_database) - .register_column(:catalog_ids, field: :catalog_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:descriptions, field: :description) + .register_column(:location_uris, field: :location_uri) + .register_column(:parameters, field: :parameters) + .register_column(:create_times, field: :create_time) + .register_column(:create_table_default_permissions, field: :create_table_default_permissions) + .register_column(:target_databases, field: :target_database) + .register_column(:catalog_ids, field: :catalog_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_guardduty_detector.rb b/libraries/aws_guardduty_detector.rb index bf8b558b9..afaff5c0d 100644 --- a/libraries/aws_guardduty_detector.rb +++ b/libraries/aws_guardduty_detector.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsGuardDutyDetector < AwsResourceBase - name "aws_guardduty_detector" - desc "Verifies settings for a Detector." + name 'aws_guardduty_detector' + desc 'Verifies settings for a Detector.' example " describe aws_guardduty_detector(detector_id: 'detector-id') do it { should exist } @@ -28,7 +28,7 @@ def initialize(opts = {}) end def resource_id - "#{@res? @display_name: ""}_#{@res? @created_at: ""}" + "#{@res? @display_name: ''}_#{@res? @created_at: ''}" end def exists? @@ -36,7 +36,7 @@ def exists? end def enabled? - status.upcase == "ENABLED" + status.upcase == 'ENABLED' end def to_s diff --git a/libraries/aws_guardduty_detectors.rb b/libraries/aws_guardduty_detectors.rb index f4f0f220a..554b90254 100644 --- a/libraries/aws_guardduty_detectors.rb +++ b/libraries/aws_guardduty_detectors.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsGuardDutyDetectors < AwsResourceBase - name "aws_guardduty_detectors" - desc "Verifies settings for a Detector in bulk." + name 'aws_guardduty_detectors' + desc 'Verifies settings for a Detector in bulk.' example " describe aws_guardduty_detectors do it { should exist } @@ -12,8 +12,8 @@ class AwsGuardDutyDetectors < AwsResourceBase attr_reader :table, :detector_rows, :api_response FilterTable.create - .register_column(:detector_ids, field: :detector_ids) - .install_filter_methods_on_resource(self, :table) + .register_column(:detector_ids, field: :detector_ids) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_hosted_zone.rb b/libraries/aws_hosted_zone.rb index 8881bd683..07627d57c 100644 --- a/libraries/aws_hosted_zone.rb +++ b/libraries/aws_hosted_zone.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsHostedZone < AwsResourceBase - name "aws_hosted_zone" - desc "Verifies hosted zone settings are correct." + name 'aws_hosted_zone' + desc 'Verifies hosted zone settings are correct.' example " describe aws_hosted_zone('zone-name') do @@ -16,13 +16,13 @@ class AwsHostedZone < AwsResourceBase attr_reader :records FilterTable.create - .register_column(:record_names, field: :record_name) - .register_column(:ids, field: :id) - .register_column(:private, field: :private) - .register_column(:ttls, field: :ttl) - .register_column(:types, field: :type) - .register_column(:values, field: :value) - .install_filter_methods_on_resource(self, :records) + .register_column(:record_names, field: :record_name) + .register_column(:ids, field: :id) + .register_column(:private, field: :private) + .register_column(:ttls, field: :ttl) + .register_column(:types, field: :type) + .register_column(:values, field: :value) + .install_filter_methods_on_resource(self, :records) def initialize(opts = {}) opts = { zone_name: opts } if opts.is_a?(String) diff --git a/libraries/aws_hosted_zones.rb b/libraries/aws_hosted_zones.rb index b05c7fe2e..b54ab299a 100644 --- a/libraries/aws_hosted_zones.rb +++ b/libraries/aws_hosted_zones.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSHostedZones < AwsResourceBase - name "aws_hosted_zones" - desc "Retrieves a list of the public and private hosted zones that are associated with the current Amazon Web Services account." + name 'aws_hosted_zones' + desc 'Retrieves a list of the public and private hosted zones that are associated with the current Amazon Web Services account.' example " describe aws_hosted_zones do @@ -19,13 +19,13 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:caller_references, field: :caller_reference) - .register_column(:configs, field: :config) - .register_column(:resource_record_set_counts, field: :resource_record_set_count) - .register_column(:linked_services, field: :linked_service) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:caller_references, field: :caller_reference) + .register_column(:configs, field: :config) + .register_column(:resource_record_set_counts, field: :resource_record_set_count) + .register_column(:linked_services, field: :linked_service) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_iam_access_key.rb b/libraries/aws_iam_access_key.rb index f71397671..5765f0e74 100644 --- a/libraries/aws_iam_access_key.rb +++ b/libraries/aws_iam_access_key.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamAccessKey < AwsResourceBase - name "aws_iam_access_key" - desc "Verifies settings for an AWS IAM Access Key." + name 'aws_iam_access_key' + desc 'Verifies settings for an AWS IAM Access Key.' example " describe aws_iam_access_key(username: 'username', access_key_id: 'access-key id') do it { should exist } @@ -19,7 +19,7 @@ class AwsIamAccessKey < AwsResourceBase def initialize(opts = {}) if opts.is_a?(String) # If String passed, determine if username or ID. - if opts.start_with?("AKIA") + if opts.start_with?('AKIA') opts = { access_key_id: opts } else opts = { username: opts } @@ -73,8 +73,8 @@ def resource_id end def active? - return nil unless exists? - status == "Active" + return unless exists? + status == 'Active' end def exists? @@ -86,12 +86,12 @@ def to_s end def last_used_date - return nil unless exists? + return unless exists? return @last_used_date if defined? @last_used_date catch_aws_errors do @last_used_date = @aws.iam_client.get_access_key_last_used({ access_key_id: @access_key_id }) - .access_key_last_used - .last_used_date + .access_key_last_used + .last_used_date end end end diff --git a/libraries/aws_iam_access_keys.rb b/libraries/aws_iam_access_keys.rb index fb04f6fe8..a52f4aa0e 100644 --- a/libraries/aws_iam_access_keys.rb +++ b/libraries/aws_iam_access_keys.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamAccessKeys < AwsCollectionResourceBase - name "aws_iam_access_keys" - desc "Verifies settings for a collection of AWS IAM Access Keys." + name 'aws_iam_access_keys' + desc 'Verifies settings for a collection of AWS IAM Access Keys.' example " describe aws_iam_access_keys do it { should_not exist } @@ -12,22 +12,22 @@ class AwsIamAccessKeys < AwsCollectionResourceBase attr_reader :table FilterTable.create - .register_column(:usernames, field: :username) - .register_column(:access_key_ids, field: :access_key_id) - .register_column(:created_date, field: :create_date) - .register_column(:created_days_ago, field: :created_days_ago) - .register_column(:created_with_user, field: :created_with_user) - .register_column(:created_hours_ago, field: :created_hours_ago) - .register_column(:active, field: :active) - .register_column(:inactive, field: :inactive) - .register_column(:last_used_date, field: :last_used_date, lazy_instance: :lazy_load_last_used_date) - .register_column(:last_used_hours_ago, field: :last_used_hours_ago, lazy_instance: :lazy_load_last_used_hours_ago) - .register_column(:last_used_days_ago, field: :last_used_days_ago, lazy_instance: :lazy_load_last_used_days_ago) - .register_column(:ever_used, field: :ever_used, lazy_instance: :lazy_load_ever_used) - .register_column(:never_used, field: :never_used, lazy_instance: :lazy_load_never_used_time) - .register_column(:user_created_date, field: :user_created_date) - .register_custom_matcher(:exists?) { |x| !x.entries.empty? } - .install_filter_methods_on_resource(self, :table) + .register_column(:usernames, field: :username) + .register_column(:access_key_ids, field: :access_key_id) + .register_column(:created_date, field: :create_date) + .register_column(:created_days_ago, field: :created_days_ago) + .register_column(:created_with_user, field: :created_with_user) + .register_column(:created_hours_ago, field: :created_hours_ago) + .register_column(:active, field: :active) + .register_column(:inactive, field: :inactive) + .register_column(:last_used_date, field: :last_used_date, lazy_instance: :lazy_load_last_used_date) + .register_column(:last_used_hours_ago, field: :last_used_hours_ago, lazy_instance: :lazy_load_last_used_hours_ago) + .register_column(:last_used_days_ago, field: :last_used_days_ago, lazy_instance: :lazy_load_last_used_days_ago) + .register_column(:ever_used, field: :ever_used, lazy_instance: :lazy_load_ever_used) + .register_column(:never_used, field: :never_used, lazy_instance: :lazy_load_never_used_time) + .register_column(:user_created_date, field: :user_created_date) + .register_custom_matcher(:exists?) { |x| !x.entries.empty? } + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) opts = { username: opts } if opts.is_a?(String) @@ -37,7 +37,7 @@ def initialize(opts = {}) end def to_s - "IAM Access Keys" + 'IAM Access Keys' end private @@ -83,7 +83,7 @@ def get_keys def fetch_keys(username) access_keys = catch_aws_errors do - iam_client.list_access_keys({user_name: username}) + iam_client.list_access_keys({ user_name: username }) rescue Aws::IAM::Errors::NoSuchEntity # Swallow - a miss on search results should return an empty table end @@ -92,11 +92,11 @@ def fetch_keys(username) access_key_hash = access_key.to_h access_key_hash[:username] = access_key_hash[:user_name] access_key_hash[:id] = access_key_hash[:access_key_id] - access_key_hash[:active] = access_key_hash[:status] == "Active" - access_key_hash[:inactive] = access_key_hash[:status] != "Active" + access_key_hash[:active] = access_key_hash[:status] == 'Active' + access_key_hash[:inactive] = access_key_hash[:status] != 'Active' access_key_hash[:created_hours_ago] = ((Time.now - access_key_hash[:create_date]) / (60*60)).to_i access_key_hash[:created_days_ago] = (access_key_hash[:created_hours_ago] / 24).to_i - access_key_hash[:user_created_date] = @_users.find {|user| user.user_name == access_key_hash[:username]}.create_date + access_key_hash[:user_created_date] = @_users.find { |user| user.user_name == access_key_hash[:username] }.create_date access_key_hash[:created_with_user] = (access_key_hash[:create_date] - access_key_hash[:user_created_date]).abs < 1.0/24.0 access_key_hash end @@ -105,8 +105,8 @@ def fetch_keys(username) def last_used(row, _condition, _table) catch_aws_errors do - iam_client.get_access_key_last_used({access_key_id: row[:access_key_id]}) - .access_key_last_used + iam_client.get_access_key_last_used({ access_key_id: row[:access_key_id] }) + .access_key_last_used end end diff --git a/libraries/aws_iam_account_alias.rb b/libraries/aws_iam_account_alias.rb index 25e69a865..e5fa73bf9 100644 --- a/libraries/aws_iam_account_alias.rb +++ b/libraries/aws_iam_account_alias.rb @@ -1,13 +1,13 @@ class AwsIamAccountAlias < AwsResourceBase - name "aws_iam_account_alias" - desc "Verifies settings for an AWS IAM Account Alias." + name 'aws_iam_account_alias' + desc 'Verifies settings for an AWS IAM Account Alias.' example " describe aws_iam_account_alias do it { should exist } its('alias') { should match /^fancy-/ } end " - supports platform: "aws" + supports platform: 'aws' attr_reader :alias diff --git a/libraries/aws_iam_credential_report.rb b/libraries/aws_iam_credential_report.rb index 66261e108..77671db7d 100644 --- a/libraries/aws_iam_credential_report.rb +++ b/libraries/aws_iam_credential_report.rb @@ -1,9 +1,9 @@ -require "csv" -require "aws_backend" +require 'csv' +require 'aws_backend' class AwsIamCredentialReport < AwsCollectionResourceBase - name "aws_iam_credential_report" - desc "Lists all users in the AWS account and the status of their credentials." + name 'aws_iam_credential_report' + desc 'Lists all users in the AWS account and the status of their credentials.' example " describe aws_iam_credential_report.where(mfa_active: false) do @@ -14,29 +14,29 @@ class AwsIamCredentialReport < AwsCollectionResourceBase attr_reader :table FilterTable.create - .register_column(:user, field: :user) - .register_column(:arn, field: :arn) - .register_column(:user_creation_time, field: :user_creation_time) - .register_column(:password_enabled, field: :password_enabled) - .register_column(:password_last_used, field: :password_last_used) - .register_column(:password_last_changed, field: :password_last_changed) - .register_column(:password_next_rotation, field: :password_next_rotation) - .register_column(:mfa_active, field: :mfa_active) - .register_column(:access_key_1_active, field: :access_key_1_active) - .register_column(:access_key_1_last_rotated, field: :access_key_1_last_rotated) - .register_column(:access_key_1_last_used_date, field: :access_key_1_last_used_date) - .register_column(:access_key_1_last_used_region, field: :access_key_1_last_used_region) - .register_column(:access_key_1_last_used_service, field: :access_key_1_last_used_service) - .register_column(:access_key_2_active, field: :access_key_2_active) - .register_column(:access_key_2_last_rotated, field: :access_key_2_last_rotated) - .register_column(:access_key_2_last_used_date, field: :access_key_2_last_used_date) - .register_column(:access_key_2_last_used_region, field: :access_key_2_last_used_region) - .register_column(:access_key_2_last_used_service, field: :access_key_2_last_used_service) - .register_column(:cert_1_active, field: :cert_1_active) - .register_column(:cert_1_last_rotated, field: :cert_1_last_rotated) - .register_column(:cert_2_active, field: :cert_2_active) - .register_column(:cert_2_last_rotated, field: :cert_2_last_rotated) - .install_filter_methods_on_resource(self, :table) + .register_column(:user, field: :user) + .register_column(:arn, field: :arn) + .register_column(:user_creation_time, field: :user_creation_time) + .register_column(:password_enabled, field: :password_enabled) + .register_column(:password_last_used, field: :password_last_used) + .register_column(:password_last_changed, field: :password_last_changed) + .register_column(:password_next_rotation, field: :password_next_rotation) + .register_column(:mfa_active, field: :mfa_active) + .register_column(:access_key_1_active, field: :access_key_1_active) + .register_column(:access_key_1_last_rotated, field: :access_key_1_last_rotated) + .register_column(:access_key_1_last_used_date, field: :access_key_1_last_used_date) + .register_column(:access_key_1_last_used_region, field: :access_key_1_last_used_region) + .register_column(:access_key_1_last_used_service, field: :access_key_1_last_used_service) + .register_column(:access_key_2_active, field: :access_key_2_active) + .register_column(:access_key_2_last_rotated, field: :access_key_2_last_rotated) + .register_column(:access_key_2_last_used_date, field: :access_key_2_last_used_date) + .register_column(:access_key_2_last_used_region, field: :access_key_2_last_used_region) + .register_column(:access_key_2_last_used_service, field: :access_key_2_last_used_service) + .register_column(:cert_1_active, field: :cert_1_active) + .register_column(:cert_1_last_rotated, field: :cert_1_last_rotated) + .register_column(:cert_2_active, field: :cert_2_active) + .register_column(:cert_2_last_rotated, field: :cert_2_last_rotated) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -45,7 +45,7 @@ def initialize(opts = {}) end def to_s - "IAM Credential Report" + 'IAM Credential Report' end private @@ -62,11 +62,16 @@ def fetch_data sleep 5 retry else - Inspec::Log.warn "AWS IAM Credential Report was not generated quickly enough." + Inspec::Log.warn 'AWS IAM Credential Report was not generated quickly enough.' raise e end end - report = CSV.parse(response.content, headers: true, header_converters: :symbol, converters: [:date_time, -> field { field == 'true' ? true : field == 'false' ? false : field }]) + report = CSV.parse(response.content, headers: true, header_converters: :symbol, converters: [:date_time, lambda { |field| if field == 'true' + true + else + field == 'false' ? false : field + end + } ]) report.map(&:to_h) end end diff --git a/libraries/aws_iam_group.rb b/libraries/aws_iam_group.rb index 24d6e1d8d..15a5584be 100644 --- a/libraries/aws_iam_group.rb +++ b/libraries/aws_iam_group.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamGroup < AwsResourceBase - name "aws_iam_group" - desc "Verifies settings for an AWS IAM Group." + name 'aws_iam_group' + desc 'Verifies settings for an AWS IAM Group.' example " describe aws_iam_group('group-1') do @@ -36,7 +36,7 @@ def resource_id end def exists? - @arn.start_with?("arn:") + @arn.start_with?('arn:') end def to_s diff --git a/libraries/aws_iam_groups.rb b/libraries/aws_iam_groups.rb index 5eb2e4d1c..131e35a97 100644 --- a/libraries/aws_iam_groups.rb +++ b/libraries/aws_iam_groups.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamGroups < AwsResourceBase - name "aws_iam_groups" - desc "Verifies settings for a collection AWS IAM Groups." + name 'aws_iam_groups' + desc 'Verifies settings for a collection AWS IAM Groups.' example " describe aws_iam_groups do it { should exist } @@ -12,13 +12,13 @@ class AwsIamGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:group_names, field: :group_name) - .register_column(:group_ids, field: :group_id) - .register_column(:arns, field: :arn) - .register_column(:users, field: :users) - .register_column(:has_inline_policies, field: :has_inline_policies) - .register_column(:inline_policy_names, field: :inline_policy_names) - .install_filter_methods_on_resource(self, :table) + .register_column(:group_names, field: :group_name) + .register_column(:group_ids, field: :group_id) + .register_column(:arns, field: :arn) + .register_column(:users, field: :users) + .register_column(:has_inline_policies, field: :has_inline_policies) + .register_column(:inline_policy_names, field: :inline_policy_names) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_inline_policy.rb b/libraries/aws_iam_inline_policy.rb index 098e15211..6d49b6dec 100644 --- a/libraries/aws_iam_inline_policy.rb +++ b/libraries/aws_iam_inline_policy.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamInlinePolicy < AwsResourceBase - name "aws_iam_inline_policy" - desc "Verifies settings for an Iam Inline Policy, attached to a user, role or group." + name 'aws_iam_inline_policy' + desc 'Verifies settings for an Iam Inline Policy, attached to a user, role or group.' example " describe aws_iam_inline_policy(role_name: 'rolename-a', policy_name: 'policy-1') do diff --git a/libraries/aws_iam_instance_profile.rb b/libraries/aws_iam_instance_profile.rb index 0dff67b6a..ed4763c3d 100644 --- a/libraries/aws_iam_instance_profile.rb +++ b/libraries/aws_iam_instance_profile.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSIAMInstanceProfile < AwsResourceBase - name "aws_iam_instance_profile" - desc "Retrieves information about the specified instance profile, including the instance profiles path, GUID, ARN, and role." + name 'aws_iam_instance_profile' + desc 'Retrieves information about the specified instance profile, including the instance profiles path, GUID, ARN, and role.' example " describe aws_iam_instance_profile(instance_profile_name: 'test1') do @@ -29,7 +29,7 @@ def resource_id end def instance_profile_name - return nil unless exists? + return unless exists? @res[:instance_profile_name] end diff --git a/libraries/aws_iam_instance_profiles.rb b/libraries/aws_iam_instance_profiles.rb index 5f69c357d..5ac017fd0 100644 --- a/libraries/aws_iam_instance_profiles.rb +++ b/libraries/aws_iam_instance_profiles.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSIAMInstanceProfiles < AwsResourceBase - name "aws_iam_instance_profiles" - desc "Lists the instance profiles that have the specified path prefix." + name 'aws_iam_instance_profiles' + desc 'Lists the instance profiles that have the specified path prefix.' example " describe aws_iam_instance_profiles do @@ -13,13 +13,13 @@ class AWSIAMInstanceProfiles < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:paths, field: :path) - .register_column(:instance_profile_names, field: :instance_profile_name) - .register_column(:instance_profile_ids, field: :instance_profile_id) - .register_column(:arns, field: :arn) - .register_column(:create_dates, field: :create_date) - .register_column(:roles, field: :roles) - .install_filter_methods_on_resource(self, :table) + .register_column(:paths, field: :path) + .register_column(:instance_profile_names, field: :instance_profile_name) + .register_column(:instance_profile_ids, field: :instance_profile_id) + .register_column(:arns, field: :arn) + .register_column(:create_dates, field: :create_date) + .register_column(:roles, field: :roles) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_managed_policies.rb b/libraries/aws_iam_managed_policies.rb index 03afd952b..47a1a94b9 100644 --- a/libraries/aws_iam_managed_policies.rb +++ b/libraries/aws_iam_managed_policies.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamManagedPolicies < AwsResourceBase - name "aws_iam_managed_policies" - desc "Lists all IAM users, groups, and roles that the specified managed policy is attached to." + name 'aws_iam_managed_policies' + desc 'Lists all IAM users, groups, and roles that the specified managed policy is attached to.' example " describe aws_iam_managed_policies do @@ -17,17 +17,17 @@ class AwsIamManagedPolicies < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:attachment_counts, field: :attachment_count) - .register_column(:default_version_ids, field: :default_version_id) - .register_column(:policy_names, field: :policy_name) - .register_column(:policy_ids, field: :policy_id) - .register_column(:permissions_boundary_usage_count, field: :permissions_boundary_usage_count) - .register_column(:descriptions, field: :description) - .register_column(:create_date, field: :create_date) - .register_column(:update_date, field: :update_date) - .register_column(:update_date, field: :update_date) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:attachment_counts, field: :attachment_count) + .register_column(:default_version_ids, field: :default_version_id) + .register_column(:policy_names, field: :policy_name) + .register_column(:policy_ids, field: :policy_id) + .register_column(:permissions_boundary_usage_count, field: :permissions_boundary_usage_count) + .register_column(:descriptions, field: :description) + .register_column(:create_date, field: :create_date) + .register_column(:update_date, field: :update_date) + .register_column(:update_date, field: :update_date) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_managed_policy.rb b/libraries/aws_iam_managed_policy.rb index f9538a295..5959916e1 100644 --- a/libraries/aws_iam_managed_policy.rb +++ b/libraries/aws_iam_managed_policy.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamManagedPolicy < AwsResourceBase - name "aws_iam_managed_policy" - desc "Verifies settings for an Iam Policy." + name 'aws_iam_managed_policy' + desc 'Verifies settings for an Iam Policy.' example " describe aws_iam_managed_policy(policy_arn: 'PolicyARN') do diff --git a/libraries/aws_iam_oidc_provider.rb b/libraries/aws_iam_oidc_provider.rb index db7e32859..9791c13f0 100644 --- a/libraries/aws_iam_oidc_provider.rb +++ b/libraries/aws_iam_oidc_provider.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSIAMOIDCProvider < AwsResourceBase - name "aws_iam_oidc_provider" - desc "Retrieves information about the specified specified OpenID Connect (OIDC) provider resource." + name 'aws_iam_oidc_provider' + desc 'Retrieves information about the specified specified OpenID Connect (OIDC) provider resource.' example " describe aws_iam_oidc_provider(open_id_connect_provider_arn: 'test1') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def resource_id - @res? @display_name: "" + @res? @display_name: '' end def exists? diff --git a/libraries/aws_iam_oidc_providers.rb b/libraries/aws_iam_oidc_providers.rb index 54fbbbdfc..a72faf317 100644 --- a/libraries/aws_iam_oidc_providers.rb +++ b/libraries/aws_iam_oidc_providers.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSIAMOIDCProviders < AwsResourceBase - name "aws_iam_oidc_providers" - desc "Lists all OIDC Providers." + name 'aws_iam_oidc_providers' + desc 'Lists all OIDC Providers.' example " describe aws_iam_oidc_providers do @@ -13,8 +13,8 @@ class AWSIAMOIDCProviders < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_password_policy.rb b/libraries/aws_iam_password_policy.rb index 1ede00f6c..67c51d350 100644 --- a/libraries/aws_iam_password_policy.rb +++ b/libraries/aws_iam_password_policy.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamPasswordPolicy < AwsResourceBase - name "aws_iam_password_policy" - desc "Verifies settings for an IAM Password Policy." + name 'aws_iam_password_policy' + desc 'Verifies settings for an IAM Password Policy.' example " describe aws_iam_password_policy do @@ -24,19 +24,19 @@ def initialize(opts = {}) end def minimum_password_length - return nil if !exists? + return if !exists? @policy.minimum_password_length end def max_password_age_in_days - return nil if !exists? - raise "this policy does not expire passwords" unless expire_passwords? + return if !exists? + raise 'this policy does not expire passwords' unless expire_passwords? @policy.max_password_age end def number_of_passwords_to_remember - return nil if !exists? - raise "this policy does not prevent password reuse" \ + return if !exists? + raise 'this policy does not prevent password reuse' \ unless prevent_password_reuse? @policy.password_reuse_prevention end @@ -99,6 +99,6 @@ def resource_id end def to_s - "AWS IAM Password Policy" + 'AWS IAM Password Policy' end end diff --git a/libraries/aws_iam_policies.rb b/libraries/aws_iam_policies.rb index 2a37e5154..f419e3cdd 100644 --- a/libraries/aws_iam_policies.rb +++ b/libraries/aws_iam_policies.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamPolicies < AwsResourceBase - name "aws_iam_policies" - desc "Verifies settings for a collection AWS IAM Policies." + name 'aws_iam_policies' + desc 'Verifies settings for a collection AWS IAM Policies.' example " describe aws_iam_policies do it { should exist } @@ -12,15 +12,15 @@ class AwsIamPolicies < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:attachment_counts, field: :attachment_count) - .register_column(:default_version_ids, field: :default_version_id) - .register_column(:policy_names, field: :policy_name) - .register_column(:policy_ids, field: :policy_id) - .register_column(:attached_groups, field: :attached_groups) - .register_column(:attached_roles, field: :attached_roles) - .register_column(:attached_users, field: :attached_users) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:attachment_counts, field: :attachment_count) + .register_column(:default_version_ids, field: :default_version_id) + .register_column(:policy_names, field: :policy_name) + .register_column(:policy_ids, field: :policy_id) + .register_column(:attached_groups, field: :attached_groups) + .register_column(:attached_roles, field: :attached_roles) + .register_column(:attached_users, field: :attached_users) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_policy.rb b/libraries/aws_iam_policy.rb index cf39790a9..d79d08af7 100644 --- a/libraries/aws_iam_policy.rb +++ b/libraries/aws_iam_policy.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamPolicy < AwsResourceBase - name "aws_iam_policy" - desc "Verifies settings for an IAM Policy." + name 'aws_iam_policy' + desc 'Verifies settings for an IAM Policy.' example " describe aws_iam_policy('policy-1') do diff --git a/libraries/aws_iam_role.rb b/libraries/aws_iam_role.rb index 77f8427c0..667005852 100644 --- a/libraries/aws_iam_role.rb +++ b/libraries/aws_iam_role.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamRole < AwsResourceBase - name "aws_iam_role" - desc "Verifies settings for an IAM Role." + name 'aws_iam_role' + desc 'Verifies settings for an IAM Role.' example " describe aws_iam_role('my-role') do it { should exist } diff --git a/libraries/aws_iam_roles.rb b/libraries/aws_iam_roles.rb index 7a44331dd..428e6bc09 100644 --- a/libraries/aws_iam_roles.rb +++ b/libraries/aws_iam_roles.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamRoles < AwsResourceBase - name "aws_iam_roles" - desc "Verifies settings for a collection AWS IAM Roles." + name 'aws_iam_roles' + desc 'Verifies settings for a collection AWS IAM Roles.' example " describe aws_iam_roles do it { should exist } @@ -12,17 +12,17 @@ class AwsIamRoles < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:role_names, field: :role_name) - .register_column(:role_ids, field: :role_id) - .register_column(:paths, field: :path) - .register_column(:arns, field: :arn) - .register_column(:create_date, field: :create_date) - .register_column(:description, field: :description) - .register_column(:assume_role_policy_document, field: :assume_role_policy_document) - .register_column(:max_session_duration, field: :max_session_duration) - .register_column(:permissions_boundary_type, field: :permissions_boundary_type) - .register_column(:permissions_boundary_arn, field: :permissions_boundary_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:role_names, field: :role_name) + .register_column(:role_ids, field: :role_id) + .register_column(:paths, field: :path) + .register_column(:arns, field: :arn) + .register_column(:create_date, field: :create_date) + .register_column(:description, field: :description) + .register_column(:assume_role_policy_document, field: :assume_role_policy_document) + .register_column(:max_session_duration, field: :max_session_duration) + .register_column(:permissions_boundary_type, field: :permissions_boundary_type) + .register_column(:permissions_boundary_arn, field: :permissions_boundary_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_root_user.rb b/libraries/aws_iam_root_user.rb index b012eb5df..1cd721394 100644 --- a/libraries/aws_iam_root_user.rb +++ b/libraries/aws_iam_root_user.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamRootUser < AwsResourceBase - name "aws_iam_root_user" - desc "Verifies settings for AWS Root Account." + name 'aws_iam_root_user' + desc 'Verifies settings for AWS Root Account.' example " describe aws_iam_root_user do it { should have_access_key } @@ -27,11 +27,11 @@ def resource_id end def has_access_key? - @summary_account["AccountAccessKeysPresent"] == 1 + @summary_account['AccountAccessKeysPresent'] == 1 end def has_mfa_enabled? - @summary_account["AccountMFAEnabled"] == 1 + @summary_account['AccountMFAEnabled'] == 1 end def has_hardware_mfa_enabled? @@ -40,7 +40,7 @@ def has_hardware_mfa_enabled? # Virtual MFA devices have suffix 'root-account-mfa-device' def has_virtual_mfa_enabled? - virtual_mfa_suffix = "root-account-mfa-device" + virtual_mfa_suffix = 'root-account-mfa-device' @virtual_devices.any? { |device| device[:serial_number].end_with?(virtual_mfa_suffix) } end @@ -49,6 +49,6 @@ def exists? end def to_s - "AWS Root-User" + 'AWS Root-User' end end diff --git a/libraries/aws_iam_saml_provider.rb b/libraries/aws_iam_saml_provider.rb index 989a05183..f6ee2ee66 100644 --- a/libraries/aws_iam_saml_provider.rb +++ b/libraries/aws_iam_saml_provider.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamSamlProvider < AwsResourceBase - name "aws_iam_saml_provider" - desc "Verifies settings for a SAML Provider." + name 'aws_iam_saml_provider' + desc 'Verifies settings for a SAML Provider.' example " describe aws_iam_saml_provider('arn:aws:iam::123456789012:saml-provider/FANCY') do it { should exist } @@ -10,7 +10,7 @@ class AwsIamSamlProvider < AwsResourceBase its('valid_until') { should be > Time.now + 90 * 86400 } end " - supports platform: "aws" + supports platform: 'aws' attr_reader :provider, :arn, :saml_metadata_document, :create_date, :valid_until diff --git a/libraries/aws_iam_saml_providers.rb b/libraries/aws_iam_saml_providers.rb index b17fc1c25..7711661f5 100644 --- a/libraries/aws_iam_saml_providers.rb +++ b/libraries/aws_iam_saml_providers.rb @@ -1,21 +1,21 @@ -require "aws_backend" +require 'aws_backend' class AwsIamSamlProviders < AwsResourceBase - name "aws_iam_saml_providers" - desc "Verifies settings for a collection of SAML Providers." + name 'aws_iam_saml_providers' + desc 'Verifies settings for a collection of SAML Providers.' example " describe aws_iam_saml_providers do it { should exist } end " - supports platform: "aws" + supports platform: 'aws' attr_reader :table FilterTable.create - .register_column(:provider_arns, field: :arn) - .register_column(:valid_untils, field: :valid_until) - .install_filter_methods_on_resource(self, :table) + .register_column(:provider_arns, field: :arn) + .register_column(:valid_untils, field: :valid_until) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -40,6 +40,6 @@ def fetch_data end def to_s - "AWS IAM SAML Providers" + 'AWS IAM SAML Providers' end end diff --git a/libraries/aws_iam_server_certificate.rb b/libraries/aws_iam_server_certificate.rb index 489b7e86f..3d81cad35 100644 --- a/libraries/aws_iam_server_certificate.rb +++ b/libraries/aws_iam_server_certificate.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSIAMServerCertificate < AwsResourceBase - name "aws_iam_server_certificate" - desc "Retrieves information about the specified server certificate stored in IAM." + name 'aws_iam_server_certificate' + desc 'Retrieves information about the specified server certificate stored in IAM.' example " describe aws_iam_server_certificate(server_certificate_name: 'SERVER_CERTIFICATE_NAME') do diff --git a/libraries/aws_iam_server_certificates.rb b/libraries/aws_iam_server_certificates.rb index 21e3e8d36..cb3ba3615 100644 --- a/libraries/aws_iam_server_certificates.rb +++ b/libraries/aws_iam_server_certificates.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSIAMServerCertificates < AwsResourceBase - name "aws_iam_server_certificates" - desc "Verifies the server certificates stored in IAM." + name 'aws_iam_server_certificates' + desc 'Verifies the server certificates stored in IAM.' example " describe aws_iam_server_certificates do @@ -13,13 +13,13 @@ class AWSIAMServerCertificates < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:paths, field: :path) - .register_column(:server_certificate_names, field: :server_certificate_name) - .register_column(:server_certificate_ids, field: :server_certificate_id) - .register_column(:arns, field: :arn) - .register_column(:upload_date, field: :upload_date) - .register_column(:expiration_date, field: :expiration_date) - .install_filter_methods_on_resource(self, :table) + .register_column(:paths, field: :path) + .register_column(:server_certificate_names, field: :server_certificate_name) + .register_column(:server_certificate_ids, field: :server_certificate_id) + .register_column(:arns, field: :arn) + .register_column(:upload_date, field: :upload_date) + .register_column(:expiration_date, field: :expiration_date) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_service_linked_role_deletion_status.rb b/libraries/aws_iam_service_linked_role_deletion_status.rb index 9eec4aa21..f81746452 100644 --- a/libraries/aws_iam_service_linked_role_deletion_status.rb +++ b/libraries/aws_iam_service_linked_role_deletion_status.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSIAMServiceLinkedRoleDeletionStatus < AwsResourceBase - name "aws_iam_service_linked_role_deletion_status" - desc "Retrieves the status of your service-linked role deletion." + name 'aws_iam_service_linked_role_deletion_status' + desc 'Retrieves the status of your service-linked role deletion.' example " describe aws_iam_service_linked_role_deletion_status(deletion_task_id: 'test1') do @@ -24,12 +24,12 @@ def initialize(opts = {}) end def status - return nil unless exists? + return unless exists? @res[:status] end def resource_id - @res? @display_name: "" + @res? @display_name: '' end def exists? diff --git a/libraries/aws_iam_ssh_public_key.rb b/libraries/aws_iam_ssh_public_key.rb index 462e1d96d..dbc380d60 100644 --- a/libraries/aws_iam_ssh_public_key.rb +++ b/libraries/aws_iam_ssh_public_key.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSIAMSSHPublicKey < AwsResourceBase - name "aws_iam_ssh_public_key" - desc "Retrieves the specified SSH public key, including metadata about the key." + name 'aws_iam_ssh_public_key' + desc 'Retrieves the specified SSH public key, including metadata about the key.' example " describe aws_iam_ssh_public_key(user_name: 'USER_NAME', ssh_public_key_id: 'SSH_PUBLIC_KEY_ID', encoding: 'SSH') do @@ -35,12 +35,12 @@ def resource_id end def ssh_public_key_id - return nil unless exists? + return unless exists? @res[:ssh_public_key_id] end def ssh_key_age_valid - return nil unless exists? + return unless exists? result = (Time.now - @res[:upload_date]).to_i / (24 * 60 * 60) return false if result > 730 true diff --git a/libraries/aws_iam_ssh_public_keys.rb b/libraries/aws_iam_ssh_public_keys.rb index 2899105d1..72f97d002 100644 --- a/libraries/aws_iam_ssh_public_keys.rb +++ b/libraries/aws_iam_ssh_public_keys.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSIAMSSHPublicKeys < AwsResourceBase - name "aws_iam_ssh_public_keys" - desc "Returns information about the SSH public keys associated with the specified IAM user. If none exists, the operation returns an empty list." + name 'aws_iam_ssh_public_keys' + desc 'Returns information about the SSH public keys associated with the specified IAM user. If none exists, the operation returns an empty list.' example " describe aws_iam_ssh_public_keys(user_name: 'USER_NAME') do @@ -16,11 +16,11 @@ class AWSIAMSSHPublicKeys < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:user_names, field: :user_name) - .register_column(:ssh_public_key_ids, field: :ssh_public_key_id) - .register_column(:statuses, field: :status) - .register_column(:upload_dates, field: :upload_date) - .install_filter_methods_on_resource(self, :table) + .register_column(:user_names, field: :user_name) + .register_column(:ssh_public_key_ids, field: :ssh_public_key_id) + .register_column(:statuses, field: :status) + .register_column(:upload_dates, field: :upload_date) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_user.rb b/libraries/aws_iam_user.rb index 361db92e4..3227fc443 100644 --- a/libraries/aws_iam_user.rb +++ b/libraries/aws_iam_user.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamUser < AwsResourceBase - name "aws_iam_user" - desc "Verifies settings for an AWS IAM User." + name 'aws_iam_user' + desc 'Verifies settings for an AWS IAM User.' example " describe aws_iam_user(user_name: 'TEST_USER_NAME') do it { should exist } diff --git a/libraries/aws_iam_users.rb b/libraries/aws_iam_users.rb index 10f87d931..02b76060f 100644 --- a/libraries/aws_iam_users.rb +++ b/libraries/aws_iam_users.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsIamUsers < AwsCollectionResourceBase - name "aws_iam_users" - desc "Verifies settings for a collection of AWS IAM Users." + name 'aws_iam_users' + desc 'Verifies settings for a collection of AWS IAM Users.' example " describe aws_iam_users(user_name: 'psmith') do @@ -13,20 +13,20 @@ class AwsIamUsers < AwsCollectionResourceBase attr_reader :table FilterTable.create - .register_column(:usernames, field: :username) - .register_column(:user_arns, field: :user_arn) - .register_column(:user_ids, field: :user_id) - .register_column(:access_keys, field: :access_keys, lazy_instance: :lazy_load_access_keys) - .register_column(:has_attached_policies, field: :has_attached_policies, lazy_instance: :lazy_load_attached_policies) - .register_column(:attached_policy_names, field: :attached_policy_names, lazy_instance: :lazy_load_attached_policy_names) - .register_column(:attached_policy_arns, field: :attached_policy_arns, lazy_instance: :lazy_load_attached_policy_arns) - .register_column(:has_console_password, field: :has_console_password, lazy_instance: :lazy_load_has_console_password) - .register_column(:has_inline_policies, field: :has_inline_policies, lazy_instance: :lazy_load_has_inline_policies) - .register_column(:inline_policy_names, field: :inline_policy_names, lazy_instance: :lazy_load_inline_policies) - .register_column(:has_mfa_enabled, field: :has_mfa_enabled, lazy_instance: :lazy_load_has_mfa_enabled) - .register_column(:password_ever_used?, field: :password_ever_used?) - .register_column(:password_last_used_days_ago, field: :password_last_used_days_ago) - .install_filter_methods_on_resource(self, :table) + .register_column(:usernames, field: :username) + .register_column(:user_arns, field: :user_arn) + .register_column(:user_ids, field: :user_id) + .register_column(:access_keys, field: :access_keys, lazy_instance: :lazy_load_access_keys) + .register_column(:has_attached_policies, field: :has_attached_policies, lazy_instance: :lazy_load_attached_policies) + .register_column(:attached_policy_names, field: :attached_policy_names, lazy_instance: :lazy_load_attached_policy_names) + .register_column(:attached_policy_arns, field: :attached_policy_arns, lazy_instance: :lazy_load_attached_policy_arns) + .register_column(:has_console_password, field: :has_console_password, lazy_instance: :lazy_load_has_console_password) + .register_column(:has_inline_policies, field: :has_inline_policies, lazy_instance: :lazy_load_has_inline_policies) + .register_column(:inline_policy_names, field: :inline_policy_names, lazy_instance: :lazy_load_inline_policies) + .register_column(:has_mfa_enabled, field: :has_mfa_enabled, lazy_instance: :lazy_load_has_mfa_enabled) + .register_column(:password_ever_used?, field: :password_ever_used?) + .register_column(:password_last_used_days_ago, field: :password_last_used_days_ago) + .install_filter_methods_on_resource(self, :table) alias has_mfa_enabled? has_mfa_enabled alias has_console_password? has_console_password @@ -44,7 +44,7 @@ def fetch_data @aws.iam_client.list_users.flat_map do |response| response.users.map do |user| { - username: user.arn.split("/").last, + username: user.arn.split('/').last, user_arn: user.arn, user_id: user.user_id, password_ever_used?: user.password_last_used.present?, @@ -57,17 +57,17 @@ def fetch_data def lazy_load_has_console_password(row, _condition, _table) row[:has_console_password] = fetch(client: :iam_client, operation: :get_login_profile, kwargs: { user_name: row[:username] }) - .present? + .present? end def lazy_load_access_keys(row, _condition, _table) row[:access_keys] = fetch(client: :iam_client, operation: :list_access_keys, kwargs: { user_name: row[:username] }) - .flat_map(&:access_key_metadata) || [] + .flat_map(&:access_key_metadata) || [] end def lazy_load_attached_policies(row, _condition, _table) row[:has_attached_policies] ||= fetch(client: :iam_client, operation: :list_attached_user_policies, kwargs: { user_name: row[:username] }) - .flat_map(&:attached_policies) + .flat_map(&:attached_policies) end def lazy_load_attached_policy_names(row, condition, table) @@ -80,7 +80,7 @@ def lazy_load_attached_policy_arns(row, condition, table) def lazy_load_inline_policies(row, _condition, _table) row[:inline_policy_names] ||= fetch(client: :iam_client, operation: :list_user_policies, kwargs: { user_name: row[:username] }) - .flat_map(&:policy_names) + .flat_map(&:policy_names) end def lazy_load_has_inline_policies(row, condition, table) diff --git a/libraries/aws_iam_virtual_mfa_devices.rb b/libraries/aws_iam_virtual_mfa_devices.rb index 631b9616e..3611e0804 100644 --- a/libraries/aws_iam_virtual_mfa_devices.rb +++ b/libraries/aws_iam_virtual_mfa_devices.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSIAMVirtualMFADevices < AwsResourceBase - name "aws_iam_virtual_mfa_devices" - desc "Lists all virtual MFA devices." + name 'aws_iam_virtual_mfa_devices' + desc 'Lists all virtual MFA devices.' example " describe aws_iam_virtual_mfa_devices do @@ -13,15 +13,15 @@ class AWSIAMVirtualMFADevices < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:serial_numbers, field: :serial_number) - .register_column(:paths, field: :path) - .register_column(:user_names, field: :user_name) - .register_column(:user_ids, field: :user_id) - .register_column(:arns, field: :arn) - .register_column(:tags, field: :tags) - .register_column(:enable_dates, field: :enable_date) - .register_column(:create_dates, field: :create_date) - .install_filter_methods_on_resource(self, :table) + .register_column(:serial_numbers, field: :serial_number) + .register_column(:paths, field: :path) + .register_column(:user_names, field: :user_name) + .register_column(:user_ids, field: :user_id) + .register_column(:arns, field: :arn) + .register_column(:tags, field: :tags) + .register_column(:enable_dates, field: :enable_date) + .register_column(:create_dates, field: :create_date) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_internet_gateway.rb b/libraries/aws_internet_gateway.rb index 4c3305306..eb695b1c3 100644 --- a/libraries/aws_internet_gateway.rb +++ b/libraries/aws_internet_gateway.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsInternetGateway < AwsResourceBase - name "aws_internet_gateway" - desc "Verifies settings for an AWS Internet Gateway." + name 'aws_internet_gateway' + desc 'Verifies settings for an AWS Internet Gateway.' example " describe aws_internet_gateway(id: 'igw-abc12450edc87a8bd') do @@ -29,16 +29,16 @@ def initialize(opts = {}) elsif opts.key?(:name) && !opts.key?(:id) name = opts[:name] tag_error = "#{@__resource_name__}: `name` should be maximum 255 characters long and contain "\ - "letters, numbers, spaces and the following characters only: + - = . _ : / @" + 'letters, numbers, spaces and the following characters only: + - = . _ : / @' raise ArgumentError, tag_error unless name.match?(%r{^[\w+\- =._:/@]{1,256}$}) && name.length.between?(1, 255) query_params = { filters: [ - name: "tag:Name", + name: 'tag:Name', values: [name], ] } else raise ArgumentError, "#{@__resource_name__}: either `id` or `name` must be provided." end - @display_name = opts.values.join(" ") + @display_name = opts.values.join(' ') catch_aws_errors do resp = @aws.compute_client.describe_internet_gateways(query_params) @@ -54,7 +54,7 @@ def initialize(opts = {}) if gateways.length > 1 fail_resource("#{@__resource_name__}: Multiple internet gateways were returned for the provided parameter:"\ " `#{@display_name}`. If you wish to test multiple internet gateways, "\ - "please use the aws_internet_gateways resource.") + 'please use the aws_internet_gateways resource.') @failed_resource = true return end @@ -74,7 +74,7 @@ def id def name return unless exists? - tags["Name"] if tags.key?("Name") + tags['Name'] if tags.key?('Name') end def tags @@ -99,7 +99,7 @@ def attached? return false if attachments.empty? # available means it is attached to a VPC. # https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_InternetGatewayAttachment.html - attachments.first.state == "available" + attachments.first.state == 'available' end def detached? diff --git a/libraries/aws_internet_gateways.rb b/libraries/aws_internet_gateways.rb index c0d85e18d..3cbbdae9d 100644 --- a/libraries/aws_internet_gateways.rb +++ b/libraries/aws_internet_gateways.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsInternetGateways < AwsResourceBase - name "aws_internet_gateways" - desc "Verifies settings for a collection of AWS internet gateways." + name 'aws_internet_gateways' + desc 'Verifies settings for a collection of AWS internet gateways.' example " describe aws_internet_gateways do @@ -17,13 +17,13 @@ class AwsInternetGateways < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:tags, field: :tags) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:attachment_states, field: :attachment_state) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:tags, field: :tags) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:attachment_states, field: :attachment_state) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -43,11 +43,11 @@ def fetch_data @api_response.internet_gateways.each do |igw| igw_rows += [{ id: igw.internet_gateway_id, - name: igw[:tags].select { |tag| tag[:key] == "Name" }.first&.dig(:value), + name: igw[:tags].select { |tag| tag[:key] == 'Name' }.first&.dig(:value), tags: igw.tags, owner_id: igw.owner_id, vpc_id: igw.attachments.empty? ? nil : igw.attachments.first[:vpc_id], - attachment_state: igw.attachments.empty? ? "detached" : "attached", + attachment_state: igw.attachments.empty? ? 'detached' : 'attached', }] end break unless @api_response.next_token diff --git a/libraries/aws_kms_key.rb b/libraries/aws_kms_key.rb index bf4f03eb2..ffdf6990c 100644 --- a/libraries/aws_kms_key.rb +++ b/libraries/aws_kms_key.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsKmsKey < AwsResourceBase - name "aws_kms_key" - desc "Verifies settings for an individual AWS KMS Key." + name 'aws_kms_key' + desc 'Verifies settings for an individual AWS KMS Key.' example " describe aws_kms_key(key_id: 'arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do it { should exist } @@ -63,7 +63,7 @@ def invalidation_time end def external? - key_metadata[:origin] == "EXTERNAL" + key_metadata[:origin] == 'EXTERNAL' end def enabled? @@ -71,11 +71,11 @@ def enabled? end def managed_by_aws? - key_metadata[:key_manager] == "AWS" + key_metadata[:key_manager] == 'AWS' end def has_key_expiration? - key_metadata[:expiration_model] == "KEY_MATERIAL_EXPIRES" + key_metadata[:expiration_model] == 'KEY_MATERIAL_EXPIRES' end def has_rotation_enabled? @@ -92,8 +92,8 @@ def fetch_key_id end if response.present? response.aliases.each do |alias_entry| - if alias_entry["alias_name"] == @alias && alias_entry["target_key_id"] - return alias_entry["target_key_id"] + if alias_entry['alias_name'] == @alias && alias_entry['target_key_id'] + return alias_entry['target_key_id'] end end end @@ -111,7 +111,7 @@ def key_metadata end def key_rotation_response - return if key_metadata[:key_manager] == "AWS" + return if key_metadata[:key_manager] == 'AWS' @key_rotation_response ||= catch_aws_errors do kms_client.get_key_rotation_status({ key_id: opts[:key_id] }) end diff --git a/libraries/aws_kms_keys.rb b/libraries/aws_kms_keys.rb index e5d97e700..f0c6f92cb 100644 --- a/libraries/aws_kms_keys.rb +++ b/libraries/aws_kms_keys.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsKmsKeys < AwsResourceBase - name "aws_kms_keys" - desc "Verifies settings for AWS KMS Keys in bulk." + name 'aws_kms_keys' + desc 'Verifies settings for AWS KMS Keys in bulk.' example " describe aws_kms_keys do it { should exist } @@ -12,9 +12,9 @@ class AwsKmsKeys < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:key_ids, field: :key_id) - .register_column(:key_arns, field: :key_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:key_ids, field: :key_id) + .register_column(:key_arns, field: :key_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_lambda.rb b/libraries/aws_lambda.rb index acc15258b..f7964fb27 100644 --- a/libraries/aws_lambda.rb +++ b/libraries/aws_lambda.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsLambda < AwsResourceBase - name "aws_lambda" - desc "Verifies the settings for a set of lambda." + name 'aws_lambda' + desc 'Verifies the settings for a set of lambda.' example " describe aws_lambda('lambda_fred') do .... diff --git a/libraries/aws_lambda_alias.rb b/libraries/aws_lambda_alias.rb index 9f7844d93..2ced312b3 100644 --- a/libraries/aws_lambda_alias.rb +++ b/libraries/aws_lambda_alias.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSLambdaAlias < AwsResourceBase - name "aws_lambda_alias" - desc "Retrieves information about a patch baseline." + name 'aws_lambda_alias' + desc 'Retrieves information about a patch baseline.' example " describe aws_lambda_alias(function_name: 'FUNCTION_NAME', function_alias_name: 'FUNCTION_ALIAS_NAME') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def function_alias_name - return nil unless exists? + return unless exists? @res[:function_alias_name] end diff --git a/libraries/aws_lambda_aliases.rb b/libraries/aws_lambda_aliases.rb index 07176d116..85a11de1e 100644 --- a/libraries/aws_lambda_aliases.rb +++ b/libraries/aws_lambda_aliases.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSLambdaAliases < AwsResourceBase - name "aws_lambda_aliases" - desc "Returns a list of aliases for a Lambda function." + name 'aws_lambda_aliases' + desc 'Returns a list of aliases for a Lambda function.' example " describe aws_lambda_aliases(function_name: 'FUNCTION_NAME') do @@ -13,13 +13,13 @@ class AWSLambdaAliases < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:alias_arns, field: :alias_arn) - .register_column(:names, field: :name) - .register_column(:function_versions, field: :function_version) - .register_column(:descriptions, field: :description) - .register_column(:routing_configs, field: :routing_config) - .register_column(:revision_ids, field: :revision_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:alias_arns, field: :alias_arn) + .register_column(:names, field: :name) + .register_column(:function_versions, field: :function_version) + .register_column(:descriptions, field: :description) + .register_column(:routing_configs, field: :routing_config) + .register_column(:revision_ids, field: :revision_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_lambda_code_signing_config.rb b/libraries/aws_lambda_code_signing_config.rb index 0e8f62ecb..74b82c58d 100644 --- a/libraries/aws_lambda_code_signing_config.rb +++ b/libraries/aws_lambda_code_signing_config.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSLambdaCodeSigningConfig < AwsResourceBase - name "aws_lambda_code_signing_config" - desc "Returns information about the specified code signing configuration." + name 'aws_lambda_code_signing_config' + desc 'Returns information about the specified code signing configuration.' example " describe aws_lambda_code_signing_config(code_signing_config_arn: 'CODE_SIGNING_CONFIG_ARN') do @@ -23,7 +23,7 @@ def initialize(opts = {}) end def code_signing_config_arn - return nil unless exists? + return unless exists? @res[:code_signing_config_arn] end diff --git a/libraries/aws_lambda_code_signing_configs.rb b/libraries/aws_lambda_code_signing_configs.rb index 790bf9177..47f7208ff 100644 --- a/libraries/aws_lambda_code_signing_configs.rb +++ b/libraries/aws_lambda_code_signing_configs.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSLambdaCodeSigningConfigs < AwsResourceBase - name "aws_lambda_code_signing_configs" - desc "Returns a list of code signing configurations." + name 'aws_lambda_code_signing_configs' + desc 'Returns a list of code signing configurations.' example " describe aws_lambda_code_signing_configs do @@ -13,13 +13,13 @@ class AWSLambdaCodeSigningConfigs < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:code_signing_config_ids, field: :code_signing_config_id) - .register_column(:code_signing_config_arns, field: :code_signing_config_arn) - .register_column(:descriptions, field: :description) - .register_column(:allowed_publishers, field: :allowed_publishers) - .register_column(:code_signing_policies, field: :code_signing_policies) - .register_column(:last_modified, field: :last_modified) - .install_filter_methods_on_resource(self, :table) + .register_column(:code_signing_config_ids, field: :code_signing_config_id) + .register_column(:code_signing_config_arns, field: :code_signing_config_arn) + .register_column(:descriptions, field: :description) + .register_column(:allowed_publishers, field: :allowed_publishers) + .register_column(:code_signing_policies, field: :code_signing_policies) + .register_column(:last_modified, field: :last_modified) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_lambda_event_invoke_config.rb b/libraries/aws_lambda_event_invoke_config.rb index a90dba54e..7fd3b9757 100644 --- a/libraries/aws_lambda_event_invoke_config.rb +++ b/libraries/aws_lambda_event_invoke_config.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSLambdaEventInvokeConfig < AwsResourceBase - name "aws_lambda_event_invoke_config" - desc "Retrieves the configuration for asynchronous invocation for a function, version, or alias." + name 'aws_lambda_event_invoke_config' + desc 'Retrieves the configuration for asynchronous invocation for a function, version, or alias.' example " describe aws_lambda_event_invoke_config(function_name: 'FUNCTION_NAME') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def function_name - return nil unless exists? + return unless exists? @res[:function_name] end diff --git a/libraries/aws_lambda_event_invoke_configs.rb b/libraries/aws_lambda_event_invoke_configs.rb index 800aa0336..3852fd5de 100644 --- a/libraries/aws_lambda_event_invoke_configs.rb +++ b/libraries/aws_lambda_event_invoke_configs.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSLambdaEventInvokeConfigs < AwsResourceBase - name "aws_lambda_event_invoke_configs" - desc "Gets information about the scalable targets in the specified namespace." + name 'aws_lambda_event_invoke_configs' + desc 'Gets information about the scalable targets in the specified namespace.' example " describe aws_lambda_event_invoke_configs(function_name: 'FUNCTION_NAME') do @@ -13,12 +13,12 @@ class AWSLambdaEventInvokeConfigs < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:last_modified, field: :last_modified) - .register_column(:function_arns, field: :function_arn) - .register_column(:maximum_retry_attempts, field: :maximum_retry_attempts) - .register_column(:maximum_event_age_in_seconds, field: :maximum_event_age_in_seconds) - .register_column(:destination_configs, field: :destination_config) - .install_filter_methods_on_resource(self, :table) + .register_column(:last_modified, field: :last_modified) + .register_column(:function_arns, field: :function_arn) + .register_column(:maximum_retry_attempts, field: :maximum_retry_attempts) + .register_column(:maximum_event_age_in_seconds, field: :maximum_event_age_in_seconds) + .register_column(:destination_configs, field: :destination_config) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_lambda_event_source_mapping.rb b/libraries/aws_lambda_event_source_mapping.rb index c222ae774..3cc74dce2 100644 --- a/libraries/aws_lambda_event_source_mapping.rb +++ b/libraries/aws_lambda_event_source_mapping.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSLambdaEventSourceMapping < AwsResourceBase - name "aws_lambda_event_source_mapping" - desc "Returns details about an event source mapping." + name 'aws_lambda_event_source_mapping' + desc 'Returns details about an event source mapping.' example " describe aws_lambda_event_source_mapping(uuid: 'test1') do @@ -24,12 +24,12 @@ def initialize(opts = {}) end def uuid - return nil unless exists? + return unless exists? @res[:uuid] end def resource_id - return "" unless exists? + return '' unless exists? @res[:uuid] end diff --git a/libraries/aws_lambda_event_source_mappings.rb b/libraries/aws_lambda_event_source_mappings.rb index fe1058349..8e366a366 100644 --- a/libraries/aws_lambda_event_source_mappings.rb +++ b/libraries/aws_lambda_event_source_mappings.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSLambdaEventSourceMappings < AwsResourceBase - name "aws_lambda_event_source_mappings" - desc "Lists event source mappings." + name 'aws_lambda_event_source_mappings' + desc 'Lists event source mappings.' example " describe aws_lambda_event_source_mappings do @@ -13,26 +13,26 @@ class AWSLambdaEventSourceMappings < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:uuids, field: :uuid) - .register_column(:starting_positions, field: :starting_position) - .register_column(:starting_position_timestamps, field: :starting_position_timestamp) - .register_column(:batch_sizes, field: :batch_size) - .register_column(:maximum_batching_window_in_seconds, field: :maximum_batching_window_in_seconds) - .register_column(:parallelization_factors, field: :parallelization_factor) - .register_column(:event_source_arns, field: :event_source_arn) - .register_column(:function_arns, field: :function_arn) - .register_column(:last_modified, field: :last_modified) - .register_column(:last_processing_results, field: :last_processing_result) - .register_column(:states, field: :state) - .register_column(:state_transition_reasons, field: :state_transition_reason) - .register_column(:destination_configs, field: :destination_config) - .register_column(:topics, field: :topics) - .register_column(:queues, field: :queues) - .register_column(:source_access_configurations, field: :source_access_configurations) - .register_column(:maximum_record_age_in_seconds, field: :maximum_record_age_in_seconds) - .register_column(:bisect_batch_on_function_errors, field: :bisect_batch_on_function_error) - .register_column(:maximum_retry_attempts, field: :maximum_retry_attempts) - .install_filter_methods_on_resource(self, :table) + .register_column(:uuids, field: :uuid) + .register_column(:starting_positions, field: :starting_position) + .register_column(:starting_position_timestamps, field: :starting_position_timestamp) + .register_column(:batch_sizes, field: :batch_size) + .register_column(:maximum_batching_window_in_seconds, field: :maximum_batching_window_in_seconds) + .register_column(:parallelization_factors, field: :parallelization_factor) + .register_column(:event_source_arns, field: :event_source_arn) + .register_column(:function_arns, field: :function_arn) + .register_column(:last_modified, field: :last_modified) + .register_column(:last_processing_results, field: :last_processing_result) + .register_column(:states, field: :state) + .register_column(:state_transition_reasons, field: :state_transition_reason) + .register_column(:destination_configs, field: :destination_config) + .register_column(:topics, field: :topics) + .register_column(:queues, field: :queues) + .register_column(:source_access_configurations, field: :source_access_configurations) + .register_column(:maximum_record_age_in_seconds, field: :maximum_record_age_in_seconds) + .register_column(:bisect_batch_on_function_errors, field: :bisect_batch_on_function_error) + .register_column(:maximum_retry_attempts, field: :maximum_retry_attempts) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_lambda_layer_version_permission.rb b/libraries/aws_lambda_layer_version_permission.rb index cc7a0e81c..c7a429027 100644 --- a/libraries/aws_lambda_layer_version_permission.rb +++ b/libraries/aws_lambda_layer_version_permission.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSLambdaLayerVersionPermission < AwsResourceBase - name "aws_lambda_layer_version_permission" - desc "Returns the permission policy for a version of an Lambda layer." + name 'aws_lambda_layer_version_permission' + desc 'Returns the permission policy for a version of an Lambda layer.' example " describe aws_lambda_layer_version_permission(layer_name: 'LAYER_NAME', version_number: 'VERSION_NUMBER') do @@ -25,7 +25,7 @@ def initialize(opts = {}) end def layer_name - return nil unless exists? + return unless exists? @res[:layer_name] end diff --git a/libraries/aws_lambda_permission.rb b/libraries/aws_lambda_permission.rb index 7fa649b20..6339159b4 100644 --- a/libraries/aws_lambda_permission.rb +++ b/libraries/aws_lambda_permission.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSLambdaPermission < AwsResourceBase - name "aws_lambda_permission" - desc "Returns the resource-based IAM policy for a function, version, or alias." + name 'aws_lambda_permission' + desc 'Returns the resource-based IAM policy for a function, version, or alias.' example " describe aws_lambda_permission(function_name: 'LambdaFunctionName', Sid: 'StatementID') do @@ -19,15 +19,15 @@ def initialize(opts = {}) row = {} catch_aws_errors do resp = @aws.lambda_client.get_policy({ function_name: opts[:function_name] }) - statements = JSON.parse(resp.policy)["Statement"] + statements = JSON.parse(resp.policy)['Statement'] statements.each do |value| - next if value["Sid"] != opts[:Sid] + next if value['Sid'] != opts[:Sid] row = { - sid: value["Sid"], - effect: value["Effect"], - principal: value["Principal"]["Service"], - action: value["Action"], - resource: value["Resource"], + sid: value['Sid'], + effect: value['Effect'], + principal: value['Principal']['Service'], + action: value['Action'], + resource: value['Resource'], } end create_resource_methods(row.to_h) diff --git a/libraries/aws_lambda_permissions.rb b/libraries/aws_lambda_permissions.rb index c16294e26..d0de017d9 100644 --- a/libraries/aws_lambda_permissions.rb +++ b/libraries/aws_lambda_permissions.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSLambdaPermissions < AwsResourceBase - name "aws_lambda_permissions" - desc "Returns the resource-based IAM policy for a function, version, or alias." + name 'aws_lambda_permissions' + desc 'Returns the resource-based IAM policy for a function, version, or alias.' example " describe aws_lambda_permissions(function_name: 'LambdaFunctionName') do @@ -13,12 +13,12 @@ class AWSLambdaPermissions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:sids, field: :sid) - .register_column(:effects, field: :effect) - .register_column(:principals, field: :principal) - .register_column(:actions, field: :action) - .register_column(:resources, field: :resource) - .install_filter_methods_on_resource(self, :table) + .register_column(:sids, field: :sid) + .register_column(:effects, field: :effect) + .register_column(:principals, field: :principal) + .register_column(:actions, field: :action) + .register_column(:resources, field: :resource) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -31,14 +31,14 @@ def fetch_data rows = [] catch_aws_errors do resp = @aws.lambda_client.get_policy({ function_name: opts[:function_name] }) - statements = JSON.parse(resp.policy)["Statement"] + statements = JSON.parse(resp.policy)['Statement'] statements.each do |value| rows += [{ - sid: value["Sid"], - effect: value["Effect"], - principal: value["Principal"]["Service"], - action: value["Action"], - resource: value["Resource"], + sid: value['Sid'], + effect: value['Effect'], + principal: value['Principal']['Service'], + action: value['Action'], + resource: value['Resource'], }] end rows diff --git a/libraries/aws_lambda_version.rb b/libraries/aws_lambda_version.rb index c0f1abf89..9f3075419 100644 --- a/libraries/aws_lambda_version.rb +++ b/libraries/aws_lambda_version.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSLambdaVersion < AwsResourceBase - name "aws_lambda_version" - desc "Returns information about a version of an Lambda layer." + name 'aws_lambda_version' + desc 'Returns information about a version of an Lambda layer.' example " describe aws_lambda_version(layer_name: 'LAYER_NAME', version_number: 1) do @@ -23,7 +23,7 @@ def initialize(opts = {}) end def version_number - return nil unless exists? + return unless exists? @res[:version_number] end diff --git a/libraries/aws_lambda_versions.rb b/libraries/aws_lambda_versions.rb index d1265fa18..a7ee67c04 100644 --- a/libraries/aws_lambda_versions.rb +++ b/libraries/aws_lambda_versions.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSLambdaVersions < AwsResourceBase - name "aws_lambda_versions" - desc "Lists the versions of an Lambda layer." + name 'aws_lambda_versions' + desc 'Lists the versions of an Lambda layer.' example " describe aws_lambda_versions(layer_name: 'LAYER_NAME') do @@ -13,14 +13,14 @@ class AWSLambdaVersions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:layer_version_arns, field: :layer_version_arn) - .register_column(:versions, field: :version) - .register_column(:descriptions, field: :description) - .register_column(:created_dates, field: :created_date) - .register_column(:compatible_runtimes, field: :compatible_runtimes) - .register_column(:license_infos, field: :license_info) - .register_column(:compatible_architectures, field: :compatible_architectures) - .install_filter_methods_on_resource(self, :table) + .register_column(:layer_version_arns, field: :layer_version_arn) + .register_column(:versions, field: :version) + .register_column(:descriptions, field: :description) + .register_column(:created_dates, field: :created_date) + .register_column(:compatible_runtimes, field: :compatible_runtimes) + .register_column(:license_infos, field: :license_info) + .register_column(:compatible_architectures, field: :compatible_architectures) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_lambdas.rb b/libraries/aws_lambdas.rb index 40cffc32d..159631b68 100644 --- a/libraries/aws_lambdas.rb +++ b/libraries/aws_lambdas.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsLambdas < AwsResourceBase - name "aws_lambdas" - desc "Verifies generic settings for a set of lambdas." + name 'aws_lambdas' + desc 'Verifies generic settings for a set of lambdas.' example " describe aws_lambdas() do its ('count') { should eq 6} @@ -11,10 +11,10 @@ class AwsLambdas < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:arns, field: :arn) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:arns, field: :arn) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_launch_configuration.rb b/libraries/aws_launch_configuration.rb index 5ec214e2c..6acfbf49e 100644 --- a/libraries/aws_launch_configuration.rb +++ b/libraries/aws_launch_configuration.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsLaunchConfiguration < AwsResourceBase - name "aws_launch_configuration" - desc "Verifies settings for an AWS Launch Configuration." + name 'aws_launch_configuration' + desc 'Verifies settings for an AWS Launch Configuration.' example " describe aws_launch_configuration('config-name') do @@ -20,7 +20,7 @@ def initialize(opts = {}) catch_aws_errors do resp = @aws.service_client.describe_launch_configurations(launch_configuration_names: [opts[:launch_configuration_name]]) - return nil if resp.launch_configurations.nil? || resp.launch_configurations.empty? + return if resp.launch_configurations.nil? || resp.launch_configurations.empty? configuration = resp.launch_configurations[0] @name = configuration[:launch_configuration_name] @arn = configuration[:launch_configuration_arn] @@ -32,7 +32,7 @@ def initialize(opts = {}) @associate_public_ip_address = configuration[:associate_public_ip_address].nil? ? false : true @ebs_optimized = configuration[:ebs_optimized] @spot_price = configuration[:spot_price].to_f - @instance_monitoring = configuration[:instance_monitoring][:enabled] ? "detailed": "basic" + @instance_monitoring = configuration[:instance_monitoring][:enabled] ? 'detailed': 'basic' @user_data = configuration[:user_data] ? Base64.decode64(configuration[:user_data]) : nil end end diff --git a/libraries/aws_launch_configurations.rb b/libraries/aws_launch_configurations.rb index 2b296c3fc..9fcb59599 100644 --- a/libraries/aws_launch_configurations.rb +++ b/libraries/aws_launch_configurations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsLaunchConfigurations < AwsResourceBase - name "aws_launch_configurations" - desc "Verifies settings for a collection AWS Launch Configurations." + name 'aws_launch_configurations' + desc 'Verifies settings for a collection AWS Launch Configurations.' example " describe aws_launch_configurations do it { should exist } @@ -12,19 +12,19 @@ class AwsLaunchConfigurations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:names, field: :name) - .register_column(:image_ids, field: :image_id) - .register_column(:instance_types, field: :instance_type) - .register_column(:iam_instance_profiles, field: :iam_instance_profile) - .register_column(:key_names, field: :key_name) - .register_column(:security_groups, field: :security_groups) - .register_column(:associate_public_ip_addresses, field: :associate_public_ip_address) - .register_column(:ebs_optimizeds, field: :ebs_optimized) - .register_column(:spot_prices, field: :spot_price) - .register_column(:instance_monitoring, field: :instance_monitoring) - .register_column(:user_data, field: :user_data) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:names, field: :name) + .register_column(:image_ids, field: :image_id) + .register_column(:instance_types, field: :instance_type) + .register_column(:iam_instance_profiles, field: :iam_instance_profile) + .register_column(:key_names, field: :key_name) + .register_column(:security_groups, field: :security_groups) + .register_column(:associate_public_ip_addresses, field: :associate_public_ip_address) + .register_column(:ebs_optimizeds, field: :ebs_optimized) + .register_column(:spot_prices, field: :spot_price) + .register_column(:instance_monitoring, field: :instance_monitoring) + .register_column(:user_data, field: :user_data) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -48,7 +48,7 @@ def fetch_data associate_public_ip_address: config[:associate_public_ip_address].nil? ? false : true, ebs_optimized: config[:ebs_optimized], spot_price: config[:spot_price].to_f, - instance_monitoring: config[:instance_monitoring][:enabled] ? "detailed": "basic", + instance_monitoring: config[:instance_monitoring][:enabled] ? 'detailed': 'basic', user_data: config[:user_data] ? Base64.decode64(config[:user_data]) : nil }] end end diff --git a/libraries/aws_logs_metric_filter.rb b/libraries/aws_logs_metric_filter.rb index f4f033b50..8ad48c50c 100644 --- a/libraries/aws_logs_metric_filter.rb +++ b/libraries/aws_logs_metric_filter.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSLogsMetricFilter < AwsResourceBase - name "aws_logs_metric_filter" - desc "Lists the specified metric filters." + name 'aws_logs_metric_filter' + desc 'Lists the specified metric filters.' example " describe aws_logs_metric_filter(filter_name: 'FilterName') do @@ -30,7 +30,7 @@ def resource_id end def filter_name - return nil unless exists? + return unless exists? @metric_filters[:filter_name_prefix] end diff --git a/libraries/aws_logs_metric_filters.rb b/libraries/aws_logs_metric_filters.rb index 6f262c090..e71af7f31 100644 --- a/libraries/aws_logs_metric_filters.rb +++ b/libraries/aws_logs_metric_filters.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSLogsMetricFilters < AwsResourceBase - name "aws_logs_metric_filters" - desc "Lists the specified metric filters." + name 'aws_logs_metric_filters' + desc 'Lists the specified metric filters.' example " describe aws_logs_metric_filters do @@ -13,12 +13,12 @@ class AWSLogsMetricFilters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:filter_names, field: :filter_name) - .register_column(:filter_patterns, field: :filter_pattern) - .register_column(:metric_transformations, field: :metric_transformations) - .register_column(:creation_times, field: :creation_time) - .register_column(:log_group_names, field: :log_group_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:filter_names, field: :filter_name) + .register_column(:filter_patterns, field: :filter_pattern) + .register_column(:metric_transformations, field: :metric_transformations) + .register_column(:creation_times, field: :creation_time) + .register_column(:log_group_names, field: :log_group_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_mq_broker.rb b/libraries/aws_mq_broker.rb index 5ddfe09ef..48a524948 100644 --- a/libraries/aws_mq_broker.rb +++ b/libraries/aws_mq_broker.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSMQBroker < AwsResourceBase - name "aws_mq_broker" - desc "Describes a Amazon MQ broker." + name 'aws_mq_broker' + desc 'Describes a Amazon MQ broker.' example " describe aws_mq_broker(broker_id: 'test1') do @@ -22,7 +22,7 @@ def initialize(opts = {}) end def broker_id - return nil unless exists? + return unless exists? @brokers[:broker_id] end diff --git a/libraries/aws_mq_brokers.rb b/libraries/aws_mq_brokers.rb index 83a53131e..6d5358a6d 100644 --- a/libraries/aws_mq_brokers.rb +++ b/libraries/aws_mq_brokers.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSMQBrokers < AwsResourceBase - name "aws_mq_brokers" - desc "Describes a list of aws mq broker." + name 'aws_mq_brokers' + desc 'Describes a list of aws mq broker.' example " describe aws_mq_brokers do @@ -13,16 +13,16 @@ class AWSMQBrokers < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:broker_arns, field: :broker_arn) - .register_column(:broker_ids, field: :broker_id) - .register_column(:broker_names, field: :broker_name) - .register_column(:broker_states, field: :broker_state) - .register_column(:created, field: :created) - .register_column(:deployment_modes, field: :deployment_mode) - .register_column(:engine_types, field: :engine_type) - .register_column(:propagate_tags, field: :propagate_tags) - .register_column(:host_instance_types, field: :host_instance_type) - .install_filter_methods_on_resource(self, :table) + .register_column(:broker_arns, field: :broker_arn) + .register_column(:broker_ids, field: :broker_id) + .register_column(:broker_names, field: :broker_name) + .register_column(:broker_states, field: :broker_state) + .register_column(:created, field: :created) + .register_column(:deployment_modes, field: :deployment_mode) + .register_column(:engine_types, field: :engine_type) + .register_column(:propagate_tags, field: :propagate_tags) + .register_column(:host_instance_types, field: :host_instance_type) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_mq_configuration.rb b/libraries/aws_mq_configuration.rb index 069dff7e6..bf21dde48 100644 --- a/libraries/aws_mq_configuration.rb +++ b/libraries/aws_mq_configuration.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSMQConfiguration < AwsResourceBase - name "aws_mq_configuration" - desc "Returns information about the specified configuration." + name 'aws_mq_configuration' + desc 'Returns information about the specified configuration.' example <<-EXAMPLE describe aws_mq_configuration(configuration_id: 'CONFIGURATION_ID') do it { should exist } @@ -34,7 +34,7 @@ def exists? end def configuration_id - return nil unless exists? + return unless exists? @configurations[:id] end diff --git a/libraries/aws_mq_configurations.rb b/libraries/aws_mq_configurations.rb index 539e9acf7..43410921a 100644 --- a/libraries/aws_mq_configurations.rb +++ b/libraries/aws_mq_configurations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSMQConfigurations < AwsResourceBase - name "aws_mq_configurations" - desc "Describes a list of aws mq broker." + name 'aws_mq_configurations' + desc 'Describes a list of aws mq broker.' example " describe aws_mq_configurations do @@ -13,16 +13,16 @@ class AWSMQConfigurations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:authentication_strategies, field: :authentication_strategy) - .register_column(:description, field: :description) - .register_column(:created, field: :created) - .register_column(:engine_types, field: :engine_type) - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:engine_version, field: :engine_version) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:authentication_strategies, field: :authentication_strategy) + .register_column(:description, field: :description) + .register_column(:created, field: :created) + .register_column(:engine_types, field: :engine_type) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:engine_version, field: :engine_version) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_nat_gateway.rb b/libraries/aws_nat_gateway.rb index 586ea2274..e4ef66cdc 100644 --- a/libraries/aws_nat_gateway.rb +++ b/libraries/aws_nat_gateway.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsNatGateway < AwsResourceBase - name "aws_nat_gateway" - desc "Verifies settings for an AWS NAT Gateway." + name 'aws_nat_gateway' + desc 'Verifies settings for an AWS NAT Gateway.' example " describe aws_nat_gateway(id: 'nat-11aa578bffadf6ba6') do @@ -31,24 +31,24 @@ def initialize(opts = {}) if opts.key?(:id) id = opts[:id].to_s raise ArgumentError, "#{@__resource_name__}: `id` must be a string in the format of 'nat-' followed by 8 or 17 hexadecimal characters." unless /^nat-[0-9a-f]{8,17}$/.match?(id) - filter << { name: "nat-gateway-id", values: [id] } + filter << { name: 'nat-gateway-id', values: [id] } end if opts.key?(:name) name = opts[:name].to_s raise ArgumentError, "#{@__resource_name__}: `name` must be maximum 255 characters long." unless name.length < 256 - filter << { name: "tag:Name", values: [name] } + filter << { name: 'tag:Name', values: [name] } end if opts.key?(:vpc_id) vpc_id = opts[:vpc_id].to_s raise ArgumentError, "#{@__resource_name__}: `vpc_id` must be a string in the format of 'vpc-' followed by 8 or 17 hexadecimal characters." unless /^vpc-[0-9a-f]{8,17}$/.match?(vpc_id) - filter << { name: "vpc-id", values: [vpc_id] } + filter << { name: 'vpc-id', values: [vpc_id] } end if opts.key?(:subnet_id) subnet_id = opts[:subnet_id].to_s raise ArgumentError, "#{@__resource_name__}: `subnet_id` must be a string in the format of 'subnet-' followed by 8 or 17 hexadecimal characters." unless /^subnet-[0-9a-f]{8,17}$/.match?(subnet_id) - filter << { name: "subnet-id", values: [subnet_id] } + filter << { name: 'subnet-id', values: [subnet_id] } end - @display_name = opts.slice(:id, :subnet_id, :name, :vpc_id).values.join(" ") + @display_name = opts.slice(:id, :subnet_id, :name, :vpc_id).values.join(' ') query_params = { filter: filter } catch_aws_errors do diff --git a/libraries/aws_nat_gateways.rb b/libraries/aws_nat_gateways.rb index 422523ff9..1c2d89b2b 100644 --- a/libraries/aws_nat_gateways.rb +++ b/libraries/aws_nat_gateways.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsNatGateways < AwsResourceBase - name "aws_nat_gateways" - desc "Verifies settings for a collection of AWS NAT gateways." + name 'aws_nat_gateways' + desc 'Verifies settings for a collection of AWS NAT gateways.' example " describe aws_nat_gateways do @@ -17,14 +17,14 @@ class AwsNatGateways < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:tags, field: :tags) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:subnet_ids, field: :subnet_id) - .register_column(:states, field: :state) - .register_column(:nat_gateways, field: :nat_gateway) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:tags, field: :tags) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:subnet_ids, field: :subnet_id) + .register_column(:states, field: :state) + .register_column(:nat_gateways, field: :nat_gateway) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -50,7 +50,7 @@ def fetch_data ngw_rows += [{ id: ngw.nat_gateway_id, tags: ngw_tags, - name: ngw_tags["Name"], + name: ngw_tags['Name'], subnet_id: ngw.subnet_id, vpc_id: ngw.vpc_id, state: ngw.state, diff --git a/libraries/aws_network_acl.rb b/libraries/aws_network_acl.rb index 1ed0e6155..6ae4c8420 100644 --- a/libraries/aws_network_acl.rb +++ b/libraries/aws_network_acl.rb @@ -1,10 +1,10 @@ -require "aws_backend" +require 'aws_backend' class AwsNetworkACL < AwsResourceBase - EGRESS = "egress".freeze - INGRESS = "ingress".freeze - name "aws_network_acl" - desc "Verifies settings for a single AWS Network ACL" + EGRESS = 'egress'.freeze + INGRESS = 'ingress'.freeze + name 'aws_network_acl' + desc 'Verifies settings for a single AWS Network ACL' example " describe aws_network_acl(network_acl_id: '014aef8a0689b8f43') do it { should exist } @@ -54,7 +54,7 @@ def has_associations?(subnet_id: nil) def has_acl_entry_value?(cidr_block:, egress:, rule_action:) invalid_args = method(__method__).parameters.select { |param| param.nil? || param.empty? } - raise ArgumentError, "params #{invalid_args.map { |i| "`#{i}`" }.join(",")} cannot be blank" if cidr_block.nil? || cidr_block.empty? + raise ArgumentError, "params #{invalid_args.map { |i| "`#{i}`" }.join(',')} cannot be blank" if cidr_block.nil? || cidr_block.empty? return false unless acl_entries acl_entries.any? { |entry| entry.egress == egress && entry.cidr_block == cidr_block && entry.rule_action == rule_action } @@ -83,7 +83,7 @@ def ingress end def resource_id - @response ? @response.network_acls.first.network_acl_id : "" + @response ? @response.network_acls.first.network_acl_id : '' end def to_s @@ -141,8 +141,8 @@ def create_rule_number_methods end def validate_identifier - raise ArgumentError, "parameter `network_acl_id` cannot be blank" if @opts[:network_acl_id].nil? || @opts[:network_acl_id].empty? - raise ArgumentError, "parameter `network_acl_id` should start with `acl-` followed by alpha numeric characters" if @opts[:network_acl_id] !~ /^acl-[a-z0-9]+$/ + raise ArgumentError, 'parameter `network_acl_id` cannot be blank' if @opts[:network_acl_id].nil? || @opts[:network_acl_id].empty? + raise ArgumentError, 'parameter `network_acl_id` should start with `acl-` followed by alpha numeric characters' if @opts[:network_acl_id] !~ /^acl-[a-z0-9]+$/ end def cidr_block_and_rule_action_exists_for?(collection, cidr_block, rule_action) diff --git a/libraries/aws_network_acls.rb b/libraries/aws_network_acls.rb index c4d78fb2d..e4a46e4a0 100644 --- a/libraries/aws_network_acls.rb +++ b/libraries/aws_network_acls.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsNetworkACLs < AwsResourceBase - name "aws_network_acls" - desc "Verifies settings for a collection of AWS internet gateways." + name 'aws_network_acls' + desc 'Verifies settings for a collection of AWS internet gateways.' example " describe aws_network_acls do @@ -17,11 +17,11 @@ class AwsNetworkACLs < AwsResourceBase attr_reader :table filter_table_config = FilterTable.create - .register_column(:network_acl_ids, field: :network_acl_id) - .register_column(:default, field: :default) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:tags, field: :tags) + .register_column(:network_acl_ids, field: :network_acl_id) + .register_column(:default, field: :default) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:tags, field: :tags) # fields that needs to be customized as flattened Arrays %i(default_network_acl_ids associated_subnet_ids network_acl_association_ids entries_cidr_blocks entries_cidr_egress entries_icmp_type_codes entries_icmp_type_code_types entries_ipv_6_cidr_blocks entries_port_ranges entries_protocols entries_rule_actions @@ -68,20 +68,20 @@ def flat_hash_from(network_acl) network_acl_hash[:default] = network_acl_hash[:is_default] network_acl_hash[:default_network_acl_ids] = network_acl_hash.delete(:is_default) ? network_acl.network_acl_id : nil # Associations - network_acl_hash[:associated_subnet_ids] = mappable_attribute_from(network_acl.associations, "subnet_id") - network_acl_hash[:network_acl_association_ids] = mappable_attribute_from(network_acl.associations, "network_acl_association_id") + network_acl_hash[:associated_subnet_ids] = mappable_attribute_from(network_acl.associations, 'subnet_id') + network_acl_hash[:network_acl_association_ids] = mappable_attribute_from(network_acl.associations, 'network_acl_association_id') # Entries - network_acl_hash[:entries_cidr_blocks] = mappable_attribute_from(network_acl.entries, "cidr_block") - network_acl_hash[:entries_cidr_egress] = mappable_attribute_from(network_acl.entries, "egress") - network_acl_hash[:entries_icmp_type_codes] = mappable_attribute_from(network_acl.entries, "icmp_type_code&.code") - network_acl_hash[:entries_icmp_type_code_types] = mappable_attribute_from(network_acl.entries, "icmp_type_code&.type") - network_acl_hash[:entries_ipv_6_cidr_blocks] = mappable_attribute_from(network_acl.entries, "ipv_6_cidr_block") + network_acl_hash[:entries_cidr_blocks] = mappable_attribute_from(network_acl.entries, 'cidr_block') + network_acl_hash[:entries_cidr_egress] = mappable_attribute_from(network_acl.entries, 'egress') + network_acl_hash[:entries_icmp_type_codes] = mappable_attribute_from(network_acl.entries, 'icmp_type_code&.code') + network_acl_hash[:entries_icmp_type_code_types] = mappable_attribute_from(network_acl.entries, 'icmp_type_code&.type') + network_acl_hash[:entries_ipv_6_cidr_blocks] = mappable_attribute_from(network_acl.entries, 'ipv_6_cidr_block') network_acl_hash[:entries_port_ranges] = mapped_port_ranges_for(network_acl.entries) - network_acl_hash[:entries_protocols] = mappable_attribute_from(network_acl.entries, "protocol") - network_acl_hash[:entries_rule_actions] = mappable_attribute_from(network_acl.entries, "rule_action") - network_acl_hash[:entries_rule_numbers] = mappable_attribute_from(network_acl.entries, "rule_number") - network_acl_hash[:egress_rule_numbers] = mappable_attribute_from(network_acl.entries.select(&:egress), "rule_number") - network_acl_hash[:ingress_rule_numbers] = mappable_attribute_from(network_acl.entries.reject(&:egress), "rule_number") + network_acl_hash[:entries_protocols] = mappable_attribute_from(network_acl.entries, 'protocol') + network_acl_hash[:entries_rule_actions] = mappable_attribute_from(network_acl.entries, 'rule_action') + network_acl_hash[:entries_rule_numbers] = mappable_attribute_from(network_acl.entries, 'rule_number') + network_acl_hash[:egress_rule_numbers] = mappable_attribute_from(network_acl.entries.select(&:egress), 'rule_number') + network_acl_hash[:ingress_rule_numbers] = mappable_attribute_from(network_acl.entries.reject(&:egress), 'rule_number') # Tags network_acl_hash[:tags] = network_acl.tags.empty? ? nil : map_tags(network_acl.tags) network_acl_hash.delete(:associations) diff --git a/libraries/aws_network_firewall_firewall.rb b/libraries/aws_network_firewall_firewall.rb index dc3b7eb6c..06d6af58d 100644 --- a/libraries/aws_network_firewall_firewall.rb +++ b/libraries/aws_network_firewall_firewall.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSNetworkFirewallFirewall < AwsResourceBase - name "aws_network_firewall_firewall" - desc "Returns the data objects for the specified firewall." + name 'aws_network_firewall_firewall' + desc 'Returns the data objects for the specified firewall.' example " describe aws_network_firewall_firewall(firewall_name: 'FirewallName') do @@ -25,7 +25,7 @@ def initialize(opts = {}) end def firewall_name - return nil unless exists? + return unless exists? @res[:firewall_name] end diff --git a/libraries/aws_network_firewall_firewall_policies.rb b/libraries/aws_network_firewall_firewall_policies.rb index 5eab80643..9217f195f 100644 --- a/libraries/aws_network_firewall_firewall_policies.rb +++ b/libraries/aws_network_firewall_firewall_policies.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsNetworkFirewallFirewallPolicies < AwsResourceBase - name "aws_network_firewall_firewall_policies" - desc "Retrieves the metadata for the firewall policies that you have defined." + name 'aws_network_firewall_firewall_policies' + desc 'Retrieves the metadata for the firewall policies that you have defined.' example " describe aws_network_firewall_firewalls do @@ -13,9 +13,9 @@ class AwsNetworkFirewallFirewallPolicies < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:arns, field: :arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:arns, field: :arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_network_firewall_firewall_policy.rb b/libraries/aws_network_firewall_firewall_policy.rb index ae71e423c..c29b5d2e9 100644 --- a/libraries/aws_network_firewall_firewall_policy.rb +++ b/libraries/aws_network_firewall_firewall_policy.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsNetworkFirewallFirewallPolicy < AwsResourceBase - name "aws_network_firewall_firewall_policy" - desc "Returns the data objects for the specified firewall policy." + name 'aws_network_firewall_firewall_policy' + desc 'Returns the data objects for the specified firewall policy.' example " describe aws_network_firewall_firewall_policy(firewall_policy_name: 'FirewallPolicyName') do @@ -25,7 +25,7 @@ def initialize(opts = {}) end def firewall_policy_name - return nil unless exists? + return unless exists? @res[:firewall_policy_name] end diff --git a/libraries/aws_network_firewall_firewalls.rb b/libraries/aws_network_firewall_firewalls.rb index d98546202..76ea5b6b7 100644 --- a/libraries/aws_network_firewall_firewalls.rb +++ b/libraries/aws_network_firewall_firewalls.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSNetworkFirewallFirewalls < AwsResourceBase - name "aws_network_firewall_firewalls" - desc "Retrieves the metadata for the firewalls that you have defined." + name 'aws_network_firewall_firewalls' + desc 'Retrieves the metadata for the firewalls that you have defined.' example " describe aws_network_firewall_firewalls do @@ -13,9 +13,9 @@ class AWSNetworkFirewallFirewalls < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:firewall_names, field: :firewall_name) - .register_column(:firewall_arns, field: :firewall_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:firewall_names, field: :firewall_name) + .register_column(:firewall_arns, field: :firewall_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_network_firewall_logging_configuration.rb b/libraries/aws_network_firewall_logging_configuration.rb index 3eef38fc5..bd776db95 100644 --- a/libraries/aws_network_firewall_logging_configuration.rb +++ b/libraries/aws_network_firewall_logging_configuration.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSNetworkFirewallLoggingConfiguration < AwsResourceBase - name "aws_network_firewall_logging_configuration" - desc "Returns the logging configuration for the specified firewall." + name 'aws_network_firewall_logging_configuration' + desc 'Returns the logging configuration for the specified firewall.' example " describe aws_network_firewall_logging_configuration(firewall_name: 'FirewallName') do @@ -24,12 +24,12 @@ def initialize(opts = {}) end def firewall_name - return nil unless exists? + return unless exists? @res[:firewall_name] end def resource_id - @res? @res[:firewall_arn]: "" + @res? @res[:firewall_arn]: '' end def exists? diff --git a/libraries/aws_network_firewall_rule_group.rb b/libraries/aws_network_firewall_rule_group.rb index 6bb98514e..49f838513 100644 --- a/libraries/aws_network_firewall_rule_group.rb +++ b/libraries/aws_network_firewall_rule_group.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSNetworkFirewallRuleGroup < AwsResourceBase - name "aws_network_firewall_rule_group" - desc "Returns the data objects for the specified rule group." + name 'aws_network_firewall_rule_group' + desc 'Returns the data objects for the specified rule group.' example " describe aws_network_firewall_rule_group(rule_group_arn: 'RuleGroupName') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def rule_group_arn - return nil unless exists? + return unless exists? @res[:rule_group_arn] end diff --git a/libraries/aws_network_firewall_rule_groups.rb b/libraries/aws_network_firewall_rule_groups.rb index c34ddd03c..49e1570ec 100644 --- a/libraries/aws_network_firewall_rule_groups.rb +++ b/libraries/aws_network_firewall_rule_groups.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSNetworkFirewallRuleGroups < AwsResourceBase - name "aws_network_firewall_rule_groups" - desc "Retrieves the metadata for the rule groups that you have defined." + name 'aws_network_firewall_rule_groups' + desc 'Retrieves the metadata for the rule groups that you have defined.' example " describe aws_network_firewall_rule_groups do @@ -13,9 +13,9 @@ class AWSNetworkFirewallRuleGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:arns, field: :arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:arns, field: :arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_network_manager_customer_gateway_association.rb b/libraries/aws_network_manager_customer_gateway_association.rb index 0407a3296..4e126044d 100644 --- a/libraries/aws_network_manager_customer_gateway_association.rb +++ b/libraries/aws_network_manager_customer_gateway_association.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSNetworkManagerCustomerGatewayAssociation < AwsResourceBase - name "aws_network_manager_customer_gateway_association" - desc "Gets the association information for customer gateways that are associated with devices and links in your global network." + name 'aws_network_manager_customer_gateway_association' + desc 'Gets the association information for customer gateways that are associated with devices and links in your global network.' example " describe aws_network_manager_customer_gateway_association(global_network_id: 'GlobalNetworkID', customer_gateway_arn: 'CustomerGatewayARN') do @@ -26,7 +26,7 @@ def initialize(opts = {}) end def customer_gateway_arn - return nil unless exists? + return unless exists? @res[:customer_gateway_arn] end diff --git a/libraries/aws_network_manager_customer_gateway_associations.rb b/libraries/aws_network_manager_customer_gateway_associations.rb index 609af714c..43e7f22e4 100644 --- a/libraries/aws_network_manager_customer_gateway_associations.rb +++ b/libraries/aws_network_manager_customer_gateway_associations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSNetworkManagerCustomerGatewayAssociations < AwsResourceBase - name "aws_network_manager_customer_gateway_associations" - desc "Gets the association information for customer gateways that are associated with devices and links in your global network." + name 'aws_network_manager_customer_gateway_associations' + desc 'Gets the association information for customer gateways that are associated with devices and links in your global network.' example " describe aws_network_manager_customer_gateway_associations(global_network_id: 'GlobalNetworkID') do @@ -13,13 +13,13 @@ class AWSNetworkManagerCustomerGatewayAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:customer_gateway_arns, field: :customer_gateway_arn) - .register_column(:global_network_ids, field: :global_network_id) - .register_column(:device_ids, field: :device_id) - .register_column(:link_ids, field: :link_id) - .register_column(:states, field: :state) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:customer_gateway_arns, field: :customer_gateway_arn) + .register_column(:global_network_ids, field: :global_network_id) + .register_column(:device_ids, field: :device_id) + .register_column(:link_ids, field: :link_id) + .register_column(:states, field: :state) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_network_manager_device.rb b/libraries/aws_network_manager_device.rb index 19dd6a489..2d9878ea6 100644 --- a/libraries/aws_network_manager_device.rb +++ b/libraries/aws_network_manager_device.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSNetworkManagerDevice < AwsResourceBase - name "aws_network_manager_device" - desc "Gets information about one or more of your devices in a global network." + name 'aws_network_manager_device' + desc 'Gets information about one or more of your devices in a global network.' example " describe aws_network_manager_device(device_id: 'test1', global_network_id: 'test1') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def device_id - return nil unless exists? + return unless exists? @res[:device_id] end diff --git a/libraries/aws_network_manager_devices.rb b/libraries/aws_network_manager_devices.rb index 00a61a92f..98341751b 100644 --- a/libraries/aws_network_manager_devices.rb +++ b/libraries/aws_network_manager_devices.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSNetworkManagerDevices < AwsResourceBase - name "aws_network_manager_devices" - desc "List all the devices." + name 'aws_network_manager_devices' + desc 'List all the devices.' example " describe aws_network_manager_devices(global_network_id: 'GlobalNetworkID') do @@ -13,24 +13,24 @@ class AWSNetworkManagerDevices < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:device_ids, field: :device_id) - .register_column(:device_arns, field: :device_arn) - .register_column(:global_network_ids, field: :global_network_id) - .register_column(:location_zones, field: :location_zones, style: :simple) - .register_column(:location_subnet_arns, field: :location_subnet_arn, style: :simple) - .register_column(:descriptions, field: :description) - .register_column(:types, field: :type) - .register_column(:vendors, field: :vendor) - .register_column(:models, field: :model) - .register_column(:serial_numbers, field: :serial_number) - .register_column(:addresses, field: :address, style: :simple) - .register_column(:latitudes, field: :latitude, style: :simple) - .register_column(:longitudes, field: :longitude, style: :simple) - .register_column(:site_ids, field: :site_id) - .register_column(:created_at, field: :created_at) - .register_column(:states, field: :state) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:device_ids, field: :device_id) + .register_column(:device_arns, field: :device_arn) + .register_column(:global_network_ids, field: :global_network_id) + .register_column(:location_zones, field: :location_zones, style: :simple) + .register_column(:location_subnet_arns, field: :location_subnet_arn, style: :simple) + .register_column(:descriptions, field: :description) + .register_column(:types, field: :type) + .register_column(:vendors, field: :vendor) + .register_column(:models, field: :model) + .register_column(:serial_numbers, field: :serial_number) + .register_column(:addresses, field: :address, style: :simple) + .register_column(:latitudes, field: :latitude, style: :simple) + .register_column(:longitudes, field: :longitude, style: :simple) + .register_column(:site_ids, field: :site_id) + .register_column(:created_at, field: :created_at) + .register_column(:states, field: :state) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_network_manager_global_network.rb b/libraries/aws_network_manager_global_network.rb index 56c67adad..a50b740de 100644 --- a/libraries/aws_network_manager_global_network.rb +++ b/libraries/aws_network_manager_global_network.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSNetworkManagerGlobalNetwork < AwsResourceBase - name "aws_network_manager_global_network" - desc "Describes one or more global networks." + name 'aws_network_manager_global_network' + desc 'Describes one or more global networks.' example " describe aws_network_manager_global_network(global_network_id: 'test1') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def global_network_id - return nil unless exists? + return unless exists? @res[:global_network_id] end diff --git a/libraries/aws_network_manager_global_networks.rb b/libraries/aws_network_manager_global_networks.rb index 78c4b55ba..ffa2cd3e5 100644 --- a/libraries/aws_network_manager_global_networks.rb +++ b/libraries/aws_network_manager_global_networks.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSNetworkManagerGlobalNetworks < AwsResourceBase - name "aws_network_manager_global_networks" - desc "List all the global networks." + name 'aws_network_manager_global_networks' + desc 'List all the global networks.' example " describe aws_network_manager_global_networks do @@ -13,13 +13,13 @@ class AWSNetworkManagerGlobalNetworks < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:global_network_ids, field: :global_network_id) - .register_column(:global_network_arns, field: :global_network_arn) - .register_column(:descriptions, field: :description) - .register_column(:created_at, field: :created_at) - .register_column(:states, field: :state) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:global_network_ids, field: :global_network_id) + .register_column(:global_network_arns, field: :global_network_arn) + .register_column(:descriptions, field: :description) + .register_column(:created_at, field: :created_at) + .register_column(:states, field: :state) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_organizations_member.rb b/libraries/aws_organizations_member.rb index 54c62fb92..391408be9 100644 --- a/libraries/aws_organizations_member.rb +++ b/libraries/aws_organizations_member.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsOrganizationsMember < AwsResourceBase - name "aws_organizations_member" - desc "Verifies status of the current AWWS Account within Organizations service." + name 'aws_organizations_member' + desc 'Verifies status of the current AWWS Account within Organizations service.' example " describe aws_organizations_member do it { should_not be_master } @@ -15,11 +15,11 @@ class AwsOrganizationsMember < AwsResourceBase alias master? master def initialize(opts = {}) - raise "Expected parameter opts to be a Hash." if !opts.nil? && !opts.is_a?(Hash) + raise 'Expected parameter opts to be a Hash.' if !opts.nil? && !opts.is_a?(Hash) # Operations on Organizations must target us-east-1, see # https://docs.aws.amazon.com/organizations/latest/APIReference/Welcome.html - opts[:aws_region] = "us-east-1" + opts[:aws_region] = 'us-east-1' super(opts) validate_parameters @@ -58,7 +58,7 @@ def exists? end def to_s - "Organizations Member Status" + 'Organizations Member Status' end private @@ -66,6 +66,6 @@ def to_s # Fetch AWS Account Number def fetch_id arn = @aws.sts_client.get_caller_identity({}).arn - arn.split(":")[4] + arn.split(':')[4] end end diff --git a/libraries/aws_ram_resource_share.rb b/libraries/aws_ram_resource_share.rb index 7c56be5ad..62831d95a 100644 --- a/libraries/aws_ram_resource_share.rb +++ b/libraries/aws_ram_resource_share.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRAMResourceShare < AwsResourceBase - name "aws_ram_resource_share" - desc "Describes the resource shares of the ram." + name 'aws_ram_resource_share' + desc 'Describes the resource shares of the ram.' example " describe aws_ram_resource_share(resource_owner: 'SELF', resource_share_arn: 'resource_share_arn_test') do @@ -25,7 +25,7 @@ def initialize(opts = {}) end def resource_share_arn - return nil unless exists? + return unless exists? @res[:resource_share_arn] end diff --git a/libraries/aws_ram_resource_shares.rb b/libraries/aws_ram_resource_shares.rb index 5aaed54df..ab2b01051 100644 --- a/libraries/aws_ram_resource_shares.rb +++ b/libraries/aws_ram_resource_shares.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRAMResourceShares < AwsResourceBase - name "aws_ram_resource_shares" - desc "Lists the resources that you added to a resource shares or the resources that are shared with you." + name 'aws_ram_resource_shares' + desc 'Lists the resources that you added to a resource shares or the resources that are shared with you.' example " describe aws_ram_resource_shares(resource_owner: 'SELF') do @@ -13,17 +13,17 @@ class AWSRAMResourceShares < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:resource_share_arns, field: :resource_share_arn) - .register_column(:names, field: :name) - .register_column(:owning_account_ids, field: :owning_account_id) - .register_column(:allow_external_principals, field: :allow_external_principals) - .register_column(:statuses, field: :status) - .register_column(:status_messages, field: :status_message) - .register_column(:tags, field: :tags) - .register_column(:creation_times, field: :creation_time) - .register_column(:last_updated_times, field: :last_updated_time) - .register_column(:feature_sets, field: :feature_set) - .install_filter_methods_on_resource(self, :table) + .register_column(:resource_share_arns, field: :resource_share_arn) + .register_column(:names, field: :name) + .register_column(:owning_account_ids, field: :owning_account_id) + .register_column(:allow_external_principals, field: :allow_external_principals) + .register_column(:statuses, field: :status) + .register_column(:status_messages, field: :status_message) + .register_column(:tags, field: :tags) + .register_column(:creation_times, field: :creation_time) + .register_column(:last_updated_times, field: :last_updated_time) + .register_column(:feature_sets, field: :feature_set) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_cluster.rb b/libraries/aws_rds_cluster.rb index cd61f81d0..cdb46ba13 100644 --- a/libraries/aws_rds_cluster.rb +++ b/libraries/aws_rds_cluster.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRdsCluster < AwsResourceBase - name "aws_rds_cluster" - desc "Verifies settings for an RDS Cluster." + name 'aws_rds_cluster' + desc 'Verifies settings for an RDS Cluster.' example " describe aws_rds_cluster(db_cluster_identifier: 'test-cluster-id') do diff --git a/libraries/aws_rds_clusters.rb b/libraries/aws_rds_clusters.rb index a65e3b256..8d1ab6f43 100644 --- a/libraries/aws_rds_clusters.rb +++ b/libraries/aws_rds_clusters.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRdsClusters < AwsResourceBase - name "aws_rds_clusters" - desc "Verifies settings for a collection AWS RDS Clusters." + name 'aws_rds_clusters' + desc 'Verifies settings for a collection AWS RDS Clusters.' example " describe aws_rds_clusters do it { should exist } @@ -12,18 +12,18 @@ class AwsRdsClusters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:cluster_identifier, field: :cluster_identifier) - .register_column(:database_name, field: :database_name) - .register_column(:cluster_members, field: :cluster_members) - .register_column(:engine, field: :engine) - .register_column(:engine_version, field: :engine_version) - .register_column(:status, field: :status) - .register_column(:allocated_storage, field: :allocated_storage) - .register_column(:storage_encrypted, field: :storage_encrypted) - .register_column(:availability_zones, field: :availability_zones) - .register_column(:multi_az, field: :multi_az) - .register_column(:arn, field: :arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:cluster_identifier, field: :cluster_identifier) + .register_column(:database_name, field: :database_name) + .register_column(:cluster_members, field: :cluster_members) + .register_column(:engine, field: :engine) + .register_column(:engine_version, field: :engine_version) + .register_column(:status, field: :status) + .register_column(:allocated_storage, field: :allocated_storage) + .register_column(:storage_encrypted, field: :storage_encrypted) + .register_column(:availability_zones, field: :availability_zones) + .register_column(:multi_az, field: :multi_az) + .register_column(:arn, field: :arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_db_cluster_snapshot.rb b/libraries/aws_rds_db_cluster_snapshot.rb index a7de8acb0..95f72c70f 100644 --- a/libraries/aws_rds_db_cluster_snapshot.rb +++ b/libraries/aws_rds_db_cluster_snapshot.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRDSDBClusterSnapShot < AwsResourceBase - name "aws_rds_db_cluster_snapshot" - desc "Returns information about DB cluster snapshots." + name 'aws_rds_db_cluster_snapshot' + desc 'Returns information about DB cluster snapshots.' example " describe aws_rds_db_cluster_snapshot(db_cluster_snapshot_id: 'DBSnapshotID') do @@ -18,7 +18,7 @@ def initialize(opts = {}) @display_name = opts[:db_cluster_snapshot_id] filter = [ { - name: "db-cluster-snapshot-id", + name: 'db-cluster-snapshot-id', values: [opts[:db_cluster_snapshot_id]], }, ] @@ -31,7 +31,7 @@ def initialize(opts = {}) end def db_cluster_snapshot_id - return nil unless exists? + return unless exists? @res[:db_cluster_snapshot_id] end diff --git a/libraries/aws_rds_db_cluster_snapshots.rb b/libraries/aws_rds_db_cluster_snapshots.rb index 723748d6f..83d6c520e 100644 --- a/libraries/aws_rds_db_cluster_snapshots.rb +++ b/libraries/aws_rds_db_cluster_snapshots.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRDSDBClusterSnapShots < AwsResourceBase - name "aws_rds_db_cluster_snapshots" - desc "Returns information about DB cluster snapshots." + name 'aws_rds_db_cluster_snapshots' + desc 'Returns information about DB cluster snapshots.' example " describe aws_rds_db_cluster_snapshots do @@ -13,29 +13,29 @@ class AWSRDSDBClusterSnapShots < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:availability_zones, field: :availability_zones) - .register_column(:db_cluster_snapshot_identifiers, field: :db_cluster_snapshot_identifier) - .register_column(:db_cluster_identifiers, field: :db_cluster_identifier) - .register_column(:snapshot_create_times, field: :snapshot_create_time) - .register_column(:engines, field: :engine) - .register_column(:engine_modes, field: :engine_mode) - .register_column(:allocated_storages, field: :allocated_storage) - .register_column(:statuses, field: :status) - .register_column(:ports, field: :port) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:cluster_create_times, field: :cluster_create_time) - .register_column(:master_usernames, field: :master_username) - .register_column(:engine_versions, field: :engine_version) - .register_column(:license_models, field: :license_model) - .register_column(:snapshot_types, field: :snapshot_type) - .register_column(:percent_progresses, field: :percent_progress) - .register_column(:storage_encrypted, field: :storage_encrypted) - .register_column(:kms_key_ids, field: :kms_key_id) - .register_column(:db_cluster_snapshot_arns, field: :db_cluster_snapshot_arn) - .register_column(:source_db_cluster_snapshot_arns, field: :source_db_cluster_snapshot_arn) - .register_column(:iam_database_authentication_enabled, field: :iam_database_authentication_enabled) - .register_column(:tag_lists, field: :tag_list) - .install_filter_methods_on_resource(self, :table) + .register_column(:availability_zones, field: :availability_zones) + .register_column(:db_cluster_snapshot_identifiers, field: :db_cluster_snapshot_identifier) + .register_column(:db_cluster_identifiers, field: :db_cluster_identifier) + .register_column(:snapshot_create_times, field: :snapshot_create_time) + .register_column(:engines, field: :engine) + .register_column(:engine_modes, field: :engine_mode) + .register_column(:allocated_storages, field: :allocated_storage) + .register_column(:statuses, field: :status) + .register_column(:ports, field: :port) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:cluster_create_times, field: :cluster_create_time) + .register_column(:master_usernames, field: :master_username) + .register_column(:engine_versions, field: :engine_version) + .register_column(:license_models, field: :license_model) + .register_column(:snapshot_types, field: :snapshot_type) + .register_column(:percent_progresses, field: :percent_progress) + .register_column(:storage_encrypted, field: :storage_encrypted) + .register_column(:kms_key_ids, field: :kms_key_id) + .register_column(:db_cluster_snapshot_arns, field: :db_cluster_snapshot_arn) + .register_column(:source_db_cluster_snapshot_arns, field: :source_db_cluster_snapshot_arn) + .register_column(:iam_database_authentication_enabled, field: :iam_database_authentication_enabled) + .register_column(:tag_lists, field: :tag_list) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_db_proxy.rb b/libraries/aws_rds_db_proxy.rb index a73694e10..9b1fd5f83 100644 --- a/libraries/aws_rds_db_proxy.rb +++ b/libraries/aws_rds_db_proxy.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRDSProxy < AwsResourceBase - name "aws_rds_db_proxy" - desc "Returns information about DB proxies." + name 'aws_rds_db_proxy' + desc 'Returns information about DB proxies.' example " describe aws_rds_db_proxy(db_proxy_name: 'DB_PROXY_NAME') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def db_proxy_name - return nil unless exists? + return unless exists? @res[:db_proxy_name] end diff --git a/libraries/aws_rds_db_proxy_endpoint.rb b/libraries/aws_rds_db_proxy_endpoint.rb index 54540d636..668059e04 100644 --- a/libraries/aws_rds_db_proxy_endpoint.rb +++ b/libraries/aws_rds_db_proxy_endpoint.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRDSProxyEndpoint < AwsResourceBase - name "aws_rds_db_proxy_endpoint" - desc "Retrieves information about a patch baseline." + name 'aws_rds_db_proxy_endpoint' + desc 'Retrieves information about a patch baseline.' example " describe aws_rds_db_proxy_endpoint(db_proxy_name: 'DB_PROXY_NAME', db_proxy_endpoint_name: 'DB_PROXY_ENDPOINT_NAME') do @@ -29,7 +29,7 @@ def resource_id end def db_proxy_endpoint_name - return nil unless exists? + return unless exists? @res[:db_proxy_endpoint_name] end diff --git a/libraries/aws_rds_db_proxy_endpoints.rb b/libraries/aws_rds_db_proxy_endpoints.rb index d17559422..0892115e2 100644 --- a/libraries/aws_rds_db_proxy_endpoints.rb +++ b/libraries/aws_rds_db_proxy_endpoints.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRDSProxyEndpoints < AwsResourceBase - name "aws_rds_db_proxy_endpoints" - desc "Returns information about DB proxy endpoints." + name 'aws_rds_db_proxy_endpoints' + desc 'Returns information about DB proxy endpoints.' example " describe aws_rds_db_proxy_endpoints(db_proxy_name: 'DB_PROXY_NAME') do @@ -13,18 +13,18 @@ class AWSRDSProxyEndpoints < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:db_proxy_endpoint_names, field: :db_proxy_endpoint_name) - .register_column(:db_proxy_endpoint_arns, field: :db_proxy_endpoint_arn) - .register_column(:db_proxy_names, field: :db_proxy_name) - .register_column(:statuses, field: :status) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:vpc_security_group_ids, field: :vpc_security_group_ids) - .register_column(:vpc_subnet_ids, field: :vpc_subnet_ids) - .register_column(:endpoints, field: :endpoint) - .register_column(:created_dates, field: :created_date) - .register_column(:target_roles, field: :target_role) - .register_column(:is_default, field: :is_default) - .install_filter_methods_on_resource(self, :table) + .register_column(:db_proxy_endpoint_names, field: :db_proxy_endpoint_name) + .register_column(:db_proxy_endpoint_arns, field: :db_proxy_endpoint_arn) + .register_column(:db_proxy_names, field: :db_proxy_name) + .register_column(:statuses, field: :status) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:vpc_security_group_ids, field: :vpc_security_group_ids) + .register_column(:vpc_subnet_ids, field: :vpc_subnet_ids) + .register_column(:endpoints, field: :endpoint) + .register_column(:created_dates, field: :created_date) + .register_column(:target_roles, field: :target_role) + .register_column(:is_default, field: :is_default) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_db_security_group.rb b/libraries/aws_rds_db_security_group.rb index 91059fe8a..95682e692 100644 --- a/libraries/aws_rds_db_security_group.rb +++ b/libraries/aws_rds_db_security_group.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRDSDBSecurityGroup < AwsResourceBase - name "aws_rds_db_security_group" - desc "Returns information about a db security group." + name 'aws_rds_db_security_group' + desc 'Returns information about a db security group.' example " describe aws_rds_db_security_group(db_security_group_name: 'SECURITY_GROUP_NAME') do @@ -28,7 +28,7 @@ def resource_id end def db_security_group_name - return nil unless exists? + return unless exists? @res[:db_security_group_name] end diff --git a/libraries/aws_rds_db_security_groups.rb b/libraries/aws_rds_db_security_groups.rb index e93982fec..84ddc21c5 100644 --- a/libraries/aws_rds_db_security_groups.rb +++ b/libraries/aws_rds_db_security_groups.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRDSDBSecurityGroups < AwsResourceBase - name "aws_rds_db_security_groups" - desc "Returns information about all the db security group." + name 'aws_rds_db_security_groups' + desc 'Returns information about all the db security group.' example " describe aws_rds_db_security_groups do @@ -13,14 +13,14 @@ class AWSRDSDBSecurityGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:owner_ids, field: :owner_id) - .register_column(:db_security_group_names, field: :db_security_group_name) - .register_column(:db_security_group_descriptions, field: :db_security_group_description) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:ec2_security_groups, field: :ec2_security_groups, style: :simple) - .register_column(:ip_ranges, field: :ip_ranges, style: :simple) - .register_column(:db_security_group_arns, field: :db_security_group_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:owner_ids, field: :owner_id) + .register_column(:db_security_group_names, field: :db_security_group_name) + .register_column(:db_security_group_descriptions, field: :db_security_group_description) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:ec2_security_groups, field: :ec2_security_groups, style: :simple) + .register_column(:ip_ranges, field: :ip_ranges, style: :simple) + .register_column(:db_security_group_arns, field: :db_security_group_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_event_subscription.rb b/libraries/aws_rds_event_subscription.rb index 7e40e6581..03d11fb93 100644 --- a/libraries/aws_rds_event_subscription.rb +++ b/libraries/aws_rds_event_subscription.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRDSEventSubscription < AwsResourceBase - name "aws_rds_event_subscription" - desc "Returns information about a RDS Event Subscription." + name 'aws_rds_event_subscription' + desc 'Returns information about a RDS Event Subscription.' example " describe aws_rds_event_subscription(subscription_name: 'EVENT_SUBSCRIPTION_NAME') do @@ -23,11 +23,11 @@ def initialize(opts = {}) end def resource_id - "#{@res? @res[:customer_aws_id]: ""}_#{@res? @res[:cust_subscription_id]: ""}" + "#{@res? @res[:customer_aws_id]: ''}_#{@res? @res[:cust_subscription_id]: ''}" end def subscription_name - return nil unless exists? + return unless exists? @res[:subscription_name] end diff --git a/libraries/aws_rds_event_subscriptions.rb b/libraries/aws_rds_event_subscriptions.rb index 21002b254..1aafd8264 100644 --- a/libraries/aws_rds_event_subscriptions.rb +++ b/libraries/aws_rds_event_subscriptions.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRDSEventSubscriptions < AwsResourceBase - name "aws_rds_event_subscriptions" - desc "Returns information about DB Event Subscription." + name 'aws_rds_event_subscriptions' + desc 'Returns information about DB Event Subscription.' example " describe aws_rds_event_subscriptions do @@ -13,17 +13,17 @@ class AWSRDSEventSubscriptions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:customer_aws_ids, field: :customer_aws_id) - .register_column(:cust_subscription_ids, field: :cust_subscription_id) - .register_column(:sns_topic_arns, field: :sns_topic_arn) - .register_column(:statuses, field: :status) - .register_column(:subscription_creation_times, field: :subscription_creation_time) - .register_column(:source_types, field: :source_type) - .register_column(:source_ids_list, field: :source_ids_list, style: :simple) - .register_column(:event_categories_list, field: :event_categories_list, style: :simple) - .register_column(:enabled, field: :enabled) - .register_column(:event_subscription_arns, field: :event_subscription_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:customer_aws_ids, field: :customer_aws_id) + .register_column(:cust_subscription_ids, field: :cust_subscription_id) + .register_column(:sns_topic_arns, field: :sns_topic_arn) + .register_column(:statuses, field: :status) + .register_column(:subscription_creation_times, field: :subscription_creation_time) + .register_column(:source_types, field: :source_type) + .register_column(:source_ids_list, field: :source_ids_list, style: :simple) + .register_column(:event_categories_list, field: :event_categories_list, style: :simple) + .register_column(:enabled, field: :enabled) + .register_column(:event_subscription_arns, field: :event_subscription_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_global_cluster.rb b/libraries/aws_rds_global_cluster.rb index 29cb1b136..a024d9ab5 100644 --- a/libraries/aws_rds_global_cluster.rb +++ b/libraries/aws_rds_global_cluster.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRDSGlobalCluster < AwsResourceBase - name "aws_rds_global_cluster" - desc "Returns information about Aurora global database clusters." + name 'aws_rds_global_cluster' + desc 'Returns information about Aurora global database clusters.' example " describe aws_rds_global_cluster(global_cluster_identifier: 'GLOBAL_CLUSTER_IDENTIFIER') do @@ -28,7 +28,7 @@ def resource_id end def global_cluster_identifier - return nil unless exists? + return unless exists? @res[:global_cluster_identifier] end diff --git a/libraries/aws_rds_global_clusters.rb b/libraries/aws_rds_global_clusters.rb index 27f97d616..d1dd6e3cc 100644 --- a/libraries/aws_rds_global_clusters.rb +++ b/libraries/aws_rds_global_clusters.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRDSGlobalClusters < AwsResourceBase - name "aws_rds_global_clusters" - desc "Returns information about DB Global Cluster." + name 'aws_rds_global_clusters' + desc 'Returns information about DB Global Cluster.' example " describe aws_rds_global_clusters do @@ -13,17 +13,17 @@ class AWSRDSGlobalClusters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:global_cluster_identifiers, field: :global_cluster_identifier) - .register_column(:global_cluster_resource_ids, field: :global_cluster_resource_id) - .register_column(:global_cluster_arns, field: :global_cluster_arn) - .register_column(:statuses, field: :status) - .register_column(:engines, field: :engine) - .register_column(:vpc_security_group_ids, field: :vpc_security_group_ids) - .register_column(:engine_versions, field: :engine_version) - .register_column(:database_names, field: :database_name) - .register_column(:storage_encrypted, field: :role_arn) - .register_column(:deletion_protection, field: :deletion_protection) - .install_filter_methods_on_resource(self, :table) + .register_column(:global_cluster_identifiers, field: :global_cluster_identifier) + .register_column(:global_cluster_resource_ids, field: :global_cluster_resource_id) + .register_column(:global_cluster_arns, field: :global_cluster_arn) + .register_column(:statuses, field: :status) + .register_column(:engines, field: :engine) + .register_column(:vpc_security_group_ids, field: :vpc_security_group_ids) + .register_column(:engine_versions, field: :engine_version) + .register_column(:database_names, field: :database_name) + .register_column(:storage_encrypted, field: :role_arn) + .register_column(:deletion_protection, field: :deletion_protection) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_instance.rb b/libraries/aws_rds_instance.rb index b233dec82..55a6b7631 100644 --- a/libraries/aws_rds_instance.rb +++ b/libraries/aws_rds_instance.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRdsInstance < AwsResourceBase - name "aws_rds_instance" - desc "Verifies settings for an RDS instance." + name 'aws_rds_instance' + desc 'Verifies settings for an RDS instance.' example " describe aws_rds_instance(db_instance_identifier: 'test-instance-id') do @@ -23,7 +23,7 @@ def initialize(opts = {}) end def resource_id - "#{@rds_instance? @rds_instance[:db_instance_identifier]: ""}_#{@rds_instance? @rds_instance[:db_name]: ""}_#{@rds_instance? @rds_instance[:master_username]: ""}" + "#{@rds_instance? @rds_instance[:db_instance_identifier]: ''}_#{@rds_instance? @rds_instance[:db_name]: ''}_#{@rds_instance? @rds_instance[:master_username]: ''}" end def has_encrypted_storage? diff --git a/libraries/aws_rds_instances.rb b/libraries/aws_rds_instances.rb index 0b8fa576a..2f795a257 100644 --- a/libraries/aws_rds_instances.rb +++ b/libraries/aws_rds_instances.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRdsInstances < AwsCollectionResourceBase - name "aws_rds_instances" - desc "Verifies settings for AWS RDS instances in bulk." + name 'aws_rds_instances' + desc 'Verifies settings for AWS RDS instances in bulk.' example " describe aws_rds_instances do it { should exist } diff --git a/libraries/aws_rds_option_group.rb b/libraries/aws_rds_option_group.rb index d2ed7170b..76245dc62 100644 --- a/libraries/aws_rds_option_group.rb +++ b/libraries/aws_rds_option_group.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRdsOptionGroup < AwsResourceBase - name "aws_rds_option_group" - desc "Verifies settings for an RDS Option Group." + name 'aws_rds_option_group' + desc 'Verifies settings for an RDS Option Group.' example " describe aws_rds_option_group(option_group_name: 'test-option_group_name') do @@ -32,7 +32,7 @@ def initialize(opts = {}) end def resource_id - @rds_cluster? @rds_cluster[:option_group_arn]: "" + @rds_cluster? @rds_cluster[:option_group_arn]: '' end def exists? diff --git a/libraries/aws_rds_option_groups.rb b/libraries/aws_rds_option_groups.rb index 48a2b706e..32bf32a1e 100644 --- a/libraries/aws_rds_option_groups.rb +++ b/libraries/aws_rds_option_groups.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRdsOptionGroups < AwsResourceBase - name "aws_rds_option_groups" - desc "Verifies settings for a collection AWS RDS Clusters." + name 'aws_rds_option_groups' + desc 'Verifies settings for a collection AWS RDS Clusters.' example " describe aws_rds_group_options do it { should exist } @@ -12,14 +12,14 @@ class AwsRdsOptionGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:option_group_names, field: :option_group_name) - .register_column(:option_group_description, field: :option_group_description) - .register_column(:engine_names, field: :engine_name) - .register_column(:major_engine_versions, field: :major_engine_version) - .register_column(:option_group_arns, field: :option_group_arn) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:allows_vpc_and_non_vpc_instance_memberships, field: :allows_vpc_and_non_vpc_instance_memberships) - .install_filter_methods_on_resource(self, :table) + .register_column(:option_group_names, field: :option_group_name) + .register_column(:option_group_description, field: :option_group_description) + .register_column(:engine_names, field: :engine_name) + .register_column(:major_engine_versions, field: :major_engine_version) + .register_column(:option_group_arns, field: :option_group_arn) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:allows_vpc_and_non_vpc_instance_memberships, field: :allows_vpc_and_non_vpc_instance_memberships) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_snapshot.rb b/libraries/aws_rds_snapshot.rb index 6a6affabc..d4c6e9f63 100644 --- a/libraries/aws_rds_snapshot.rb +++ b/libraries/aws_rds_snapshot.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRdsSnapshot < AwsResourceBase - name "aws_rds_snapshot" - desc "Verifies settings for an RDS snapshot." + name 'aws_rds_snapshot' + desc 'Verifies settings for an RDS snapshot.' example " describe aws_rds_snapshot(db_snapshot_identifier: 'test-snapshot-id') do @@ -23,7 +23,7 @@ def initialize(opts = {}) end def resource_id - @rds_snapshot? @rds_snapshot[:db_snapshot_identifier]: "" + @rds_snapshot? @rds_snapshot[:db_snapshot_identifier]: '' end def has_encrypted_snapshot? diff --git a/libraries/aws_rds_snapshot_attributes.rb b/libraries/aws_rds_snapshot_attributes.rb index 638baf37d..b07ad7e41 100644 --- a/libraries/aws_rds_snapshot_attributes.rb +++ b/libraries/aws_rds_snapshot_attributes.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRdsSnapshotAttributes < AwsResourceBase - name "aws_rds_snapshot_attributes" - desc "Verifies settings for an RDS snapshot attributes." + name 'aws_rds_snapshot_attributes' + desc 'Verifies settings for an RDS snapshot attributes.' example ' describe aws_rds_snapshot_attributes(db_snapshot_identifier: "test") do @@ -13,10 +13,10 @@ class AwsRdsSnapshotAttributes < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:db_snapshot_identifier, field: :db_snapshot_identifier) - .register_column(:attribute_name, field: :attribute_name) - .register_column(:attribute_values, field: :attribute_values) - .install_filter_methods_on_resource(self, :table) + .register_column(:db_snapshot_identifier, field: :db_snapshot_identifier) + .register_column(:attribute_name, field: :attribute_name) + .register_column(:attribute_values, field: :attribute_values) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) opts = { db_snapshot_identifier: opts } if opts.is_a?(String) @@ -29,7 +29,7 @@ def initialize(opts = {}) begin @aws.rds_client.describe_db_snapshots(db_snapshot_identifier: opts[:db_snapshot_identifier]) rescue Aws::RDS::Errors::DBSnapshotNotFound - fail_resource("DBSnapshot does not exist") + fail_resource('DBSnapshot does not exist') end end @table = fetch_data diff --git a/libraries/aws_rds_snapshots.rb b/libraries/aws_rds_snapshots.rb index aa5bccc3f..849d794e2 100644 --- a/libraries/aws_rds_snapshots.rb +++ b/libraries/aws_rds_snapshots.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRdsSnapshots < AwsCollectionResourceBase - name "aws_rds_snapshots" - desc "Verifies settings for AWS RDS snapshots in bulk." + name 'aws_rds_snapshots' + desc 'Verifies settings for AWS RDS snapshots in bulk.' example " describe aws_rds_snapshots do it { should exist } diff --git a/libraries/aws_redshift_cluster.rb b/libraries/aws_redshift_cluster.rb index 194285c82..643c2cd99 100644 --- a/libraries/aws_redshift_cluster.rb +++ b/libraries/aws_redshift_cluster.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRedshiftCluster < AwsResourceBase - name "aws_redshift_cluster" - desc "Verifies an Redshift Cluster." + name 'aws_redshift_cluster' + desc 'Verifies an Redshift Cluster.' example " describe aws_redshift_cluster(cluster_identifier: 'test-cluster-id') do diff --git a/libraries/aws_redshift_cluster_parameter_group.rb b/libraries/aws_redshift_cluster_parameter_group.rb index bee0498e2..8fd7af855 100644 --- a/libraries/aws_redshift_cluster_parameter_group.rb +++ b/libraries/aws_redshift_cluster_parameter_group.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRedshiftClusterParameterGroup < AwsResourceBase - name "aws_redshift_cluster_parameter_group" - desc "Describes a parameter group." + name 'aws_redshift_cluster_parameter_group' + desc 'Describes a parameter group.' example " describe aws_redshift_cluster_parameter_group(parameter_group_name: aws_parameter_group_name) do it { should exist } @@ -24,7 +24,7 @@ def initialize(opts = {}) end def parameter_group_name - return nil unless exists? + return unless exists? @parameter_groups[:parameter_group_name] end diff --git a/libraries/aws_redshift_cluster_parameter_groups.rb b/libraries/aws_redshift_cluster_parameter_groups.rb index 1a550c2d2..23606465f 100644 --- a/libraries/aws_redshift_cluster_parameter_groups.rb +++ b/libraries/aws_redshift_cluster_parameter_groups.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRedshiftClusterParameterGroups < AwsResourceBase - name "aws_redshift_cluster_parameter_groups" - desc "Describes a parameter group." + name 'aws_redshift_cluster_parameter_groups' + desc 'Describes a parameter group.' example " describe aws_redshift_cluster_parameter_groups do it { should exist } @@ -11,11 +11,11 @@ class AwsRedshiftClusterParameterGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:parameter_group_names, field: :parameter_group_name) - .register_column(:parameter_group_families, field: :parameter_group_family) - .register_column(:descriptions, field: :description) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:parameter_group_names, field: :parameter_group_name) + .register_column(:parameter_group_families, field: :parameter_group_family) + .register_column(:descriptions, field: :description) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_redshift_clusters.rb b/libraries/aws_redshift_clusters.rb index 81c3bb3d8..83bfe51a2 100644 --- a/libraries/aws_redshift_clusters.rb +++ b/libraries/aws_redshift_clusters.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRedshiftClusters < AwsResourceBase - name "aws_redshift_clusters" - desc "Verifies settings for a collection AWS RDS Clusters." + name 'aws_redshift_clusters' + desc 'Verifies settings for a collection AWS RDS Clusters.' example " describe aws_redshift_clusters do it { should exist } @@ -12,21 +12,21 @@ class AwsRedshiftClusters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:cluster_identifiers, field: :cluster_identifier) - .register_column(:node_types, field: :node_type) - .register_column(:cluster_status, field: :cluster_status) - .register_column(:cluster_availability_status, field: :cluster_availability_status) - .register_column(:db_names, field: :db_name) - .register_column(:modify_status, field: :modify_status) - .register_column(:master_usernames, field: :master_username) - .register_column(:cluster_create_time, field: :cluster_create_time) - .register_column(:cluster_subnet_group_names, field: :cluster_subnet_group_name) - .register_column(:availability_zones, field: :availability_zones) - .register_column(:allow_version_upgrade, field: :allow_version_upgrade) - .register_column(:encrypted, field: :encrypted) - .register_column(:iam_roles, field: :iam_roles) - .register_column(:vpc_ids, field: :vpc_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:cluster_identifiers, field: :cluster_identifier) + .register_column(:node_types, field: :node_type) + .register_column(:cluster_status, field: :cluster_status) + .register_column(:cluster_availability_status, field: :cluster_availability_status) + .register_column(:db_names, field: :db_name) + .register_column(:modify_status, field: :modify_status) + .register_column(:master_usernames, field: :master_username) + .register_column(:cluster_create_time, field: :cluster_create_time) + .register_column(:cluster_subnet_group_names, field: :cluster_subnet_group_name) + .register_column(:availability_zones, field: :availability_zones) + .register_column(:allow_version_upgrade, field: :allow_version_upgrade) + .register_column(:encrypted, field: :encrypted) + .register_column(:iam_roles, field: :iam_roles) + .register_column(:vpc_ids, field: :vpc_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_region.rb b/libraries/aws_region.rb index e3091a727..29c0627fe 100644 --- a/libraries/aws_region.rb +++ b/libraries/aws_region.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRegion < AwsResourceBase - name "aws_region" - desc "Verifies settings for an AWS region." + name 'aws_region' + desc 'Verifies settings for an AWS region.' example " describe aws_region('eu-west-2') do diff --git a/libraries/aws_regions.rb b/libraries/aws_regions.rb index 4f527177c..c258c26c4 100644 --- a/libraries/aws_regions.rb +++ b/libraries/aws_regions.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRegions < AwsResourceBase - name "aws_regions" - desc "Verifies settings for AWS Regions in bulk." + name 'aws_regions' + desc 'Verifies settings for AWS Regions in bulk.' example " describe aws_regions do @@ -13,9 +13,9 @@ class AwsRegions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:region_names, field: :region_name) - .register_column(:endpoints, field: :endpoint) - .install_filter_methods_on_resource(self, :table) + .register_column(:region_names, field: :region_name) + .register_column(:endpoints, field: :endpoint) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_route53_record_set.rb b/libraries/aws_route53_record_set.rb index 68dbe73cf..8a8244d43 100644 --- a/libraries/aws_route53_record_set.rb +++ b/libraries/aws_route53_record_set.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRoute53RecordSet < AwsResourceBase - name "aws_route53_record_set" - desc "Describe a resource record sets in a specified hosted zone." + name 'aws_route53_record_set' + desc 'Describe a resource record sets in a specified hosted zone.' example " describe aws_route53_record_set(hosted_zone_id: 'ResourceId', start_record_name: 'DNSName') do @@ -25,12 +25,12 @@ def initialize(opts = {}) end def hosted_zone_id - return nil unless exists? + return unless exists? @res[:alias_target][:hosted_zone_id] end def resource_id - "#{@res? @hosted_zone_id: ""}_#{@res? @start_record_name: ""}" + "#{@res? @hosted_zone_id: ''}_#{@res? @start_record_name: ''}" end def exists? diff --git a/libraries/aws_route53_record_sets.rb b/libraries/aws_route53_record_sets.rb index efd7736bc..c128aa175 100644 --- a/libraries/aws_route53_record_sets.rb +++ b/libraries/aws_route53_record_sets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRoute53RecordSets < AwsResourceBase - name "aws_route53_record_sets" - desc "Lists the resource record sets in a specified hosted zone." + name 'aws_route53_record_sets' + desc 'Lists the resource record sets in a specified hosted zone.' example " describe aws_route53_record_sets(hosted_zone_id: 'HOSTED_ZONE_ID') do @@ -13,20 +13,20 @@ class AWSRoute53RecordSets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:types, field: :type) - .register_column(:set_identifiers, field: :set_identifier) - .register_column(:weights, field: :weight) - .register_column(:regions, field: :region) - .register_column(:geo_locations, field: :geo_location) - .register_column(:failovers, field: :failover) - .register_column(:multi_value_answers, field: :multi_value_answer) - .register_column(:ttls, field: :ttl) - .register_column(:resource_records, field: :resource_records, style: :simple) - .register_column(:alias_targets, field: :alias_target) - .register_column(:health_check_ids, field: :health_check_id) - .register_column(:traffic_policy_instance_ids, field: :traffic_policy_instance_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:types, field: :type) + .register_column(:set_identifiers, field: :set_identifier) + .register_column(:weights, field: :weight) + .register_column(:regions, field: :region) + .register_column(:geo_locations, field: :geo_location) + .register_column(:failovers, field: :failover) + .register_column(:multi_value_answers, field: :multi_value_answer) + .register_column(:ttls, field: :ttl) + .register_column(:resource_records, field: :resource_records, style: :simple) + .register_column(:alias_targets, field: :alias_target) + .register_column(:health_check_ids, field: :health_check_id) + .register_column(:traffic_policy_instance_ids, field: :traffic_policy_instance_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_route53resolver_resolver_endpoint.rb b/libraries/aws_route53resolver_resolver_endpoint.rb index c577c55c3..e5bdea4cc 100644 --- a/libraries/aws_route53resolver_resolver_endpoint.rb +++ b/libraries/aws_route53resolver_resolver_endpoint.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRoute53ResolverResolverEndpoint < AwsResourceBase - name "aws_route53resolver_resolver_endpoint" - desc "Gets information about a specified Resolver endpoint, such as whether its an inbound or an outbound Resolver endpoint, and the current status of the endpoint." + name 'aws_route53resolver_resolver_endpoint' + desc 'Gets information about a specified Resolver endpoint, such as whether its an inbound or an outbound Resolver endpoint, and the current status of the endpoint.' example " describe aws_route53resolver_resolver_endpoint(resolver_endpoint_id: 'ResourceId') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def resolver_endpoint_id - return nil unless exists? + return unless exists? @res[:id] end diff --git a/libraries/aws_route53resolver_resolver_endpoints.rb b/libraries/aws_route53resolver_resolver_endpoints.rb index 184bcfed8..cd1915b8e 100644 --- a/libraries/aws_route53resolver_resolver_endpoints.rb +++ b/libraries/aws_route53resolver_resolver_endpoints.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRoute53ResolverResolverEndpoints < AwsResourceBase - name "aws_route53resolver_resolver_endpoints" - desc "Lists all the Resolver endpoints that were created using the current AWS account." + name 'aws_route53resolver_resolver_endpoints' + desc 'Lists all the Resolver endpoints that were created using the current AWS account.' example " describe aws_route53resolver_resolver_endpoints do @@ -13,19 +13,19 @@ class AWSRoute53ResolverResolverEndpoints < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:creator_request_ids, field: :creator_request_id) - .register_column(:arns, field: :arn) - .register_column(:names, field: :name) - .register_column(:security_group_ids, field: :security_group_ids) - .register_column(:directions, field: :direction) - .register_column(:ip_address_counts, field: :ip_address_count) - .register_column(:host_vpc_ids, field: :host_vpc_id) - .register_column(:statuses, field: :status) - .register_column(:status_messages, field: :status_message) - .register_column(:creation_times, field: :creation_time) - .register_column(:modification_times, field: :modification_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:creator_request_ids, field: :creator_request_id) + .register_column(:arns, field: :arn) + .register_column(:names, field: :name) + .register_column(:security_group_ids, field: :security_group_ids) + .register_column(:directions, field: :direction) + .register_column(:ip_address_counts, field: :ip_address_count) + .register_column(:host_vpc_ids, field: :host_vpc_id) + .register_column(:statuses, field: :status) + .register_column(:status_messages, field: :status_message) + .register_column(:creation_times, field: :creation_time) + .register_column(:modification_times, field: :modification_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_route53resolver_resolver_rule.rb b/libraries/aws_route53resolver_resolver_rule.rb index 4ea4a3cef..a4c02e48a 100644 --- a/libraries/aws_route53resolver_resolver_rule.rb +++ b/libraries/aws_route53resolver_resolver_rule.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRoute53ResolverResolverRule < AwsResourceBase - name "aws_route53resolver_resolver_rule" - desc "Gets information about a specified Resolver rule, such as the domain name that the rule forwards DNS queries for and the ID of the outbound Resolver endpoint that the rule is associated with." + name 'aws_route53resolver_resolver_rule' + desc 'Gets information about a specified Resolver rule, such as the domain name that the rule forwards DNS queries for and the ID of the outbound Resolver endpoint that the rule is associated with.' example " describe aws_route53resolver_resolver_rule(resolver_rule_id: 'resolver_rule_id_test') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def resolver_rule_id - return nil unless exists? + return unless exists? @res[:id] end diff --git a/libraries/aws_route53resolver_resolver_rule_association.rb b/libraries/aws_route53resolver_resolver_rule_association.rb index 8ffa0f9e1..5c70824c8 100644 --- a/libraries/aws_route53resolver_resolver_rule_association.rb +++ b/libraries/aws_route53resolver_resolver_rule_association.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRoute53ResolverResolverRuleAssociation < AwsResourceBase - name "aws_route53resolver_resolver_rule_association" - desc "Gets information about an association between a specified Resolver rule and a VPC." + name 'aws_route53resolver_resolver_rule_association' + desc 'Gets information about an association between a specified Resolver rule and a VPC.' example " describe aws_route53resolver_resolver_rule_association(resolver_rule_association_id: 'ResourceId') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def resolver_rule_association_id - return nil unless exists? + return unless exists? @res[:id] end diff --git a/libraries/aws_route53resolver_resolver_rule_associations.rb b/libraries/aws_route53resolver_resolver_rule_associations.rb index a84f83f1d..6efbca11c 100644 --- a/libraries/aws_route53resolver_resolver_rule_associations.rb +++ b/libraries/aws_route53resolver_resolver_rule_associations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRoute53ResolverResolverRuleAssociations < AwsResourceBase - name "aws_route53resolver_resolver_rule_associations" - desc "Lists the associations that were created between Resolver rules and VPCs using the current AWS account." + name 'aws_route53resolver_resolver_rule_associations' + desc 'Lists the associations that were created between Resolver rules and VPCs using the current AWS account.' example " describe aws_route53resolver_resolver_rule_associations do @@ -13,13 +13,13 @@ class AWSRoute53ResolverResolverRuleAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:resolver_rule_ids, field: :resolver_rule_id) - .register_column(:names, field: :name) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:statuses, field: :status) - .register_column(:status_messages, field: :status_message) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:resolver_rule_ids, field: :resolver_rule_id) + .register_column(:names, field: :name) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:statuses, field: :status) + .register_column(:status_messages, field: :status_message) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_route53resolver_resolver_rules.rb b/libraries/aws_route53resolver_resolver_rules.rb index 09bebe2f7..54646bebc 100644 --- a/libraries/aws_route53resolver_resolver_rules.rb +++ b/libraries/aws_route53resolver_resolver_rules.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSRoute53ResolverResolverRules < AwsResourceBase - name "aws_route53resolver_resolver_rules" - desc "Lists the Resolver rules that were created using the current AWS account." + name 'aws_route53resolver_resolver_rules' + desc 'Lists the Resolver rules that were created using the current AWS account.' example " describe aws_route53resolver_resolver_rules do @@ -13,21 +13,21 @@ class AWSRoute53ResolverResolverRules < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:creator_request_ids, field: :creator_request_id) - .register_column(:arns, field: :arn) - .register_column(:domain_names, field: :domain_name) - .register_column(:statuses, field: :status) - .register_column(:status_messages, field: :status_message) - .register_column(:rule_types, field: :rule_type) - .register_column(:names, field: :name) - .register_column(:target_ips, field: :target_ips) - .register_column(:resolver_endpoint_ids, field: :resolver_endpoint_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:share_statuses, field: :share_status) - .register_column(:creation_times, field: :creation_time) - .register_column(:modification_times, field: :modification_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:creator_request_ids, field: :creator_request_id) + .register_column(:arns, field: :arn) + .register_column(:domain_names, field: :domain_name) + .register_column(:statuses, field: :status) + .register_column(:status_messages, field: :status_message) + .register_column(:rule_types, field: :rule_type) + .register_column(:names, field: :name) + .register_column(:target_ips, field: :target_ips) + .register_column(:resolver_endpoint_ids, field: :resolver_endpoint_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:share_statuses, field: :share_status) + .register_column(:creation_times, field: :creation_time) + .register_column(:modification_times, field: :modification_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_route_table.rb b/libraries/aws_route_table.rb index b4c4a03fe..574d8f17a 100644 --- a/libraries/aws_route_table.rb +++ b/libraries/aws_route_table.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRouteTable < AwsResourceBase - name "aws_route_table" - desc "Verifies settings for an AWS Route Table." + name 'aws_route_table' + desc 'Verifies settings for an AWS Route Table.' example " describe aws_route_table(route_table_id: 'rtb-05462d2278326a79c') do its('route_table_id') { should cmp 'rtb-05462d2278326a79c' } @@ -14,9 +14,9 @@ class AwsRouteTable < AwsResourceBase " ASSOCIATION_STATES = { - associated: "associated", - failed: "failed", - disassociated: "disassociated", + associated: 'associated', + failed: 'failed', + disassociated: 'disassociated', }.freeze def initialize(opts = {}) @@ -27,7 +27,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: ID must be in the format 'rtb-' followed by 8 or 17 hexadecimal characters." if opts[:route_table_id] !~ /^rtb\-([0-9a-f]{8})|(^rtb\-[0-9a-f]{17})$/ @display_name = opts[:route_table_id] - filter = { name: "route-table-id", values: [opts[:route_table_id]] } + filter = { name: 'route-table-id', values: [opts[:route_table_id]] } catch_aws_errors do resp = @aws.compute_client.describe_route_tables({ filters: [filter] }) @route_table = resp.route_tables.first diff --git a/libraries/aws_route_tables.rb b/libraries/aws_route_tables.rb index a26047afa..0e9d71be6 100644 --- a/libraries/aws_route_tables.rb +++ b/libraries/aws_route_tables.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsRouteTables < AwsResourceBase - name "aws_route_tables" - desc "Verifies settings for an AWS Route Tables in bulk." + name 'aws_route_tables' + desc 'Verifies settings for an AWS Route Tables in bulk.' example " describe aws_route_tables do @@ -13,31 +13,31 @@ class AwsRouteTables < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:route_table_ids, field: :route_table_id) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:destination_cidr_blocks, field: :destination_cidr_block, style: :simple) - .register_column(:destination_ipv_6_cidr_blocks, field: :destination_ipv_6_cidr_block, style: :simple) - .register_column(:destination_prefix_list_ids, field: :destination_prefix_list_id, style: :simple) - .register_column(:egress_only_internet_gateway_ids, field: :egress_only_internet_gateway_id, style: :simple) - .register_column(:gateway_ids, field: :gateway_id, style: :simple) - .register_column(:instance_ids, field: :instance_id, style: :simple) - .register_column(:instance_owner_ids, field: :instance_owner_id, style: :simple) - .register_column(:nat_gateway_ids, field: :nat_gateway_id, style: :simple) - .register_column(:transit_gateway_ids, field: :transit_gateway_id, style: :simple) - .register_column(:local_gateway_ids, field: :local_gateway_id, style: :simple) - .register_column(:carrier_gateway_ids, field: :carrier_gateway_id, style: :simple) - .register_column(:network_interface_ids, field: :network_interface_id, style: :simple) - .register_column(:origins, field: :origin, style: :simple) - .register_column(:states, field: :state, style: :simple) - .register_column(:vpc_peering_connection_ids, field: :vpc_peering_connection_id, style: :simple) - .register_column(:route_table_association_ids, field: :route_table_association_ids, style: :simple) - .register_column(:association_subnet_ids, field: :association_subnet_ids, style: :simple) - .register_column(:associated_subnet_ids, field: :associated_subnet_ids, style: :simple) - .register_column(:association_gateway_ids, field: :association_gateway_ids, style: :simple) - .register_column(:associated_gateway_ids, field: :associated_gateway_ids, style: :simple) - .register_column(:association_states, field: :association_states, style: :simple) - .register_column(:main, field: :main, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:route_table_ids, field: :route_table_id) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:destination_cidr_blocks, field: :destination_cidr_block, style: :simple) + .register_column(:destination_ipv_6_cidr_blocks, field: :destination_ipv_6_cidr_block, style: :simple) + .register_column(:destination_prefix_list_ids, field: :destination_prefix_list_id, style: :simple) + .register_column(:egress_only_internet_gateway_ids, field: :egress_only_internet_gateway_id, style: :simple) + .register_column(:gateway_ids, field: :gateway_id, style: :simple) + .register_column(:instance_ids, field: :instance_id, style: :simple) + .register_column(:instance_owner_ids, field: :instance_owner_id, style: :simple) + .register_column(:nat_gateway_ids, field: :nat_gateway_id, style: :simple) + .register_column(:transit_gateway_ids, field: :transit_gateway_id, style: :simple) + .register_column(:local_gateway_ids, field: :local_gateway_id, style: :simple) + .register_column(:carrier_gateway_ids, field: :carrier_gateway_id, style: :simple) + .register_column(:network_interface_ids, field: :network_interface_id, style: :simple) + .register_column(:origins, field: :origin, style: :simple) + .register_column(:states, field: :state, style: :simple) + .register_column(:vpc_peering_connection_ids, field: :vpc_peering_connection_id, style: :simple) + .register_column(:route_table_association_ids, field: :route_table_association_ids, style: :simple) + .register_column(:association_subnet_ids, field: :association_subnet_ids, style: :simple) + .register_column(:associated_subnet_ids, field: :associated_subnet_ids, style: :simple) + .register_column(:association_gateway_ids, field: :association_gateway_ids, style: :simple) + .register_column(:associated_gateway_ids, field: :associated_gateway_ids, style: :simple) + .register_column(:association_states, field: :association_states, style: :simple) + .register_column(:main, field: :main, style: :simple) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -74,32 +74,32 @@ def paginate_request def flat_hash_from(route_table) routes = route_table.routes associations = route_table.associations - associates = associations.select { |association| association.association_state.state == "associated" } + associates = associations.select { |association| association.association_state.state == 'associated' } { vpc_id: route_table.vpc_id, route_table_id: route_table.route_table_id, - destination_cidr_block: map(routes, "destination_cidr_block"), - destination_ipv_6_cidr_block: map(routes, "destination_ipv_6_cidr_block"), - destination_prefix_list_id: map(routes, "destination_prefix_list_id"), - egress_only_internet_gateway_id: map(routes, "egress_only_internet_gateway_id"), - gateway_id: map(routes, "gateway_id"), - instance_id: map(routes, "instance_id"), - instance_owner_id: map(routes, "instance_owner_id"), - nat_gateway_id: map(routes, "nat_gateway_id"), - transit_gateway_id: map(routes, "transit_gateway_id"), - local_gateway_id: map(routes, "local_gateway_id"), - carrier_gateway_id: map(routes, "carrier_gateway_id"), - network_interface_id: map(routes, "network_interface_id"), - origin: map(routes, "origin"), - state: map(routes, "state"), - vpc_peering_connection_id: map(routes, "vpc_peering_connection_id"), + destination_cidr_block: map(routes, 'destination_cidr_block'), + destination_ipv_6_cidr_block: map(routes, 'destination_ipv_6_cidr_block'), + destination_prefix_list_id: map(routes, 'destination_prefix_list_id'), + egress_only_internet_gateway_id: map(routes, 'egress_only_internet_gateway_id'), + gateway_id: map(routes, 'gateway_id'), + instance_id: map(routes, 'instance_id'), + instance_owner_id: map(routes, 'instance_owner_id'), + nat_gateway_id: map(routes, 'nat_gateway_id'), + transit_gateway_id: map(routes, 'transit_gateway_id'), + local_gateway_id: map(routes, 'local_gateway_id'), + carrier_gateway_id: map(routes, 'carrier_gateway_id'), + network_interface_id: map(routes, 'network_interface_id'), + origin: map(routes, 'origin'), + state: map(routes, 'state'), + vpc_peering_connection_id: map(routes, 'vpc_peering_connection_id'), main: associations.any?(&:main), - route_table_association_ids: map(associations, "route_table_association_id"), - association_subnet_ids: map(associations, "subnet_id"), - associated_subnet_ids: map(associates, "subnet_id"), - association_gateway_ids: map(associations, "gateway_id"), - associated_gateway_ids: map(associates, "gateway_id"), - association_states: map(associations, "association_state.state"), + route_table_association_ids: map(associations, 'route_table_association_id'), + association_subnet_ids: map(associations, 'subnet_id'), + associated_subnet_ids: map(associates, 'subnet_id'), + association_gateway_ids: map(associations, 'gateway_id'), + associated_gateway_ids: map(associates, 'gateway_id'), + association_states: map(associations, 'association_state.state'), } end diff --git a/libraries/aws_s3_access_point.rb b/libraries/aws_s3_access_point.rb index 39c9944bd..a7a089650 100644 --- a/libraries/aws_s3_access_point.rb +++ b/libraries/aws_s3_access_point.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSS3AccessPoint < AwsResourceBase - name "aws_s3_access_point" - desc "Describes one S3 Access Points." + name 'aws_s3_access_point' + desc 'Describes one S3 Access Points.' example " describe aws_s3_access_point(bucket_name: 'BucketName', metrics_id: 'MetricsId') do @@ -26,7 +26,7 @@ def initialize(opts = {}) end def metrics_id - return nil unless exists? + return unless exists? @resp[:id] end diff --git a/libraries/aws_s3_access_points.rb b/libraries/aws_s3_access_points.rb index aa86f6e3c..da0dc6436 100644 --- a/libraries/aws_s3_access_points.rb +++ b/libraries/aws_s3_access_points.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSS3AccessPoints < AwsResourceBase - name "aws_s3_access_points" - desc "List one or more S3 Access Points." + name 'aws_s3_access_points' + desc 'List one or more S3 Access Points.' example " describe aws_s3_access_points(bucket_name: 'BucketName') do @@ -13,10 +13,10 @@ class AWSS3AccessPoints < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:filter_access_point_arns, field: :filter_access_point_arn) - .register_column(:filter_and_access_point_arns, field: :filter_and_access_point_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:filter_access_point_arns, field: :filter_access_point_arn) + .register_column(:filter_and_access_point_arns, field: :filter_and_access_point_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_s3_bucket.rb b/libraries/aws_s3_bucket.rb index 53b0ae6a0..e0d2f8d23 100644 --- a/libraries/aws_s3_bucket.rb +++ b/libraries/aws_s3_bucket.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsS3Bucket < AwsResourceBase - name "aws_s3_bucket" - desc "Verifies settings for a s3 bucket." + name 'aws_s3_bucket' + desc 'Verifies settings for a s3 bucket.' example " describe aws_s3_bucket(bucket_name: 'test_bucket') do it { should exist } @@ -23,10 +23,10 @@ def initialize(opts = {}) @region = @aws.storage_client.get_bucket_location(bucket: @bucket_name).location_constraint # LocationConstraint "EU" correlates to the region "eu-west-1", but region "EU" does not exist as a "region", only a LocationConstraint # this currently is the only Location constraint that can have either of 2 values "EU" or "eu-west-1". But only "eu-west-1" is a region - @region = "eu-west-1" if @region == "EU" + @region = 'eu-west-1' if @region == 'EU' # Forcing bucket region for future bucket calls to avoid warnings about multiple unnecessary # redirects and signing attempts. - opts[:aws_region] = @region.empty? ? "us-east-1" : @region + opts[:aws_region] = @region.empty? ? 'us-east-1' : @region super(opts) rescue Aws::S3::Errors::NoSuchBucket @region = nil @@ -61,8 +61,8 @@ def public? @bucket_policy_status_public = false # preserves the original behaviour end @bucket_policy_status_public || \ - bucket_acl.any? { |g| g.grantee.type == "Group" && g.grantee.uri =~ /AllUsers/ } || \ - bucket_acl.any? { |g| g.grantee.type == "Group" && g.grantee.uri =~ /AuthenticatedUsers/ } + bucket_acl.any? { |g| g.grantee.type == 'Group' && g.grantee.uri =~ /AllUsers/ } || \ + bucket_acl.any? { |g| g.grantee.type == 'Group' && g.grantee.uri =~ /AuthenticatedUsers/ } end end @@ -97,12 +97,12 @@ def has_default_encryption_enabled? def has_versioning_enabled? return false unless exists? catch_aws_errors do - @has_versioning_enabled = @aws.storage_client.get_bucket_versioning(bucket: @bucket_name).status == "Enabled" + @has_versioning_enabled = @aws.storage_client.get_bucket_versioning(bucket: @bucket_name).status == 'Enabled' end end def has_secure_transport_enabled? - bucket_policy.any? { |s| s.effect == "Deny" && s.condition && s.condition["Bool"] && s.condition["Bool"]["aws:SecureTransport"] && s.condition["Bool"]["aws:SecureTransport"] == "false" } + bucket_policy.any? { |s| s.effect == 'Deny' && s.condition && s.condition['Bool'] && s.condition['Bool']['aws:SecureTransport'] && s.condition['Bool']['aws:SecureTransport'] == 'false' } end # below is to preserve the original 'unsupported' function but isn't used in the above @@ -117,7 +117,7 @@ def fetch_bucket_policy # AWS SDK returns a StringIO, we have to read() raw_policy = @aws.storage_client.get_bucket_policy(bucket: @bucket_name).to_h return [] if !raw_policy.key?(:policy) - JSON.parse(raw_policy[:policy].read)["Statement"].map do |statement| + JSON.parse(raw_policy[:policy].read)['Statement'].map do |statement| lowercase_hash = {} statement.each_key { |k| lowercase_hash[k.downcase] = statement[k] } policy_list += [OpenStruct.new(lowercase_hash)] diff --git a/libraries/aws_s3_bucket_object.rb b/libraries/aws_s3_bucket_object.rb index b9c468249..ef8d48dfa 100644 --- a/libraries/aws_s3_bucket_object.rb +++ b/libraries/aws_s3_bucket_object.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsS3BucketObject < AwsResourceBase - name "aws_s3_bucket_object" - desc "Verifies settings for a s3 bucket object." + name 'aws_s3_bucket_object' + desc 'Verifies settings for a s3 bucket object.' example " describe aws_s3_bucket_object(bucket_name: 'bucket_name', key: 'file_name') do it { should exist } @@ -40,8 +40,8 @@ def object_acl def public? # first line just for formatting false || \ - object_acl.any? { |g| g.grantee.type == "Group" && g.grantee.uri =~ /AllUsers/ } || \ - object_acl.any? { |g| g.grantee.type == "Group" && g.grantee.uri =~ /AuthenticatedUsers/ } + object_acl.any? { |g| g.grantee.type == 'Group' && g.grantee.uri =~ /AllUsers/ } || \ + object_acl.any? { |g| g.grantee.type == 'Group' && g.grantee.uri =~ /AuthenticatedUsers/ } end def exists? diff --git a/libraries/aws_s3_bucket_objects.rb b/libraries/aws_s3_bucket_objects.rb index bd66f265b..fcd0f201d 100644 --- a/libraries/aws_s3_bucket_objects.rb +++ b/libraries/aws_s3_bucket_objects.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsS3BucketObjects < AwsResourceBase - name "aws_s3_bucket_objects" - desc "List all the objects for a particular bucket." + name 'aws_s3_bucket_objects' + desc 'List all the objects for a particular bucket.' example " describe aws_s3_bucket_objects(bucket_name: 'test_bucket_name') do @@ -13,22 +13,22 @@ class AwsS3BucketObjects < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:contents, field: :contents) - .register_column(:contents_keys, field: :contents_keys, style: :simple) - .register_column(:contents_last_modified, field: :contents_last_modified, style: :simple) - .register_column(:contents_etags, field: :contents_etags, style: :simple) - .register_column(:contents_sizes, field: :contents_sizes, style: :simple) - .register_column(:contents_storage_classes, field: :contents_storage_classes, style: :simple) - .register_column(:contents_owners, field: :contents_owners, style: :simple) - .register_column(:names, field: :name) - .register_column(:prefixes, field: :prefix) - .register_column(:delimiters, field: :delimiter) - .register_column(:max_keys, field: :max_keys) - .register_column(:common_prefixes, field: :common_prefixes, style: :simple) - .register_column(:encoding_types, field: :encoding_type) - .register_column(:key_counts, field: :key_count) - .register_column(:continuation_tokens, field: :continuation_token) - .install_filter_methods_on_resource(self, :table) + .register_column(:contents, field: :contents) + .register_column(:contents_keys, field: :contents_keys, style: :simple) + .register_column(:contents_last_modified, field: :contents_last_modified, style: :simple) + .register_column(:contents_etags, field: :contents_etags, style: :simple) + .register_column(:contents_sizes, field: :contents_sizes, style: :simple) + .register_column(:contents_storage_classes, field: :contents_storage_classes, style: :simple) + .register_column(:contents_owners, field: :contents_owners, style: :simple) + .register_column(:names, field: :name) + .register_column(:prefixes, field: :prefix) + .register_column(:delimiters, field: :delimiter) + .register_column(:max_keys, field: :max_keys) + .register_column(:common_prefixes, field: :common_prefixes, style: :simple) + .register_column(:encoding_types, field: :encoding_type) + .register_column(:key_counts, field: :key_count) + .register_column(:continuation_tokens, field: :continuation_token) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_s3_bucket_policy.rb b/libraries/aws_s3_bucket_policy.rb index f6a261708..64f7576e2 100644 --- a/libraries/aws_s3_bucket_policy.rb +++ b/libraries/aws_s3_bucket_policy.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSS3BucketPolicy < AwsResourceBase - name "aws_s3_bucket_policy" - desc "Retrieves the policy of a specified S3 Bucket." + name 'aws_s3_bucket_policy' + desc 'Retrieves the policy of a specified S3 Bucket.' example " describe aws_s3_bucket_policy(bucket: 'BUCKET_NAME') do @@ -17,7 +17,7 @@ def initialize(opts = {}) @display_name = opts[:bucket] catch_aws_errors do resp = @aws.storage_client.get_bucket_policy({ bucket: opts[:bucket] }) - @parsed_json = JSON.parse(resp.policy.read)["Statement"] + @parsed_json = JSON.parse(resp.policy.read)['Statement'] create_resource_methods(@parsed_json[0]) end end diff --git a/libraries/aws_s3_buckets.rb b/libraries/aws_s3_buckets.rb index fcd1e8f3f..087b7322f 100644 --- a/libraries/aws_s3_buckets.rb +++ b/libraries/aws_s3_buckets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsS3Buckets < AwsResourceBase - name "aws_s3_buckets" - desc "Verifies settings for AWS S3 Buckets in bulk." + name 'aws_s3_buckets' + desc 'Verifies settings for AWS S3 Buckets in bulk.' example " describe aws_s3_bucket do its('bucket_names') { should eq ['my_bucket'] } @@ -12,9 +12,9 @@ class AwsS3Buckets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:bucket_names, field: :bucket_name) - .register_column(:tags, field: :tags, lazy: ->(r, c, t) { r[:tags] = fetch_tags_from(r, c, t) }) - .install_filter_methods_on_resource(self, :table) + .register_column(:bucket_names, field: :bucket_name) + .register_column(:tags, field: :tags, lazy: ->(r, c, t) { r[:tags] = fetch_tags_from(r, c, t) }) + .install_filter_methods_on_resource(self, :table) # helps to lazy load tags def self.fetch_tags_from(row, _condition, table) diff --git a/libraries/aws_sdb_domains.rb b/libraries/aws_sdb_domains.rb index 32abc5e8c..3fa6267b6 100644 --- a/libraries/aws_sdb_domains.rb +++ b/libraries/aws_sdb_domains.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSDBDomains < AwsResourceBase - name "aws_sdb_domains" - desc "Verifies settings for SDB Domain in bulk." + name 'aws_sdb_domains' + desc 'Verifies settings for SDB Domain in bulk.' example " describe aws_sdb_domains do @@ -19,8 +19,8 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:domain_names, field: :domain_names, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:domain_names, field: :domain_names, style: :simple) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_secretsmanager_secret.rb b/libraries/aws_secretsmanager_secret.rb index fc2163e02..8394f9eba 100644 --- a/libraries/aws_secretsmanager_secret.rb +++ b/libraries/aws_secretsmanager_secret.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSecretsManagerSecret < AwsResourceBase - name "aws_secretsmanager_secret" - desc "Retrieves the details of a secret." + name 'aws_secretsmanager_secret' + desc 'Retrieves the details of a secret.' example " describe aws_secretsmanager_secret(secret_id: 'Secret-Id') do @@ -28,7 +28,7 @@ def resource_id end def secret_id - return nil unless exists? + return unless exists? @res[:secret_id] end diff --git a/libraries/aws_secretsmanager_secrets.rb b/libraries/aws_secretsmanager_secrets.rb index f7c92662c..dbf87e7b6 100644 --- a/libraries/aws_secretsmanager_secrets.rb +++ b/libraries/aws_secretsmanager_secrets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSecretsManagerSecrets < AwsResourceBase - name "aws_secretsmanager_secrets" - desc "Lists all of the secrets that are stored by Secrets Manager in the AWS account." + name 'aws_secretsmanager_secrets' + desc 'Lists all of the secrets that are stored by Secrets Manager in the AWS account.' example " describe aws_secretsmanager_secrets do @@ -13,23 +13,23 @@ class AWSSecretsManagerSecrets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:names, field: :name) - .register_column(:descriptions, field: :description) - .register_column(:kms_key_ids, field: :kms_key_id) - .register_column(:rotation_enableds, field: :rotation_enabled) - .register_column(:rotation_lambda_arns, field: :rotation_lambda_arn) - .register_column(:rotation_rules, field: :rotation_rules) - .register_column(:last_rotated_dates, field: :last_rotated_date) - .register_column(:last_changed_dates, field: :last_changed_date) - .register_column(:last_accessed_dates, field: :last_accessed_date) - .register_column(:deleted_dates, field: :deleted_date) - .register_column(:tags, field: :tags) - .register_column(:secret_versions_to_stages, field: :secret_versions_to_stages) - .register_column(:owning_services, field: :owning_service) - .register_column(:created_dates, field: :created_date) - .register_column(:primary_regions, field: :primary_region) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:names, field: :name) + .register_column(:descriptions, field: :description) + .register_column(:kms_key_ids, field: :kms_key_id) + .register_column(:rotation_enableds, field: :rotation_enabled) + .register_column(:rotation_lambda_arns, field: :rotation_lambda_arn) + .register_column(:rotation_rules, field: :rotation_rules) + .register_column(:last_rotated_dates, field: :last_rotated_date) + .register_column(:last_changed_dates, field: :last_changed_date) + .register_column(:last_accessed_dates, field: :last_accessed_date) + .register_column(:deleted_dates, field: :deleted_date) + .register_column(:tags, field: :tags) + .register_column(:secret_versions_to_stages, field: :secret_versions_to_stages) + .register_column(:owning_services, field: :owning_service) + .register_column(:created_dates, field: :created_date) + .register_column(:primary_regions, field: :primary_region) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_security_group.rb b/libraries/aws_security_group.rb index ede6c7023..c9cb1bac6 100644 --- a/libraries/aws_security_group.rb +++ b/libraries/aws_security_group.rb @@ -1,10 +1,10 @@ -require "set" -require "ipaddr" -require "aws_backend" +require 'set' +require 'ipaddr' +require 'aws_backend' class AwsSecurityGroup < AwsResourceBase - name "aws_security_group" - desc "Verifies settings for an individual AWS Security Group." + name 'aws_security_group' + desc 'Verifies settings for an individual AWS Security Group.' example " describe aws_security_group('sg-12345678') do it { should exist } @@ -24,14 +24,14 @@ def initialize(opts = {}) filter = [] if opts.key?(:vpc_id) raise ArgumentError, "#{@__resource_name__}: VPC ID must be in the format 'vpc-' followed by 8 or 17 hexadecimal characters." if opts[:vpc_id] !~ /^vpc\-[0-9a-f]{8}|(^vpc\-[0-9a-f]{17})$/ - filter += [{ name: "vpc-id", values: [opts[:vpc_id]] }] + filter += [{ name: 'vpc-id', values: [opts[:vpc_id]] }] end if opts.key?(:group_id) raise ArgumentError, "#{@__resource_name__}: security group ID must be in the format 'sg-' followed by 8 or 17 hexadecimal characters." if opts[:group_id] !~ /^sg\-[0-9a-f]{8}|(^sg\-[0-9a-f]{17})$/ - filter += [{ name: "group-id", values: [opts[:group_id]] }] + filter += [{ name: 'group-id', values: [opts[:group_id]] }] end - filter += [{ name: "group-name", values: [opts[:group_name]] }] if opts.key?(:group_name) + filter += [{ name: 'group-name', values: [opts[:group_name]] }] if opts.key?(:group_name) end if opts.key?(:resource_data) @@ -47,7 +47,7 @@ def initialize(opts = {}) if resp.security_groups.empty? @inbound_rules = [] @outbound_rules = [] - @group_id = "empty response" + @group_id = 'empty response' return end @security_group = resp.security_groups[0] @@ -97,7 +97,7 @@ def resource_id end def to_s - sg = "" + sg = '' sg += "ID: #{@group_id} " if @group_id sg += "Name: #{@group_name} " if @group_name sg += "VPC ID: #{@vpc_id} " if @vpc_id @@ -159,7 +159,7 @@ def allow__check_criteria(raw_criteria) # Any leftovers are unwelcome unless raw_criteria.empty? - raise ArgumentError, "Unrecognized security group rule 'allow' criteria '#{raw_criteria.keys.join(",")}'. Expected criteria: #{allowed_criteria.join(", ")}" + raise ArgumentError, "Unrecognized security group rule 'allow' criteria '#{raw_criteria.keys.join(',')}'. Expected criteria: #{allowed_criteria.join(', ')}" end recognized_criteria @@ -223,7 +223,7 @@ def allow__match_protocol(rule, criteria) return true unless criteria.key?(:protocol) prot = criteria[:protocol] # We provide a "fluency alias" for -1 (any). - prot = "-1" if prot == "any" or prot.casecmp?("all") + prot = '-1' if prot == 'any' or prot.casecmp?('all') rule[:ip_protocol] == prot end @@ -231,11 +231,11 @@ def allow__match_protocol(rule, criteria) def match_ipv4_or_6_range(rule, criteria) if criteria.key?(:ipv4_range) query = criteria[:ipv4_range] - query = [query] unless query.is_a?(Array) + query = Array(query) ranges = rule[:ip_ranges].map { |rng| rng[:cidr_ip] } else # IPv6 query = criteria[:ipv6_range] - query = [query] unless query.is_a?(Array) + query = Array(query) ranges = rule[:ipv_6_ranges].map { |rng| rng[:cidr_ipv_6] } end diff --git a/libraries/aws_security_groups.rb b/libraries/aws_security_groups.rb index 61dff86f4..186ae4c38 100644 --- a/libraries/aws_security_groups.rb +++ b/libraries/aws_security_groups.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSecurityGroups < AwsCollectionResourceBase - name "aws_security_groups" - desc "Verifies settings for AWS Security Groups in bulk." + name 'aws_security_groups' + desc 'Verifies settings for AWS Security Groups in bulk.' example " # Verify that you have security groups defined describe aws_security_groups do diff --git a/libraries/aws_securityhub_hub.rb b/libraries/aws_securityhub_hub.rb index c9dcdc020..0817115b0 100644 --- a/libraries/aws_securityhub_hub.rb +++ b/libraries/aws_securityhub_hub.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSecurityHubHub < AwsResourceBase - name "aws_securityhub_hub" - desc "Gets information about the Security Hub." + name 'aws_securityhub_hub' + desc 'Gets information about the Security Hub.' example " describe aws_securityhub_hub(hub_arn: 'HUB_ARN') do @@ -29,7 +29,7 @@ def resource_id end def hub_arn - return nil unless exists? + return unless exists? @hub_arn end diff --git a/libraries/aws_servicecatalog_cloud_formation_product.rb b/libraries/aws_servicecatalog_cloud_formation_product.rb index 2b9af0524..edd516bc6 100644 --- a/libraries/aws_servicecatalog_cloud_formation_product.rb +++ b/libraries/aws_servicecatalog_cloud_formation_product.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSServiceCatalogCloudFormationProduct < AwsResourceBase - name "aws_servicecatalog_cloud_formation_product" - desc "Gets information about the specified product." + name 'aws_servicecatalog_cloud_formation_product' + desc 'Gets information about the specified product.' example " describe aws_servicecatalog_cloud_formation_product(name: 'product_name') do @@ -29,7 +29,7 @@ def resource_id end def name - return nil unless exists? + return unless exists? @res[:name] end diff --git a/libraries/aws_servicecatalog_launch_role_constraint.rb b/libraries/aws_servicecatalog_launch_role_constraint.rb index 4265b6afc..a39d9a315 100644 --- a/libraries/aws_servicecatalog_launch_role_constraint.rb +++ b/libraries/aws_servicecatalog_launch_role_constraint.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSServiceCatalogLaunchRoleConstraint < AwsResourceBase - name "aws_servicecatalog_launch_role_constraint" - desc "Gets information about the specified constraint." + name 'aws_servicecatalog_launch_role_constraint' + desc 'Gets information about the specified constraint.' example " describe aws_servicecatalog_launch_role_constraint(id: 'Id') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def resource_id - @res? @display_name : "" + @res? @display_name : '' end def exists? diff --git a/libraries/aws_servicecatalog_launch_role_constraints.rb b/libraries/aws_servicecatalog_launch_role_constraints.rb index 01db4f60e..b9b7c7efe 100644 --- a/libraries/aws_servicecatalog_launch_role_constraints.rb +++ b/libraries/aws_servicecatalog_launch_role_constraints.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSServiceCatalogLaunchRoleConstraints < AwsResourceBase - name "aws_servicecatalog_launch_role_constraints" - desc "Lists the constraints for the specified portfolio and product." + name 'aws_servicecatalog_launch_role_constraints' + desc 'Lists the constraints for the specified portfolio and product.' example " describe aws_servicecatalog_launch_role_constraints(portfolio_id: 'portfolio_id') do @@ -13,13 +13,13 @@ class AWSServiceCatalogLaunchRoleConstraints < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:constraint_ids, field: :constraint_id) - .register_column(:types, field: :type) - .register_column(:descriptions, field: :description) - .register_column(:owners, field: :owner) - .register_column(:product_ids, field: :product_id) - .register_column(:portfolio_ids, field: :portfolio_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:constraint_ids, field: :constraint_id) + .register_column(:types, field: :type) + .register_column(:descriptions, field: :description) + .register_column(:owners, field: :owner) + .register_column(:product_ids, field: :product_id) + .register_column(:portfolio_ids, field: :portfolio_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_servicecatalog_portfolio_principal_association.rb b/libraries/aws_servicecatalog_portfolio_principal_association.rb index e99d0597b..b19a2604a 100644 --- a/libraries/aws_servicecatalog_portfolio_principal_association.rb +++ b/libraries/aws_servicecatalog_portfolio_principal_association.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSServiceCatalogPortfolioPrincipalAssociation < AwsResourceBase - name "aws_servicecatalog_portfolio_principal_association" - desc "Lists all principal ARNs associated with the specified portfolio." + name 'aws_servicecatalog_portfolio_principal_association' + desc 'Lists all principal ARNs associated with the specified portfolio.' example " describe aws_servicecatalog_portfolio_principal_association(portfolio_id: 'test1') do @@ -29,7 +29,7 @@ def resource_id end def portfolio_id - return nil unless exists? + return unless exists? @res[:portfolio_id] end diff --git a/libraries/aws_servicecatalog_portfolio_principal_associations.rb b/libraries/aws_servicecatalog_portfolio_principal_associations.rb index f9b422269..97ab57c09 100644 --- a/libraries/aws_servicecatalog_portfolio_principal_associations.rb +++ b/libraries/aws_servicecatalog_portfolio_principal_associations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSServiceCatalogPortfolioPrincipalAssociations < AwsResourceBase - name "aws_servicecatalog_portfolio_principal_associations" - desc "Lists all principal ARNs associated with the specified portfolio." + name 'aws_servicecatalog_portfolio_principal_associations' + desc 'Lists all principal ARNs associated with the specified portfolio.' example " describe aws_servicecatalog_portfolio_principal_associations(portfolio_id: 'test1') do @@ -13,9 +13,9 @@ class AWSServiceCatalogPortfolioPrincipalAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:principal_arns, field: :principal_arn) - .register_column(:principal_types, field: :principal_type) - .install_filter_methods_on_resource(self, :table) + .register_column(:principal_arns, field: :principal_arn) + .register_column(:principal_types, field: :principal_type) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_servicecatalog_portfolio_product_association.rb b/libraries/aws_servicecatalog_portfolio_product_association.rb index 125f5d153..457746cd2 100644 --- a/libraries/aws_servicecatalog_portfolio_product_association.rb +++ b/libraries/aws_servicecatalog_portfolio_product_association.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSServiceCatalogPortfolioProductAssociation < AwsResourceBase - name "aws_servicecatalog_portfolio_product_association" - desc "Describe a portfolio that the specified product is associated with." + name 'aws_servicecatalog_portfolio_product_association' + desc 'Describe a portfolio that the specified product is associated with.' example " describe aws_servicecatalog_portfolio_product_association(product_id: 'test1') do @@ -29,7 +29,7 @@ def resource_id end def product_id - return nil unless exists? + return unless exists? @res[:product_id] end diff --git a/libraries/aws_servicecatalog_portfolio_product_associations.rb b/libraries/aws_servicecatalog_portfolio_product_associations.rb index d56a957d8..1d346861f 100644 --- a/libraries/aws_servicecatalog_portfolio_product_associations.rb +++ b/libraries/aws_servicecatalog_portfolio_product_associations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSServiceCatalogPortfolioProductAssociations < AwsResourceBase - name "aws_servicecatalog_portfolio_product_associations" - desc "Lists all portfolios that the specified product is associated with." + name 'aws_servicecatalog_portfolio_product_associations' + desc 'Lists all portfolios that the specified product is associated with.' example " describe aws_servicecatalog_portfolio_product_associations(product_id: 'test1') do @@ -13,13 +13,13 @@ class AWSServiceCatalogPortfolioProductAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:arns, field: :arn) - .register_column(:display_names, field: :display_name) - .register_column(:descriptions, field: :description) - .register_column(:created_times, field: :created_time) - .register_column(:provider_names, field: :provider_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:arns, field: :arn) + .register_column(:display_names, field: :display_name) + .register_column(:descriptions, field: :description) + .register_column(:created_times, field: :created_time) + .register_column(:provider_names, field: :provider_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ses_receipt_rule.rb b/libraries/aws_ses_receipt_rule.rb index 8d71e04ba..00f6411ab 100644 --- a/libraries/aws_ses_receipt_rule.rb +++ b/libraries/aws_ses_receipt_rule.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSESReceiptRule < AwsResourceBase - name "aws_ses_receipt_rule" - desc "Returns the details of the specified receipt rule." + name 'aws_ses_receipt_rule' + desc 'Returns the details of the specified receipt rule.' example " describe aws_ses_receipt_rule(rule_set_name: 'RULE_SET_NAME', rule_name: 'RULE_NAME') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def rule_name - return nil unless exists? + return unless exists? @res[:rule_name] end diff --git a/libraries/aws_ses_receipt_rule_set.rb b/libraries/aws_ses_receipt_rule_set.rb index 4ad178bba..58e11e85a 100644 --- a/libraries/aws_ses_receipt_rule_set.rb +++ b/libraries/aws_ses_receipt_rule_set.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSESReceiptRuleSet < AwsResourceBase - name "aws_ses_receipt_rule_set" - desc "Returns the details of the specified receipt rule set." + name 'aws_ses_receipt_rule_set' + desc 'Returns the details of the specified receipt rule set.' example " describe aws_ses_receipt_rule_set(rule_set_name: 'RULE_SET_NAME') do @@ -23,7 +23,7 @@ def initialize(opts = {}) end def rule_set_name - return nil unless exists? + return unless exists? @res[:rule_set_name] end diff --git a/libraries/aws_ses_receipt_rule_sets.rb b/libraries/aws_ses_receipt_rule_sets.rb index d0d98b856..a73fa2848 100644 --- a/libraries/aws_ses_receipt_rule_sets.rb +++ b/libraries/aws_ses_receipt_rule_sets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSESReceiptRuleSets < AwsResourceBase - name "aws_ses_receipt_rule_sets" - desc "Lists the receipt rule sets that exist under your AWS account in the current AWS Region." + name 'aws_ses_receipt_rule_sets' + desc 'Lists the receipt rule sets that exist under your AWS account in the current AWS Region.' example " describe aws_ses_receipt_rule_sets do @@ -13,9 +13,9 @@ class AWSSESReceiptRuleSets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:created_timestamps, field: :created_timestamp) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:created_timestamps, field: :created_timestamp) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ses_template.rb b/libraries/aws_ses_template.rb index 292177e5d..e43ec894f 100644 --- a/libraries/aws_ses_template.rb +++ b/libraries/aws_ses_template.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSESTemplate < AwsResourceBase - name "aws_ses_template" - desc "Displays the template object (which includes the Subject line, HTML part and text part) for the template you specify." + name 'aws_ses_template' + desc 'Displays the template object (which includes the Subject line, HTML part and text part) for the template you specify.' example " describe aws_ses_template(template_name: 'TEMPLATE_NAME') do @@ -23,7 +23,7 @@ def initialize(opts = {}) end def template_name - return nil unless exists? + return unless exists? @res[:template_name] end diff --git a/libraries/aws_ses_templates.rb b/libraries/aws_ses_templates.rb index c527c02bd..b6f6febc3 100644 --- a/libraries/aws_ses_templates.rb +++ b/libraries/aws_ses_templates.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSESTemplates < AwsResourceBase - name "aws_ses_templates" - desc "Lists the email templates present in your Amazon SES account in the current AWS Region." + name 'aws_ses_templates' + desc 'Lists the email templates present in your Amazon SES account in the current AWS Region.' example " describe aws_ses_templates do @@ -13,9 +13,9 @@ class AWSSESTemplates < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:created_timestamps, field: :created_timestamp) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:created_timestamps, field: :created_timestamp) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_shield_subscription.rb b/libraries/aws_shield_subscription.rb index d9fd465c2..f31817bfb 100644 --- a/libraries/aws_shield_subscription.rb +++ b/libraries/aws_shield_subscription.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsShieldSubscription < AwsResourceBase - name "aws_shield_subscription" - desc "Verifies settings for a Shield Subscription." + name 'aws_shield_subscription' + desc 'Verifies settings for a Shield Subscription.' example " describe aws_shield_subscription do it { should exist } diff --git a/libraries/aws_signer_profile_permissions.rb b/libraries/aws_signer_profile_permissions.rb index 5a72f9333..0911ac5b5 100644 --- a/libraries/aws_signer_profile_permissions.rb +++ b/libraries/aws_signer_profile_permissions.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSignerProfilePermissions < AwsResourceBase - name "aws_signer_profile_permissions" - desc "Lists the cross-account permissions associated with a signing profile." + name 'aws_signer_profile_permissions' + desc 'Lists the cross-account permissions associated with a signing profile.' example " describe aws_signer_profile_permissions(profile_name: 'PROFILE_NAME') do @@ -13,11 +13,11 @@ class AWSSignerProfilePermissions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:actions, field: :action) - .register_column(:principals, field: :principal) - .register_column(:statement_ids, field: :statement_id) - .register_column(:profile_versions, field: :profile_version) - .install_filter_methods_on_resource(self, :table) + .register_column(:actions, field: :action) + .register_column(:principals, field: :principal) + .register_column(:statement_ids, field: :statement_id) + .register_column(:profile_versions, field: :profile_version) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_signer_signing_profile.rb b/libraries/aws_signer_signing_profile.rb index fb0570346..62aed3f3e 100644 --- a/libraries/aws_signer_signing_profile.rb +++ b/libraries/aws_signer_signing_profile.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSignerSigningProfile < AwsResourceBase - name "aws_signer_signing_profile" - desc "Returns information on a specific signing profile." + name 'aws_signer_signing_profile' + desc 'Returns information on a specific signing profile.' example " describe aws_signer_signing_profile(profile_name: 'PROFILE_NAME') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def profile_name - return nil unless exists? + return unless exists? @res[:profile_name] end diff --git a/libraries/aws_signer_signing_profiles.rb b/libraries/aws_signer_signing_profiles.rb index 9646c5b85..beb30ee9c 100644 --- a/libraries/aws_signer_signing_profiles.rb +++ b/libraries/aws_signer_signing_profiles.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSignerSigningProfiles < AwsResourceBase - name "aws_signer_signing_profiles" - desc "Returns information on a specific signing profile." + name 'aws_signer_signing_profiles' + desc 'Returns information on a specific signing profile.' example " describe aws_signer_signing_profiles do @@ -13,18 +13,18 @@ class AWSSignerSigningProfiles < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:profile_names, field: :profile_name) - .register_column(:profile_versions, field: :profile_version) - .register_column(:profile_version_arns, field: :profile_version_arn) - .register_column(:signing_materials, field: :signing_material) - .register_column(:signature_validity_periods, field: :signature_validity_period) - .register_column(:platform_ids, field: :platform_id) - .register_column(:platform_display_names, field: :platform_display_name) - .register_column(:signing_parameters, field: :signing_parameters) - .register_column(:statuses, field: :status) - .register_column(:arns, field: :arn) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:profile_names, field: :profile_name) + .register_column(:profile_versions, field: :profile_version) + .register_column(:profile_version_arns, field: :profile_version_arn) + .register_column(:signing_materials, field: :signing_material) + .register_column(:signature_validity_periods, field: :signature_validity_period) + .register_column(:platform_ids, field: :platform_id) + .register_column(:platform_display_names, field: :platform_display_name) + .register_column(:signing_parameters, field: :signing_parameters) + .register_column(:statuses, field: :status) + .register_column(:arns, field: :arn) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_sns_subscription.rb b/libraries/aws_sns_subscription.rb index d0646f36d..e545e78a5 100644 --- a/libraries/aws_sns_subscription.rb +++ b/libraries/aws_sns_subscription.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSnsSubscription < AwsResourceBase - name "aws_sns_subscription" - desc "Verifies settings for a SNS Subscription." + name 'aws_sns_subscription' + desc 'Verifies settings for a SNS Subscription.' example " describe aws_sns_subscription('arn:aws:sns:us-east-1::test-topic-01:b214aff5-a2c7-438f-a753-8494493f2ff6') do it { should_not have_raw_message_delivery } @@ -30,12 +30,12 @@ def initialize(opts = {}) catch_aws_errors do begin aws_response = @aws.sns_client.get_subscription_attributes(subscription_arn: opts[:subscription_arn]).attributes.to_h - @owner = aws_response["Owner"] - @topic_arn = aws_response["TopicArn"] - @endpoint = aws_response["Endpoint"] - @protocol = aws_response["Protocol"] - @raw_message_delivery = aws_response["RawMessageDelivery"].eql?("true") - @confirmation_was_authenticated = aws_response["ConfirmationWasAuthenticated"].eql?("true") + @owner = aws_response['Owner'] + @topic_arn = aws_response['TopicArn'] + @endpoint = aws_response['Endpoint'] + @protocol = aws_response['Protocol'] + @raw_message_delivery = aws_response['RawMessageDelivery'].eql?('true') + @confirmation_was_authenticated = aws_response['ConfirmationWasAuthenticated'].eql?('true') rescue Aws::SNS::Errors::NotFound return end diff --git a/libraries/aws_sns_subscriptions.rb b/libraries/aws_sns_subscriptions.rb index d5f8634e3..07421c2e8 100644 --- a/libraries/aws_sns_subscriptions.rb +++ b/libraries/aws_sns_subscriptions.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSNSSubscriptions < AwsResourceBase - name "aws_sns_subscriptions" - desc "Verifies setting for a SNS Subscriptions." + name 'aws_sns_subscriptions' + desc 'Verifies setting for a SNS Subscriptions.' example " describe aws_sns_subscriptions do @@ -13,12 +13,12 @@ class AWSSNSSubscriptions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:subscription_arns, field: :subscription_arn) - .register_column(:owners, field: :owner) - .register_column(:protocols, field: :protocol) - .register_column(:endpoints, field: :endpoint) - .register_column(:topic_arns, field: :topic_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:subscription_arns, field: :subscription_arn) + .register_column(:owners, field: :owner) + .register_column(:protocols, field: :protocol) + .register_column(:endpoints, field: :endpoint) + .register_column(:topic_arns, field: :topic_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_sns_topic.rb b/libraries/aws_sns_topic.rb index 17b59ea8a..849f50d9f 100644 --- a/libraries/aws_sns_topic.rb +++ b/libraries/aws_sns_topic.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSnsTopic < AwsResourceBase - name "aws_sns_topic" - desc "Verifies settings for an SNS Topic." + name 'aws_sns_topic' + desc 'Verifies settings for an SNS Topic.' example " describe aws_sns_topic('arn:aws:sns:us-east-1:123456789012:some-topic') do it { should exist } @@ -22,8 +22,8 @@ def initialize(opts = {}) catch_aws_errors do begin resp = @aws.sns_client.get_topic_attributes(topic_arn: @arn).attributes.to_h - @confirmed_subscription_count = resp["SubscriptionsConfirmed"].to_i - @kms_master_key_id = resp["KmsMasterKeyId"] + @confirmed_subscription_count = resp['SubscriptionsConfirmed'].to_i + @kms_master_key_id = resp['KmsMasterKeyId'] create_resource_methods(resp) rescue Aws::SNS::Errors::NotFound return diff --git a/libraries/aws_sns_topics.rb b/libraries/aws_sns_topics.rb index 06dc16d00..18af7d7cb 100644 --- a/libraries/aws_sns_topics.rb +++ b/libraries/aws_sns_topics.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSnsTopics < AwsResourceBase - name "aws_sns_topics" - desc "Verifies settings for SNS Topics in bulk." + name 'aws_sns_topics' + desc 'Verifies settings for SNS Topics in bulk.' example " describe aws_sns_topics do its('topic_arns') { should include 'arn:aws:sns:us-west-2:012345678901:aws-sns-topic-auzoitotenajpdiftuiorkmrf' } @@ -11,8 +11,8 @@ class AwsSnsTopics < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:topic_arns, field: :topic_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:topic_arns, field: :topic_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_sqs_queue.rb b/libraries/aws_sqs_queue.rb index 8470fab65..a612c5494 100644 --- a/libraries/aws_sqs_queue.rb +++ b/libraries/aws_sqs_queue.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSqsQueue < AwsResourceBase - name "aws_sqs_queue" - desc "Verifies settings for an SQS Queue." + name 'aws_sqs_queue' + desc 'Verifies settings for an SQS Queue.' example " describe aws_sqs_queue('queue-name') do it { should exist } @@ -20,21 +20,21 @@ def initialize(opts = {}) super(opts) validate_parameters(required: [:queue_url]) catch_aws_errors do - resp = @aws.sqs_client.get_queue_attributes(queue_url: opts[:queue_url], attribute_names: ["All"]).attributes - @arn = resp["QueueArn"] - @visibility_timeout = resp["VisibilityTimeout"].to_i - @maximum_message_size = resp["MaximumMessageSize"].to_i - @message_retention_period = resp["MessageRetentionPeriod"].to_i - @delay_seconds = resp["DelaySeconds"].to_i - @receive_message_wait_timeout_seconds = resp["ReceiveMessageWaitTimeoutSeconds"].to_i - @content_based_deduplication = resp["ContentBasedDeduplication"].nil? ? false: true - @is_fifo_queue = resp["FifoQueue"].nil? ? false: true - @redrive_policy = resp["RedrivePolicy"] - @kms_master_key_id = resp["KmsMasterKeyId"] - @kms_data_key_reuse_period_seconds = resp["KmsDataKeyReusePeriodSeconds"] - @sqs_managed_enabled = resp["SqsManagedSseEnabled"] - @sqs_managed = resp["SqsManagedSseEnabled"].nil? ? false: true - @policy = resp["Policy"] + resp = @aws.sqs_client.get_queue_attributes(queue_url: opts[:queue_url], attribute_names: ['All']).attributes + @arn = resp['QueueArn'] + @visibility_timeout = resp['VisibilityTimeout'].to_i + @maximum_message_size = resp['MaximumMessageSize'].to_i + @message_retention_period = resp['MessageRetentionPeriod'].to_i + @delay_seconds = resp['DelaySeconds'].to_i + @receive_message_wait_timeout_seconds = resp['ReceiveMessageWaitTimeoutSeconds'].to_i + @content_based_deduplication = resp['ContentBasedDeduplication'].nil? ? false: true + @is_fifo_queue = resp['FifoQueue'].nil? ? false: true + @redrive_policy = resp['RedrivePolicy'] + @kms_master_key_id = resp['KmsMasterKeyId'] + @kms_data_key_reuse_period_seconds = resp['KmsDataKeyReusePeriodSeconds'] + @sqs_managed_enabled = resp['SqsManagedSseEnabled'] + @sqs_managed = resp['SqsManagedSseEnabled'].nil? ? false: true + @policy = resp['Policy'] create_resource_methods(resp.to_h) end end @@ -52,10 +52,10 @@ def to_s end def policy_statement_principal_all_permissions_enabled? - @policy_statement_principal_all_permissions_enabled = @policy_statement_principal.include? "*" + @policy_statement_principal_all_permissions_enabled = @policy_statement_principal.include? '*' end def policy_statement_action_all_permissions_enabled? - @policy_statement_action_all_permissions_enabled = @policy_statement_action.include? "*" + @policy_statement_action_all_permissions_enabled = @policy_statement_action.include? '*' end end diff --git a/libraries/aws_sqs_queues.rb b/libraries/aws_sqs_queues.rb index 79c88ec86..54409733c 100644 --- a/libraries/aws_sqs_queues.rb +++ b/libraries/aws_sqs_queues.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSqsQueues < AwsResourceBase - name "aws_sqs_queues" - desc "Verifies settings for a collection AWS SQS Queues." + name 'aws_sqs_queues' + desc 'Verifies settings for a collection AWS SQS Queues.' example " describe aws_sqs_queues do it { should exist } @@ -12,16 +12,16 @@ class AwsSqsQueues < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:queue_urls, field: :queue_url) - .register_column(:is_fifo_queues, field: :is_fifo_queue) - .register_column(:visibility_timeouts, field: :visibility_timeout) - .register_column(:maximum_message_sizes, field: :maximum_message_size) - .register_column(:message_retention_periods, field: :message_retention_period) - .register_column(:delay_seconds, field: :delay_seconds) - .register_column(:receive_message_wait_timeout_seconds, field: :receive_message_wait_timeout_seconds) - .register_column(:content_based_deduplications, field: :content_based_deduplication) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:queue_urls, field: :queue_url) + .register_column(:is_fifo_queues, field: :is_fifo_queue) + .register_column(:visibility_timeouts, field: :visibility_timeout) + .register_column(:maximum_message_sizes, field: :maximum_message_size) + .register_column(:message_retention_periods, field: :message_retention_period) + .register_column(:delay_seconds, field: :delay_seconds) + .register_column(:receive_message_wait_timeout_seconds, field: :receive_message_wait_timeout_seconds) + .register_column(:content_based_deduplications, field: :content_based_deduplication) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -35,16 +35,16 @@ def fetch_data response = @aws.sqs_client.list_queues return [] if !response || response.empty? response.queue_urls.each do |url| - queue_attributes = @aws.sqs_client.get_queue_attributes(queue_url: url, attribute_names: ["All"]).attributes - queue_rows += [{ arn: queue_attributes["QueueArn"], + queue_attributes = @aws.sqs_client.get_queue_attributes(queue_url: url, attribute_names: ['All']).attributes + queue_rows += [{ arn: queue_attributes['QueueArn'], queue_url: url, - attachment_count: queue_attributes["VisibilityTimeout"].to_i, - default_version_id: queue_attributes["MaximumMessageSize"].to_i, - policy_name: queue_attributes["MessageRetentionPeriod"].to_i, - policy_id: queue_attributes["DelaySeconds"].to_i, - attached_groups: queue_attributes["ReceiveMessageWaitTimeoutSeconds"].to_i, - attached_roles: queue_attributes["ContentBasedDeduplication"].nil? ? false: true, - attached_users: queue_attributes["FifoQueue"].nil? ? false: true }] + attachment_count: queue_attributes['VisibilityTimeout'].to_i, + default_version_id: queue_attributes['MaximumMessageSize'].to_i, + policy_name: queue_attributes['MessageRetentionPeriod'].to_i, + policy_id: queue_attributes['DelaySeconds'].to_i, + attached_groups: queue_attributes['ReceiveMessageWaitTimeoutSeconds'].to_i, + attached_roles: queue_attributes['ContentBasedDeduplication'].nil? ? false: true, + attached_users: queue_attributes['FifoQueue'].nil? ? false: true }] end end @table = queue_rows diff --git a/libraries/aws_ssm_activation.rb b/libraries/aws_ssm_activation.rb index b6acb9c0f..e9e1f4826 100644 --- a/libraries/aws_ssm_activation.rb +++ b/libraries/aws_ssm_activation.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSsmActivation < AwsResourceBase - name "aws_ssm_activation" - desc "Verifies settings for a SSM Activation." + name 'aws_ssm_activation' + desc 'Verifies settings for a SSM Activation.' example " describe aws_ssm_activation(activation_id: 'activation-id') do @@ -17,7 +17,7 @@ def initialize(opts = {}) @display_name = opts[:activation_id] catch_aws_errors do - filter = { filter_key: "ActivationIds", filter_values: [opts[:activation_id]] } + filter = { filter_key: 'ActivationIds', filter_values: [opts[:activation_id]] } resp = @aws.ssm_client.describe_activations({ filters: [filter] }) if resp.activation_list.first.nil? empty_response_warn diff --git a/libraries/aws_ssm_activations.rb b/libraries/aws_ssm_activations.rb index 2f2a6b591..0f4c0fbfb 100644 --- a/libraries/aws_ssm_activations.rb +++ b/libraries/aws_ssm_activations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSsmActivations < AwsResourceBase - name "aws_ssm_activations" - desc "Verifies settings for a SSM Activation in bulk." + name 'aws_ssm_activations' + desc 'Verifies settings for a SSM Activation in bulk.' example " describe aws_ssm_activations do it { should exist } @@ -12,17 +12,17 @@ class AwsSsmActivations < AwsResourceBase attr_reader :table, :api_response FilterTable.create - .register_column(:activation_ids, field: :activation_id) - .register_column(:descriptions, field: :description) - .register_column(:default_instance_names, field: :default_instance_name) - .register_column(:iam_roles, field: :iam_role) - .register_column(:registration_limits, field: :registration_limit) - .register_column(:registrations_count, field: :registrations_count) - .register_column(:expiration_dates, field: :expiration_date) - .register_column(:expired, field: :expired) - .register_column(:created_dates, field: :created_date) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:activation_ids, field: :activation_id) + .register_column(:descriptions, field: :description) + .register_column(:default_instance_names, field: :default_instance_name) + .register_column(:iam_roles, field: :iam_role) + .register_column(:registration_limits, field: :registration_limit) + .register_column(:registrations_count, field: :registrations_count) + .register_column(:expiration_dates, field: :expiration_date) + .register_column(:expired, field: :expired) + .register_column(:created_dates, field: :created_date) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_association.rb b/libraries/aws_ssm_association.rb index 0b52ccf29..cc961fa3e 100644 --- a/libraries/aws_ssm_association.rb +++ b/libraries/aws_ssm_association.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSsmAssociation < AwsResourceBase - name "aws_ssm_association" - desc "Verifies settings for a SSM Association." + name 'aws_ssm_association' + desc 'Verifies settings for a SSM Association.' example " describe aws_ssm_association(association_id: 'association-id') do diff --git a/libraries/aws_ssm_associations.rb b/libraries/aws_ssm_associations.rb index 15f5cce6a..23b7a0257 100644 --- a/libraries/aws_ssm_associations.rb +++ b/libraries/aws_ssm_associations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSsmAssociations < AwsResourceBase - name "aws_ssm_associations" - desc "Verifies settings for a SSM Association in bulk." + name 'aws_ssm_associations' + desc 'Verifies settings for a SSM Association in bulk.' example " describe aws_ssm_associations do it { should exist } @@ -12,17 +12,17 @@ class AwsSsmAssociations < AwsResourceBase attr_reader :table, :api_response FilterTable.create - .register_column(:names, field: :name) - .register_column(:instance_ids, field: :instance_id) - .register_column(:association_ids, field: :association_id) - .register_column(:association_versions, field: :association_version) - .register_column(:document_versions, field: :document_version) - .register_column(:targets, field: :targets) - .register_column(:last_execution_dates, field: :last_execution_date) - .register_column(:overviews, field: :overview) - .register_column(:schedule_expressions, field: :schedule_expression) - .register_column(:association_names, field: :association_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:instance_ids, field: :instance_id) + .register_column(:association_ids, field: :association_id) + .register_column(:association_versions, field: :association_version) + .register_column(:document_versions, field: :document_version) + .register_column(:targets, field: :targets) + .register_column(:last_execution_dates, field: :last_execution_date) + .register_column(:overviews, field: :overview) + .register_column(:schedule_expressions, field: :schedule_expression) + .register_column(:association_names, field: :association_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_document.rb b/libraries/aws_ssm_document.rb index 44dadb5ca..af13d2ca0 100644 --- a/libraries/aws_ssm_document.rb +++ b/libraries/aws_ssm_document.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSsmDocument < AwsResourceBase - name "aws_ssm_document" - desc "Verifies settings for a SSM Document." + name 'aws_ssm_document' + desc 'Verifies settings for a SSM Document.' example " describe aws_ssm_document(name: 'document-name') do diff --git a/libraries/aws_ssm_documents.rb b/libraries/aws_ssm_documents.rb index 7b6440d6e..65477633b 100644 --- a/libraries/aws_ssm_documents.rb +++ b/libraries/aws_ssm_documents.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSsmDocuments < AwsResourceBase - name "aws_ssm_documents" - desc "Verifies settings for a SSM Document in bulk." + name 'aws_ssm_documents' + desc 'Verifies settings for a SSM Document in bulk.' example " describe aws_ssm_documents do it { should exist } @@ -12,16 +12,16 @@ class AwsSsmDocuments < AwsResourceBase attr_reader :table, :api_response FilterTable.create - .register_column(:names, field: :name) - .register_column(:owners, field: :owner) - .register_column(:platform_types, field: :platform_types) - .register_column(:document_versions, field: :document_version) - .register_column(:document_types, field: :document_type) - .register_column(:schema_versions, field: :schema_version) - .register_column(:document_formats, field: :document_format) - .register_column(:target_types, field: :target_type) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:owners, field: :owner) + .register_column(:platform_types, field: :platform_types) + .register_column(:document_versions, field: :document_version) + .register_column(:document_types, field: :document_type) + .register_column(:schema_versions, field: :schema_version) + .register_column(:document_formats, field: :document_format) + .register_column(:target_types, field: :target_type) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_maintenance_window.rb b/libraries/aws_ssm_maintenance_window.rb index bee5c564f..8eb6d4e3a 100644 --- a/libraries/aws_ssm_maintenance_window.rb +++ b/libraries/aws_ssm_maintenance_window.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSESMaintenanceWindow < AwsResourceBase - name "aws_ssm_maintenance_window" - desc "Retrieves a maintenance window." + name 'aws_ssm_maintenance_window' + desc 'Retrieves a maintenance window.' example " describe aws_ssm_maintenance_window(window_id: 'WINDOW_ID') do @@ -27,7 +27,7 @@ def resource_id end def window_id - return nil unless exists? + return unless exists? @res[:window_id] end diff --git a/libraries/aws_ssm_maintenance_window_target.rb b/libraries/aws_ssm_maintenance_window_target.rb index 17da61ecf..628224e97 100644 --- a/libraries/aws_ssm_maintenance_window_target.rb +++ b/libraries/aws_ssm_maintenance_window_target.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSESMaintenanceWindowTarget < AwsResourceBase - name "aws_ssm_maintenance_window_target" - desc "Retrieves a target in the maintenance window." + name 'aws_ssm_maintenance_window_target' + desc 'Retrieves a target in the maintenance window.' example " describe aws_ssm_maintenance_window_target(window_id: 'WINDOW_ID', window_target_id: 'WINDOW_TARGET_ID') do @@ -17,7 +17,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: window_target_id must be provided" unless opts[:window_target_id] && !opts[:window_target_id].empty? filter = [ { - key: "WindowTargetId", + key: 'WindowTargetId', values: [opts[:window_target_id]], }, ] @@ -36,7 +36,7 @@ def resource_id end def window_target_id - return nil unless exists? + return unless exists? @res[:window_target_id] end diff --git a/libraries/aws_ssm_maintenance_window_targets.rb b/libraries/aws_ssm_maintenance_window_targets.rb index 7e0e74f23..1cfd2d3b9 100644 --- a/libraries/aws_ssm_maintenance_window_targets.rb +++ b/libraries/aws_ssm_maintenance_window_targets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSESMaintenanceWindowTargets < AwsResourceBase - name "aws_ssm_maintenance_window_targets" - desc "Lists the targets registered with the maintenance window." + name 'aws_ssm_maintenance_window_targets' + desc 'Lists the targets registered with the maintenance window.' example " describe aws_ssm_maintenance_window_targets(window_id: 'WINDOW_ID') do @@ -13,14 +13,14 @@ class AWSSESMaintenanceWindowTargets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:window_ids, field: :window_id) - .register_column(:window_target_ids, field: :window_target_id) - .register_column(:resource_types, field: :resource_type) - .register_column(:targets, field: :targets) - .register_column(:owner_informations, field: :owner_information) - .register_column(:names, field: :name) - .register_column(:descriptions, field: :description) - .install_filter_methods_on_resource(self, :table) + .register_column(:window_ids, field: :window_id) + .register_column(:window_target_ids, field: :window_target_id) + .register_column(:resource_types, field: :resource_type) + .register_column(:targets, field: :targets) + .register_column(:owner_informations, field: :owner_information) + .register_column(:names, field: :name) + .register_column(:descriptions, field: :description) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_maintenance_window_task.rb b/libraries/aws_ssm_maintenance_window_task.rb index 44ff8ec66..95f0d4489 100644 --- a/libraries/aws_ssm_maintenance_window_task.rb +++ b/libraries/aws_ssm_maintenance_window_task.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSESMaintenanceWindowTask < AwsResourceBase - name "aws_ssm_maintenance_window_task" - desc "Retrieves a task in the maintenance window." + name 'aws_ssm_maintenance_window_task' + desc 'Retrieves a task in the maintenance window.' example " describe aws_ssm_maintenance_window_task(window_id: 'WINDOW_ID', window_task_id: 'WINDOW_TASK_ID') do @@ -17,7 +17,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: window_task_id must be provided" unless opts[:window_task_id] && !opts[:window_task_id].empty? filter = [ { - key: "WindowTaskId", + key: 'WindowTaskId', values: [opts[:window_task_id]], }, ] @@ -36,7 +36,7 @@ def resource_id end def window_task_id - return nil unless exists? + return unless exists? @res[:window_task_id] end diff --git a/libraries/aws_ssm_maintenance_window_tasks.rb b/libraries/aws_ssm_maintenance_window_tasks.rb index 61e8f49f0..0fdb91748 100644 --- a/libraries/aws_ssm_maintenance_window_tasks.rb +++ b/libraries/aws_ssm_maintenance_window_tasks.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSESMaintenanceWindowTasks < AwsResourceBase - name "aws_ssm_maintenance_window_tasks" - desc "Retrieves a task in the maintenance window." + name 'aws_ssm_maintenance_window_tasks' + desc 'Retrieves a task in the maintenance window.' example " describe aws_ssm_maintenance_window_tasks(window_id: 'WINDOW_ID') do @@ -13,21 +13,21 @@ class AWSSESMaintenanceWindowTasks < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:window_ids, field: :window_id) - .register_column(:window_task_ids, field: :window_task_id) - .register_column(:task_arns, field: :task_arn) - .register_column(:types, field: :type) - .register_column(:targets, field: :targets) - .register_column(:task_parameters, field: :task_parameters) - .register_column(:priorities, field: :priority) - .register_column(:logging_infos, field: :logging_info) - .register_column(:service_role_arns, field: :service_role_arn) - .register_column(:max_concurrencies, field: :max_concurrency) - .register_column(:max_errors, field: :max_errors) - .register_column(:names, field: :name) - .register_column(:descriptions, field: :description) - .register_column(:cutoff_behaviors, field: :cutoff_behavior) - .install_filter_methods_on_resource(self, :table) + .register_column(:window_ids, field: :window_id) + .register_column(:window_task_ids, field: :window_task_id) + .register_column(:task_arns, field: :task_arn) + .register_column(:types, field: :type) + .register_column(:targets, field: :targets) + .register_column(:task_parameters, field: :task_parameters) + .register_column(:priorities, field: :priority) + .register_column(:logging_infos, field: :logging_info) + .register_column(:service_role_arns, field: :service_role_arn) + .register_column(:max_concurrencies, field: :max_concurrency) + .register_column(:max_errors, field: :max_errors) + .register_column(:names, field: :name) + .register_column(:descriptions, field: :description) + .register_column(:cutoff_behaviors, field: :cutoff_behavior) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_maintenance_windows.rb b/libraries/aws_ssm_maintenance_windows.rb index c25f0dca5..8e8832a64 100644 --- a/libraries/aws_ssm_maintenance_windows.rb +++ b/libraries/aws_ssm_maintenance_windows.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSESMaintenanceWindows < AwsResourceBase - name "aws_ssm_maintenance_windows" - desc "Retrieves the maintenance windows in an Amazon Web Services account." + name 'aws_ssm_maintenance_windows' + desc 'Retrieves the maintenance windows in an Amazon Web Services account.' example " describe aws_ssm_maintenance_windows do @@ -13,19 +13,19 @@ class AWSSESMaintenanceWindows < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:window_ids, field: :window_id) - .register_column(:names, field: :name) - .register_column(:descriptions, field: :description) - .register_column(:enabled, field: :enabled) - .register_column(:durations, field: :duration) - .register_column(:cutoffs, field: :cutoff) - .register_column(:schedules, field: :schedule) - .register_column(:schedule_timezones, field: :schedule_timezone) - .register_column(:schedule_offsets, field: :schedule_offset) - .register_column(:end_dates, field: :end_date) - .register_column(:start_dates, field: :start_date) - .register_column(:next_execution_times, field: :next_execution_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:window_ids, field: :window_id) + .register_column(:names, field: :name) + .register_column(:descriptions, field: :description) + .register_column(:enabled, field: :enabled) + .register_column(:durations, field: :duration) + .register_column(:cutoffs, field: :cutoff) + .register_column(:schedules, field: :schedule) + .register_column(:schedule_timezones, field: :schedule_timezone) + .register_column(:schedule_offsets, field: :schedule_offset) + .register_column(:end_dates, field: :end_date) + .register_column(:start_dates, field: :start_date) + .register_column(:next_execution_times, field: :next_execution_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_parameter.rb b/libraries/aws_ssm_parameter.rb index 1bfa50045..6343f9b0d 100644 --- a/libraries/aws_ssm_parameter.rb +++ b/libraries/aws_ssm_parameter.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSsmParameter < AwsResourceBase - name "aws_ssm_parameter" - desc "Verifies settings for a SSM Parameter." + name 'aws_ssm_parameter' + desc 'Verifies settings for a SSM Parameter.' example " describe aws_ssm_parameter(name: 'parameter-name') do diff --git a/libraries/aws_ssm_parameters.rb b/libraries/aws_ssm_parameters.rb index 707b812a6..601809560 100644 --- a/libraries/aws_ssm_parameters.rb +++ b/libraries/aws_ssm_parameters.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSsmParameters < AwsResourceBase - name "aws_ssm_parameters" - desc "Verifies settings for a SSM Parameter in bulk." + name 'aws_ssm_parameters' + desc 'Verifies settings for a SSM Parameter in bulk.' example " describe aws_ssm_parameters do it { should exist } @@ -12,15 +12,15 @@ class AwsSsmParameters < AwsResourceBase attr_reader :table, :api_response FilterTable.create - .register_column(:names, field: :name) - .register_column(:types, field: :type) - .register_column(:key_ids, field: :key_id) - .register_column(:last_modified_dates, field: :last_modified_date) - .register_column(:last_modified_users, field: :last_modified_user) - .register_column(:descriptions, field: :description) - .register_column(:versions, field: :version) - .register_column(:tiers, field: :tier) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:types, field: :type) + .register_column(:key_ids, field: :key_id) + .register_column(:last_modified_dates, field: :last_modified_date) + .register_column(:last_modified_users, field: :last_modified_user) + .register_column(:descriptions, field: :description) + .register_column(:versions, field: :version) + .register_column(:tiers, field: :tier) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_patch_baseline.rb b/libraries/aws_ssm_patch_baseline.rb index ce9e7cebb..63a705621 100644 --- a/libraries/aws_ssm_patch_baseline.rb +++ b/libraries/aws_ssm_patch_baseline.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSESPatchBaseline < AwsResourceBase - name "aws_ssm_patch_baseline" - desc "Retrieves information about a patch baseline." + name 'aws_ssm_patch_baseline' + desc 'Retrieves information about a patch baseline.' example " describe aws_ssm_patch_baseline(baseline_id: 'BASELINE_ID') do @@ -37,7 +37,7 @@ def resource_id end def baseline_id - return nil unless exists? + return unless exists? @res[:baseline_id] end diff --git a/libraries/aws_ssm_patch_baselines.rb b/libraries/aws_ssm_patch_baselines.rb index d8b842af3..e63e18da8 100644 --- a/libraries/aws_ssm_patch_baselines.rb +++ b/libraries/aws_ssm_patch_baselines.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSESPatchBaselines < AwsResourceBase - name "aws_ssm_patch_baselines" - desc "Lists the patch baselines in your Amazon Web Services account." + name 'aws_ssm_patch_baselines' + desc 'Lists the patch baselines in your Amazon Web Services account.' example " describe aws_ssm_patch_baselines do @@ -17,12 +17,12 @@ class AWSSESPatchBaselines < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:baseline_ids, field: :baseline_id) - .register_column(:baseline_names, field: :baseline_name) - .register_column(:operating_systems, field: :operating_system) - .register_column(:baseline_descriptions, field: :baseline_description) - .register_column(:default_baselines, field: :default_baseline) - .install_filter_methods_on_resource(self, :table) + .register_column(:baseline_ids, field: :baseline_id) + .register_column(:baseline_names, field: :baseline_name) + .register_column(:operating_systems, field: :operating_system) + .register_column(:baseline_descriptions, field: :baseline_description) + .register_column(:default_baselines, field: :default_baseline) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_resource_compliance_summaries.rb b/libraries/aws_ssm_resource_compliance_summaries.rb index 6ec71e279..63565986d 100644 --- a/libraries/aws_ssm_resource_compliance_summaries.rb +++ b/libraries/aws_ssm_resource_compliance_summaries.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSsmResourceComplianceSummaries < AwsResourceBase - name "aws_ssm_resource_compliance_summaries" - desc "Verifies settings for a SSM Resource Compliance Summary in bulk." + name 'aws_ssm_resource_compliance_summaries' + desc 'Verifies settings for a SSM Resource Compliance Summary in bulk.' example " describe aws_ssm_resource_compliance_summaries do it { should exist } @@ -12,15 +12,15 @@ class AwsSsmResourceComplianceSummaries < AwsResourceBase attr_reader :table, :api_response FilterTable.create - .register_column(:compliance_types, field: :compliance_type) - .register_column(:resource_types, field: :resource_type) - .register_column(:resource_ids, field: :resource_id) - .register_column(:status, field: :status) - .register_column(:overall_severity, field: :overall_severity) - .register_column(:execution_summaries, field: :execution_summary) - .register_column(:compliant_summaries, field: :compliant_summary) - .register_column(:non_compliant_summaries, field: :non_compliant_summary) - .install_filter_methods_on_resource(self, :table) + .register_column(:compliance_types, field: :compliance_type) + .register_column(:resource_types, field: :resource_type) + .register_column(:resource_ids, field: :resource_id) + .register_column(:status, field: :status) + .register_column(:overall_severity, field: :overall_severity) + .register_column(:execution_summaries, field: :execution_summary) + .register_column(:compliant_summaries, field: :compliant_summary) + .register_column(:non_compliant_summaries, field: :non_compliant_summary) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -34,8 +34,8 @@ def fetch_data if opts[:compliance_type] || opts[:overall_severity] filter_array = [] - filter_array << { key: "ComplianceType", values: [opts[:compliance_type]] } if opts[:compliance_type] - filter_array << { key: "OverallSeverity", values: [opts[:overall_severity]] } if opts[:overall_severity] + filter_array << { key: 'ComplianceType', values: [opts[:compliance_type]] } if opts[:compliance_type] + filter_array << { key: 'OverallSeverity', values: [opts[:overall_severity]] } if opts[:overall_severity] filter_options = { filters: filter_array } end diff --git a/libraries/aws_ssm_resource_compliance_summary.rb b/libraries/aws_ssm_resource_compliance_summary.rb index 0e3d6e758..293fcc1f3 100644 --- a/libraries/aws_ssm_resource_compliance_summary.rb +++ b/libraries/aws_ssm_resource_compliance_summary.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSsmResourceComplianceSummary < AwsResourceBase - name "aws_ssm_resource_compliance_summary" - desc "Verifies settings for a SSM Resource Compliance Summary." + name 'aws_ssm_resource_compliance_summary' + desc 'Verifies settings for a SSM Resource Compliance Summary.' example " describe aws_ssm_resource_compliance_summary(resource_id: 'resource-id') do @@ -16,10 +16,10 @@ def initialize(opts = {}) validate_parameters(required: [:resource_id], allow: %i(compliance_type overall_severity status)) @display_name = opts[:resource_id] - filter_params = [{ key: "InstanceId", values: [opts[:resource_id]] }] - filter_params << { key: "ComplianceType", values: [opts[:compliance_type]] } if opts[:compliance_type] - filter_params << { key: "OverallSeverity", values: [opts[:overall_severity]] } if opts[:overall_severity] - filter_params << { key: "Status", values: [opts[:status]] } if opts[:status] + filter_params = [{ key: 'InstanceId', values: [opts[:resource_id]] }] + filter_params << { key: 'ComplianceType', values: [opts[:compliance_type]] } if opts[:compliance_type] + filter_params << { key: 'OverallSeverity', values: [opts[:overall_severity]] } if opts[:overall_severity] + filter_params << { key: 'Status', values: [opts[:status]] } if opts[:status] filter = { filters: filter_params } diff --git a/libraries/aws_ssm_resource_data_syncs.rb b/libraries/aws_ssm_resource_data_syncs.rb index 051aa7f70..b5f5fb955 100644 --- a/libraries/aws_ssm_resource_data_syncs.rb +++ b/libraries/aws_ssm_resource_data_syncs.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSESResourceDataSyncs < AwsResourceBase - name "aws_ssm_resource_data_syncs" - desc "Lists your resource data sync configurations. Includes information about the last time a sync attempted to start, the last sync status, and the last time a sync successfully completed." + name 'aws_ssm_resource_data_syncs' + desc 'Lists your resource data sync configurations. Includes information about the last time a sync attempted to start, the last sync status, and the last time a sync successfully completed.' example " describe aws_ssm_resource_data_syncs do @@ -13,17 +13,17 @@ class AWSSESResourceDataSyncs < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:sync_names, field: :sync_name) - .register_column(:sync_types, field: :sync_type) - .register_column(:sync_sources, field: :sync_source) - .register_column(:s3_destinations, field: :s3_destination) - .register_column(:last_sync_times, field: :last_sync_time) - .register_column(:last_successful_sync_times, field: :last_successful_sync_time) - .register_column(:sync_last_modified_times, field: :sync_last_modified_time) - .register_column(:last_statuses, field: :last_status) - .register_column(:sync_created_times, field: :sync_created_time) - .register_column(:last_sync_status_messages, field: :last_sync_status_message) - .install_filter_methods_on_resource(self, :table) + .register_column(:sync_names, field: :sync_name) + .register_column(:sync_types, field: :sync_type) + .register_column(:sync_sources, field: :sync_source) + .register_column(:s3_destinations, field: :s3_destination) + .register_column(:last_sync_times, field: :last_sync_time) + .register_column(:last_successful_sync_times, field: :last_successful_sync_time) + .register_column(:sync_last_modified_times, field: :sync_last_modified_time) + .register_column(:last_statuses, field: :last_status) + .register_column(:sync_created_times, field: :sync_created_time) + .register_column(:last_sync_status_messages, field: :last_sync_status_message) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_stepfunctions_activities.rb b/libraries/aws_stepfunctions_activities.rb index acb85f7cc..0fbec8fb1 100644 --- a/libraries/aws_stepfunctions_activities.rb +++ b/libraries/aws_stepfunctions_activities.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSStepFunctionsActivities < AwsResourceBase - name "aws_stepfunctions_activities" - desc "Retrieves a task in the maintenance window." + name 'aws_stepfunctions_activities' + desc 'Retrieves a task in the maintenance window.' example " describe aws_stepfunctions_activities do @@ -13,10 +13,10 @@ class AWSStepFunctionsActivities < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:activity_arns, field: :activity_arn) - .register_column(:names, field: :name) - .register_column(:creation_dates, field: :creation_date) - .install_filter_methods_on_resource(self, :table) + .register_column(:activity_arns, field: :activity_arn) + .register_column(:names, field: :name) + .register_column(:creation_dates, field: :creation_date) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_stepfunctions_activity.rb b/libraries/aws_stepfunctions_activity.rb index d62618c29..c6f8f6af2 100644 --- a/libraries/aws_stepfunctions_activity.rb +++ b/libraries/aws_stepfunctions_activity.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSStepFunctionsActivity < AwsResourceBase - name "aws_stepfunctions_activity" - desc "Describes an activity." + name 'aws_stepfunctions_activity' + desc 'Describes an activity.' example " describe aws_stepfunctions_activity(activity_arn: 'ACTIVITY_ARN') do @@ -23,7 +23,7 @@ def initialize(opts = {}) end def activity_arn - return nil unless exists? + return unless exists? @res[:activity_arn] end diff --git a/libraries/aws_stepfunctions_state_machine.rb b/libraries/aws_stepfunctions_state_machine.rb index ce704ef89..31e86a094 100644 --- a/libraries/aws_stepfunctions_state_machine.rb +++ b/libraries/aws_stepfunctions_state_machine.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSStepFunctionsStateMachine < AwsResourceBase - name "aws_stepfunctions_state_machine" - desc "Describes a state machine." + name 'aws_stepfunctions_state_machine' + desc 'Describes a state machine.' example " describe aws_stepfunctions_state_machine(state_machine_arn: 'state_machine_arn_value') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def state_machine_arn - return nil unless exists? + return unless exists? @res[:state_machine_arn] end diff --git a/libraries/aws_stepfunctions_state_machines.rb b/libraries/aws_stepfunctions_state_machines.rb index 89cd90698..736135a16 100644 --- a/libraries/aws_stepfunctions_state_machines.rb +++ b/libraries/aws_stepfunctions_state_machines.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSStepFunctionsStateMachines < AwsResourceBase - name "aws_stepfunctions_state_machines" - desc "Lists the existing state machines." + name 'aws_stepfunctions_state_machines' + desc 'Lists the existing state machines.' example " describe aws_stepfnctions_state_machines do @@ -13,11 +13,11 @@ class AWSStepFunctionsStateMachines < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:state_machine_arns, field: :state_machine_arn) - .register_column(:names, field: :name) - .register_column(:types, field: :type) - .register_column(:creation_dates, field: :creation_date) - .install_filter_methods_on_resource(self, :table) + .register_column(:state_machine_arns, field: :state_machine_arn) + .register_column(:names, field: :name) + .register_column(:types, field: :type) + .register_column(:creation_dates, field: :creation_date) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_sts_caller_identity.rb b/libraries/aws_sts_caller_identity.rb index b99738c5f..e381c74b0 100644 --- a/libraries/aws_sts_caller_identity.rb +++ b/libraries/aws_sts_caller_identity.rb @@ -1,6 +1,6 @@ class AwsStsCallerIdentity < AwsResourceBase - name "aws_sts_caller_identity" - desc "Verifies settings for an AWS STS Caller Identity." + name 'aws_sts_caller_identity' + desc 'Verifies settings for an AWS STS Caller Identity.' example " describe aws_sts_caller_identity do its('arn') { should match 'arn:aws:iam::.*:user/service-account-inspec' } @@ -27,7 +27,7 @@ def resource_id end def govcloud? - fetch_arn_components[:partition] == "aws-us-gov" + fetch_arn_components[:partition] == 'aws-us-gov' end def exists? @@ -35,12 +35,12 @@ def exists? end def to_s - "AWS Security Token Service Caller Identity" + 'AWS Security Token Service Caller Identity' end private def fetch_arn_components - Hash[%i(arn partition service region account_id resource).zip(arn.split(":"))] + Hash[%i(arn partition service region account_id resource).zip(arn.split(':'))] end end diff --git a/libraries/aws_subnet.rb b/libraries/aws_subnet.rb index bf0edc90b..d2e3f5d5b 100644 --- a/libraries/aws_subnet.rb +++ b/libraries/aws_subnet.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSubnet < AwsResourceBase - name "aws_subnet" - desc "Verifies settings for an AWS VPC Subnet." + name 'aws_subnet' + desc 'Verifies settings for an AWS VPC Subnet.' example " describe aws_subnet(subnet_id: 'subnet-12345678') do @@ -21,7 +21,7 @@ def initialize(opts = {}) end @display_name = opts[:subnet_id] - filter = { name: "subnet-id", values: [opts[:subnet_id]] } + filter = { name: 'subnet-id', values: [opts[:subnet_id]] } catch_aws_errors do resp = @aws.compute_client.describe_subnets({ filters: [filter] }) @subnet = resp.subnets[0].to_h @@ -30,7 +30,7 @@ def initialize(opts = {}) end def available? - @subnet[:state]=="available" + @subnet[:state]=='available' end def exists? diff --git a/libraries/aws_subnets.rb b/libraries/aws_subnets.rb index 45ad44625..cce0de437 100644 --- a/libraries/aws_subnets.rb +++ b/libraries/aws_subnets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsSubnets < AwsResourceBase - name "aws_subnets" - desc "Verifies settings for an AWS VPC Subnets in bulk." + name 'aws_subnets' + desc 'Verifies settings for an AWS VPC Subnets in bulk.' example " describe aws_subnets do @@ -19,14 +19,14 @@ class AwsSubnets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:availability_zone, field: :availability_zone) - .register_column(:cidr_blocks, field: :cidr_block) - .register_column(:map_public_ip_on_launch, field: :map_public_ip_on_launch) - .register_column(:states, field: :state) - .register_column(:subnet_ids, field: :subnet_id) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:availability_zone, field: :availability_zone) + .register_column(:cidr_blocks, field: :cidr_block) + .register_column(:map_public_ip_on_launch, field: :map_public_ip_on_launch) + .register_column(:states, field: :state) + .register_column(:subnet_ids, field: :subnet_id) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_synthetics_canaries.rb b/libraries/aws_synthetics_canaries.rb index fc4f99ff9..9cf9f21ed 100644 --- a/libraries/aws_synthetics_canaries.rb +++ b/libraries/aws_synthetics_canaries.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSyntheticsCanaries < AwsResourceBase - name "aws_synthetics_canaries" - desc "Lists the canaries." + name 'aws_synthetics_canaries' + desc 'Lists the canaries.' example " describe aws_synthetics_canaries do @@ -13,24 +13,24 @@ class AWSSyntheticsCanaries < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:codes, field: :code) - .register_column(:execution_role_arns, field: :execution_role_arn) - .register_column(:schedules, field: :schedule) - .register_column(:run_configs, field: :run_config) - .register_column(:success_retention_period_in_days, field: :success_retention_period_in_days) - .register_column(:failure_retention_period_in_days, field: :failure_retention_period_in_days) - .register_column(:statuses, field: :status) - .register_column(:timelines, field: :timeline) - .register_column(:artifact_s3_locations, field: :artifact_s3_location) - .register_column(:engine_arns, field: :engine_arn) - .register_column(:runtime_versions, field: :runtime_version) - .register_column(:vpc_configs, field: :vpc_config) - .register_column(:visual_references, field: :visual_reference) - .register_column(:tags, field: :tags) - .register_column(:artifact_configs, field: :artifact_config) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:codes, field: :code) + .register_column(:execution_role_arns, field: :execution_role_arn) + .register_column(:schedules, field: :schedule) + .register_column(:run_configs, field: :run_config) + .register_column(:success_retention_period_in_days, field: :success_retention_period_in_days) + .register_column(:failure_retention_period_in_days, field: :failure_retention_period_in_days) + .register_column(:statuses, field: :status) + .register_column(:timelines, field: :timeline) + .register_column(:artifact_s3_locations, field: :artifact_s3_location) + .register_column(:engine_arns, field: :engine_arn) + .register_column(:runtime_versions, field: :runtime_version) + .register_column(:vpc_configs, field: :vpc_config) + .register_column(:visual_references, field: :visual_reference) + .register_column(:tags, field: :tags) + .register_column(:artifact_configs, field: :artifact_config) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_synthetics_canary.rb b/libraries/aws_synthetics_canary.rb index 15ad21a89..c33a2243b 100644 --- a/libraries/aws_synthetics_canary.rb +++ b/libraries/aws_synthetics_canary.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSSyntheticsCanary < AwsResourceBase - name "aws_synthetics_canary" - desc "Retrieves complete information about one canary." + name 'aws_synthetics_canary' + desc 'Retrieves complete information about one canary.' example " describe aws_synthetics_canary(name: 'CANARY_NAME') do @@ -23,7 +23,7 @@ def initialize(opts = {}) end def name - return nil unless exists? + return unless exists? @res[:name] end diff --git a/libraries/aws_transfer_user.rb b/libraries/aws_transfer_user.rb index f2d8de829..e2436a597 100644 --- a/libraries/aws_transfer_user.rb +++ b/libraries/aws_transfer_user.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSTransferUser < AwsResourceBase - name "aws_transfer_user" - desc "Describes the user assigned to the specific file transfer protocol-enabled server, as identified by its ServerId property." + name 'aws_transfer_user' + desc 'Describes the user assigned to the specific file transfer protocol-enabled server, as identified by its ServerId property.' example " describe aws_transfer_user(server_id: 'test', user_name: 'test') do it { should exist } @@ -24,7 +24,7 @@ def initialize(opts = {}) end def user_name - return nil unless exists? + return unless exists? @res[:user_name] end diff --git a/libraries/aws_transfer_users.rb b/libraries/aws_transfer_users.rb index 9465b77b2..c4d046fbf 100644 --- a/libraries/aws_transfer_users.rb +++ b/libraries/aws_transfer_users.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSTransferUsers < AwsResourceBase - name "aws_transfer_users" - desc "Lists the users for a file transfer protocol-enabled server that you specify by passing the ServerId parameter." + name 'aws_transfer_users' + desc 'Lists the users for a file transfer protocol-enabled server that you specify by passing the ServerId parameter.' example " describe aws_transfer_users(server_id: 's-0123456789') do @@ -13,13 +13,13 @@ class AWSTransferUsers < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:home_directories, field: :home_directory) - .register_column(:home_directory_types, field: :home_directory_type) - .register_column(:roles, field: :role) - .register_column(:ssh_public_key_count, field: :ssh_public_key_count) - .register_column(:user_names, field: :user_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:home_directories, field: :home_directory) + .register_column(:home_directory_types, field: :home_directory_type) + .register_column(:roles, field: :role) + .register_column(:ssh_public_key_count, field: :ssh_public_key_count) + .register_column(:user_names, field: :user_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_transit_gateway.rb b/libraries/aws_transit_gateway.rb index d777f656b..db5a41c05 100644 --- a/libraries/aws_transit_gateway.rb +++ b/libraries/aws_transit_gateway.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsTransitGateway < AwsResourceBase - name "aws_transit_gateway" - desc "Verifies settings for an AWS Transit Gateway." + name 'aws_transit_gateway' + desc 'Verifies settings for an AWS Transit Gateway.' example " describe aws_transit_gateway('TRANSIT_GATEWAY_ID') do @@ -20,7 +20,7 @@ def initialize(opts = {}) catch_aws_errors do resp = @aws.compute_client.describe_transit_gateways(transit_gateway_ids: [opts[:transit_gateway_id]]) - return nil if resp.transit_gateways.nil? || resp.transit_gateways.empty? + return if resp.transit_gateways.nil? || resp.transit_gateways.empty? transit_gateway = resp.transit_gateways.first @transit_gateway_arn = transit_gateway.transit_gateway_arn @transit_gateway_id = transit_gateway.transit_gateway_id diff --git a/libraries/aws_transit_gateway_connect.rb b/libraries/aws_transit_gateway_connect.rb index ab53aa00f..f275e87aa 100644 --- a/libraries/aws_transit_gateway_connect.rb +++ b/libraries/aws_transit_gateway_connect.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSTransitGatewayConnect < AwsResourceBase - name "aws_transit_gateway_connect" - desc "Describes one or more Connect attachments." + name 'aws_transit_gateway_connect' + desc 'Describes one or more Connect attachments.' example " describe aws_transit_gateway_connect(transit_gateway_attachment_id: 'TRANSIT_GATEWAY_CONNECT_ATTACHMENT_ID') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def transit_gateway_attachment_id - return nil unless exists? + return unless exists? @transit_gateway_connects[:transit_gateway_attachment_id] end diff --git a/libraries/aws_transit_gateway_connects.rb b/libraries/aws_transit_gateway_connects.rb index e5cc84e4b..35efa01a4 100644 --- a/libraries/aws_transit_gateway_connects.rb +++ b/libraries/aws_transit_gateway_connects.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSTransitGatewayConnects < AwsResourceBase - name "aws_transit_gateway_connects" - desc "Describes one or more Connect attachments." + name 'aws_transit_gateway_connects' + desc 'Describes one or more Connect attachments.' example " describe aws_transit_gateway_connects do @@ -17,15 +17,15 @@ class AWSTransitGatewayConnects < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) - .register_column(:transport_transit_gateway_attachment_ids, field: :transport_transit_gateway_attachment_id) - .register_column(:transit_gateway_ids, field: :transit_gateway_id) - .register_column(:states, field: :state) - .register_column(:creation_times, field: :creation_time) - .register_column(:options, field: :options) - .register_column(:creation_times, field: :creation_time) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) + .register_column(:transport_transit_gateway_attachment_ids, field: :transport_transit_gateway_attachment_id) + .register_column(:transit_gateway_ids, field: :transit_gateway_id) + .register_column(:states, field: :state) + .register_column(:creation_times, field: :creation_time) + .register_column(:options, field: :options) + .register_column(:creation_times, field: :creation_time) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_transit_gateway_multicast_domain.rb b/libraries/aws_transit_gateway_multicast_domain.rb index 86ce410f5..b5e8cb67e 100644 --- a/libraries/aws_transit_gateway_multicast_domain.rb +++ b/libraries/aws_transit_gateway_multicast_domain.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSTransitGatewayMulticastDomain < AwsResourceBase - name "aws_transit_gateway_multicast_domain" - desc "Describes one or more transit gateway multicast domains." + name 'aws_transit_gateway_multicast_domain' + desc 'Describes one or more transit gateway multicast domains.' example " describe aws_transit_gateway_multicast_domain(transit_gateway_multicast_domain_id: 'Domain ID') do @@ -28,7 +28,7 @@ def initialize(opts = {}) end def transit_gateway_multicast_domain_id - return nil unless exists? + return unless exists? @transit_gateway_multicast_domains[:transit_gateway_multicast_domain_id] end diff --git a/libraries/aws_transit_gateway_multicast_domain_association.rb b/libraries/aws_transit_gateway_multicast_domain_association.rb index f33e5c5ea..4e761bbaf 100644 --- a/libraries/aws_transit_gateway_multicast_domain_association.rb +++ b/libraries/aws_transit_gateway_multicast_domain_association.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSTransitGatewayMulticastDomainAssociation < AwsResourceBase - name "aws_transit_gateway_multicast_domain_association" - desc "Gets information about the associations for the transit gateway multicast domain." + name 'aws_transit_gateway_multicast_domain_association' + desc 'Gets information about the associations for the transit gateway multicast domain.' example " describe aws_transit_gateway_multicast_domain_association(transit_gateway_multicast_domain_id: 'Domain ID') do @@ -27,7 +27,7 @@ def initialize(opts = {}) end def transit_gateway_multicast_domain_id - return nil unless exists? + return unless exists? @multicast_domain_associations[:transit_gateway_multicast_domain_id] end diff --git a/libraries/aws_transit_gateway_multicast_domain_associations.rb b/libraries/aws_transit_gateway_multicast_domain_associations.rb index 8b0f06682..2dc891cae 100644 --- a/libraries/aws_transit_gateway_multicast_domain_associations.rb +++ b/libraries/aws_transit_gateway_multicast_domain_associations.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSTransitGatewayMulticastDomainAssociations < AwsResourceBase - name "aws_transit_gateway_multicast_domain_associations" - desc "Gets information about the associations for the transit gateway multicast domain." + name 'aws_transit_gateway_multicast_domain_associations' + desc 'Gets information about the associations for the transit gateway multicast domain.' example " describe aws_transit_gateway_multicast_domain_associations(transit_gateway_multicast_domain_id: 'id') do @@ -17,12 +17,12 @@ class AWSTransitGatewayMulticastDomainAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) - .register_column(:resource_ids, field: :resource_id) - .register_column(:resource_types, field: :resource_type) - .register_column(:resource_owner_ids, field: :resource_owner_id) - .register_column(:subnets, field: :subnet) - .install_filter_methods_on_resource(self, :table) + .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) + .register_column(:resource_ids, field: :resource_id) + .register_column(:resource_types, field: :resource_type) + .register_column(:resource_owner_ids, field: :resource_owner_id) + .register_column(:subnets, field: :subnet) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_transit_gateway_multicast_domains.rb b/libraries/aws_transit_gateway_multicast_domains.rb index 8ec01312b..238aeb98f 100644 --- a/libraries/aws_transit_gateway_multicast_domains.rb +++ b/libraries/aws_transit_gateway_multicast_domains.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSTransitGatewayMulticastDomains < AwsResourceBase - name "aws_transit_gateway_multicast_domains" - desc "Describes one or more transit gateway multicast domains." + name 'aws_transit_gateway_multicast_domains' + desc 'Describes one or more transit gateway multicast domains.' example " describe aws_transit_gateway_multicast_domains do @@ -17,15 +17,15 @@ class AWSTransitGatewayMulticastDomains < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:transit_gateway_multicast_domain_ids, field: :transit_gateway_multicast_domain_id) - .register_column(:transit_gateway_ids, field: :transit_gateway_id) - .register_column(:transit_gateway_multicast_domain_arns, field: :transit_gateway_multicast_domain_arn) - .register_column(:owner_ids, field: :owner_id) - .register_column(:options, field: :options) - .register_column(:states, field: :state) - .register_column(:creation_time, field: :creation_time) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:transit_gateway_multicast_domain_ids, field: :transit_gateway_multicast_domain_id) + .register_column(:transit_gateway_ids, field: :transit_gateway_id) + .register_column(:transit_gateway_multicast_domain_arns, field: :transit_gateway_multicast_domain_arn) + .register_column(:owner_ids, field: :owner_id) + .register_column(:options, field: :options) + .register_column(:states, field: :state) + .register_column(:creation_time, field: :creation_time) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_transit_gateway_multicast_group_member.rb b/libraries/aws_transit_gateway_multicast_group_member.rb index 7e0121d1a..0475cc187 100644 --- a/libraries/aws_transit_gateway_multicast_group_member.rb +++ b/libraries/aws_transit_gateway_multicast_group_member.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSTransitGatewayMulticastGroupMember < AwsResourceBase - name "aws_transit_gateway_multicast_group_member" - desc "Searches one or more transit gateway multicast groups and returns the group membership information." + name 'aws_transit_gateway_multicast_group_member' + desc 'Searches one or more transit gateway multicast groups and returns the group membership information.' example " describe aws_transit_gateway_multicast_group_member(transit_gateway_multicast_domain_id: 'test') do @@ -28,7 +28,7 @@ def initialize(opts = {}) end def transit_gateway_multicast_domain_id - return nil unless exists? + return unless exists? @multicast_groups[:transit_gateway_multicast_domain_id] end diff --git a/libraries/aws_transit_gateway_multicast_group_members.rb b/libraries/aws_transit_gateway_multicast_group_members.rb index 44ebfa068..cd43f5a2d 100644 --- a/libraries/aws_transit_gateway_multicast_group_members.rb +++ b/libraries/aws_transit_gateway_multicast_group_members.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSTransitGatewayMulticastGroupMembers < AwsResourceBase - name "aws_transit_gateway_multicast_group_members" - desc "Searches one or more transit gateway multicast groups and returns the group membership information." + name 'aws_transit_gateway_multicast_group_members' + desc 'Searches one or more transit gateway multicast groups and returns the group membership information.' example " describe aws_transit_gateway_multicast_group_members(transit_gateway_multicast_domain_id: 'tgw-mcast-domain-1234567890') do @@ -17,18 +17,18 @@ class AWSTransitGatewayMulticastGroupMembers < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:group_ip_addresses, field: :group_ip_address) - .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) - .register_column(:subnet_ids, field: :subnet_id) - .register_column(:resource_ids, field: :resource_id) - .register_column(:resource_types, field: :resource_type) - .register_column(:resource_owner_ids, field: :resource_owner_id) - .register_column(:network_interface_ids, field: :network_interface_id) - .register_column(:group_members, field: :group_member) - .register_column(:group_sources, field: :group_source) - .register_column(:member_types, field: :member_type) - .register_column(:source_types, field: :source_type) - .install_filter_methods_on_resource(self, :table) + .register_column(:group_ip_addresses, field: :group_ip_address) + .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) + .register_column(:subnet_ids, field: :subnet_id) + .register_column(:resource_ids, field: :resource_id) + .register_column(:resource_types, field: :resource_type) + .register_column(:resource_owner_ids, field: :resource_owner_id) + .register_column(:network_interface_ids, field: :network_interface_id) + .register_column(:group_members, field: :group_member) + .register_column(:group_sources, field: :group_source) + .register_column(:member_types, field: :member_type) + .register_column(:source_types, field: :source_type) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_transit_gateway_multicast_group_source.rb b/libraries/aws_transit_gateway_multicast_group_source.rb index 3a6c23e04..c2734648e 100644 --- a/libraries/aws_transit_gateway_multicast_group_source.rb +++ b/libraries/aws_transit_gateway_multicast_group_source.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSTransitGatewayMulticastGroupSource < AwsResourceBase - name "aws_transit_gateway_multicast_group_source" - desc "Searches one or more transit gateway multicast groups and returns the group membership information." + name 'aws_transit_gateway_multicast_group_source' + desc 'Searches one or more transit gateway multicast groups and returns the group membership information.' example " describe aws_transit_gateway_multicast_group_source(transit_gateway_multicast_domain_id: 'test') do @@ -28,7 +28,7 @@ def initialize(opts = {}) end def transit_gateway_multicast_domain_id - return nil unless exists? + return unless exists? @multicast_groups[:transit_gateway_multicast_domain_id] end diff --git a/libraries/aws_transit_gateway_multicast_group_sources.rb b/libraries/aws_transit_gateway_multicast_group_sources.rb index 458c88f49..d9f6f867b 100644 --- a/libraries/aws_transit_gateway_multicast_group_sources.rb +++ b/libraries/aws_transit_gateway_multicast_group_sources.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSTransitGatewayMulticastGroupSources < AwsResourceBase - name "aws_transit_gateway_multicast_group_sources" - desc "Describes one or more transit gateway multicast domains." + name 'aws_transit_gateway_multicast_group_sources' + desc 'Describes one or more transit gateway multicast domains.' example " describe aws_transit_gateway_multicast_group_sources(transit_gateway_multicast_domain_id: 'tgw-mcast-domain-1234567890') do @@ -17,18 +17,18 @@ class AWSTransitGatewayMulticastGroupSources < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:group_ip_addresses, field: :group_ip_address) - .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) - .register_column(:subnet_ids, field: :subnet_id) - .register_column(:resource_ids, field: :resource_id) - .register_column(:resource_types, field: :resource_type) - .register_column(:resource_owner_ids, field: :resource_owner_id) - .register_column(:network_interface_ids, field: :network_interface_id) - .register_column(:group_members, field: :group_member) - .register_column(:group_sources, field: :group_source) - .register_column(:member_types, field: :member_type) - .register_column(:source_types, field: :source_type) - .install_filter_methods_on_resource(self, :table) + .register_column(:group_ip_addresses, field: :group_ip_address) + .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) + .register_column(:subnet_ids, field: :subnet_id) + .register_column(:resource_ids, field: :resource_id) + .register_column(:resource_types, field: :resource_type) + .register_column(:resource_owner_ids, field: :resource_owner_id) + .register_column(:network_interface_ids, field: :network_interface_id) + .register_column(:group_members, field: :group_member) + .register_column(:group_sources, field: :group_source) + .register_column(:member_types, field: :member_type) + .register_column(:source_types, field: :source_type) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_transit_gateway_route.rb b/libraries/aws_transit_gateway_route.rb index 2696f1c98..c1e075455 100644 --- a/libraries/aws_transit_gateway_route.rb +++ b/libraries/aws_transit_gateway_route.rb @@ -1,11 +1,11 @@ -require "aws_backend" +require 'aws_backend' class AwsTransitGatewayRoute < AwsResourceBase STATES = %w{active blackhole}.freeze TYPES = %w{static propagated}.freeze ATTACHMENT_RESOURCE_TYPES = %w{vpc vpn direct-connect-gateway connect peering tgw-peering}.freeze - name "aws_transit_gateway_route" - desc "Verifies settings for an AWS Transit Gateway." + name 'aws_transit_gateway_route' + desc 'Verifies settings for an AWS Transit Gateway.' example " describe aws_transit_gateway_route(transit_gateway_route_table_id: 'tgw-rtb-08acd74550c99e589', cidr_block: '0.0.0.0/16') do @@ -28,7 +28,7 @@ class AwsTransitGatewayRoute < AwsResourceBase end ATTACHMENT_RESOURCE_TYPES.each do |resource_type| - resource_type_name = resource_type.gsub("-", "_") + resource_type_name = resource_type.gsub('-', '_') method_name = "#{resource_type_name}_attachment?" define_method method_name do attachment_resource_type == resource_type @@ -49,7 +49,7 @@ def exists? end def resource_id - @response ? @display_name : "" + @response ? @display_name : '' end def to_s @@ -73,7 +73,7 @@ def fetch_response transit_gateway_route_table_id: @opts[:transit_gateway_route_table_id], filters: [ { - name: "route-search.exact-match", + name: 'route-search.exact-match', values: [@opts[:cidr_block]], }, ], @@ -84,7 +84,7 @@ def fetch_response end def route - raise StandardError, "More than One Route is available" if @response.additional_routes_available + raise StandardError, 'More than One Route is available' if @response.additional_routes_available @response.routes.first end diff --git a/libraries/aws_transit_gateway_routes.rb b/libraries/aws_transit_gateway_routes.rb index 026b049ed..3ab24fd3e 100644 --- a/libraries/aws_transit_gateway_routes.rb +++ b/libraries/aws_transit_gateway_routes.rb @@ -1,10 +1,10 @@ -require "aws_backend" +require 'aws_backend' class AwsTransitGatewayRoutes < AwsResourceBase TYPES = %w{static propagated}.freeze SUPPORTED_FILTER_PARAMS = %i(exact_match longest_prefix_match subnet_of_match supernet_of_match).freeze - name "aws_transit_gateway_routes" - desc "Verifies settings for list of AWS Transit Gateways." + name 'aws_transit_gateway_routes' + desc 'Verifies settings for list of AWS Transit Gateways.' example " describe aws_transit_gateway_routes(transit_gateway_route_table_id: 'tgw-rtb-08acd74550c99e589') do @@ -19,19 +19,19 @@ class AwsTransitGatewayRoutes < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:cidr_blocks, field: :cidr_block) - .register_column(:prefix_list_ids, field: :prefix_list_id) - .register_column(:types, field: :type, style: :simple) - .register_column(:states, field: :state, style: :simple) - .register_column(:static, field: :static, style: :simple) - .register_column(:propagated, field: :propagated, style: :simple) - .register_column(:active, field: :active, style: :simple) - .register_column(:blackhole, field: :blackhole, style: :simple) - .register_column(:attachment_ids, field: :attachment_id, style: :simple) - .register_column(:attachment_resource_ids, field: :attachment_resource_id, style: :simple) - .register_column(:attachment_resource_types, field: :attachment_resource_type, style: :simple) - .register_column(:attached_vpc_ids, field: :attached_vpc_id, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:cidr_blocks, field: :cidr_block) + .register_column(:prefix_list_ids, field: :prefix_list_id) + .register_column(:types, field: :type, style: :simple) + .register_column(:states, field: :state, style: :simple) + .register_column(:static, field: :static, style: :simple) + .register_column(:propagated, field: :propagated, style: :simple) + .register_column(:active, field: :active, style: :simple) + .register_column(:blackhole, field: :blackhole, style: :simple) + .register_column(:attachment_ids, field: :attachment_id, style: :simple) + .register_column(:attachment_resource_ids, field: :attachment_resource_id, style: :simple) + .register_column(:attachment_resource_types, field: :attachment_resource_type, style: :simple) + .register_column(:attached_vpc_ids, field: :attached_vpc_id, style: :simple) + .install_filter_methods_on_resource(self, :table) def initialize(opts) super @@ -78,15 +78,15 @@ def populate_filter_table @table = routes.map do |route| row = route.to_h row[:cidr_block] = row.delete(:destination_cidr_block) - row[:static] = (row[:type] == "static") - row[:propagated] = (row[:type] == "propagated") - row[:active] = (row[:state] == "active") - row[:blackhole] = (row[:state] == "blackhole") + row[:static] = (row[:type] == 'static') + row[:propagated] = (row[:type] == 'propagated') + row[:active] = (row[:state] == 'active') + row[:blackhole] = (row[:state] == 'blackhole') tgw = transit_gw_attachment_for(route) row[:attachment_id] = tgw&.transit_gateway_attachment_id row[:attachment_resource_type] = tgw&.resource_type row[:attachment_resource_id] = tgw&.resource_id - row[:attached_vpc_id] = (row[:attachment_resource_type] == "vpc" && row[:attachment_resource_id]) + row[:attached_vpc_id] = (row[:attachment_resource_type] == 'vpc' && row[:attachment_resource_id]) row.delete(:transit_gateway_attachments) row end @@ -99,7 +99,7 @@ def transit_gw_attachment_for(route) end def format_route_search_for(param) - format("route-search.%s", param.to_s.gsub("_", "-")) + format('route-search.%s', param.to_s.gsub('_', '-')) end def build_filters_from_params @@ -111,7 +111,7 @@ def build_filters_from_params def default_filters [ - name: "type", + name: 'type', values: TYPES, ] end diff --git a/libraries/aws_vpc.rb b/libraries/aws_vpc.rb index 69765c3c0..9cdb97484 100644 --- a/libraries/aws_vpc.rb +++ b/libraries/aws_vpc.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsVpc < AwsResourceBase - name "aws_vpc" - desc "Verifies settings for an AWS VPC." + name 'aws_vpc' + desc 'Verifies settings for an AWS VPC.' example " describe aws_vpc(vpc_id: 'vpc-12345678') do @@ -20,12 +20,12 @@ def initialize(opts = {}) validate_parameters(allow: [:vpc_id]) if opts[:vpc_id].nil? - @display_name = "default" - filter = { name: "isDefault", values: ["true"] } + @display_name = 'default' + filter = { name: 'isDefault', values: ['true'] } else @display_name = opts[:vpc_id] raise ArgumentError, "#{@__resource_name__}: VPC ID must be in the format 'vpc-' followed by 8 or 17 hexadecimal characters." if opts[:vpc_id] !~ /^vpc\-([0-9a-f]{8})|(^vpc\-[0-9a-f]{17})$/ - filter = { name: "vpc-id", values: [opts[:vpc_id]] } + filter = { name: 'vpc-id', values: [opts[:vpc_id]] } end catch_aws_errors do @@ -61,7 +61,7 @@ def exists? end def resource_id - @response ? @display_name : "" + @response ? @display_name : '' end def has_cidr_block_associated?(cidr_block) @@ -105,13 +105,13 @@ def has_ipv6_cidr_block_disassociated?(ipv6_cidr_block) end def has_network_border_group_value?(ipv6_cidr_block:, network_border_group:) - raise ArgumentError, "parameters `ipv6_cidr_block` and `network_border_group` should be present" unless ipv6_cidr_block && network_border_group + raise ArgumentError, 'parameters `ipv6_cidr_block` and `network_border_group` should be present' unless ipv6_cidr_block && network_border_group ipv6_cidr_block_associations.any? { |assoc| assoc.ipv_6_cidr_block == ipv6_cidr_block && assoc.network_border_group == network_border_group } end def has_ipv6_pool_value?(ipv6_cidr_block:, ipv6_pool:) - raise ArgumentError, "parameters `ipv6_cidr_block` and `ipv6_pool` should be present" unless ipv6_cidr_block && ipv6_pool + raise ArgumentError, 'parameters `ipv6_cidr_block` and `ipv6_pool` should be present' unless ipv6_cidr_block && ipv6_pool ipv6_cidr_block_associations.any? { |assoc| assoc.ipv_6_cidr_block == ipv6_cidr_block && assoc.ipv_6_pool == ipv6_pool } end diff --git a/libraries/aws_vpc_endpoint.rb b/libraries/aws_vpc_endpoint.rb index e26d34a27..cea24d5c3 100644 --- a/libraries/aws_vpc_endpoint.rb +++ b/libraries/aws_vpc_endpoint.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsVpce < AwsResourceBase - name "aws_vpc_endpoint" - desc "Verifies settings for an AWS VPC Endpoint." + name 'aws_vpc_endpoint' + desc 'Verifies settings for an AWS VPC Endpoint.' example " describe aws_vpc_endpoint(vpc_endpoint_id: 'vpce-12345678123456789') do @@ -20,7 +20,7 @@ def initialize(opts = {}) end @display_name = opts[:vpc_endpoint_id] - filter = { name: "vpc-endpoint-id", values: [opts[:vpc_endpoint_id]] } + filter = { name: 'vpc-endpoint-id', values: [opts[:vpc_endpoint_id]] } catch_aws_errors do resp = @aws.compute_client.describe_vpc_endpoints({ filters: [filter] }) @vpce = resp.vpc_endpoints[0].to_h @@ -34,7 +34,7 @@ def exists? def available? return false unless exists? - @vpce[:state] == "available" + @vpce[:state] == 'available' end def private_dns_enabled? @@ -43,12 +43,12 @@ def private_dns_enabled? def interface? return false unless exists? - @vpce[:vpc_endpoint_type] == "Interface" + @vpce[:vpc_endpoint_type] == 'Interface' end def gateway? return false unless exists? - @vpce[:vpc_endpoint_type] == "Gateway" + @vpce[:vpc_endpoint_type] == 'Gateway' end def resource_id diff --git a/libraries/aws_vpc_endpoint_connection_notification.rb b/libraries/aws_vpc_endpoint_connection_notification.rb index 24b81ff67..e4c2b026d 100644 --- a/libraries/aws_vpc_endpoint_connection_notification.rb +++ b/libraries/aws_vpc_endpoint_connection_notification.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsVpcEndpointConnectionNotification < AwsResourceBase - name "aws_vpc_endpoint_connection_notification" - desc "Verifies settings for an AWS VPC Endpoint Notification." + name 'aws_vpc_endpoint_connection_notification' + desc 'Verifies settings for an AWS VPC Endpoint Notification.' example " describe aws_vpc_endpoint_connection_notification(connection-notification-id: 'vpce-12345678123456789') do @@ -37,7 +37,7 @@ def exists? end def connection_notification_state_enabled? - @vpcen[:connection_notification_state]=="Enabled" + @vpcen[:connection_notification_state]=='Enabled' end def resource_id diff --git a/libraries/aws_vpc_endpoint_connection_notifications.rb b/libraries/aws_vpc_endpoint_connection_notifications.rb index d73b456a2..c34e8eb0e 100644 --- a/libraries/aws_vpc_endpoint_connection_notifications.rb +++ b/libraries/aws_vpc_endpoint_connection_notifications.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsVpcEndpointConnectionNotifications < AwsResourceBase - name "aws_vpc_endpoint_connection_notifications" - desc "Verifies settings for all the AWS VPC Endpoint Notifications." + name 'aws_vpc_endpoint_connection_notifications' + desc 'Verifies settings for all the AWS VPC Endpoint Notifications.' example " describe aws_vpc_endpoint_connection_notifications do @@ -14,14 +14,14 @@ class AwsVpcEndpointConnectionNotifications < AwsResourceBase # FilterTable setup FilterTable.create - .register_column(:connection_notification_ids, field: :connection_notification_id) - .register_column(:service_ids, field: :service_id) - .register_column(:connection_notification_types, field: :connection_notification_type) - .register_column(:connection_notification_arns, field: :connection_notification_arn) - .register_column(:connection_events, field: :connection_events) - .register_column(:connection_notification_state, field: :connection_notification_state) - .register_column(:vpc_endpoint_id, field: :vpc_endpoint_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:connection_notification_ids, field: :connection_notification_id) + .register_column(:service_ids, field: :service_id) + .register_column(:connection_notification_types, field: :connection_notification_type) + .register_column(:connection_notification_arns, field: :connection_notification_arn) + .register_column(:connection_events, field: :connection_events) + .register_column(:connection_notification_state, field: :connection_notification_state) + .register_column(:vpc_endpoint_id, field: :vpc_endpoint_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_vpc_endpoint_service.rb b/libraries/aws_vpc_endpoint_service.rb index 622e13a2f..446260bdf 100644 --- a/libraries/aws_vpc_endpoint_service.rb +++ b/libraries/aws_vpc_endpoint_service.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsVPCEndpointService < AwsResourceBase - name "aws_vpc_endpoint_service" - desc "Verifies settings for an AWS VPC End Point Service." + name 'aws_vpc_endpoint_service' + desc 'Verifies settings for an AWS VPC End Point Service.' example " describe aws_vpc_endpoint_service(service_name: 'aws.sagemaker.us-east-2.notebook') do @@ -90,7 +90,7 @@ def service_type end def service_detail - raise StandardError, "More than One Route is available" if @response.next_token + raise StandardError, 'More than One Route is available' if @response.next_token @response.service_details.first end diff --git a/libraries/aws_vpc_endpoint_service_permission.rb b/libraries/aws_vpc_endpoint_service_permission.rb index fd0c2dba0..627825c7f 100644 --- a/libraries/aws_vpc_endpoint_service_permission.rb +++ b/libraries/aws_vpc_endpoint_service_permission.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsVPCEndpointServicePermission < AwsResourceBase - name "aws_vpc_endpoint_service_permission" - desc "Describes the principal (service consumers) that are permitted to discover your VPC endpoint service." + name 'aws_vpc_endpoint_service_permission' + desc 'Describes the principal (service consumers) that are permitted to discover your VPC endpoint service.' example " describe aws_vpc_endpoint_service_permission(service_id: 'vpce-svc-04deb776dc2b8e67f', principal: 'arn:aws:iam::112758395563:user/chef-server') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts) validate_parameters(required: %i(service_id principal)) filters = { filters: [ - name: "principal", + name: 'principal', values: [opts[:principal]], ], } @@ -37,7 +37,7 @@ def exists? end def resource_id - "#{@opts ? @opts[:service_id] : ""}_#{@opts ? @opts[:principal] : ""}" + "#{@opts ? @opts[:service_id] : ''}_#{@opts ? @opts[:principal] : ''}" end def to_s diff --git a/libraries/aws_vpc_endpoint_service_permissions.rb b/libraries/aws_vpc_endpoint_service_permissions.rb index 3cf98776d..81b65a357 100644 --- a/libraries/aws_vpc_endpoint_service_permissions.rb +++ b/libraries/aws_vpc_endpoint_service_permissions.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsVPCEndpointServicePermissions < AwsResourceBase - name "aws_vpc_endpoint_service_permissions" - desc "Describes the principals (service consumers) that are permitted to discover your VPC endpoint service." + name 'aws_vpc_endpoint_service_permissions' + desc 'Describes the principals (service consumers) that are permitted to discover your VPC endpoint service.' example " describe aws_vpc_endpoint_service_permissions(service_id: 'vpce-svc-04deb776dc2b8e67f') do it { should exist } @@ -12,9 +12,9 @@ class AwsVPCEndpointServicePermissions < AwsResourceBase attr_reader :table, :params FilterTable.create - .register_column(:principal_types, field: :principal_type, style: :simple) - .register_column(:principals, field: :principal) - .install_filter_methods_on_resource(self, :table) + .register_column(:principal_types, field: :principal_type, style: :simple) + .register_column(:principals, field: :principal) + .install_filter_methods_on_resource(self, :table) def initialize(opts) super diff --git a/libraries/aws_vpc_endpoint_services.rb b/libraries/aws_vpc_endpoint_services.rb index d9ebe869b..8f9757858 100644 --- a/libraries/aws_vpc_endpoint_services.rb +++ b/libraries/aws_vpc_endpoint_services.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsVPCEndpointServices < AwsResourceBase - name "aws_vpc_endpoint_services" - desc "Verifies settings for a collection of AWS VPC End Point Services." + name 'aws_vpc_endpoint_services' + desc 'Verifies settings for a collection of AWS VPC End Point Services.' example " describe aws_vpc_endpoint_services do @@ -13,19 +13,19 @@ class AwsVPCEndpointServices < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:service_names, field: :service_name) - .register_column(:service_ids, field: :service_id) - .register_column(:service_types, field: :service_type) - .register_column(:availability_zones, field: :availability_zones, style: :simple) - .register_column(:owners, field: :owner) - .register_column(:base_endpoint_dns_names, field: :base_endpoint_dns_names, style: :simple) - .register_column(:private_dns_names, field: :private_dns_name) - .register_column(:vpc_endpoint_policy_supported, field: :vpc_endpoint_policy_supported) - .register_column(:acceptance_required, field: :acceptance_required) - .register_column(:manages_vpc_endpoints, field: :manages_vpc_endpoints) - .register_column(:tags, field: :tags) - .register_column(:private_dns_name_verification_states, field: :private_dns_name_verification_state) - .install_filter_methods_on_resource(self, :table) + .register_column(:service_names, field: :service_name) + .register_column(:service_ids, field: :service_id) + .register_column(:service_types, field: :service_type) + .register_column(:availability_zones, field: :availability_zones, style: :simple) + .register_column(:owners, field: :owner) + .register_column(:base_endpoint_dns_names, field: :base_endpoint_dns_names, style: :simple) + .register_column(:private_dns_names, field: :private_dns_name) + .register_column(:vpc_endpoint_policy_supported, field: :vpc_endpoint_policy_supported) + .register_column(:acceptance_required, field: :acceptance_required) + .register_column(:manages_vpc_endpoints, field: :manages_vpc_endpoints) + .register_column(:tags, field: :tags) + .register_column(:private_dns_name_verification_states, field: :private_dns_name_verification_state) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_vpc_endpoints.rb b/libraries/aws_vpc_endpoints.rb index db70a2bdd..d53a6b3ee 100644 --- a/libraries/aws_vpc_endpoints.rb +++ b/libraries/aws_vpc_endpoints.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsVpces < AwsResourceBase - name "aws_vpc_endpoints" - desc "Verifies settings for an AWS VPC Endpoints in bulk." + name 'aws_vpc_endpoints' + desc 'Verifies settings for an AWS VPC Endpoints in bulk.' example " describe aws_vpc_endpoints do @@ -13,16 +13,16 @@ class AwsVpces < AwsResourceBase # FilterTable setup FilterTable.create - .register_column(:vpc_endpoint_ids, field: :vpc_endpoint_id) - .register_column(:vpc_endpoint_types, field: :vpc_endpoint_type) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:service_names, field: :service_name) - .register_column(:states, field: :state) - .register_column(:route_table_ids, field: :route_table_ids) - .register_column(:subnet_ids, field: :subnet_ids) - .register_column(:private_dns_enabled, field: :private_dns_enabled) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:vpc_endpoint_ids, field: :vpc_endpoint_id) + .register_column(:vpc_endpoint_types, field: :vpc_endpoint_type) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:service_names, field: :service_name) + .register_column(:states, field: :state) + .register_column(:route_table_ids, field: :route_table_ids) + .register_column(:subnet_ids, field: :subnet_ids) + .register_column(:private_dns_enabled, field: :private_dns_enabled) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_vpcs.rb b/libraries/aws_vpcs.rb index e5f7a2de5..916681e99 100644 --- a/libraries/aws_vpcs.rb +++ b/libraries/aws_vpcs.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsVpcs < AwsResourceBase - name "aws_vpcs" - desc "Verifies settings for an AWS VPCs in bulk." + name 'aws_vpcs' + desc 'Verifies settings for an AWS VPCs in bulk.' example " describe aws_vpcs do @@ -13,23 +13,23 @@ class AwsVpcs < AwsResourceBase # FilterTable setup FilterTable.create - .register_column(:cidr_blocks, field: :cidr_block, style: :simple) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:states, field: :state, style: :simple) - .register_column(:dhcp_options_ids, field: :dhcp_options_id) - .register_column(:instance_tenancies, field: :instance_tenancy, style: :simple) - .register_column(:is_default, field: :is_default, style: :simple) - .register_column(:defaults, field: :defaults, style: :simple) - .register_column(:tags, field: :tags) - .register_column(:cidr_block_association_ids, field: :cidr_block_association_ids, style: :simple) - .register_column(:associated_cidr_blocks, field: :associated_cidr_blocks, style: :simple) - .register_column(:cidr_block_states, field: :cidr_block_states, style: :simple) - .register_column(:ipv6_cidr_block_association_ids, field: :ipv6_cidr_block_association_ids, style: :simple) - .register_column(:ipv6_cidr_blocks, field: :ipv6_cidr_blocks, style: :simple) - .register_column(:ipv6_cidr_block_states, field: :ipv6_cidr_block_states, style: :simple) - .register_column(:ipv6_network_border_groups, field: :ipv6_network_border_groups, style: :simple) - .register_column(:ipv6_pools, field: :ipv6_pools, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:cidr_blocks, field: :cidr_block, style: :simple) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:states, field: :state, style: :simple) + .register_column(:dhcp_options_ids, field: :dhcp_options_id) + .register_column(:instance_tenancies, field: :instance_tenancy, style: :simple) + .register_column(:is_default, field: :is_default, style: :simple) + .register_column(:defaults, field: :defaults, style: :simple) + .register_column(:tags, field: :tags) + .register_column(:cidr_block_association_ids, field: :cidr_block_association_ids, style: :simple) + .register_column(:associated_cidr_blocks, field: :associated_cidr_blocks, style: :simple) + .register_column(:cidr_block_states, field: :cidr_block_states, style: :simple) + .register_column(:ipv6_cidr_block_association_ids, field: :ipv6_cidr_block_association_ids, style: :simple) + .register_column(:ipv6_cidr_blocks, field: :ipv6_cidr_blocks, style: :simple) + .register_column(:ipv6_cidr_block_states, field: :ipv6_cidr_block_states, style: :simple) + .register_column(:ipv6_network_border_groups, field: :ipv6_network_border_groups, style: :simple) + .register_column(:ipv6_pools, field: :ipv6_pools, style: :simple) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -69,16 +69,16 @@ def flat_hash_for(vpc) hash[:tags] = map_tags(vpc.tags) cidr_block_associations = vpc.cidr_block_association_set - hash[:cidr_block_association_ids] = map_attributes_from(cidr_block_associations, "association_id") - hash[:associated_cidr_blocks] = map_attributes_from(cidr_block_associations, "cidr_block") - hash[:cidr_block_states] = map_attributes_from(cidr_block_associations, "cidr_block_state&.state") + hash[:cidr_block_association_ids] = map_attributes_from(cidr_block_associations, 'association_id') + hash[:associated_cidr_blocks] = map_attributes_from(cidr_block_associations, 'cidr_block') + hash[:cidr_block_states] = map_attributes_from(cidr_block_associations, 'cidr_block_state&.state') ipv6_cidr_block_associations = vpc.ipv_6_cidr_block_association_set - hash[:ipv6_cidr_block_association_ids] = map_attributes_from(ipv6_cidr_block_associations, "association_id") - hash[:ipv6_cidr_blocks] = map_attributes_from(ipv6_cidr_block_associations, "ipv_6_cidr_block") - hash[:ipv6_cidr_block_states] = map_attributes_from(ipv6_cidr_block_associations, "ipv_6_cidr_block_state&.state") - hash[:ipv6_network_border_groups] = map_attributes_from(ipv6_cidr_block_associations, "network_border_group") - hash[:ipv6_pools] = map_attributes_from(ipv6_cidr_block_associations, "ipv_6_pool") + hash[:ipv6_cidr_block_association_ids] = map_attributes_from(ipv6_cidr_block_associations, 'association_id') + hash[:ipv6_cidr_blocks] = map_attributes_from(ipv6_cidr_block_associations, 'ipv_6_cidr_block') + hash[:ipv6_cidr_block_states] = map_attributes_from(ipv6_cidr_block_associations, 'ipv_6_cidr_block_state&.state') + hash[:ipv6_network_border_groups] = map_attributes_from(ipv6_cidr_block_associations, 'network_border_group') + hash[:ipv6_pools] = map_attributes_from(ipv6_cidr_block_associations, 'ipv_6_pool') end end diff --git a/libraries/aws_vpn_connection.rb b/libraries/aws_vpn_connection.rb index 9ecf80225..3d648cc2c 100644 --- a/libraries/aws_vpn_connection.rb +++ b/libraries/aws_vpn_connection.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsVPNConnection < AwsResourceBase - name "aws_vpn_connection" - desc "Verifies settings for a single AWS VPN Connection." + name 'aws_vpn_connection' + desc 'Verifies settings for a single AWS VPN Connection.' example <<-EXAMPLE describe aws_vpn_connection(vpn_connection_id: 'vpn-1234567890') do it { should exist } @@ -50,6 +50,6 @@ def query_with(params) end def validate_identifier - raise ArgumentError, "parameter `vpn_connection_id` cannot be blank" if @opts[:vpn_connection_id].blank? + raise ArgumentError, 'parameter `vpn_connection_id` cannot be blank' if @opts[:vpn_connection_id].blank? end end diff --git a/libraries/aws_vpn_connections.rb b/libraries/aws_vpn_connections.rb index bdcc3a964..cdb676693 100644 --- a/libraries/aws_vpn_connections.rb +++ b/libraries/aws_vpn_connections.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsVpnConnections < AwsResourceBase - name "aws_vpn_connections" - desc "Verifies settings for an AWS VPN connections in bulk" + name 'aws_vpn_connections' + desc 'Verifies settings for an AWS VPN connections in bulk' example " describe aws_vpn_connections do @@ -13,14 +13,14 @@ class AwsVpnConnections < AwsResourceBase # FilterTable setup FilterTable.create - .register_column(:vpn_connection_ids, field: :vpn_connection_id) - .register_column(:vpn_gateway_ids, field: :vpn_gateway_id) - .register_column(:outside_ip_addresses, field: :outside_ip_address) - .register_column(:tunnel_inside_cidrs, field: :tunnel_inside_cidr) - .register_column(:states, field: :state) - .register_column(:types, field: :type) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:vpn_connection_ids, field: :vpn_connection_id) + .register_column(:vpn_gateway_ids, field: :vpn_gateway_id) + .register_column(:outside_ip_addresses, field: :outside_ip_address) + .register_column(:tunnel_inside_cidrs, field: :tunnel_inside_cidr) + .register_column(:states, field: :state) + .register_column(:types, field: :type) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_vpn_gateway.rb b/libraries/aws_vpn_gateway.rb index 079ac2cc6..72b2c086b 100644 --- a/libraries/aws_vpn_gateway.rb +++ b/libraries/aws_vpn_gateway.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsVPNGateway < AwsResourceBase - name "aws_vpn_gateway" - desc "Verifies settings for a single AWS VPN Gateway." + name 'aws_vpn_gateway' + desc 'Verifies settings for a single AWS VPN Gateway.' example " describe aws_vpn_gateway(vpn_gateway_id: 'vgw-014aef8a0689b8f43') do @@ -39,7 +39,7 @@ def vpc_id def attached? return false if attachments.nil? || attachments.empty? - attachments.first.state == "attached" + attachments.first.state == 'attached' end def detached? @@ -47,7 +47,7 @@ def detached? end def resource_id - @opts ? @opts[:vpn_gateway_id] : "" + @opts ? @opts[:vpn_gateway_id] : '' end private @@ -73,7 +73,7 @@ def attachments end def validate_identifier - raise ArgumentError, "parameter `vpn_gateway_id` cannot be blank" if @opts[:vpn_gateway_id].nil? || @opts[:vpn_gateway_id].empty? - raise ArgumentError, "parameter `vpn_gateway_id` should start with `vgw-` followed by alpha numeric characters" if @opts[:vpn_gateway_id] !~ /^vgw-[a-z0-9]+$/ + raise ArgumentError, 'parameter `vpn_gateway_id` cannot be blank' if @opts[:vpn_gateway_id].nil? || @opts[:vpn_gateway_id].empty? + raise ArgumentError, 'parameter `vpn_gateway_id` should start with `vgw-` followed by alpha numeric characters' if @opts[:vpn_gateway_id] !~ /^vgw-[a-z0-9]+$/ end end diff --git a/libraries/aws_vpn_gateways.rb b/libraries/aws_vpn_gateways.rb index f9e7804be..3fd6f49a3 100644 --- a/libraries/aws_vpn_gateways.rb +++ b/libraries/aws_vpn_gateways.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AwsVPNGateways < AwsResourceBase - name "aws_vpn_gateways" - desc "Verifies settings for AWS VPN Gateways." + name 'aws_vpn_gateways' + desc 'Verifies settings for AWS VPN Gateways.' example " describe aws_vpn_gateways do @@ -13,14 +13,14 @@ class AwsVPNGateways < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:availability_zones, field: :availability_zone, style: :simple) - .register_column(:states, field: :state) - .register_column(:types, field: :type) - .register_column(:vpn_gateway_ids, field: :vpn_gateway_id) - .register_column(:amazon_side_asns, field: :amazon_side_asn) - .register_column(:tags, field: :tags) - .register_column(:vpc_attachments, field: :vpc_attachments) - .install_filter_methods_on_resource(self, :table) + .register_column(:availability_zones, field: :availability_zone, style: :simple) + .register_column(:states, field: :state) + .register_column(:types, field: :type) + .register_column(:vpn_gateway_ids, field: :vpn_gateway_id) + .register_column(:amazon_side_asns, field: :amazon_side_asn) + .register_column(:tags, field: :tags) + .register_column(:vpc_attachments, field: :vpc_attachments) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super diff --git a/libraries/aws_waf_byte_match_set.rb b/libraries/aws_waf_byte_match_set.rb index ff02f7968..df7c8a34c 100644 --- a/libraries/aws_waf_byte_match_set.rb +++ b/libraries/aws_waf_byte_match_set.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSWAFByteMatchSet < AwsResourceBase - name "aws_waf_byte_match_set" - desc "Describes one WAF byte set." + name 'aws_waf_byte_match_set' + desc 'Describes one WAF byte set.' example " describe aws_waf_byte_match_set(byte_match_set_id: 'BYTE_MATCH_SET_ID') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def byte_match_set_id - return nil unless exists? + return unless exists? @resp[:byte_match_set_id] end diff --git a/libraries/aws_waf_byte_match_sets.rb b/libraries/aws_waf_byte_match_sets.rb index cd908ce31..05ab4e74b 100644 --- a/libraries/aws_waf_byte_match_sets.rb +++ b/libraries/aws_waf_byte_match_sets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSWAFByteMatchSets < AwsResourceBase - name "aws_waf_byte_match_sets" - desc "Verifies settings for all the WAF rules." + name 'aws_waf_byte_match_sets' + desc 'Verifies settings for all the WAF rules.' example " describe aws_waf_byte_match_sets do @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:byte_match_set_ids, field: :byte_match_set_id, style: :simple) - .register_column(:names, field: :name, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:byte_match_set_ids, field: :byte_match_set_id, style: :simple) + .register_column(:names, field: :name, style: :simple) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_waf_ip_set.rb b/libraries/aws_waf_ip_set.rb index f652062e1..3ad2bf11f 100644 --- a/libraries/aws_waf_ip_set.rb +++ b/libraries/aws_waf_ip_set.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSWAFIPSet < AwsResourceBase - name "aws_waf_ip_set" - desc "Describes one WAF IP set." + name 'aws_waf_ip_set' + desc 'Describes one WAF IP set.' example " describe aws_waf_ip_set(ip_set_id: 'IP_SET_ID') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def ip_set_id - return nil unless exists? + return unless exists? @resp[:ip_set_id] end diff --git a/libraries/aws_waf_ip_sets.rb b/libraries/aws_waf_ip_sets.rb index e314e32a5..c0eb70ad2 100644 --- a/libraries/aws_waf_ip_sets.rb +++ b/libraries/aws_waf_ip_sets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSWAFIPSets < AwsResourceBase - name "aws_waf_ip_sets" - desc "Verifies settings for all the IP sets." + name 'aws_waf_ip_sets' + desc 'Verifies settings for all the IP sets.' example " describe aws_waf_ip_sets do @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:ip_set_ids, field: :ip_set_id, style: :simple) - .register_column(:names, field: :name, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:ip_set_ids, field: :ip_set_id, style: :simple) + .register_column(:names, field: :name, style: :simple) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_waf_rule.rb b/libraries/aws_waf_rule.rb index 66d8599fd..aae044361 100644 --- a/libraries/aws_waf_rule.rb +++ b/libraries/aws_waf_rule.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSWAFRule < AwsResourceBase - name "aws_waf_rule" - desc "Describes one WAF rule." + name 'aws_waf_rule' + desc 'Describes one WAF rule.' example " describe aws_waf_rule(rule_id: 'RULE_ID') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def rule_id - return nil unless exists? + return unless exists? @resp[:rule_id] end diff --git a/libraries/aws_waf_rules.rb b/libraries/aws_waf_rules.rb index 74b7f0267..7bda9c93c 100644 --- a/libraries/aws_waf_rules.rb +++ b/libraries/aws_waf_rules.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSWAFRules < AwsResourceBase - name "aws_waf_rules" - desc "Verifies settings for all the WAF rules." + name 'aws_waf_rules' + desc 'Verifies settings for all the WAF rules.' example " describe aws_waf_rules do @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:rule_ids, field: :rule_id) - .register_column(:names, field: :name) - .install_filter_methods_on_resource(self, :table) + .register_column(:rule_ids, field: :rule_id) + .register_column(:names, field: :name) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_waf_size_constraint_set.rb b/libraries/aws_waf_size_constraint_set.rb index cd7a22327..c621eaf00 100644 --- a/libraries/aws_waf_size_constraint_set.rb +++ b/libraries/aws_waf_size_constraint_set.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSWAFSizeConstraintSet < AwsResourceBase - name "aws_waf_size_constraint_set" - desc "Describes one WAF size constraint set." + name 'aws_waf_size_constraint_set' + desc 'Describes one WAF size constraint set.' example " describe aws_waf_size_constraint_set(size_constraint_set_id: 'SIZE_CONSTRAINT_SET_ID') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def size_constraint_set_id - return nil unless exists? + return unless exists? @resp[:size_constraint_set_id] end diff --git a/libraries/aws_waf_size_constraint_sets.rb b/libraries/aws_waf_size_constraint_sets.rb index cf8bf1e72..cce3bcab1 100644 --- a/libraries/aws_waf_size_constraint_sets.rb +++ b/libraries/aws_waf_size_constraint_sets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSWAFSizeConstraintSets < AwsResourceBase - name "aws_waf_size_constraint_sets" - desc "Describes all the WAF size constraint sets." + name 'aws_waf_size_constraint_sets' + desc 'Describes all the WAF size constraint sets.' example " describe aws_waf_size_constraint_set do @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:size_constraint_set_ids, field: :size_constraint_set_id, style: :simple) - .register_column(:names, field: :name, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:size_constraint_set_ids, field: :size_constraint_set_id, style: :simple) + .register_column(:names, field: :name, style: :simple) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_waf_sql_injection_match_set.rb b/libraries/aws_waf_sql_injection_match_set.rb index 40adc2f32..b320ac633 100644 --- a/libraries/aws_waf_sql_injection_match_set.rb +++ b/libraries/aws_waf_sql_injection_match_set.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSWAFSQLInjectionMatchSet < AwsResourceBase - name "aws_waf_sql_injection_match_set" - desc "Describes one WAF SQL Injection match set." + name 'aws_waf_sql_injection_match_set' + desc 'Describes one WAF SQL Injection match set.' example " describe aws_waf_sql_injection_match_set(sql_injection_match_set_id: 'SQL_INJECTION_MATCH_SET_ID') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def sql_injection_match_set_id - return nil unless exists? + return unless exists? @resp[:sql_injection_match_set_id] end diff --git a/libraries/aws_waf_sql_injection_match_sets.rb b/libraries/aws_waf_sql_injection_match_sets.rb index 16938c939..259b10b74 100644 --- a/libraries/aws_waf_sql_injection_match_sets.rb +++ b/libraries/aws_waf_sql_injection_match_sets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSWAFSQLInjectionMatchSets < AwsResourceBase - name "aws_waf_sql_injection_match_sets" - desc "Verifies settings for all the WAF SQL Injection match set." + name 'aws_waf_sql_injection_match_sets' + desc 'Verifies settings for all the WAF SQL Injection match set.' example " describe aws_waf_sql_injection_match_sets do @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:sql_injection_match_set_ids, field: :sql_injection_match_set_id, style: :simple) - .register_column(:names, field: :name, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:sql_injection_match_set_ids, field: :sql_injection_match_set_id, style: :simple) + .register_column(:names, field: :name, style: :simple) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_waf_web_acl.rb b/libraries/aws_waf_web_acl.rb index 789165a24..e8a6185b6 100644 --- a/libraries/aws_waf_web_acl.rb +++ b/libraries/aws_waf_web_acl.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSWAFWebACL < AwsResourceBase - name "aws_waf_web_acl" - desc "Describes one WAF Web ACL." + name 'aws_waf_web_acl' + desc 'Describes one WAF Web ACL.' example " describe aws_waf_web_acl(web_acl_id: 'WEB_ACL_ID') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def web_acl_id - return nil unless exists? + return unless exists? @resp[:web_acl_id] end diff --git a/libraries/aws_waf_web_acls.rb b/libraries/aws_waf_web_acls.rb index f9d372c08..02c97e383 100644 --- a/libraries/aws_waf_web_acls.rb +++ b/libraries/aws_waf_web_acls.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSWAFWebACLS < AwsResourceBase - name "aws_waf_web_acls" - desc "Verifies settings for all the Web ACLs." + name 'aws_waf_web_acls' + desc 'Verifies settings for all the Web ACLs.' example " describe aws_waf_web_acls do @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:web_acl_ids, field: :web_acl_id, style: :simple) - .register_column(:names, field: :name, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:web_acl_ids, field: :web_acl_id, style: :simple) + .register_column(:names, field: :name, style: :simple) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_waf_xss_match_set.rb b/libraries/aws_waf_xss_match_set.rb index 4c1d7964f..99d79aacf 100644 --- a/libraries/aws_waf_xss_match_set.rb +++ b/libraries/aws_waf_xss_match_set.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSWAFXSSMatchSet < AwsResourceBase - name "aws_waf_xss_match_set" - desc "Describes one WAF XSS match set." + name 'aws_waf_xss_match_set' + desc 'Describes one WAF XSS match set.' example " describe aws_waf_xss_match_set(xss_match_set_id: 'XSS_MATCH_SET_ID') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def xss_match_set_id - return nil unless exists? + return unless exists? @resp[:xss_match_set_id] end diff --git a/libraries/aws_waf_xss_match_sets.rb b/libraries/aws_waf_xss_match_sets.rb index cb5c18428..71fb8ccfd 100644 --- a/libraries/aws_waf_xss_match_sets.rb +++ b/libraries/aws_waf_xss_match_sets.rb @@ -1,8 +1,8 @@ -require "aws_backend" +require 'aws_backend' class AWSWAFXSSMatchSets < AwsResourceBase - name "aws_waf_xss_match_sets" - desc "Verifies settings for all the WAF XSS Match Set." + name 'aws_waf_xss_match_sets' + desc 'Verifies settings for all the WAF XSS Match Set.' example " describe aws_waf_xss_match_sets do @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:xss_match_set_ids, field: :xss_match_set_id, style: :simple) - .register_column(:names, field: :name, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:xss_match_set_ids, field: :xss_match_set_id, style: :simple) + .register_column(:names, field: :name, style: :simple) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do From 51207506409593fef127822f08aac29518bd058a Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Sun, 12 Nov 2023 21:30:56 -0500 Subject: [PATCH 12/15] fixed aws-backend to not throw errors when some account setting are not configured Signed-off-by: Aaron Lippold --- libraries/aws_backend.rb | 3 +-- libraries/aws_iam_credential_report.rb | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libraries/aws_backend.rb b/libraries/aws_backend.rb index 48f661611..6378012e2 100644 --- a/libraries/aws_backend.rb +++ b/libraries/aws_backend.rb @@ -440,8 +440,7 @@ def catch_aws_errors fail_resource('No AWS credentials available') nil rescue Aws::Account::Errors::ResourceNotFoundException => e - # require 'pry';binding.pry - Inspec::Log.error "#{e.message}" + Inspec::Log.warn "#{e.message}" fail_resource("#{e.message}") nil rescue Aws::Errors::NoSuchEndpointError diff --git a/libraries/aws_iam_credential_report.rb b/libraries/aws_iam_credential_report.rb index 77671db7d..b5a6db968 100644 --- a/libraries/aws_iam_credential_report.rb +++ b/libraries/aws_iam_credential_report.rb @@ -1,9 +1,9 @@ -require 'csv' -require 'aws_backend' +require "csv" +require "aws_backend" class AwsIamCredentialReport < AwsCollectionResourceBase - name 'aws_iam_credential_report' - desc 'Lists all users in the AWS account and the status of their credentials.' + name "aws_iam_credential_report" + desc "Lists all users in the AWS account and the status of their credentials." example " describe aws_iam_credential_report.where(mfa_active: false) do @@ -45,7 +45,7 @@ def initialize(opts = {}) end def to_s - 'IAM Credential Report' + "IAM Credential Report" end private @@ -62,16 +62,17 @@ def fetch_data sleep 5 retry else - Inspec::Log.warn 'AWS IAM Credential Report was not generated quickly enough.' + Inspec::Log.warn "AWS IAM Credential Report was not generated quickly enough." raise e end end - report = CSV.parse(response.content, headers: true, header_converters: :symbol, converters: [:date_time, lambda { |field| if field == 'true' - true - else - field == 'false' ? false : field - end - } ]) + report = CSV.parse(response.content, headers: true, header_converters: :symbol, converters: [:date_time, lambda { |field| + if field == "true" + true + else + field == "false" ? false : field + end + }]) report.map(&:to_h) end end From f40ab216dc3ccfd0757c5b10a22652600da58e0f Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Mon, 13 Nov 2023 09:16:02 -0500 Subject: [PATCH 13/15] ran bundle exec chefstyle -A Signed-off-by: Aaron Lippold --- libraries/aws_account.rb | 106 +++++----- libraries/aws_alb.rb | 12 +- libraries/aws_albs.rb | 34 +-- libraries/aws_ami.rb | 6 +- libraries/aws_amis.rb | 66 +++--- libraries/aws_amplify_app.rb | 6 +- libraries/aws_amplify_apps.rb | 30 +-- libraries/aws_amplify_branch.rb | 6 +- libraries/aws_amplify_branches.rb | 26 +-- libraries/aws_api_gateway_deployment.rb | 6 +- libraries/aws_api_gateway_deployments.rb | 16 +- .../aws_api_gateway_documentation_part.rb | 6 +- .../aws_api_gateway_documentation_parts.rb | 22 +- .../aws_api_gateway_documentation_version.rb | 6 +- .../aws_api_gateway_documentation_versions.rb | 14 +- libraries/aws_api_gateway_domain_name.rb | 8 +- libraries/aws_api_gateway_domain_names.rb | 6 +- libraries/aws_api_gateway_method.rb | 6 +- libraries/aws_api_gateway_methods.rb | 30 +-- libraries/aws_api_gateway_model.rb | 6 +- libraries/aws_api_gateway_models.rb | 18 +- .../aws_api_gateway_request_validator.rb | 6 +- .../aws_api_gateway_request_validators.rb | 6 +- libraries/aws_api_gateway_resource.rb | 6 +- libraries/aws_api_gateway_resources.rb | 6 +- libraries/aws_api_gateway_response.rb | 6 +- libraries/aws_api_gateway_responses.rb | 22 +- libraries/aws_api_gateway_restapi.rb | 6 +- libraries/aws_api_gateway_restapis.rb | 34 +-- libraries/aws_api_gateway_stage.rb | 6 +- libraries/aws_api_gateway_stages.rb | 16 +- libraries/aws_api_gateway_usage_plan.rb | 6 +- libraries/aws_api_gateway_usage_plan_key.rb | 8 +- libraries/aws_api_gateway_usage_plan_keys.rb | 6 +- libraries/aws_api_gateway_usage_plans.rb | 4 +- libraries/aws_api_gateway_v2_api.rb | 6 +- libraries/aws_api_gateway_v2_api_mapping.rb | 6 +- libraries/aws_api_gateway_v2_api_mappings.rb | 6 +- libraries/aws_api_gateway_v2_apis.rb | 6 +- libraries/aws_api_gateway_v2_authorizer.rb | 6 +- libraries/aws_api_gateway_v2_authorizers.rb | 6 +- libraries/aws_api_gateway_v2_deployment.rb | 6 +- libraries/aws_api_gateway_v2_deployments.rb | 6 +- libraries/aws_api_gateway_v2_domain_name.rb | 6 +- libraries/aws_api_gateway_v2_domain_names.rb | 6 +- libraries/aws_api_gateway_v2_integration.rb | 6 +- ...aws_api_gateway_v2_integration_response.rb | 6 +- ...ws_api_gateway_v2_integration_responses.rb | 6 +- libraries/aws_api_gateway_v2_integrations.rb | 6 +- libraries/aws_api_gateway_v2_model.rb | 6 +- libraries/aws_api_gateway_v2_models.rb | 6 +- libraries/aws_api_gateway_v2_route.rb | 6 +- libraries/aws_api_gateway_v2_routes.rb | 6 +- libraries/aws_api_gateway_vpc_link.rb | 6 +- libraries/aws_api_gateway_vpc_links.rb | 6 +- libraries/aws_apigateway_account.rb | 8 +- libraries/aws_apigateway_api_key.rb | 6 +- libraries/aws_apigateway_api_keys.rb | 28 +-- libraries/aws_apigateway_authorizer.rb | 6 +- libraries/aws_apigateway_authorizers.rb | 28 +-- libraries/aws_apigateway_base_path_mapping.rb | 6 +- .../aws_apigateway_base_path_mappings.rb | 14 +- .../aws_apigateway_client_certificate.rb | 6 +- .../aws_apigateway_client_certificates.rb | 20 +- ...application_autoscaling_scalable_target.rb | 8 +- ...pplication_autoscaling_scalable_targets.rb | 24 +-- ...pplication_autoscaling_scaling_policies.rb | 28 +-- ..._application_autoscaling_scaling_policy.rb | 8 +- libraries/aws_athena_work_group.rb | 6 +- libraries/aws_athena_work_groups.rb | 16 +- libraries/aws_auto_scaling_group.rb | 8 +- libraries/aws_auto_scaling_groups.rb | 26 +-- libraries/aws_autoscaling_scaling_policies.rb | 34 +-- libraries/aws_autoscaling_scaling_policy.rb | 6 +- libraries/aws_backend.rb | 200 +++++++++--------- libraries/aws_batch_compute_environment.rb | 6 +- libraries/aws_batch_compute_environments.rb | 26 +-- libraries/aws_batch_job_definition.rb | 6 +- libraries/aws_batch_job_definitions.rb | 26 +-- libraries/aws_batch_job_queue.rb | 6 +- libraries/aws_batch_job_queues.rb | 22 +- libraries/aws_cloud_formation_stack_set.rb | 6 +- libraries/aws_cloud_formation_stack_sets.rb | 24 +-- libraries/aws_cloudformation_stack.rb | 6 +- libraries/aws_cloudformation_stacks.rb | 22 +- libraries/aws_cloudformation_template.rb | 6 +- libraries/aws_cloudfront_cache_policies.rb | 34 +-- libraries/aws_cloudfront_cache_policy.rb | 6 +- libraries/aws_cloudfront_distribution.rb | 10 +- libraries/aws_cloudfront_distributions.rb | 36 ++-- libraries/aws_cloudfront_key_group.rb | 6 +- libraries/aws_cloudfront_key_groups.rb | 18 +- ...aws_cloudfront_origin_access_identities.rb | 14 +- .../aws_cloudfront_origin_access_identity.rb | 6 +- .../aws_cloudfront_origin_request_policy.rb | 6 +- libraries/aws_cloudfront_public_key.rb | 6 +- libraries/aws_cloudfront_public_keys.rb | 18 +- .../aws_cloudfront_realtime_log_config.rb | 6 +- .../aws_cloudfront_realtime_log_configs.rb | 18 +- .../aws_cloudfront_streaming_distribution.rb | 6 +- .../aws_cloudfront_streaming_distributions.rb | 30 +-- libraries/aws_cloudtrail_trail.rb | 12 +- libraries/aws_cloudtrail_trails.rb | 12 +- libraries/aws_cloudwatch_alarm.rb | 10 +- libraries/aws_cloudwatch_anomaly_detector.rb | 8 +- libraries/aws_cloudwatch_anomaly_detectors.rb | 20 +- libraries/aws_cloudwatch_composite_alarm.rb | 8 +- libraries/aws_cloudwatch_composite_alarms.rb | 36 ++-- libraries/aws_cloudwatch_dashboard.rb | 6 +- libraries/aws_cloudwatch_dashboards.rb | 16 +- libraries/aws_cloudwatch_insight_rules.rb | 16 +- libraries/aws_cloudwatch_log_group.rb | 8 +- libraries/aws_cloudwatch_log_metric_filter.rb | 8 +- libraries/aws_cloudwatch_metric_stream.rb | 6 +- libraries/aws_cloudwatch_metric_streams.rb | 22 +- libraries/aws_cloudwatchlogs_destinantion.rb | 6 +- libraries/aws_cloudwatchlogs_destinantions.rb | 20 +- libraries/aws_cloudwatchlogs_log_stream.rb | 6 +- libraries/aws_cloudwatchlogs_log_streams.rb | 24 +-- .../aws_cloudwatchlogs_subscription_filter.rb | 6 +- ...aws_cloudwatchlogs_subscription_filters.rb | 22 +- libraries/aws_cognito_identity_pool.rb | 6 +- libraries/aws_cognito_identity_pools.rb | 12 +- libraries/aws_cognito_userpool.rb | 6 +- libraries/aws_cognito_userpool_client.rb | 6 +- libraries/aws_cognito_userpool_clients.rb | 14 +- libraries/aws_cognito_userpools.rb | 20 +- libraries/aws_config_delivery_channel.rb | 16 +- libraries/aws_config_recorder.rb | 6 +- libraries/aws_db_parameter_group.rb | 6 +- libraries/aws_db_parameter_groups.rb | 16 +- libraries/aws_db_subnet_group.rb | 6 +- libraries/aws_db_subnet_groups.rb | 20 +- libraries/aws_dhcp_options.rb | 16 +- libraries/aws_dms_endpoint.rb | 8 +- libraries/aws_dms_endpoints.rb | 74 +++---- libraries/aws_dms_replication_instance.rb | 8 +- libraries/aws_dms_replication_instances.rb | 26 +-- libraries/aws_dms_replication_subnet_group.rb | 8 +- .../aws_dms_replication_subnet_groups.rb | 18 +- libraries/aws_dynamodb_table.rb | 10 +- libraries/aws_dynamodb_tables.rb | 10 +- libraries/aws_ebs_snapshot.rb | 14 +- libraries/aws_ebs_snapshots.rb | 16 +- libraries/aws_ebs_volume.rb | 8 +- libraries/aws_ebs_volumes.rb | 38 ++-- libraries/aws_ec2_capacity_reservation.rb | 6 +- libraries/aws_ec2_capacity_reservations.rb | 48 ++--- libraries/aws_ec2_carrier_gateway.rb | 6 +- libraries/aws_ec2_carrier_gateways.rb | 18 +- .../aws_ec2_client_vpn_authorization_rule.rb | 10 +- .../aws_ec2_client_vpn_authorization_rules.rb | 22 +- libraries/aws_ec2_client_vpn_endpoint.rb | 8 +- libraries/aws_ec2_client_vpn_endpoints.rb | 30 +-- libraries/aws_ec2_client_vpn_route.rb | 10 +- libraries/aws_ec2_client_vpn_routes.rb | 24 +-- ...2_client_vpn_target_network_association.rb | 10 +- ..._client_vpn_target_network_associations.rb | 22 +- libraries/aws_ec2_customer_gateway.rb | 6 +- libraries/aws_ec2_customer_gateways.rb | 24 +-- libraries/aws_ec2_dhcp_option.rb | 14 +- libraries/aws_ec2_dhcp_options.rb | 30 +-- .../aws_ec2_egress_only_internet_gateway.rb | 6 +- .../aws_ec2_egress_only_internet_gateways.rb | 14 +- libraries/aws_ec2_eip.rb | 6 +- libraries/aws_ec2_eip_association.rb | 8 +- libraries/aws_ec2_eip_associations.rb | 10 +- libraries/aws_ec2_eips.rb | 28 +-- libraries/aws_ec2_fleet.rb | 6 +- libraries/aws_ec2_fleets.rb | 50 ++--- libraries/aws_ec2_host.rb | 6 +- libraries/aws_ec2_hosts.rb | 38 ++-- libraries/aws_ec2_instance.rb | 12 +- libraries/aws_ec2_instances.rb | 26 +-- libraries/aws_ec2_internet_gateway.rb | 6 +- libraries/aws_ec2_internet_gateways.rb | 20 +- libraries/aws_ec2_launch_template.rb | 6 +- libraries/aws_ec2_launch_templates.rb | 24 +-- .../aws_ec2_network_insights_analysis.rb | 6 +- ...ws_ec2_network_insights_analysis_plural.rb | 34 +-- libraries/aws_ec2_network_insights_path.rb | 6 +- libraries/aws_ec2_network_insights_paths.rb | 28 +-- libraries/aws_ec2_network_interface.rb | 6 +- .../aws_ec2_network_interface_attachment.rb | 8 +- .../aws_ec2_network_interface_attachments.rb | 24 +-- libraries/aws_ec2_network_interfaces.rb | 48 ++--- libraries/aws_ec2_placement_group.rb | 6 +- libraries/aws_ec2_placement_groups.rb | 48 ++--- libraries/aws_ec2_prefix_list.rb | 6 +- libraries/aws_ec2_prefix_lists.rb | 28 +-- libraries/aws_ec2_spot_fleet.rb | 6 +- libraries/aws_ec2_spot_fleets.rb | 20 +- libraries/aws_ec2_traffic_mirror_filter.rb | 6 +- libraries/aws_ec2_traffic_mirror_filters.rb | 14 +- libraries/aws_ec2_traffic_mirror_session.rb | 6 +- libraries/aws_ec2_traffic_mirror_sessions.rb | 28 +-- libraries/aws_ec2_traffic_mirror_target.rb | 6 +- libraries/aws_ec2_traffic_mirror_targets.rb | 22 +- .../aws_ec2_transit_gateway_attachment.rb | 6 +- .../aws_ec2_transit_gateway_attachments.rb | 28 +-- .../aws_ec2_transit_gateway_route_table.rb | 6 +- ...transit_gateway_route_table_association.rb | 6 +- ...ransit_gateway_route_table_associations.rb | 16 +- ...transit_gateway_route_table_propagation.rb | 8 +- ...ransit_gateway_route_table_propagations.rb | 16 +- .../aws_ec2_transit_gateway_route_tables.rb | 22 +- libraries/aws_ec2_volume_attachment.rb | 6 +- libraries/aws_ec2_volume_attachments.rb | 20 +- libraries/aws_ec2_vpc_peering_connection.rb | 6 +- libraries/aws_ec2_vpc_peering_connections.rb | 20 +- libraries/aws_ec2_vpn_connection_routes.rb | 14 +- .../aws_ec2_vpn_gateway_route_propagation.rb | 6 +- .../aws_ec2_vpn_gateway_route_propagations.rb | 14 +- libraries/aws_ecr.rb | 6 +- libraries/aws_ecr_image.rb | 16 +- libraries/aws_ecr_images.rb | 24 +-- libraries/aws_ecr_repositories.rb | 20 +- libraries/aws_ecr_repository.rb | 10 +- libraries/aws_ecr_repository_policy.rb | 6 +- libraries/aws_ecrpublic_repositories.rb | 16 +- libraries/aws_ecrpublic_repository.rb | 10 +- libraries/aws_ecs_cluster.rb | 6 +- libraries/aws_ecs_clusters.rb | 24 +-- libraries/aws_ecs_service.rb | 6 +- libraries/aws_ecs_services.rb | 28 +-- libraries/aws_ecs_task_definition.rb | 6 +- libraries/aws_ecs_task_definitions.rb | 10 +- libraries/aws_efs_file_system.rb | 6 +- libraries/aws_efs_file_systems.rb | 32 +-- libraries/aws_efs_mount_target.rb | 6 +- libraries/aws_efs_mount_targets.rb | 28 +-- libraries/aws_eks_cluster.rb | 16 +- libraries/aws_eks_clusters.rb | 14 +- libraries/aws_elasticache_cluster.rb | 8 +- libraries/aws_elasticache_cluster_node.rb | 8 +- libraries/aws_elasticache_clusters.rb | 24 +-- .../aws_elasticache_replication_group.rb | 6 +- .../aws_elasticache_replication_groups.rb | 18 +- .../aws_elasticloadbalancingv2_listener.rb | 6 +- ...ticloadbalancingv2_listener_certificate.rb | 6 +- ...icloadbalancingv2_listener_certificates.rb | 12 +- ...ws_elasticloadbalancingv2_listener_rule.rb | 6 +- ...s_elasticloadbalancingv2_listener_rules.rb | 18 +- .../aws_elasticloadbalancingv2_listeners.rb | 24 +-- ...aws_elasticloadbalancingv2_target_group.rb | 6 +- ...ws_elasticloadbalancingv2_target_groups.rb | 42 ++-- libraries/aws_elasticsearchservice_domain.rb | 8 +- libraries/aws_elasticsearchservice_domains.rb | 10 +- libraries/aws_elb.rb | 10 +- libraries/aws_elbs.rb | 26 +-- libraries/aws_emr_cluster.rb | 12 +- libraries/aws_emr_clusters.rb | 44 ++-- libraries/aws_emr_security_configuration.rb | 18 +- libraries/aws_emr_security_configurations.rb | 28 +-- libraries/aws_eventbridge_rule.rb | 6 +- libraries/aws_eventbridge_rules.rb | 26 +-- libraries/aws_flow_log.rb | 24 +-- libraries/aws_glue_crawler.rb | 6 +- libraries/aws_glue_crawlers.rb | 44 ++-- libraries/aws_glue_database.rb | 6 +- libraries/aws_glue_databases.rb | 24 +-- libraries/aws_guardduty_detector.rb | 10 +- libraries/aws_guardduty_detectors.rb | 10 +- libraries/aws_hosted_zone.rb | 20 +- libraries/aws_hosted_zones.rb | 20 +- libraries/aws_iam_access_key.rb | 14 +- libraries/aws_iam_access_keys.rb | 46 ++-- libraries/aws_iam_account_alias.rb | 6 +- libraries/aws_iam_credential_report.rb | 58 ++--- libraries/aws_iam_group.rb | 8 +- libraries/aws_iam_groups.rb | 20 +- libraries/aws_iam_inline_policy.rb | 6 +- libraries/aws_iam_instance_profile.rb | 6 +- libraries/aws_iam_instance_profiles.rb | 20 +- libraries/aws_iam_managed_policies.rb | 28 +-- libraries/aws_iam_managed_policy.rb | 6 +- libraries/aws_iam_oidc_provider.rb | 8 +- libraries/aws_iam_oidc_providers.rb | 10 +- libraries/aws_iam_password_policy.rb | 12 +- libraries/aws_iam_policies.rb | 24 +-- libraries/aws_iam_policy.rb | 6 +- libraries/aws_iam_role.rb | 6 +- libraries/aws_iam_roles.rb | 28 +-- libraries/aws_iam_root_user.rb | 14 +- libraries/aws_iam_saml_provider.rb | 8 +- libraries/aws_iam_saml_providers.rb | 16 +- libraries/aws_iam_server_certificate.rb | 6 +- libraries/aws_iam_server_certificates.rb | 20 +- ...iam_service_linked_role_deletion_status.rb | 8 +- libraries/aws_iam_ssh_public_key.rb | 6 +- libraries/aws_iam_ssh_public_keys.rb | 16 +- libraries/aws_iam_user.rb | 6 +- libraries/aws_iam_users.rb | 44 ++-- libraries/aws_iam_virtual_mfa_devices.rb | 24 +-- libraries/aws_internet_gateway.rb | 18 +- libraries/aws_internet_gateways.rb | 24 +-- libraries/aws_kms_key.rb | 18 +- libraries/aws_kms_keys.rb | 12 +- libraries/aws_lambda.rb | 6 +- libraries/aws_lambda_alias.rb | 6 +- libraries/aws_lambda_aliases.rb | 20 +- libraries/aws_lambda_code_signing_config.rb | 6 +- libraries/aws_lambda_code_signing_configs.rb | 20 +- libraries/aws_lambda_event_invoke_config.rb | 6 +- libraries/aws_lambda_event_invoke_configs.rb | 18 +- libraries/aws_lambda_event_source_mapping.rb | 8 +- libraries/aws_lambda_event_source_mappings.rb | 46 ++-- .../aws_lambda_layer_version_permission.rb | 6 +- libraries/aws_lambda_permission.rb | 20 +- libraries/aws_lambda_permissions.rb | 30 +-- libraries/aws_lambda_version.rb | 6 +- libraries/aws_lambda_versions.rb | 22 +- libraries/aws_lambdas.rb | 14 +- libraries/aws_launch_configuration.rb | 8 +- libraries/aws_launch_configurations.rb | 34 +-- libraries/aws_logs_metric_filter.rb | 6 +- libraries/aws_logs_metric_filters.rb | 18 +- libraries/aws_mq_broker.rb | 6 +- libraries/aws_mq_brokers.rb | 26 +-- libraries/aws_mq_configuration.rb | 6 +- libraries/aws_mq_configurations.rb | 26 +-- libraries/aws_nat_gateway.rb | 16 +- libraries/aws_nat_gateways.rb | 24 +-- libraries/aws_network_acl.rb | 18 +- libraries/aws_network_acls.rb | 40 ++-- libraries/aws_network_firewall_firewall.rb | 6 +- .../aws_network_firewall_firewall_policies.rb | 12 +- .../aws_network_firewall_firewall_policy.rb | 6 +- libraries/aws_network_firewall_firewalls.rb | 12 +- ..._network_firewall_logging_configuration.rb | 8 +- libraries/aws_network_firewall_rule_group.rb | 6 +- libraries/aws_network_firewall_rule_groups.rb | 12 +- ...rk_manager_customer_gateway_association.rb | 6 +- ...k_manager_customer_gateway_associations.rb | 20 +- libraries/aws_network_manager_device.rb | 6 +- libraries/aws_network_manager_devices.rb | 42 ++-- .../aws_network_manager_global_network.rb | 6 +- .../aws_network_manager_global_networks.rb | 20 +- libraries/aws_organizations_member.rb | 14 +- libraries/aws_ram_resource_share.rb | 6 +- libraries/aws_ram_resource_shares.rb | 28 +-- libraries/aws_rds_cluster.rb | 6 +- libraries/aws_rds_clusters.rb | 30 +-- libraries/aws_rds_db_cluster_snapshot.rb | 8 +- libraries/aws_rds_db_cluster_snapshots.rb | 52 ++--- libraries/aws_rds_db_proxy.rb | 6 +- libraries/aws_rds_db_proxy_endpoint.rb | 6 +- libraries/aws_rds_db_proxy_endpoints.rb | 30 +-- libraries/aws_rds_db_security_group.rb | 6 +- libraries/aws_rds_db_security_groups.rb | 22 +- libraries/aws_rds_event_subscription.rb | 8 +- libraries/aws_rds_event_subscriptions.rb | 28 +-- libraries/aws_rds_global_cluster.rb | 6 +- libraries/aws_rds_global_clusters.rb | 28 +-- libraries/aws_rds_instance.rb | 8 +- libraries/aws_rds_instances.rb | 6 +- libraries/aws_rds_option_group.rb | 8 +- libraries/aws_rds_option_groups.rb | 22 +- libraries/aws_rds_snapshot.rb | 8 +- libraries/aws_rds_snapshot_attributes.rb | 16 +- libraries/aws_rds_snapshots.rb | 6 +- libraries/aws_redshift_cluster.rb | 6 +- .../aws_redshift_cluster_parameter_group.rb | 6 +- .../aws_redshift_cluster_parameter_groups.rb | 16 +- libraries/aws_redshift_clusters.rb | 36 ++-- libraries/aws_region.rb | 6 +- libraries/aws_regions.rb | 12 +- libraries/aws_route53_record_set.rb | 8 +- libraries/aws_route53_record_sets.rb | 34 +-- .../aws_route53resolver_resolver_endpoint.rb | 6 +- .../aws_route53resolver_resolver_endpoints.rb | 32 +-- .../aws_route53resolver_resolver_rule.rb | 6 +- ...ute53resolver_resolver_rule_association.rb | 6 +- ...te53resolver_resolver_rule_associations.rb | 20 +- .../aws_route53resolver_resolver_rules.rb | 36 ++-- libraries/aws_route_table.rb | 14 +- libraries/aws_route_tables.rb | 100 ++++----- libraries/aws_s3_access_point.rb | 6 +- libraries/aws_s3_access_points.rb | 14 +- libraries/aws_s3_bucket.rb | 20 +- libraries/aws_s3_bucket_object.rb | 10 +- libraries/aws_s3_bucket_objects.rb | 38 ++-- libraries/aws_s3_bucket_policy.rb | 8 +- libraries/aws_s3_buckets.rb | 12 +- libraries/aws_sdb_domains.rb | 10 +- libraries/aws_secretsmanager_secret.rb | 6 +- libraries/aws_secretsmanager_secrets.rb | 40 ++-- libraries/aws_security_group.rb | 24 +-- libraries/aws_security_groups.rb | 6 +- libraries/aws_securityhub_hub.rb | 6 +- ..._servicecatalog_cloud_formation_product.rb | 6 +- ...s_servicecatalog_launch_role_constraint.rb | 8 +- ..._servicecatalog_launch_role_constraints.rb | 20 +- ...catalog_portfolio_principal_association.rb | 6 +- ...atalog_portfolio_principal_associations.rb | 12 +- ...cecatalog_portfolio_product_association.rb | 6 +- ...ecatalog_portfolio_product_associations.rb | 20 +- libraries/aws_ses_receipt_rule.rb | 6 +- libraries/aws_ses_receipt_rule_set.rb | 6 +- libraries/aws_ses_receipt_rule_sets.rb | 12 +- libraries/aws_ses_template.rb | 6 +- libraries/aws_ses_templates.rb | 12 +- libraries/aws_shield_subscription.rb | 6 +- libraries/aws_signer_profile_permissions.rb | 16 +- libraries/aws_signer_signing_profile.rb | 6 +- libraries/aws_signer_signing_profiles.rb | 30 +-- libraries/aws_sns_subscription.rb | 18 +- libraries/aws_sns_subscriptions.rb | 18 +- libraries/aws_sns_topic.rb | 10 +- libraries/aws_sns_topics.rb | 10 +- libraries/aws_sqs_queue.rb | 40 ++-- libraries/aws_sqs_queues.rb | 44 ++-- libraries/aws_ssm_activation.rb | 8 +- libraries/aws_ssm_activations.rb | 28 +-- libraries/aws_ssm_association.rb | 6 +- libraries/aws_ssm_associations.rb | 28 +-- libraries/aws_ssm_document.rb | 6 +- libraries/aws_ssm_documents.rb | 26 +-- libraries/aws_ssm_maintenance_window.rb | 6 +- .../aws_ssm_maintenance_window_target.rb | 8 +- .../aws_ssm_maintenance_window_targets.rb | 22 +- libraries/aws_ssm_maintenance_window_task.rb | 8 +- libraries/aws_ssm_maintenance_window_tasks.rb | 36 ++-- libraries/aws_ssm_maintenance_windows.rb | 32 +-- libraries/aws_ssm_parameter.rb | 6 +- libraries/aws_ssm_parameters.rb | 24 +-- libraries/aws_ssm_patch_baseline.rb | 6 +- libraries/aws_ssm_patch_baselines.rb | 18 +- .../aws_ssm_resource_compliance_summaries.rb | 28 +-- .../aws_ssm_resource_compliance_summary.rb | 14 +- libraries/aws_ssm_resource_data_syncs.rb | 28 +-- libraries/aws_stepfunctions_activities.rb | 14 +- libraries/aws_stepfunctions_activity.rb | 6 +- libraries/aws_stepfunctions_state_machine.rb | 6 +- libraries/aws_stepfunctions_state_machines.rb | 16 +- libraries/aws_sts_caller_identity.rb | 10 +- libraries/aws_subnet.rb | 10 +- libraries/aws_subnets.rb | 22 +- libraries/aws_synthetics_canaries.rb | 42 ++-- libraries/aws_synthetics_canary.rb | 6 +- libraries/aws_transfer_user.rb | 6 +- libraries/aws_transfer_users.rb | 20 +- libraries/aws_transit_gateway.rb | 6 +- libraries/aws_transit_gateway_connect.rb | 6 +- libraries/aws_transit_gateway_connects.rb | 24 +-- .../aws_transit_gateway_multicast_domain.rb | 6 +- ...it_gateway_multicast_domain_association.rb | 6 +- ...t_gateway_multicast_domain_associations.rb | 18 +- .../aws_transit_gateway_multicast_domains.rb | 24 +-- ..._transit_gateway_multicast_group_member.rb | 6 +- ...transit_gateway_multicast_group_members.rb | 30 +-- ..._transit_gateway_multicast_group_source.rb | 6 +- ...transit_gateway_multicast_group_sources.rb | 30 +-- libraries/aws_transit_gateway_route.rb | 14 +- libraries/aws_transit_gateway_routes.rb | 46 ++-- libraries/aws_vpc.rb | 18 +- libraries/aws_vpc_endpoint.rb | 14 +- ...ws_vpc_endpoint_connection_notification.rb | 8 +- ...s_vpc_endpoint_connection_notifications.rb | 22 +- libraries/aws_vpc_endpoint_service.rb | 8 +- .../aws_vpc_endpoint_service_permission.rb | 10 +- .../aws_vpc_endpoint_service_permissions.rb | 12 +- libraries/aws_vpc_endpoint_services.rb | 32 +-- libraries/aws_vpc_endpoints.rb | 26 +-- libraries/aws_vpcs.rb | 56 ++--- libraries/aws_vpn_connection.rb | 8 +- libraries/aws_vpn_connections.rb | 22 +- libraries/aws_vpn_gateway.rb | 14 +- libraries/aws_vpn_gateways.rb | 22 +- libraries/aws_waf_byte_match_set.rb | 6 +- libraries/aws_waf_byte_match_sets.rb | 12 +- libraries/aws_waf_ip_set.rb | 6 +- libraries/aws_waf_ip_sets.rb | 12 +- libraries/aws_waf_rule.rb | 6 +- libraries/aws_waf_rules.rb | 12 +- libraries/aws_waf_size_constraint_set.rb | 6 +- libraries/aws_waf_size_constraint_sets.rb | 12 +- libraries/aws_waf_sql_injection_match_set.rb | 6 +- libraries/aws_waf_sql_injection_match_sets.rb | 12 +- libraries/aws_waf_web_acl.rb | 6 +- libraries/aws_waf_web_acls.rb | 12 +- libraries/aws_waf_xss_match_set.rb | 6 +- libraries/aws_waf_xss_match_sets.rb | 12 +- 483 files changed, 3829 insertions(+), 3829 deletions(-) diff --git a/libraries/aws_account.rb b/libraries/aws_account.rb index 8f4e3ce29..e0491072f 100644 --- a/libraries/aws_account.rb +++ b/libraries/aws_account.rb @@ -1,9 +1,9 @@ -require 'aws_backend' -require 'pry' +require "aws_backend" +require "pry" class AwsPrimaryAccount < AwsResourceBase - name 'aws_primary_contact' - desc 'Verifies the primary contact information for an AWS Account.' + name "aws_primary_contact" + desc "Verifies the primary contact information for an AWS Account." example <<~EXAMPLE describe aws_primary_account do it { should be_configured } @@ -15,20 +15,20 @@ class AwsPrimaryAccount < AwsResourceBase attr_reader :table, :raw_data FilterTable.create - .register_column(:address_line_1, field: :address_line_1, style: :simple) - .register_column(:adress_line_2, field: :adress_line_2, style: :simple) - .register_column(:address_line_3, field: :address_line_3, style: :simple) - .register_column(:city, field: :city, style: :simple) - .register_column(:company_name, field: :company_name, style: :simple) - .register_column(:country_code, field: :country_code, style: :simple) - .register_column(:district_or_county, field: :district_or_county, style: :simple) - .register_column(:full_name, field: :full_name, style: :simple) - .register_column(:phone_number, field: :phone_number, style: :simple) - .register_column(:postal_code, field: :postal_code, style: :simple) - .register_column(:state_or_region, field: :state_or_region, style: :simple) - .register_column(:website_url, field: :website_url, style: :simple) - .register_custom_matcher(:configured?) { |x| x.entries.any? } - .install_filter_methods_on_resource(self, :table) + .register_column(:address_line_1, field: :address_line_1, style: :simple) + .register_column(:adress_line_2, field: :adress_line_2, style: :simple) + .register_column(:address_line_3, field: :address_line_3, style: :simple) + .register_column(:city, field: :city, style: :simple) + .register_column(:company_name, field: :company_name, style: :simple) + .register_column(:country_code, field: :country_code, style: :simple) + .register_column(:district_or_county, field: :district_or_county, style: :simple) + .register_column(:full_name, field: :full_name, style: :simple) + .register_column(:phone_number, field: :phone_number, style: :simple) + .register_column(:postal_code, field: :postal_code, style: :simple) + .register_column(:state_or_region, field: :state_or_region, style: :simple) + .register_column(:website_url, field: :website_url, style: :simple) + .register_custom_matcher(:configured?) { |x| x.entries.any? } + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -38,11 +38,11 @@ def initialize(opts = {}) end def resource_id - "AWS Account for #{@table[0][:full_name]}" || 'AWS Account Contact Information' + "AWS Account for #{@table[0][:full_name]}" || "AWS Account Contact Information" end def to_s - 'AWS Account Primary Contact' + "AWS Account Primary Contact" end def fetch_data @@ -80,8 +80,8 @@ def fetch_data # resp.alternate_contact.title #=> String class AwsBillingAccount < AwsResourceBase - name 'aws_billing_contact' - desc 'Verifies the billing contact information for an AWS Account.' + name "aws_billing_contact" + desc "Verifies the billing contact information for an AWS Account." example <<~EXAMPLE describe aws_billing_account do it { should be_configured } @@ -93,12 +93,12 @@ class AwsBillingAccount < AwsResourceBase attr_reader :table, :raw_data FilterTable.create - .register_column(:email_address, field: :email_address, style: :simple) - .register_column(:name, field: :name, style: :simple) - .register_column(:phone_number, field: :phone_number, style: :simple) - .register_column(:title, field: :title, style: :simple) - .register_custom_matcher(:configured?) { |x| x.entries.any? } - .install_filter_methods_on_resource(self, :table) + .register_column(:email_address, field: :email_address, style: :simple) + .register_column(:name, field: :name, style: :simple) + .register_column(:phone_number, field: :phone_number, style: :simple) + .register_column(:title, field: :title, style: :simple) + .register_custom_matcher(:configured?) { |x| x.entries.any? } + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -107,18 +107,18 @@ def initialize(opts = {}) end def resource_id - "AWS Billing for #{@table[0][:name]}" || 'AWS Account Billing Information' + "AWS Billing for #{@table[0][:name]}" || "AWS Account Billing Information" end def to_s - 'AWS Account Billing Contact' + "AWS Account Billing Contact" end def fetch_data @raw_data = [] loop do catch_aws_errors do - @api_response = @aws.account_client.get_alternate_contact({ alternate_contact_type: 'BILLING' }).alternate_contact + @api_response = @aws.account_client.get_alternate_contact({ alternate_contact_type: "BILLING" }).alternate_contact end return [] if !@api_response || @api_response.empty? @@ -137,8 +137,8 @@ def fetch_data # @aws.account_client.get_alternate_contact({alternate_contact_type: "OPERATIONS"}).alternate_contact.to_h.transform_keys(&:to_s) class AwsAccountOperationsContact < AwsResourceBase - name 'aws_operations_contact' - desc 'Verifies the operations contact information for an AWS Account.' + name "aws_operations_contact" + desc "Verifies the operations contact information for an AWS Account." example <<~EXAMPLE describe aws_operations_account do it { should be_configured } @@ -150,12 +150,12 @@ class AwsAccountOperationsContact < AwsResourceBase attr_reader :table, :raw_data FilterTable.create - .register_column(:email_address, field: :email_address, style: :simple) - .register_column(:name, field: :name, style: :simple) - .register_column(:phone_number, field: :phone_number, style: :simple) - .register_column(:title, field: :title, style: :simple) - .register_custom_matcher(:configured?) { |x| x.entries.any? } - .install_filter_methods_on_resource(self, :table) + .register_column(:email_address, field: :email_address, style: :simple) + .register_column(:name, field: :name, style: :simple) + .register_column(:phone_number, field: :phone_number, style: :simple) + .register_column(:title, field: :title, style: :simple) + .register_custom_matcher(:configured?) { |x| x.entries.any? } + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -164,18 +164,18 @@ def initialize(opts = {}) end def resource_id - "AWS Operations Contact for #{@table[0][:name]}" || 'AWS Account Operations Contact Information' + "AWS Operations Contact for #{@table[0][:name]}" || "AWS Account Operations Contact Information" end def to_s - 'AWS Account Operations Contact Information' + "AWS Account Operations Contact Information" end def fetch_data @raw_data = [] loop do catch_aws_errors do - @api_response = @aws.account_client.get_alternate_contact({ alternate_contact_type: 'OPERATIONS' }).alternate_contact + @api_response = @aws.account_client.get_alternate_contact({ alternate_contact_type: "OPERATIONS" }).alternate_contact end return [] if !@api_response || @api_response.empty? @@ -193,8 +193,8 @@ def fetch_data # @aws.account_client.get_alternate_contact({alternate_contact_type: "SECURITY"}).alternate_contact.to_h.transform_keys(&:to_s) class AwsAccountSecurityContact < AwsResourceBase - name 'aws_security_contact' - desc 'Verifies the security contact information for an AWS Account.' + name "aws_security_contact" + desc "Verifies the security contact information for an AWS Account." example <<~EXAMPLE describe aws_security_account do it { should be_configured } @@ -206,12 +206,12 @@ class AwsAccountSecurityContact < AwsResourceBase attr_reader :table, :raw_data FilterTable.create - .register_column(:email_address, field: :email_address, style: :simple) - .register_column(:name, field: :name, style: :simple) - .register_column(:phone_number, field: :phone_number, style: :simple) - .register_column(:title, field: :title, style: :simple) - .register_custom_matcher(:configured?) { |x| x.entries.any? } - .install_filter_methods_on_resource(self, :table) + .register_column(:email_address, field: :email_address, style: :simple) + .register_column(:name, field: :name, style: :simple) + .register_column(:phone_number, field: :phone_number, style: :simple) + .register_column(:title, field: :title, style: :simple) + .register_custom_matcher(:configured?) { |x| x.entries.any? } + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -220,18 +220,18 @@ def initialize(opts = {}) end def resource_id - "AWS Security Contact for #{@table[0][:name]}" || 'AWS Account Security Contact Information' + "AWS Security Contact for #{@table[0][:name]}" || "AWS Account Security Contact Information" end def to_s - 'AWS Account Security Contact' + "AWS Account Security Contact" end def fetch_data @raw_data = [] loop do catch_aws_errors do - @api_response = @aws.account_client.get_alternate_contact({ alternate_contact_type: 'SECURITY' }).alternate_contact + @api_response = @aws.account_client.get_alternate_contact({ alternate_contact_type: "SECURITY" }).alternate_contact end return [] if !@api_response || @api_response.empty? diff --git a/libraries/aws_alb.rb b/libraries/aws_alb.rb index d64f8e6b2..315b24b35 100644 --- a/libraries/aws_alb.rb +++ b/libraries/aws_alb.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsAlb < AwsResourceBase - name 'aws_alb' - desc 'Verifies settings for an Application Load Balancer.' + name "aws_alb" + desc "Verifies settings for an Application Load Balancer." example <<-EXAMPLE describe aws_alb('arn:aws:elasticloadbalancing') do it { should exist } @@ -45,8 +45,8 @@ def resource_id def access_log_enabled return unless alb_attributes - s3_enabled_attr = alb_attributes.find { |attr| attr.key.eql?('access_logs.s3.enabled') } - @access_log_enabled = s3_enabled_attr&.value == 'true' + s3_enabled_attr = alb_attributes.find { |attr| attr.key.eql?("access_logs.s3.enabled") } + @access_log_enabled = s3_enabled_attr&.value == "true" end def listeners @@ -56,7 +56,7 @@ def listeners end def ssl_policies - @ssl_policies ||= listeners.filter_map { |listener| listener.ssl_policy if listener.protocol == 'HTTPS' }.uniq + @ssl_policies ||= listeners.filter_map { |listener| listener.ssl_policy if listener.protocol == "HTTPS" }.uniq end def external_ports diff --git a/libraries/aws_albs.rb b/libraries/aws_albs.rb index 5fce9771c..d61197377 100644 --- a/libraries/aws_albs.rb +++ b/libraries/aws_albs.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsAlbs < AwsResourceBase - name 'aws_albs' - desc 'Verifies settings for a collection AWS Application Load Balancers.' + name "aws_albs" + desc "Verifies settings for a collection AWS Application Load Balancers." example <<-EXAMPLE describe aws_albs do it { should exist } @@ -12,20 +12,20 @@ class AwsAlbs < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:availability_zones, field: :availability_zones) - .register_column(:canonical_hosted_zone_ids, field: :canonical_hosted_zone_id) - .register_column(:dns_names, field: :dns_name) - .register_column(:load_balancer_arns, field: :load_balancer_arn) - .register_column(:load_balancer_names, field: :load_balancer_name) - .register_column(:load_balancer_addresses, field: :load_balancer_addresses) - .register_column(:schemes, field: :scheme) - .register_column(:security_groups, field: :security_groups) - .register_column(:states, field: :state) - .register_column(:subnets, field: :subnets) - .register_column(:types, field: :type) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:zone_names, field: :zone_names) - .install_filter_methods_on_resource(self, :table) + .register_column(:availability_zones, field: :availability_zones) + .register_column(:canonical_hosted_zone_ids, field: :canonical_hosted_zone_id) + .register_column(:dns_names, field: :dns_name) + .register_column(:load_balancer_arns, field: :load_balancer_arn) + .register_column(:load_balancer_names, field: :load_balancer_name) + .register_column(:load_balancer_addresses, field: :load_balancer_addresses) + .register_column(:schemes, field: :scheme) + .register_column(:security_groups, field: :security_groups) + .register_column(:states, field: :state) + .register_column(:subnets, field: :subnets) + .register_column(:types, field: :type) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:zone_names, field: :zone_names) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ami.rb b/libraries/aws_ami.rb index 1e9e28209..e39dadcd0 100644 --- a/libraries/aws_ami.rb +++ b/libraries/aws_ami.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsAmi < AwsResourceBase - name 'aws_ami' - desc 'Verifies settings for an AWS AMI.' + name "aws_ami" + desc "Verifies settings for an AWS AMI." example <<-EXAMPLE describe aws_ami(image_id: 'ami-12345678') do it { should exist } diff --git a/libraries/aws_amis.rb b/libraries/aws_amis.rb index e1de85c10..33298c87a 100644 --- a/libraries/aws_amis.rb +++ b/libraries/aws_amis.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsAmis < AwsResourceBase - name 'aws_amis' - desc 'Verifies settings for a collection of AWS AMIs.' + name "aws_amis" + desc "Verifies settings for a collection of AWS AMIs." example <<-EXAMPLE describe aws_amis(all_amis: 'true') do it { should exist } @@ -12,33 +12,33 @@ class AwsAmis < AwsResourceBase attr_reader :table, :api_response FilterTable.create - .register_column(:architectures, field: :architecture) - .register_column(:creation_dates, field: :creation_date) - .register_column(:image_ids, field: :image_id) - .register_column(:image_locations, field: :image_location) - .register_column(:image_types, field: :image_type) - .register_column(:public, field: :public) - .register_column(:kernel_ids, field: :kernel_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:platforms, field: :platform) - .register_column(:platform_details, field: :platform_details) - .register_column(:usage_operations, field: :usage_operation) - .register_column(:product_codes, field: :product_codes) - .register_column(:ramdisk_ids, field: :ramdisk_id) - .register_column(:states, field: :state) - .register_column(:block_device_mappings, field: :block_device_mappings) - .register_column(:descriptions, field: :description) - .register_column(:ena_support, field: :ena_support) - .register_column(:hypervisors, field: :hypervisor) - .register_column(:image_owner_alias, field: :image_owner_alias) - .register_column(:names, field: :name) - .register_column(:root_device_names, field: :root_device_name) - .register_column(:root_device_types, field: :root_device_type) - .register_column(:sriov_net_support, field: :sriov_net_support) - .register_column(:state_reasons, field: :state_reason) - .register_column(:tags, field: :tags) - .register_column(:virtualization_types, field: :virtualization_type) - .install_filter_methods_on_resource(self, :table) + .register_column(:architectures, field: :architecture) + .register_column(:creation_dates, field: :creation_date) + .register_column(:image_ids, field: :image_id) + .register_column(:image_locations, field: :image_location) + .register_column(:image_types, field: :image_type) + .register_column(:public, field: :public) + .register_column(:kernel_ids, field: :kernel_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:platforms, field: :platform) + .register_column(:platform_details, field: :platform_details) + .register_column(:usage_operations, field: :usage_operation) + .register_column(:product_codes, field: :product_codes) + .register_column(:ramdisk_ids, field: :ramdisk_id) + .register_column(:states, field: :state) + .register_column(:block_device_mappings, field: :block_device_mappings) + .register_column(:descriptions, field: :description) + .register_column(:ena_support, field: :ena_support) + .register_column(:hypervisors, field: :hypervisor) + .register_column(:image_owner_alias, field: :image_owner_alias) + .register_column(:names, field: :name) + .register_column(:root_device_names, field: :root_device_name) + .register_column(:root_device_types, field: :root_device_type) + .register_column(:sriov_net_support, field: :sriov_net_support) + .register_column(:state_reasons, field: :state_reason) + .register_column(:tags, field: :tags) + .register_column(:virtualization_types, field: :virtualization_type) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -50,7 +50,7 @@ def initialize(opts = {}) query_params = {} filter = [] owners = [] - if @opts[:all_amis] == 'true' + if @opts[:all_amis] == "true" filter = [] elsif @opts @opts.each do |k, v| @@ -67,11 +67,11 @@ def initialize(opts = {}) raise ArgumentError, "The owners parameter should be a String or an Array of String. Found: #{v.class}" end else - filter << { name: k.to_s.tr('_', '-'), values: [v] } + filter << { name: k.to_s.tr("_", "-"), values: [v] } end end else - raise ArgumentError, 'Either all_amis or filter option must be provided.' + raise ArgumentError, "Either all_amis or filter option must be provided." end query_params = { filters: filter } unless filter.empty? diff --git a/libraries/aws_amplify_app.rb b/libraries/aws_amplify_app.rb index 4943b9f43..8ffd115f4 100644 --- a/libraries/aws_amplify_app.rb +++ b/libraries/aws_amplify_app.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSAmplifyApp < AwsResourceBase - name 'aws_amplify_app' - desc 'Describes a Amplify App.' + name "aws_amplify_app" + desc "Describes a Amplify App." example <<-EXAMPLE describe aws_amplify_app(app_id: 'APP_ID') do it { should exist } diff --git a/libraries/aws_amplify_apps.rb b/libraries/aws_amplify_apps.rb index 3215ebcb0..7c3b61423 100644 --- a/libraries/aws_amplify_apps.rb +++ b/libraries/aws_amplify_apps.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSAmplifyApps < AwsResourceBase - name 'aws_amplify_apps' - desc 'Describes a list of Amplify App.' + name "aws_amplify_apps" + desc "Describes a list of Amplify App." example <<-EXAMPLE describe aws_amplify_apps do it { should exist } @@ -12,18 +12,18 @@ class AWSAmplifyApps < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:app_ids, field: :app_id) - .register_column(:app_arns, field: :app_arn) - .register_column(:names, field: :name) - .register_column(:tags, field: :tags) - .register_column(:description, field: :description) - .register_column(:repositories, field: :repository) - .register_column(:platforms, field: :platform) - .register_column(:create_time, field: :create_time) - .register_column(:host_instance_types, field: :host_instance_type) - .register_column(:update_time, field: :update_time) - .register_column(:iam_service_role_arns, field: :iam_service_role_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:app_ids, field: :app_id) + .register_column(:app_arns, field: :app_arn) + .register_column(:names, field: :name) + .register_column(:tags, field: :tags) + .register_column(:description, field: :description) + .register_column(:repositories, field: :repository) + .register_column(:platforms, field: :platform) + .register_column(:create_time, field: :create_time) + .register_column(:host_instance_types, field: :host_instance_type) + .register_column(:update_time, field: :update_time) + .register_column(:iam_service_role_arns, field: :iam_service_role_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_amplify_branch.rb b/libraries/aws_amplify_branch.rb index 84021d005..d9906dc7f 100644 --- a/libraries/aws_amplify_branch.rb +++ b/libraries/aws_amplify_branch.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSAmplifyBranch < AwsResourceBase - name 'aws_amplify_branch' - desc 'Describes a branch for an Amplify app.' + name "aws_amplify_branch" + desc "Describes a branch for an Amplify app." example <<-EXAMPLE describe aws_amplify_branch(app_id: 'APP_ID', branch_name: 'BRANCH_NAME') do it { should exist } diff --git a/libraries/aws_amplify_branches.rb b/libraries/aws_amplify_branches.rb index 2dc8f140f..5a8d3314a 100644 --- a/libraries/aws_amplify_branches.rb +++ b/libraries/aws_amplify_branches.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSAmplifyBranches < AwsResourceBase - name 'aws_amplify_branches' - desc 'Lists the branches of an Amplify app.' + name "aws_amplify_branches" + desc "Lists the branches of an Amplify app." example <<-EXAMPLE describe aws_amplify_branches(app_id: 'APP_ID') do it { should exist } @@ -12,16 +12,16 @@ class AWSAmplifyBranches < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:branch_arns, field: :branch_arn) - .register_column(:branch_names, field: :branch_name) - .register_column(:stages, field: :stage) - .register_column(:tags, field: :tags) - .register_column(:descriptions, field: :description) - .register_column(:display_names, field: :display_name) - .register_column(:enable_notifications, field: :enable_notification) - .register_column(:create_time, field: :create_time) - .register_column(:update_time, field: :update_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:branch_arns, field: :branch_arn) + .register_column(:branch_names, field: :branch_name) + .register_column(:stages, field: :stage) + .register_column(:tags, field: :tags) + .register_column(:descriptions, field: :description) + .register_column(:display_names, field: :display_name) + .register_column(:enable_notifications, field: :enable_notification) + .register_column(:create_time, field: :create_time) + .register_column(:update_time, field: :update_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_deployment.rb b/libraries/aws_api_gateway_deployment.rb index 827ea910b..69a69bcb7 100644 --- a/libraries/aws_api_gateway_deployment.rb +++ b/libraries/aws_api_gateway_deployment.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayDeployment < AwsResourceBase - name 'aws_api_gateway_deployment' - desc 'Gets information about a Deployment resource.' + name "aws_api_gateway_deployment" + desc "Gets information about a Deployment resource." example <<-EXAMPLE describe aws_api_gateway_deployment(rest_api_id: 'REST_API_ID', deployment_id: 'DEPLOYMENT_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_deployments.rb b/libraries/aws_api_gateway_deployments.rb index bcd4fcbde..36d581c9b 100644 --- a/libraries/aws_api_gateway_deployments.rb +++ b/libraries/aws_api_gateway_deployments.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayDeployments < AwsResourceBase - name 'aws_api_gateway_deployments' - desc 'Gets information about a Deployments collection.' + name "aws_api_gateway_deployments" + desc "Gets information about a Deployments collection." example <<-EXAMPLE describe aws_api_gateway_deployments(rest_api_id: 'REST_API_ID') do it { should exist } @@ -12,11 +12,11 @@ class AWSApiGatewayDeployments < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:descriptions, field: :description) - .register_column(:created_dates, field: :created_date) - .register_column(:api_summaries, field: :api_summary) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:descriptions, field: :description) + .register_column(:created_dates, field: :created_date) + .register_column(:api_summaries, field: :api_summary) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_documentation_part.rb b/libraries/aws_api_gateway_documentation_part.rb index 87e8fea08..aef2309a2 100644 --- a/libraries/aws_api_gateway_documentation_part.rb +++ b/libraries/aws_api_gateway_documentation_part.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayDocumentationPart < AwsResourceBase - name 'aws_api_gateway_documentation_part' - desc 'Retrieves API Gateway Documentation part.' + name "aws_api_gateway_documentation_part" + desc "Retrieves API Gateway Documentation part." example <<-EXAMPLE describe aws_api_gateway_documentation_part(rest_api_id: 'REST_API_ID', documentation_part_id: 'DOCUMENTATION_PART_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_documentation_parts.rb b/libraries/aws_api_gateway_documentation_parts.rb index bc3f495fa..fdf449f52 100644 --- a/libraries/aws_api_gateway_documentation_parts.rb +++ b/libraries/aws_api_gateway_documentation_parts.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayDocumentationParts < AwsResourceBase - name 'aws_api_gateway_documentation_parts' - desc 'Lists all the API Gateway documentation parts.' + name "aws_api_gateway_documentation_parts" + desc "Lists all the API Gateway documentation parts." example <<-EXAMPLE describe aws_api_gateway_documentation_parts(rest_api_id: 'REST_API_ID') do it { should exist } @@ -13,14 +13,14 @@ class AWSApiGatewayDocumentationParts < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:types, field: :type) - .register_column(:paths, field: :path) - .register_column(:methods, field: :method) - .register_column(:status_codes, field: :status_code) - .register_column(:names, field: :name) - .register_column(:properties, field: :properties) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:types, field: :type) + .register_column(:paths, field: :path) + .register_column(:methods, field: :method) + .register_column(:status_codes, field: :status_code) + .register_column(:names, field: :name) + .register_column(:properties, field: :properties) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_documentation_version.rb b/libraries/aws_api_gateway_documentation_version.rb index ebd85fbe1..ed8309cad 100644 --- a/libraries/aws_api_gateway_documentation_version.rb +++ b/libraries/aws_api_gateway_documentation_version.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayDocumentationVersion < AwsResourceBase - name 'aws_api_gateway_documentation_version' - desc 'Retrieves API Gateway Documentation Version.' + name "aws_api_gateway_documentation_version" + desc "Retrieves API Gateway Documentation Version." example <<-EXAMPLE describe aws_api_gateway_documentation_version(rest_api_id: 'REST_API_ID', documentation_version: 'DOCUMENTATION_VERSION') do it { should exist } diff --git a/libraries/aws_api_gateway_documentation_versions.rb b/libraries/aws_api_gateway_documentation_versions.rb index af895717c..ed6f94422 100644 --- a/libraries/aws_api_gateway_documentation_versions.rb +++ b/libraries/aws_api_gateway_documentation_versions.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayDocumentationVersions < AwsResourceBase - name 'aws_api_gateway_documentation_versions' - desc 'Lists all the API Gateway documentation Version.' + name "aws_api_gateway_documentation_versions" + desc "Lists all the API Gateway documentation Version." example <<-EXAMPLE describe aws_api_gateway_documentation_versions(rest_api_id: 'REST_API_ID') do it { should exist } @@ -16,10 +16,10 @@ class AWSApiGatewayDocumentationVersions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:versions, field: :version) - .register_column(:created_dates, field: :created_date) - .register_column(:descriptions, field: :description) - .install_filter_methods_on_resource(self, :table) + .register_column(:versions, field: :version) + .register_column(:created_dates, field: :created_date) + .register_column(:descriptions, field: :description) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_domain_name.rb b/libraries/aws_api_gateway_domain_name.rb index e5de61e80..e0fbd8c19 100644 --- a/libraries/aws_api_gateway_domain_name.rb +++ b/libraries/aws_api_gateway_domain_name.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayDomainName < AwsResourceBase - name 'aws_api_gateway_domain_name' - desc 'Represents a domain name that is contained in a simpler, more intuitive URL that can be called.' + name "aws_api_gateway_domain_name" + desc "Represents a domain name that is contained in a simpler, more intuitive URL that can be called." example <<-EXAMPLE describe aws_api_gateway_domain_name(domain_name: 'DOMAIN_NAME') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts = {}) end def resource_id - @res? "#{@res[:domain_name]}_#{@res[:certificate_arn]}" : '' + @res? "#{@res[:domain_name]}_#{@res[:certificate_arn]}" : "" end def exists? diff --git a/libraries/aws_api_gateway_domain_names.rb b/libraries/aws_api_gateway_domain_names.rb index 749fdb6d7..2a45e4553 100644 --- a/libraries/aws_api_gateway_domain_names.rb +++ b/libraries/aws_api_gateway_domain_names.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayDomainNames < AwsCollectionResourceBase - name 'aws_api_gateway_domain_names' - desc 'Represents a collection of DomainName resources.' + name "aws_api_gateway_domain_names" + desc "Represents a collection of DomainName resources." example <<-EXAMPLE describe aws_api_gateway_domain_names do it { should exist } diff --git a/libraries/aws_api_gateway_method.rb b/libraries/aws_api_gateway_method.rb index 45368be11..918fcd8b6 100644 --- a/libraries/aws_api_gateway_method.rb +++ b/libraries/aws_api_gateway_method.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayMethod < AwsResourceBase - name 'aws_api_gateway_method' - desc 'Describe an existing Method resource.' + name "aws_api_gateway_method" + desc "Describe an existing Method resource." example <<-EXAMPLE describe aws_api_gateway_method(rest_api_id: 'REST_API_ID', resource_id: 'RESOURCE_ID', http_method: 'GET') do it { should exist } diff --git a/libraries/aws_api_gateway_methods.rb b/libraries/aws_api_gateway_methods.rb index 5a9c64f30..e9e4142ec 100644 --- a/libraries/aws_api_gateway_methods.rb +++ b/libraries/aws_api_gateway_methods.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayMethods < AwsResourceBase - name 'aws_api_gateway_methods' - desc 'Describe an existing Method resource.' + name "aws_api_gateway_methods" + desc "Describe an existing Method resource." example <<-EXAMPLE describe aws_api_gateway_methods(rest_api_id: 'REST_API_ID', resource_id: 'RESOURCE_ID', http_method: 'GET') do it { should exist } @@ -12,18 +12,18 @@ class AWSApiGatewayMethods < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:http_methods, field: :http_method) - .register_column(:authorization_types, field: :authorization_type) - .register_column(:authorizer_ids, field: :authorizer_id) - .register_column(:api_key_required, field: :api_key_required) - .register_column(:request_validator_ids, field: :request_validator_id) - .register_column(:operation_names, field: :operation_name) - .register_column(:request_parameters, field: :request_parameters) - .register_column(:request_models, field: :request_models) - .register_column(:method_responses, field: :method_responses) - .register_column(:method_integrations, field: :method_integration) - .register_column(:authorization_scopes, field: :authorization_scopes) - .install_filter_methods_on_resource(self, :table) + .register_column(:http_methods, field: :http_method) + .register_column(:authorization_types, field: :authorization_type) + .register_column(:authorizer_ids, field: :authorizer_id) + .register_column(:api_key_required, field: :api_key_required) + .register_column(:request_validator_ids, field: :request_validator_id) + .register_column(:operation_names, field: :operation_name) + .register_column(:request_parameters, field: :request_parameters) + .register_column(:request_models, field: :request_models) + .register_column(:method_responses, field: :method_responses) + .register_column(:method_integrations, field: :method_integration) + .register_column(:authorization_scopes, field: :authorization_scopes) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_model.rb b/libraries/aws_api_gateway_model.rb index 20108cad1..27133c996 100644 --- a/libraries/aws_api_gateway_model.rb +++ b/libraries/aws_api_gateway_model.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayModel < AwsResourceBase - name 'aws_api_gateway_model' - desc 'Retrieves an API Gateway Model.' + name "aws_api_gateway_model" + desc "Retrieves an API Gateway Model." example <<-EXAMPLE describe aws_api_gateway_model(rest_api_id: 'REST_API_ID', model_name: 'MODEL_NAME') do it { should exist } diff --git a/libraries/aws_api_gateway_models.rb b/libraries/aws_api_gateway_models.rb index abb496ab5..a82692d50 100644 --- a/libraries/aws_api_gateway_models.rb +++ b/libraries/aws_api_gateway_models.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayModels < AwsResourceBase - name 'aws_api_gateway_models' - desc 'Lists all the API Gateway models.' + name "aws_api_gateway_models" + desc "Lists all the API Gateway models." example <<-EXAMPLE describe aws_api_gateway_models(rest_api_id: 'REST_API_ID') do it { should exist } @@ -12,12 +12,12 @@ class AWSApiGatewayModels < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:content_types, field: :content_type) - .register_column(:descriptions, field: :description) - .register_column(:names, field: :name) - .register_column(:schemas, field: :schema) - .register_column(:ids, field: :id) - .install_filter_methods_on_resource(self, :table) + .register_column(:content_types, field: :content_type) + .register_column(:descriptions, field: :description) + .register_column(:names, field: :name) + .register_column(:schemas, field: :schema) + .register_column(:ids, field: :id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_request_validator.rb b/libraries/aws_api_gateway_request_validator.rb index 548c05398..d2b4f087f 100644 --- a/libraries/aws_api_gateway_request_validator.rb +++ b/libraries/aws_api_gateway_request_validator.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayRequestValidator < AwsResourceBase - name 'aws_api_gateway_request_validator' - desc 'Gets a RequestValidator of a given RestAPI.' + name "aws_api_gateway_request_validator" + desc "Gets a RequestValidator of a given RestAPI." example <<-EXAMPLE describe aws_api_gateway_request_validator(rest_api_id: 'REST_API_ID', request_validator_id: 'REQUEST_VALIDATOR_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_request_validators.rb b/libraries/aws_api_gateway_request_validators.rb index de743eacc..430e4248b 100644 --- a/libraries/aws_api_gateway_request_validators.rb +++ b/libraries/aws_api_gateway_request_validators.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayRequestValidators < AwsCollectionResourceBase - name 'aws_api_gateway_request_validators' - desc 'Gets the Request Validators collection of a given RestAPI.' + name "aws_api_gateway_request_validators" + desc "Gets the Request Validators collection of a given RestAPI." example <<-EXAMPLE describe aws_api_gateway_request_validators(rest_api_id: 'REST_API_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_resource.rb b/libraries/aws_api_gateway_resource.rb index d195d093f..a206084e5 100644 --- a/libraries/aws_api_gateway_resource.rb +++ b/libraries/aws_api_gateway_resource.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayResource < AwsResourceBase - name 'aws_api_gateway_resource' - desc 'Gets information about a Resource.' + name "aws_api_gateway_resource" + desc "Gets information about a Resource." example <<-EXAMPLE describe aws_api_gateway_resource(rest_api_id: 'REST_API_ID', resource_id: 'RESOURCE_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_resources.rb b/libraries/aws_api_gateway_resources.rb index 84e76c782..1779ce798 100644 --- a/libraries/aws_api_gateway_resources.rb +++ b/libraries/aws_api_gateway_resources.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayResources < AwsCollectionResourceBase - name 'aws_api_gateway_resources' - desc 'Lists information about a collection of Resource resources.' + name "aws_api_gateway_resources" + desc "Lists information about a collection of Resource resources." example <<-EXAMPLE describe aws_api_gateway_resources(rest_api_id: 'REST_API_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_response.rb b/libraries/aws_api_gateway_response.rb index d3ada4c95..bfaaa60bb 100644 --- a/libraries/aws_api_gateway_response.rb +++ b/libraries/aws_api_gateway_response.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayResponse < AwsResourceBase - name 'aws_api_gateway_response' - desc 'Retrieves API Gateway Response.' + name "aws_api_gateway_response" + desc "Retrieves API Gateway Response." example <<-EXAMPLE describe aws_api_gateway_response(rest_api_id: 'REST_API_ID', response_type: 'RESPONSE_TYPE') do it { should exist } diff --git a/libraries/aws_api_gateway_responses.rb b/libraries/aws_api_gateway_responses.rb index 5e61b55ac..873b80ff5 100644 --- a/libraries/aws_api_gateway_responses.rb +++ b/libraries/aws_api_gateway_responses.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayResponses < AwsResourceBase - name 'aws_api_gateway_responses' - desc 'Retrieves API Gateway Responses.' + name "aws_api_gateway_responses" + desc "Retrieves API Gateway Responses." example <<-EXAMPLE describe aws_api_gateway_documentation_part(rest_api_id: 'REST_API_ID') do it { should exist } @@ -12,12 +12,12 @@ class AWSApiGatewayResponses < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:response_types, field: :response_type) - .register_column(:status_codes, field: :status_code) - .register_column(:response_parameters, field: :response_parameters) - .register_column(:response_templates, field: :response_templates) - .register_column(:default_responses, field: :default_response) - .install_filter_methods_on_resource(self, :table) + .register_column(:response_types, field: :response_type) + .register_column(:status_codes, field: :status_code) + .register_column(:response_parameters, field: :response_parameters) + .register_column(:response_templates, field: :response_templates) + .register_column(:default_responses, field: :default_response) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -32,8 +32,8 @@ def fetch_data table.items.map { |table_name| { response_type: table_name.response_type, status_code: table_name.status_code, - response_parameters: table_name.response_parameters['String'], - response_templates: table_name.response_templates['String'], + response_parameters: table_name.response_parameters["String"], + response_templates: table_name.response_templates["String"], default_response: table_name.default_response, } } diff --git a/libraries/aws_api_gateway_restapi.rb b/libraries/aws_api_gateway_restapi.rb index 69866aafd..e81d27db5 100644 --- a/libraries/aws_api_gateway_restapi.rb +++ b/libraries/aws_api_gateway_restapi.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayRestApi < AwsResourceBase - name 'aws_api_gateway_restapi' - desc 'Lists the RestApi resource in the collection.' + name "aws_api_gateway_restapi" + desc "Lists the RestApi resource in the collection." example <<-EXAMPLE describe aws_api_gateway_restapi(rest_api_id: 'REST_API_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_restapis.rb b/libraries/aws_api_gateway_restapis.rb index d1e362f3e..6e54764f4 100644 --- a/libraries/aws_api_gateway_restapis.rb +++ b/libraries/aws_api_gateway_restapis.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayRestApis < AwsResourceBase - name 'aws_api_gateway_restapis' - desc 'Lists the RestApis resources for your collection.' + name "aws_api_gateway_restapis" + desc "Lists the RestApis resources for your collection." example <<-EXAMPLE describe aws_api_gateway_restapis do it { should exist } @@ -12,20 +12,20 @@ class AWSApiGatewayRestApis < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:descriptions, field: :description) - .register_column(:created_dates, field: :created_date) - .register_column(:versions, field: :version) - .register_column(:warnings, field: :warnings) - .register_column(:binary_media_types, field: :binary_media_types) - .register_column(:minimum_compression_sizes, field: :minimum_compression_size) - .register_column(:api_key_sources, field: :api_key_source) - .register_column(:endpoint_configurations, field: :endpoint_configuration) - .register_column(:policies, field: :policy) - .register_column(:tags, field: :tags) - .register_column(:disable_execute_api_endpoints, field: :disable_execute_api_endpoint) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:descriptions, field: :description) + .register_column(:created_dates, field: :created_date) + .register_column(:versions, field: :version) + .register_column(:warnings, field: :warnings) + .register_column(:binary_media_types, field: :binary_media_types) + .register_column(:minimum_compression_sizes, field: :minimum_compression_size) + .register_column(:api_key_sources, field: :api_key_source) + .register_column(:endpoint_configurations, field: :endpoint_configuration) + .register_column(:policies, field: :policy) + .register_column(:tags, field: :tags) + .register_column(:disable_execute_api_endpoints, field: :disable_execute_api_endpoint) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_stage.rb b/libraries/aws_api_gateway_stage.rb index 6b37f5b7e..9161dba1a 100644 --- a/libraries/aws_api_gateway_stage.rb +++ b/libraries/aws_api_gateway_stage.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayStage < AwsResourceBase - name 'aws_api_gateway_stage' - desc 'Gets information about a Stage resource.' + name "aws_api_gateway_stage" + desc "Gets information about a Stage resource." example <<-EXAMPLE describe aws_api_gateway_stage(rest_api_id: 'REST_API_ID', stage_name: 'STAGE_NAME') do it { should exist } diff --git a/libraries/aws_api_gateway_stages.rb b/libraries/aws_api_gateway_stages.rb index 6d589daa6..935fd6bfb 100644 --- a/libraries/aws_api_gateway_stages.rb +++ b/libraries/aws_api_gateway_stages.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayStages < AwsResourceBase - name 'aws_api_gateway_stages' - desc 'Gets information about a Stages collection.' + name "aws_api_gateway_stages" + desc "Gets information about a Stages collection." example <<-EXAMPLE describe aws_api_gateway_stages(rest_api_id: 'REST_API_ID') do it { should exist } @@ -12,11 +12,11 @@ class AWSApiGatewayStages < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:stage_names, field: :stage_name) - .register_column(:deployment_ids, field: :deployment_id) - .register_column(:created_dates, field: :created_date) - .register_column(:descriptions, field: :description) - .install_filter_methods_on_resource(self, :table) + .register_column(:stage_names, field: :stage_name) + .register_column(:deployment_ids, field: :deployment_id) + .register_column(:created_dates, field: :created_date) + .register_column(:descriptions, field: :description) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_api_gateway_usage_plan.rb b/libraries/aws_api_gateway_usage_plan.rb index b3b4f8464..7af92a329 100644 --- a/libraries/aws_api_gateway_usage_plan.rb +++ b/libraries/aws_api_gateway_usage_plan.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayUsagePlan < AwsResourceBase - name 'aws_api_gateway_usage_plan' - desc 'Gets a usage plan of a given plan identifier.' + name "aws_api_gateway_usage_plan" + desc "Gets a usage plan of a given plan identifier." example <<-EXAMPLE describe aws_api_gateway_usage_plan(usage_plan_id: 'USAGE_PLAN_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_usage_plan_key.rb b/libraries/aws_api_gateway_usage_plan_key.rb index a6f165a37..686e2f954 100644 --- a/libraries/aws_api_gateway_usage_plan_key.rb +++ b/libraries/aws_api_gateway_usage_plan_key.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayUsagePlanKey < AwsResourceBase - name 'aws_api_gateway_usage_plan_key' - desc 'Gets a usage plan key of a given key identifier.' + name "aws_api_gateway_usage_plan_key" + desc "Gets a usage plan key of a given key identifier." example <<-EXAMPLE describe aws_api_gateway_usage_plan_key(usage_plan_id: 'USAGE_PLAN_ID', key_id: 'USAGE_PLAN_KEY_ID') do it { should exist } @@ -27,7 +27,7 @@ def initialize(opts = {}) end def resource_id - "#{@res? @usage_plan_key_id: @display_name}_#{@res? @usage_plan_key_name: ''}" + "#{@res? @usage_plan_key_id: @display_name}_#{@res? @usage_plan_key_name: ""}" end def exists? diff --git a/libraries/aws_api_gateway_usage_plan_keys.rb b/libraries/aws_api_gateway_usage_plan_keys.rb index 75cf9380c..6a6c3992f 100644 --- a/libraries/aws_api_gateway_usage_plan_keys.rb +++ b/libraries/aws_api_gateway_usage_plan_keys.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayUsagePlanKeys < AwsCollectionResourceBase - name 'aws_api_gateway_usage_plan_keys' - desc 'Gets all the usage plan keys representing the API keys added to a specified usage plan.' + name "aws_api_gateway_usage_plan_keys" + desc "Gets all the usage plan keys representing the API keys added to a specified usage plan." example <<-EXAMPLE describe aws_api_gateway_usage_plan_keys(usage_plan_id: 'USAGE_PLAN_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_usage_plans.rb b/libraries/aws_api_gateway_usage_plans.rb index 843864d6f..58320903e 100644 --- a/libraries/aws_api_gateway_usage_plans.rb +++ b/libraries/aws_api_gateway_usage_plans.rb @@ -1,7 +1,7 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayUsagePlans < AwsCollectionResourceBase - name 'aws_api_gateway_usage_plans' + name "aws_api_gateway_usage_plans" desc "Gets all the usage plans of the caller's account." example <<-EXAMPLE describe aws_api_gateway_usage_plans do diff --git a/libraries/aws_api_gateway_v2_api.rb b/libraries/aws_api_gateway_v2_api.rb index 1f3149078..76bf28887 100644 --- a/libraries/aws_api_gateway_v2_api.rb +++ b/libraries/aws_api_gateway_v2_api.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2Api < AwsResourceBase - name 'aws_api_gateway_v2_api' - desc 'Gets information about the current ApiKey resource.' + name "aws_api_gateway_v2_api" + desc "Gets information about the current ApiKey resource." example <<-EXAMPLE describe aws_api_gateway_v2_api(api_id: 'REST_API_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_api_mapping.rb b/libraries/aws_api_gateway_v2_api_mapping.rb index 40ae79415..a63d7db7d 100644 --- a/libraries/aws_api_gateway_v2_api_mapping.rb +++ b/libraries/aws_api_gateway_v2_api_mapping.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2ApiMapping < AwsResourceBase - name 'aws_api_gateway_v2_api_mapping' - desc 'Gets an API mapping.' + name "aws_api_gateway_v2_api_mapping" + desc "Gets an API mapping." example <<-EXAMPLE describe aws_api_gateway_v2_api_mapping(api_mapping_id: 'API_MAPPING_ID', domain_name: 'DOMAIN_NAME') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_api_mappings.rb b/libraries/aws_api_gateway_v2_api_mappings.rb index 899cef267..b357ba793 100644 --- a/libraries/aws_api_gateway_v2_api_mappings.rb +++ b/libraries/aws_api_gateway_v2_api_mappings.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2ApiMappings < AwsCollectionResourceBase - name 'aws_api_gateway_v2_api_mappings' - desc 'Gets API mappings.' + name "aws_api_gateway_v2_api_mappings" + desc "Gets API mappings." example <<-EXAMPLE describe aws_api_gateway_v2_api_mappings(domain_name: 'DOMAIN_NAME') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_apis.rb b/libraries/aws_api_gateway_v2_apis.rb index 8e07965ad..966b7741a 100644 --- a/libraries/aws_api_gateway_v2_apis.rb +++ b/libraries/aws_api_gateway_v2_apis.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2Apis < AwsCollectionResourceBase - name 'aws_api_gateway_v2_apis' - desc 'Gets information about the current ApiKeys resource.' + name "aws_api_gateway_v2_apis" + desc "Gets information about the current ApiKeys resource." example <<-EXAMPLE describe aws_api_gateway_v2_apis do it { should exist } diff --git a/libraries/aws_api_gateway_v2_authorizer.rb b/libraries/aws_api_gateway_v2_authorizer.rb index 7730efbb7..53e492d4d 100644 --- a/libraries/aws_api_gateway_v2_authorizer.rb +++ b/libraries/aws_api_gateway_v2_authorizer.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2Authorizer < AwsResourceBase - name 'aws_api_gateway_v2_authorizer' - desc 'Gets an Authorizer.' + name "aws_api_gateway_v2_authorizer" + desc "Gets an Authorizer." example <<-EXAMPLE describe aws_api_gateway_v2_authorizer(api_id: 'API_ID', authorizer_id: 'AUTHORIZER_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_authorizers.rb b/libraries/aws_api_gateway_v2_authorizers.rb index f8dea5636..fe4330755 100644 --- a/libraries/aws_api_gateway_v2_authorizers.rb +++ b/libraries/aws_api_gateway_v2_authorizers.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2Authorizers < AwsCollectionResourceBase - name 'aws_api_gateway_v2_authorizers' - desc 'Gets the Authorizers for an API.' + name "aws_api_gateway_v2_authorizers" + desc "Gets the Authorizers for an API." example <<-EXAMPLE describe aws_api_gateway_v2_authorizers(api_id: 'APP_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_deployment.rb b/libraries/aws_api_gateway_v2_deployment.rb index d3fc6bc27..9b1efc852 100644 --- a/libraries/aws_api_gateway_v2_deployment.rb +++ b/libraries/aws_api_gateway_v2_deployment.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2Deployment < AwsResourceBase - name 'aws_api_gateway_v2_deployment' - desc 'Gets a Deployment.' + name "aws_api_gateway_v2_deployment" + desc "Gets a Deployment." example <<-EXAMPLE describe aws_api_gateway_v2_deployment(api_id: 'APP_ID', deployment_id: 'DEPLOYMENT_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_deployments.rb b/libraries/aws_api_gateway_v2_deployments.rb index e54d310b3..47b013a24 100644 --- a/libraries/aws_api_gateway_v2_deployments.rb +++ b/libraries/aws_api_gateway_v2_deployments.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2Deployments < AwsCollectionResourceBase - name 'aws_api_gateway_v2_deployments' - desc 'Gets the Deployments for an API.' + name "aws_api_gateway_v2_deployments" + desc "Gets the Deployments for an API." example <<-EXAMPLE describe aws_api_gateway_v2_deployments(api_id: 'APP_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_domain_name.rb b/libraries/aws_api_gateway_v2_domain_name.rb index 5e4a65e0b..b7213b803 100644 --- a/libraries/aws_api_gateway_v2_domain_name.rb +++ b/libraries/aws_api_gateway_v2_domain_name.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2DomainName < AwsResourceBase - name 'aws_api_gateway_v2_domain_name' - desc 'Gets a domain name.' + name "aws_api_gateway_v2_domain_name" + desc "Gets a domain name." example <<-EXAMPLE describe aws_api_gateway_v2_domain_name(domain_name: 'DOMAIN_NAME') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_domain_names.rb b/libraries/aws_api_gateway_v2_domain_names.rb index 3953ec1a1..0b144ff8d 100644 --- a/libraries/aws_api_gateway_v2_domain_names.rb +++ b/libraries/aws_api_gateway_v2_domain_names.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2DomainNames < AwsCollectionResourceBase - name 'aws_api_gateway_v2_domain_names' - desc 'Gets the domain names for an AWS account.' + name "aws_api_gateway_v2_domain_names" + desc "Gets the domain names for an AWS account." example <<-EXAMPLE describe aws_api_gateway_v2_domain_names do it { should exist } diff --git a/libraries/aws_api_gateway_v2_integration.rb b/libraries/aws_api_gateway_v2_integration.rb index 96b03bafb..faa2d4fad 100644 --- a/libraries/aws_api_gateway_v2_integration.rb +++ b/libraries/aws_api_gateway_v2_integration.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2Integration < AwsResourceBase - name 'aws_api_gateway_v2_integration' - desc 'Gets an Integration.' + name "aws_api_gateway_v2_integration" + desc "Gets an Integration." example <<-EXAMPLE describe aws_api_gateway_v2_integration(api_id: 'APP_ID', integration_id: 'INTEGRATION_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_integration_response.rb b/libraries/aws_api_gateway_v2_integration_response.rb index ef189c69c..238530817 100644 --- a/libraries/aws_api_gateway_v2_integration_response.rb +++ b/libraries/aws_api_gateway_v2_integration_response.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2IntegrationResponse < AwsResourceBase - name 'aws_api_gateway_v2_integration_response' - desc 'Gets an IntegrationResponse for an Integration.' + name "aws_api_gateway_v2_integration_response" + desc "Gets an IntegrationResponse for an Integration." example <<-EXAMPLE describe aws_api_gateway_v2_integration_response(api_id: 'APP_ID', integration_id: 'INTEGRATION_ID', integration_response_id: 'INTEGRATION_RESPONSE_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_integration_responses.rb b/libraries/aws_api_gateway_v2_integration_responses.rb index 59e85c9fe..a40c8b1ff 100644 --- a/libraries/aws_api_gateway_v2_integration_responses.rb +++ b/libraries/aws_api_gateway_v2_integration_responses.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2IntegrationResponses < AwsCollectionResourceBase - name 'aws_api_gateway_v2_integration_responses' - desc 'Gets the IntegrationResponses for an Integration.' + name "aws_api_gateway_v2_integration_responses" + desc "Gets the IntegrationResponses for an Integration." example <<-EXAMPLE describe aws_api_gateway_v2_integration_responses(api_id: 'APP_ID', integration_id: 'INTEGRATION_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_integrations.rb b/libraries/aws_api_gateway_v2_integrations.rb index c1ea46010..7e41262a1 100644 --- a/libraries/aws_api_gateway_v2_integrations.rb +++ b/libraries/aws_api_gateway_v2_integrations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2Integrations < AwsCollectionResourceBase - name 'aws_api_gateway_v2_integrations' - desc 'Gets the Integrations for an API.' + name "aws_api_gateway_v2_integrations" + desc "Gets the Integrations for an API." example <<-EXAMPLE describe aws_api_gateway_v2_integrations(api_id: 'APP_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_model.rb b/libraries/aws_api_gateway_v2_model.rb index b6a9bd3c0..079009288 100644 --- a/libraries/aws_api_gateway_v2_model.rb +++ b/libraries/aws_api_gateway_v2_model.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2Model < AwsResourceBase - name 'aws_api_gateway_v2_model' - desc 'Gets a Model.' + name "aws_api_gateway_v2_model" + desc "Gets a Model." example <<-EXAMPLE describe aws_api_gateway_v2_model(api_id: 'APP_ID', model_id: 'MODEL_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_models.rb b/libraries/aws_api_gateway_v2_models.rb index 980964961..b74775ced 100644 --- a/libraries/aws_api_gateway_v2_models.rb +++ b/libraries/aws_api_gateway_v2_models.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2Models < AwsCollectionResourceBase - name 'aws_api_gateway_v2_models' - desc 'Gets the Models for an API.' + name "aws_api_gateway_v2_models" + desc "Gets the Models for an API." example <<-EXAMPLE describe aws_api_gateway_v2_models(api_id: 'APP_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_route.rb b/libraries/aws_api_gateway_v2_route.rb index 6432b02d9..3e1028c47 100644 --- a/libraries/aws_api_gateway_v2_route.rb +++ b/libraries/aws_api_gateway_v2_route.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2Route < AwsResourceBase - name 'aws_api_gateway_v2_route' - desc 'Gets a Route.' + name "aws_api_gateway_v2_route" + desc "Gets a Route." example <<-EXAMPLE describe aws_api_gateway_v2_route(api_id: 'APP_ID', route_id: 'ROUTE_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_v2_routes.rb b/libraries/aws_api_gateway_v2_routes.rb index d55296fca..6dd37b937 100644 --- a/libraries/aws_api_gateway_v2_routes.rb +++ b/libraries/aws_api_gateway_v2_routes.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsApiGatewayV2Routes < AwsCollectionResourceBase - name 'aws_api_gateway_v2_routes' - desc 'Gets the Routes for an API.' + name "aws_api_gateway_v2_routes" + desc "Gets the Routes for an API." example <<-EXAMPLE describe aws_api_gateway_v2_routes(api_id: 'APP_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_vpc_link.rb b/libraries/aws_api_gateway_vpc_link.rb index e3d820973..2389280a2 100644 --- a/libraries/aws_api_gateway_vpc_link.rb +++ b/libraries/aws_api_gateway_vpc_link.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayVPCLink < AwsResourceBase - name 'aws_api_gateway_vpc_link' - desc 'Gets a specified VPC link under the callers account in a region.' + name "aws_api_gateway_vpc_link" + desc "Gets a specified VPC link under the callers account in a region." example <<-EXAMPLE describe aws_api_gateway_vpc_link(vpc_link_id: 'VPC_LINK_ID') do it { should exist } diff --git a/libraries/aws_api_gateway_vpc_links.rb b/libraries/aws_api_gateway_vpc_links.rb index 783582514..e374f9858 100644 --- a/libraries/aws_api_gateway_vpc_links.rb +++ b/libraries/aws_api_gateway_vpc_links.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayVPCLinks < AwsCollectionResourceBase - name 'aws_api_gateway_vpc_links' - desc 'Gets the VpcLinks collection under the callers account in a selected region.' + name "aws_api_gateway_vpc_links" + desc "Gets the VpcLinks collection under the callers account in a selected region." example <<-EXAMPLE describe aws_api_gateway_vpc_links do it { should exist } diff --git a/libraries/aws_apigateway_account.rb b/libraries/aws_apigateway_account.rb index 50e2058a1..a55aeaa0f 100644 --- a/libraries/aws_apigateway_account.rb +++ b/libraries/aws_apigateway_account.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayAccount < AwsResourceBase - name 'aws_apigateway_account' - desc 'Gets information about the current Account resource.' + name "aws_apigateway_account" + desc "Gets information about the current Account resource." example <<-EXAMPLE describe aws_apigateway_account do it { should exist } @@ -20,7 +20,7 @@ def initialize(opts = {}) end def resource_id - @res? @res[:cloudwatch_role_arn] : '' + @res? @res[:cloudwatch_role_arn] : "" end def exists? diff --git a/libraries/aws_apigateway_api_key.rb b/libraries/aws_apigateway_api_key.rb index 96e96d378..017b771d2 100644 --- a/libraries/aws_apigateway_api_key.rb +++ b/libraries/aws_apigateway_api_key.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayAPIKey < AwsResourceBase - name 'aws_apigateway_api_key' - desc 'Gets information about the current ApiKey resource.' + name "aws_apigateway_api_key" + desc "Gets information about the current ApiKey resource." example <<-EXAMPLE describe aws_apigateway_api_key(api_key: 'API_ID') do it { should exist } diff --git a/libraries/aws_apigateway_api_keys.rb b/libraries/aws_apigateway_api_keys.rb index 40cbebcdf..5816c8cdc 100644 --- a/libraries/aws_apigateway_api_keys.rb +++ b/libraries/aws_apigateway_api_keys.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayAPIKeys < AwsResourceBase - name 'aws_apigateway_api_keys' - desc 'Gets information about the current ApiKeys resource.' + name "aws_apigateway_api_keys" + desc "Gets information about the current ApiKeys resource." example <<-EXAMPLE describe aws_apigateway_api_keys do it { should exist } @@ -12,17 +12,17 @@ class AWSApiGatewayAPIKeys < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:values, field: :value) - .register_column(:names, field: :name) - .register_column(:customer_ids, field: :customer_id) - .register_column(:descriptions, field: :description) - .register_column(:enabled, field: :enabled) - .register_column(:created_dates, field: :created_date) - .register_column(:last_updated_dates, field: :last_updated_date) - .register_column(:stage_keys, field: :stage_keys) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:values, field: :value) + .register_column(:names, field: :name) + .register_column(:customer_ids, field: :customer_id) + .register_column(:descriptions, field: :description) + .register_column(:enabled, field: :enabled) + .register_column(:created_dates, field: :created_date) + .register_column(:last_updated_dates, field: :last_updated_date) + .register_column(:stage_keys, field: :stage_keys) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_apigateway_authorizer.rb b/libraries/aws_apigateway_authorizer.rb index 05b6a16a8..39f3f3466 100644 --- a/libraries/aws_apigateway_authorizer.rb +++ b/libraries/aws_apigateway_authorizer.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayAuthorizer < AwsResourceBase - name 'aws_apigateway_authorizer' - desc 'Describe an existing Authorizer resource.' + name "aws_apigateway_authorizer" + desc "Describe an existing Authorizer resource." example <<-EXAMPLE describe aws_apigateway_authorizer(rest_api_id: 'REST_API_ID', authorizer_id: 'AUTHORIZER_ID') do it { should exist } diff --git a/libraries/aws_apigateway_authorizers.rb b/libraries/aws_apigateway_authorizers.rb index f5995ae1f..e7154002c 100644 --- a/libraries/aws_apigateway_authorizers.rb +++ b/libraries/aws_apigateway_authorizers.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayAuthorizers < AwsResourceBase - name 'aws_apigateway_authorizers' - desc 'Describes the list of Authorizers resource.' + name "aws_apigateway_authorizers" + desc "Describes the list of Authorizers resource." example <<-EXAMPLE describe aws_apigateway_authorizers(rest_api_id: 'REST_API_ID') do it { should exist } @@ -12,17 +12,17 @@ class AWSApiGatewayAuthorizers < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:types, field: :type) - .register_column(:provider_arns, field: :provider_arns) - .register_column(:auth_types, field: :auth_type) - .register_column(:authorizer_uris, field: :authorizer_uri) - .register_column(:authorizer_credentials, field: :authorizer_credentials) - .register_column(:identity_sources, field: :identity_source) - .register_column(:identity_validation_expressions, field: :identity_validation_expression) - .register_column(:authorizer_result_ttl_in_seconds, field: :authorizer_result_ttl_in_seconds) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:types, field: :type) + .register_column(:provider_arns, field: :provider_arns) + .register_column(:auth_types, field: :auth_type) + .register_column(:authorizer_uris, field: :authorizer_uri) + .register_column(:authorizer_credentials, field: :authorizer_credentials) + .register_column(:identity_sources, field: :identity_source) + .register_column(:identity_validation_expressions, field: :identity_validation_expression) + .register_column(:authorizer_result_ttl_in_seconds, field: :authorizer_result_ttl_in_seconds) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_apigateway_base_path_mapping.rb b/libraries/aws_apigateway_base_path_mapping.rb index dab3554d4..e1fb57f81 100644 --- a/libraries/aws_apigateway_base_path_mapping.rb +++ b/libraries/aws_apigateway_base_path_mapping.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayBasePathMapping < AwsResourceBase - name 'aws_apigateway_base_path_mapping' - desc 'Describe a BasePathMapping resource.' + name "aws_apigateway_base_path_mapping" + desc "Describe a BasePathMapping resource." example <<-EXAMPLE describe aws_apigateway_base_path_mapping(domain_name: 'DOMAIN_NAME', base_path: 'BASE_PATH') do it { should exist } diff --git a/libraries/aws_apigateway_base_path_mappings.rb b/libraries/aws_apigateway_base_path_mappings.rb index d5f6354e7..ab17b3c1b 100644 --- a/libraries/aws_apigateway_base_path_mappings.rb +++ b/libraries/aws_apigateway_base_path_mappings.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayBasePathMappings < AwsResourceBase - name 'aws_apigateway_base_path_mappings' - desc 'Represents a collection of BasePathMapping resources.' + name "aws_apigateway_base_path_mappings" + desc "Represents a collection of BasePathMapping resources." example <<-EXAMPLE describe aws_apigateway_base_path_mappings(domain_name: 'DOMAIN_NAME') do it { should exist } @@ -12,10 +12,10 @@ class AWSApiGatewayBasePathMappings < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:base_paths, field: :base_path) - .register_column(:rest_api_ids, field: :rest_api_id) - .register_column(:stages, field: :stage) - .install_filter_methods_on_resource(self, :table) + .register_column(:base_paths, field: :base_path) + .register_column(:rest_api_ids, field: :rest_api_id) + .register_column(:stages, field: :stage) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_apigateway_client_certificate.rb b/libraries/aws_apigateway_client_certificate.rb index 825dac38a..03779dc16 100644 --- a/libraries/aws_apigateway_client_certificate.rb +++ b/libraries/aws_apigateway_client_certificate.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayClientCertificate < AwsResourceBase - name 'aws_apigateway_client_certificate' - desc 'Gets information about the current ClientCertificate resource.' + name "aws_apigateway_client_certificate" + desc "Gets information about the current ClientCertificate resource." example <<-EXAMPLE describe aws_apigateway_client_certificate(client_certificate_id: 'CLIENT_CERTIFICATE_ID') do it { should exist } diff --git a/libraries/aws_apigateway_client_certificates.rb b/libraries/aws_apigateway_client_certificates.rb index 218c5a127..e588190b4 100644 --- a/libraries/aws_apigateway_client_certificates.rb +++ b/libraries/aws_apigateway_client_certificates.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApiGatewayClientCertificates < AwsResourceBase - name 'aws_apigateway_client_certificates' - desc 'Gets a collection of Client Certificate resources.' + name "aws_apigateway_client_certificates" + desc "Gets a collection of Client Certificate resources." example <<-EXAMPLE describe aws_apigateway_client_certificates do it { should exist } @@ -12,13 +12,13 @@ class AWSApiGatewayClientCertificates < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:client_certificate_ids, field: :client_certificate_id) - .register_column(:descriptions, field: :description) - .register_column(:pem_encoded_certificates, field: :pem_encoded_certificate) - .register_column(:created_dates, field: :created_date) - .register_column(:expiration_dates, field: :expiration_date) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:client_certificate_ids, field: :client_certificate_id) + .register_column(:descriptions, field: :description) + .register_column(:pem_encoded_certificates, field: :pem_encoded_certificate) + .register_column(:created_dates, field: :created_date) + .register_column(:expiration_dates, field: :expiration_date) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_application_autoscaling_scalable_target.rb b/libraries/aws_application_autoscaling_scalable_target.rb index 8db662cf6..459d612e9 100644 --- a/libraries/aws_application_autoscaling_scalable_target.rb +++ b/libraries/aws_application_autoscaling_scalable_target.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApplicationAutoScalingScalableTarget < AwsResourceBase - name 'aws_application_autoscaling_scalable_target' - desc 'Gets information about the scalable targets in the specified namespace.' + name "aws_application_autoscaling_scalable_target" + desc "Gets information about the scalable targets in the specified namespace." example <<-EXAMPLE describe aws_application_autoscaling_scalable_target(service_namespace: 'ec2') do it { should exist } @@ -28,7 +28,7 @@ def service_namespace end def resource_id - @scalable_targets? @scalable_targets[:resource_id]: '' + @scalable_targets? @scalable_targets[:resource_id]: "" end def exists? diff --git a/libraries/aws_application_autoscaling_scalable_targets.rb b/libraries/aws_application_autoscaling_scalable_targets.rb index 394016f9f..21df3fd57 100644 --- a/libraries/aws_application_autoscaling_scalable_targets.rb +++ b/libraries/aws_application_autoscaling_scalable_targets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApplicationAutoScalingScalableTargets < AwsResourceBase - name 'aws_application_autoscaling_scalable_targets' - desc 'Gets information about the scalable targets in the specified namespace.' + name "aws_application_autoscaling_scalable_targets" + desc "Gets information about the scalable targets in the specified namespace." example <<-EXAMPLE describe aws_application_autoscaling_scalable_targets(service_namespace: 'ec2') do it { should exist } @@ -12,15 +12,15 @@ class AWSApplicationAutoScalingScalableTargets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:service_namespaces, field: :service_namespace) - .register_column(:resource_ids, field: :resource_id) - .register_column(:scalable_dimensions, field: :scalable_dimension) - .register_column(:min_capacities, field: :min_capacity) - .register_column(:max_capacities, field: :max_capacity) - .register_column(:role_arns, field: :role_arn) - .register_column(:creation_times, field: :creation_time) - .register_column(:suspended_states, field: :suspended_state) - .install_filter_methods_on_resource(self, :table) + .register_column(:service_namespaces, field: :service_namespace) + .register_column(:resource_ids, field: :resource_id) + .register_column(:scalable_dimensions, field: :scalable_dimension) + .register_column(:min_capacities, field: :min_capacity) + .register_column(:max_capacities, field: :max_capacity) + .register_column(:role_arns, field: :role_arn) + .register_column(:creation_times, field: :creation_time) + .register_column(:suspended_states, field: :suspended_state) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_application_autoscaling_scaling_policies.rb b/libraries/aws_application_autoscaling_scaling_policies.rb index f0aaf39e0..40c00f94e 100644 --- a/libraries/aws_application_autoscaling_scaling_policies.rb +++ b/libraries/aws_application_autoscaling_scaling_policies.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApplicationAutoScalingScalingPolicies < AwsResourceBase - name 'aws_application_autoscaling_scaling_policies' - desc 'Describes the Application AutoScaling scaling policies for the specified service namespace.' + name "aws_application_autoscaling_scaling_policies" + desc "Describes the Application AutoScaling scaling policies for the specified service namespace." example <<-EXAMPLE describe aws_application_autoscaling_scaling_policies(service_namespace: 'ec2') do it { should exist } @@ -12,17 +12,17 @@ class AWSApplicationAutoScalingScalingPolicies < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:policy_arns, field: :policy_arn) - .register_column(:policy_names, field: :policy_name) - .register_column(:service_namespaces, field: :service_namespace) - .register_column(:resource_ids, field: :resource_id) - .register_column(:scalable_dimensions, field: :scalable_dimension) - .register_column(:policy_types, field: :policy_type) - .register_column(:step_scaling_policy_configurations, field: :step_scaling_policy_configuration) - .register_column(:target_tracking_scaling_policy_configurations, field: :target_tracking_scaling_policy_configuration) - .register_column(:alarms, field: :alarms) - .register_column(:creation_times, field: :creation_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:policy_arns, field: :policy_arn) + .register_column(:policy_names, field: :policy_name) + .register_column(:service_namespaces, field: :service_namespace) + .register_column(:resource_ids, field: :resource_id) + .register_column(:scalable_dimensions, field: :scalable_dimension) + .register_column(:policy_types, field: :policy_type) + .register_column(:step_scaling_policy_configurations, field: :step_scaling_policy_configuration) + .register_column(:target_tracking_scaling_policy_configurations, field: :target_tracking_scaling_policy_configuration) + .register_column(:alarms, field: :alarms) + .register_column(:creation_times, field: :creation_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_application_autoscaling_scaling_policy.rb b/libraries/aws_application_autoscaling_scaling_policy.rb index 294f5f178..ed7fcd245 100644 --- a/libraries/aws_application_autoscaling_scaling_policy.rb +++ b/libraries/aws_application_autoscaling_scaling_policy.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSApplicationAutoScalingScalingPolicy < AwsResourceBase - name 'aws_application_autoscaling_scaling_policy' - desc 'Describes the Application AutoScaling scaling policies for the specified service namespace.' + name "aws_application_autoscaling_scaling_policy" + desc "Describes the Application AutoScaling scaling policies for the specified service namespace." example <<-EXAMPLE describe aws_application_autoscaling_scaling_policy(service_namespace: 'ec2') do it { should exist } @@ -29,7 +29,7 @@ def service_namespace end def resource_id - @scaling_policies ? @scaling_policies[:resource_id]: '' + @scaling_policies ? @scaling_policies[:resource_id]: "" end def exists? diff --git a/libraries/aws_athena_work_group.rb b/libraries/aws_athena_work_group.rb index 5f5255b87..9b9bb5b50 100644 --- a/libraries/aws_athena_work_group.rb +++ b/libraries/aws_athena_work_group.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSAthenaWorkGroup < AwsResourceBase - name 'aws_athena_work_group' - desc 'Returns information about the workgroup with the specified name.' + name "aws_athena_work_group" + desc "Returns information about the workgroup with the specified name." example <<-EXAMPLE describe aws_athena_work_group(work_group: 'ATHENA_WORK_GROUP') do it { should exist } diff --git a/libraries/aws_athena_work_groups.rb b/libraries/aws_athena_work_groups.rb index 915433d8e..ea2bdb479 100644 --- a/libraries/aws_athena_work_groups.rb +++ b/libraries/aws_athena_work_groups.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSAthenaWorkGroups < AwsResourceBase - name 'aws_athena_work_groups' - desc 'Lists available workgroups for the account.' + name "aws_athena_work_groups" + desc "Lists available workgroups for the account." example <<-EXAMPLE describe aws_athena_work_groups do it { should exist } @@ -12,11 +12,11 @@ class AWSAthenaWorkGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:states, field: :state) - .register_column(:descriptions, field: :description) - .register_column(:creation_times, field: :creation_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:states, field: :state) + .register_column(:descriptions, field: :description) + .register_column(:creation_times, field: :creation_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_auto_scaling_group.rb b/libraries/aws_auto_scaling_group.rb index 2642d585a..d81b187c2 100644 --- a/libraries/aws_auto_scaling_group.rb +++ b/libraries/aws_auto_scaling_group.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsAutoScalingGroup < AwsResourceBase - name 'aws_auto_scaling_group' - desc 'Verifies settings for an AWS Auto Scaling Group.' + name "aws_auto_scaling_group" + desc "Verifies settings for an AWS Auto Scaling Group." example <<-EXAMPLE describe aws_auto_scaling_group('AUTO_SCALING_GROUP_NAME') do it { should exist } @@ -25,7 +25,7 @@ def initialize(opts = {}) @min_size = auto_scaling_group[:min_size].to_i @max_size = auto_scaling_group[:max_size].to_i @desired_capacity = auto_scaling_group[:desired_capacity].to_i - @vpc_zone_identifier = auto_scaling_group[:vpc_zone_identifier].split(',') + @vpc_zone_identifier = auto_scaling_group[:vpc_zone_identifier].split(",") @launch_configuration_name = auto_scaling_group[:launch_configuration_name] @health_check_type = auto_scaling_group[:health_check_type] @tags = [] diff --git a/libraries/aws_auto_scaling_groups.rb b/libraries/aws_auto_scaling_groups.rb index 5d44c923f..5f03f3bac 100644 --- a/libraries/aws_auto_scaling_groups.rb +++ b/libraries/aws_auto_scaling_groups.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsAutoScalingGroups < AwsResourceBase - name 'aws_auto_scaling_groups' - desc 'Verifies settings for a collection AWS Auto Scaling Groups.' + name "aws_auto_scaling_groups" + desc "Verifies settings for a collection AWS Auto Scaling Groups." example <<-EXAMPLE describe aws_auto_scaling_groups do it { should exist } @@ -12,15 +12,15 @@ class AwsAutoScalingGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:min_sizes, field: :min_size) - .register_column(:max_sizes, field: :max_size) - .register_column(:desired_capacities, field: :desired_capacity) - .register_column(:vpc_zone_identifiers, field: :vpc_zone_identifier) - .register_column(:launch_configuration_names, field: :launch_configuration_name) - .register_column(:health_check_types, field: :health_check_type) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:min_sizes, field: :min_size) + .register_column(:max_sizes, field: :max_size) + .register_column(:desired_capacities, field: :desired_capacity) + .register_column(:vpc_zone_identifiers, field: :vpc_zone_identifier) + .register_column(:launch_configuration_names, field: :launch_configuration_name) + .register_column(:health_check_types, field: :health_check_type) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -38,7 +38,7 @@ def fetch_data min_size: group[:min_size].to_i, max_size: group[:max_size].to_i, desired_capacity: group[:desired_capacity].to_i, - vpc_zone_identifier: group[:vpc_zone_identifier].split(','), + vpc_zone_identifier: group[:vpc_zone_identifier].split(","), launch_configuration_name: group[:launch_configuration_name], health_check_type: group[:health_check_type], tags: group[:tags].map { |tag| diff --git a/libraries/aws_autoscaling_scaling_policies.rb b/libraries/aws_autoscaling_scaling_policies.rb index edefd456a..1f12267d1 100644 --- a/libraries/aws_autoscaling_scaling_policies.rb +++ b/libraries/aws_autoscaling_scaling_policies.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSAutoScalingScalingPolicies < AwsResourceBase - name 'aws_autoscaling_scaling_policies' - desc 'Describes the policies for the specified Auto Scaling group.' + name "aws_autoscaling_scaling_policies" + desc "Describes the policies for the specified Auto Scaling group." example <<-EXAMPLE describe aws_autoscaling_scaling_policies do it { should exist } @@ -12,20 +12,20 @@ class AWSAutoScalingScalingPolicies < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:auto_scaling_group_names, field: :auto_scaling_group_name) - .register_column(:policy_names, field: :policy_name) - .register_column(:policy_arns, field: :policy_arn) - .register_column(:policy_types, field: :policy_type) - .register_column(:adjustment_types, field: :adjustment_type) - .register_column(:min_adjustment_steps, field: :min_adjustment_step) - .register_column(:min_adjustment_magnitudes, field: :min_adjustment_magnitude) - .register_column(:scaling_adjustments, field: :scaling_adjustment) - .register_column(:cooldowns, field: :cooldown) - .register_column(:step_adjustments, field: :step_adjustments) - .register_column(:metric_aggregation_types, field: :metric_aggregation_type) - .register_column(:estimated_instance_warmups, field: :estimated_instance_warmup) - .register_column(:target_tracking_configurations, field: :target_tracking_configuration) - .install_filter_methods_on_resource(self, :table) + .register_column(:auto_scaling_group_names, field: :auto_scaling_group_name) + .register_column(:policy_names, field: :policy_name) + .register_column(:policy_arns, field: :policy_arn) + .register_column(:policy_types, field: :policy_type) + .register_column(:adjustment_types, field: :adjustment_type) + .register_column(:min_adjustment_steps, field: :min_adjustment_step) + .register_column(:min_adjustment_magnitudes, field: :min_adjustment_magnitude) + .register_column(:scaling_adjustments, field: :scaling_adjustment) + .register_column(:cooldowns, field: :cooldown) + .register_column(:step_adjustments, field: :step_adjustments) + .register_column(:metric_aggregation_types, field: :metric_aggregation_type) + .register_column(:estimated_instance_warmups, field: :estimated_instance_warmup) + .register_column(:target_tracking_configurations, field: :target_tracking_configuration) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_autoscaling_scaling_policy.rb b/libraries/aws_autoscaling_scaling_policy.rb index df22febe8..02f8cd3f3 100644 --- a/libraries/aws_autoscaling_scaling_policy.rb +++ b/libraries/aws_autoscaling_scaling_policy.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSAutoScalingScalingPolicy < AwsResourceBase - name 'aws_autoscaling_scaling_policy' - desc 'Describes the policies for the specified Auto Scaling group.' + name "aws_autoscaling_scaling_policy" + desc "Describes the policies for the specified Auto Scaling group." example <<-EXAMPLE describe aws_autoscaling_scaling_policy(auto_scaling_group_name: 'AUTO_SCALING_GROUP_NAME') do it { should exist } diff --git a/libraries/aws_backend.rb b/libraries/aws_backend.rb index 6378012e2..e71378126 100644 --- a/libraries/aws_backend.rb +++ b/libraries/aws_backend.rb @@ -1,67 +1,67 @@ -require 'active_support' -require 'active_support/core_ext/string' - -require 'aws-sdk-autoscaling' -require 'aws-sdk-batch' -require 'aws-sdk-cloudformation' -require 'aws-sdk-cloudfront' -require 'aws-sdk-cloudtrail' -require 'aws-sdk-cloudwatch' -require 'aws-sdk-cloudwatchlogs' -require 'aws-sdk-configservice' -require 'aws-sdk-core' -require 'aws-sdk-dynamodb' -require 'aws-sdk-ec2' -require 'aws-sdk-ecr' -require 'aws-sdk-ecrpublic' -require 'aws-sdk-ecs' -require 'aws-sdk-eks' -require 'aws-sdk-elasticache' -require 'aws-sdk-elasticloadbalancing' -require 'aws-sdk-elasticloadbalancingv2' -require 'aws-sdk-guardduty' -require 'aws-sdk-iam' -require 'aws-sdk-kms' -require 'aws-sdk-lambda' -require 'aws-sdk-organizations' -require 'aws-sdk-rds' -require 'aws-sdk-route53' -require 'aws-sdk-s3' -require 'aws-sdk-shield' -require 'aws-sdk-sns' -require 'aws-sdk-sqs' -require 'aws-sdk-efs' -require 'aws-sdk-ssm' -require 'rspec/expectations' -require 'aws-sdk-transfer' -require 'aws-sdk-elasticsearchservice' -require 'aws-sdk-cognitoidentity' -require 'aws-sdk-redshift' -require 'aws-sdk-athena' -require 'aws-sdk-applicationautoscaling' -require 'aws-sdk-cognitoidentityprovider' -require 'aws-sdk-apigateway' -require 'aws-sdk-databasemigrationservice' -require 'aws-sdk-route53resolver' -require 'aws-sdk-servicecatalog' -require 'aws-sdk-glue' -require 'aws-sdk-eventbridge' -require 'aws-sdk-states' -require 'aws-sdk-ram' -require 'aws-sdk-secretsmanager' -require 'aws-sdk-networkfirewall' -require 'aws-sdk-mq' -require 'aws-sdk-networkmanager' -require 'aws-sdk-signer' -require 'aws-sdk-amplify' -require 'aws-sdk-simpledb' -require 'aws-sdk-emr' -require 'aws-sdk-securityhub' -require 'aws-sdk-ses' -require 'aws-sdk-waf' -require 'aws-sdk-synthetics' -require 'aws-sdk-apigatewayv2' -require 'aws-sdk-account' +require "active_support" +require "active_support/core_ext/string" + +require "aws-sdk-autoscaling" +require "aws-sdk-batch" +require "aws-sdk-cloudformation" +require "aws-sdk-cloudfront" +require "aws-sdk-cloudtrail" +require "aws-sdk-cloudwatch" +require "aws-sdk-cloudwatchlogs" +require "aws-sdk-configservice" +require "aws-sdk-core" +require "aws-sdk-dynamodb" +require "aws-sdk-ec2" +require "aws-sdk-ecr" +require "aws-sdk-ecrpublic" +require "aws-sdk-ecs" +require "aws-sdk-eks" +require "aws-sdk-elasticache" +require "aws-sdk-elasticloadbalancing" +require "aws-sdk-elasticloadbalancingv2" +require "aws-sdk-guardduty" +require "aws-sdk-iam" +require "aws-sdk-kms" +require "aws-sdk-lambda" +require "aws-sdk-organizations" +require "aws-sdk-rds" +require "aws-sdk-route53" +require "aws-sdk-s3" +require "aws-sdk-shield" +require "aws-sdk-sns" +require "aws-sdk-sqs" +require "aws-sdk-efs" +require "aws-sdk-ssm" +require "rspec/expectations" +require "aws-sdk-transfer" +require "aws-sdk-elasticsearchservice" +require "aws-sdk-cognitoidentity" +require "aws-sdk-redshift" +require "aws-sdk-athena" +require "aws-sdk-applicationautoscaling" +require "aws-sdk-cognitoidentityprovider" +require "aws-sdk-apigateway" +require "aws-sdk-databasemigrationservice" +require "aws-sdk-route53resolver" +require "aws-sdk-servicecatalog" +require "aws-sdk-glue" +require "aws-sdk-eventbridge" +require "aws-sdk-states" +require "aws-sdk-ram" +require "aws-sdk-secretsmanager" +require "aws-sdk-networkfirewall" +require "aws-sdk-mq" +require "aws-sdk-networkmanager" +require "aws-sdk-signer" +require "aws-sdk-amplify" +require "aws-sdk-simpledb" +require "aws-sdk-emr" +require "aws-sdk-securityhub" +require "aws-sdk-ses" +require "aws-sdk-waf" +require "aws-sdk-synthetics" +require "aws-sdk-apigatewayv2" +require "aws-sdk-account" # AWS Inspec Backend Classes # @@ -362,8 +362,8 @@ def initialize(opts) client_args[:client_args][:endpoint] = opts[:aws_endpoint] if opts[:aws_endpoint] # below allows each resource to optionally and conveniently set max_retries and retry_backoff env_hash = ENV.map { |k, v| [k.downcase, v] }.to_h - opts[:aws_retry_limit]= env_hash['aws_retry_limit'].to_i if !opts[:aws_retry_limit] && env_hash['aws_retry_limit'] - opts[:aws_retry_backoff]= env_hash['aws_retry_backoff'].to_i if !opts[:aws_retry_backoff] && env_hash['aws_retry_backoff'] + opts[:aws_retry_limit]= env_hash["aws_retry_limit"].to_i if !opts[:aws_retry_limit] && env_hash["aws_retry_limit"] + opts[:aws_retry_backoff]= env_hash["aws_retry_backoff"].to_i if !opts[:aws_retry_backoff] && env_hash["aws_retry_backoff"] client_args[:client_args][:retry_limit] = opts[:aws_retry_limit] if opts[:aws_retry_limit] client_args[:client_args][:retry_backoff] = "lambda { |c| sleep(#{opts[:aws_retry_backoff]}) }" if opts[:aws_retry_backoff] # this catches the stub_data true option for unit testing - and others that could be useful for consumers @@ -378,9 +378,9 @@ def initialize(opts) # here we might want to inject stub data for testing, let's use an option for that return if !defined?(@opts.keys) || !@opts.include?(:stub_data) - raise ArgumentError, 'Expected stub data to be an array' if !opts[:stub_data].is_a?(Array) + raise ArgumentError, "Expected stub data to be an array" if !opts[:stub_data].is_a?(Array) opts[:stub_data].each do |stub| - raise ArgumentError, 'Expect each stub_data hash to have :client, :method and :data keys' if !stub.keys.all? { |a| %i(method data client).include?(a) } + raise ArgumentError, "Expect each stub_data hash to have :client, :method and :data keys" if !stub.keys.all? { |a| %i(method data client).include?(a) } @aws.aws_client(stub[:client]).stub_responses(stub[:method], stub[:data]) end end @@ -393,20 +393,20 @@ def initialize(opts) def validate_parameters(allow: [], required: nil, require_any_of: nil) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity if required raise ArgumentError, "Expected required parameters as Array of Symbols, got #{required}" unless required.is_a?(Array) && required.all? { |r| r.is_a?(Symbol) } - raise ArgumentError, "#{@__resource_name__}: `#{required}` must be provided" unless @opts.is_a?(Hash) && required.all? { |req| @opts.key?(req) && !@opts[req].nil? && @opts[req] != '' } + raise ArgumentError, "#{@__resource_name__}: `#{required}` must be provided" unless @opts.is_a?(Hash) && required.all? { |req| @opts.key?(req) && !@opts[req].nil? && @opts[req] != "" } allow += required end if require_any_of raise ArgumentError, "Expected required parameters as Array of Symbols, got #{require_any_of}" unless require_any_of.is_a?(Array) && require_any_of.all? { |r| r.is_a?(Symbol) } - raise ArgumentError, "#{@__resource_name__}: One of `#{require_any_of}` must be provided." unless @opts.is_a?(Hash) && require_any_of.any? { |req| @opts.key?(req) && !@opts[req].nil? && @opts[req] != '' } + raise ArgumentError, "#{@__resource_name__}: One of `#{require_any_of}` must be provided." unless @opts.is_a?(Hash) && require_any_of.any? { |req| @opts.key?(req) && !@opts[req].nil? && @opts[req] != "" } allow += require_any_of end allow += %i(client_args stub_data aws_region aws_endpoint aws_retry_limit aws_retry_backoff resource_data) - raise ArgumentError, 'Scalar arguments not supported' unless defined?(@opts.keys) - raise ArgumentError, 'Unexpected arguments found' unless @opts.keys.all? { |a| allow.include?(a) } - raise ArgumentError, 'Provided parameter should not be empty' unless @opts.values.all? do |a| + raise ArgumentError, "Scalar arguments not supported" unless defined?(@opts.keys) + raise ArgumentError, "Unexpected arguments found" unless @opts.keys.all? { |a| allow.include?(a) } + raise ArgumentError, "Provided parameter should not be empty" unless @opts.values.all? do |a| return true if a.instance_of?(Integer) return true if [TrueClass, FalseClass].include?(a.class) !a.empty? @@ -427,38 +427,38 @@ def tags def name return unless tags - return tags['Name'] if tags.is_a?(Hash) + return tags["Name"] if tags.is_a?(Hash) # tags might be in the original format: [{:key=>"Name", :value=>"aws-linux-ubuntu-vm"}], e.g in EC2 - tags.select { |tag| tag[:key] == 'Name' }.first&.dig(:value) + tags.select { |tag| tag[:key] == "Name" }.first&.dig(:value) end # Intercept AWS exceptions def catch_aws_errors yield # Catch and create custom messages as needed rescue Aws::Errors::MissingCredentialsError - Inspec::Log.error 'It appears that you have not set your AWS credentials. See https://www.inspec.io/docs/reference/platforms for details.' - fail_resource('No AWS credentials available') + Inspec::Log.error "It appears that you have not set your AWS credentials. See https://www.inspec.io/docs/reference/platforms for details." + fail_resource("No AWS credentials available") nil rescue Aws::Account::Errors::ResourceNotFoundException => e Inspec::Log.warn "#{e.message}" fail_resource("#{e.message}") nil rescue Aws::Errors::NoSuchEndpointError - Inspec::Log.error 'The endpoint that is trying to be accessed does not exist.' - fail_resource('Invalid Endpoint error') + Inspec::Log.error "The endpoint that is trying to be accessed does not exist." + fail_resource("Invalid Endpoint error") nil rescue Aws::Errors::ServiceError => e if is_permissions_error(e) - advice = '' - error_type = e.class.to_s.split('::').last + advice = "" + error_type = e.class.to_s.split("::").last case error_type - when 'InvalidAccessKeyId' - advice = 'Please ensure your AWS Access Key ID is set correctly.' - when 'InvalidClientTokenId' - advice = 'Please ensure that the aws access key, aws secret access key, and the aws session token are correct.' - when 'AccessDenied' - advice = 'Please check the IAM permissions required for this Resource in the documentation, ' \ - 'and ensure your Service Principal has these permissions set.' + when "InvalidAccessKeyId" + advice = "Please ensure your AWS Access Key ID is set correctly." + when "InvalidClientTokenId" + advice = "Please ensure that the aws access key, aws secret access key, and the aws session token are correct." + when "AccessDenied" + advice = "Please check the IAM permissions required for this Resource in the documentation, " \ + "and ensure your Service Principal has these permissions set." end error_message = "#{e.message}: #{advice}" @@ -466,7 +466,7 @@ def catch_aws_errors else Inspec::Log.warn "AWS Service Error encountered running a control with Resource #{@__resource_name__}. " \ "Error message: #{e.message}. You should address this error to ensure your controls are " \ - 'behaving as expected.' + "behaving as expected." @failed_resource = true end nil @@ -517,8 +517,8 @@ def respond_to_missing?(*several_variants) # This method should be used when AWS API returns multiple resources for the provided criteria. def resource_fail(message = nil) message ||= "#{@__resource_name__}: #{@display_name}. Multiple AWS resources were returned for the provided criteria. "\ - 'If you wish to test multiple entities, please use the plural resource. '\ - 'Otherwise, please provide more specific criteria to lookup the resource.' + "If you wish to test multiple entities, please use the plural resource. "\ + "Otherwise, please provide more specific criteria to lookup the resource." # Fail resource in resource pack. `exists?` method will return `false`. @failed_resource = true # Fail resource in InSpec core. Tests in InSpec profile will return the message. @@ -553,7 +553,7 @@ def self.populate_filter_table(raw_data, table_scheme) end def fetch(client:, operation:, kwargs: {}) - raise ArgumentError, 'Valid Client not found!' unless @aws.respond_to?(client) + raise ArgumentError, "Valid Client not found!" unless @aws.respond_to?(client) client_obj = @aws.send(client) raise ArgumentError, "#{client} does not support #{operation}" unless client_obj.respond_to?(operation) @@ -590,11 +590,11 @@ def create_methods(object, data) when /Aws::.*/ # iterate around the instance variables data.instance_variables.each do |var| - create_method(object, var.to_s.delete('@'), data.instance_variable_get(var)) + create_method(object, var.to_s.delete("@"), data.instance_variable_get(var)) end # When the data is a Hash object iterate around each of the key value pairs and # create a method for each one. - when 'Hash' + when "Hash" data.each do |key, value| create_method(object, key, value) end @@ -612,11 +612,11 @@ def create_method(object, name, value) # Create the necessary method based on the var that has been passed # Test the value for its type so that the method can be setup correctly case value.class.to_s - when 'String', 'Integer', 'TrueClass', 'FalseClass', 'Fixnum', 'Time' + when "String", "Integer", "TrueClass", "FalseClass", "Fixnum", "Time" object.define_singleton_method name do value end - when 'Hash' + when "Hash" value.count == 0 ? return_value = value : return_value = AwsResourceProbe.new(value) object.define_singleton_method name do return_value @@ -627,7 +627,7 @@ def create_method(object, name, value) value = value.to_h if value.respond_to? :to_h AwsResourceProbe.new(value) end - when 'Array' + when "Array" # Some things are just string or integer arrays # Check this by seeing if the first element is a string / integer / boolean or # a hashtable @@ -635,7 +635,7 @@ def create_method(object, name, value) # the quickest test # p value[0].class.to_s case value[0].class.to_s - when 'String', 'Integer', 'TrueClass', 'FalseClass', 'Fixnum', 'Time' + when "String", "Integer", "TrueClass", "FalseClass", "Fixnum", "Time" probes = value else if name.eql?(:tags) @@ -698,10 +698,10 @@ def initialize(item) # Hash: Key=>Value pair to look for in the @item property def include?(opt) unless opt.is_a?(Symbol) || opt.is_a?(Hash) || opt.is_a?(String) - raise ArgumentError, 'Key or Key:Value pair should be provided.' + raise ArgumentError, "Key or Key:Value pair should be provided." end if opt.is_a?(Hash) - raise ArgumentError, 'Only one item can be provided' if opt.keys.size > 1 + raise ArgumentError, "Only one item can be provided" if opt.keys.size > 1 return @item[opt.keys.first] == opt.values.first end @item.key?(opt.to_sym) diff --git a/libraries/aws_batch_compute_environment.rb b/libraries/aws_batch_compute_environment.rb index cfc5d04c0..a9da53894 100644 --- a/libraries/aws_batch_compute_environment.rb +++ b/libraries/aws_batch_compute_environment.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSBatchComputeEnvironment < AwsResourceBase - name 'aws_batch_compute_environment' - desc 'Describes one or more of your compute environments.' + name "aws_batch_compute_environment" + desc "Describes one or more of your compute environments." example <<-EXAMPLE describe aws_batch_compute_environment(compute_environment_name: 'BATCH_COMPUTE_ENVIRONMENT_NAME') do it { should exist } diff --git a/libraries/aws_batch_compute_environments.rb b/libraries/aws_batch_compute_environments.rb index 7cdf1cf96..756423495 100644 --- a/libraries/aws_batch_compute_environments.rb +++ b/libraries/aws_batch_compute_environments.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSBatchComputeEnvironments < AwsResourceBase - name 'aws_batch_compute_environments' - desc 'Describes one or more of your compute environments.' + name "aws_batch_compute_environments" + desc "Describes one or more of your compute environments." example <<-EXAMPLE describe aws_batch_compute_environments do it { should exist } @@ -12,16 +12,16 @@ class AWSBatchComputeEnvironments < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:compute_environment_names, field: :compute_environment_name) - .register_column(:compute_environment_arns, field: :compute_environment_arn) - .register_column(:ecs_cluster_arns, field: :ecs_cluster_arn) - .register_column(:tags, field: :tags) - .register_column(:types, field: :type) - .register_column(:states, field: :state) - .register_column(:statuses, field: :status) - .register_column(:status_reasons, field: :status_reason) - .register_column(:service_roles, field: :service_role) - .install_filter_methods_on_resource(self, :table) + .register_column(:compute_environment_names, field: :compute_environment_name) + .register_column(:compute_environment_arns, field: :compute_environment_arn) + .register_column(:ecs_cluster_arns, field: :ecs_cluster_arn) + .register_column(:tags, field: :tags) + .register_column(:types, field: :type) + .register_column(:states, field: :state) + .register_column(:statuses, field: :status) + .register_column(:status_reasons, field: :status_reason) + .register_column(:service_roles, field: :service_role) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_batch_job_definition.rb b/libraries/aws_batch_job_definition.rb index 06da0fd36..93f1c80fa 100644 --- a/libraries/aws_batch_job_definition.rb +++ b/libraries/aws_batch_job_definition.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSBatchJobDefinition < AwsResourceBase - name 'aws_batch_job_definition' - desc 'Describes a list of job definitions.' + name "aws_batch_job_definition" + desc "Describes a list of job definitions." example <<-EXAMPLE describe aws_batch_job_definition(job_definition_name: 'JOB_DEFINITION_NAME') do it { should exist } diff --git a/libraries/aws_batch_job_definitions.rb b/libraries/aws_batch_job_definitions.rb index 8a0462e22..2436f79c7 100644 --- a/libraries/aws_batch_job_definitions.rb +++ b/libraries/aws_batch_job_definitions.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSBatchJobDefinitions < AwsResourceBase - name 'aws_batch_job_definitions' - desc 'Describes a list of job definitions.' + name "aws_batch_job_definitions" + desc "Describes a list of job definitions." example <<-EXAMPLE describe aws_batch_job_definitions do it { should exist } @@ -12,16 +12,16 @@ class AWSBatchJobDefinitions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:job_definition_names, field: :job_definition_name) - .register_column(:job_definition_arns, field: :job_definition_arn) - .register_column(:revisions, field: :revision) - .register_column(:statuses, field: :status) - .register_column(:types, field: :type) - .register_column(:parameters, field: :parameters) - .register_column(:tags, field: :tags) - .register_column(:propagate_tags, field: :propagate_tags) - .register_column(:platform_capabilities, field: :platform_capabilities) - .install_filter_methods_on_resource(self, :table) + .register_column(:job_definition_names, field: :job_definition_name) + .register_column(:job_definition_arns, field: :job_definition_arn) + .register_column(:revisions, field: :revision) + .register_column(:statuses, field: :status) + .register_column(:types, field: :type) + .register_column(:parameters, field: :parameters) + .register_column(:tags, field: :tags) + .register_column(:propagate_tags, field: :propagate_tags) + .register_column(:platform_capabilities, field: :platform_capabilities) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_batch_job_queue.rb b/libraries/aws_batch_job_queue.rb index 08c8eb78d..0c33f8014 100644 --- a/libraries/aws_batch_job_queue.rb +++ b/libraries/aws_batch_job_queue.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSBatchJobQueue < AwsResourceBase - name 'aws_batch_job_queue' - desc 'Describes one or more of your job queues.' + name "aws_batch_job_queue" + desc "Describes one or more of your job queues." example <<-EXAMPLE describe aws_batch_job_queue(job_queue_name: 'JOB_QUEUE_NAME') do it { should exist } diff --git a/libraries/aws_batch_job_queues.rb b/libraries/aws_batch_job_queues.rb index 41de1b9d3..b63c13bec 100644 --- a/libraries/aws_batch_job_queues.rb +++ b/libraries/aws_batch_job_queues.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSBatchJobQueues < AwsResourceBase - name 'aws_batch_job_queues' - desc 'Describes one or more of your job queues.' + name "aws_batch_job_queues" + desc "Describes one or more of your job queues." example <<-EXAMPLE describe aws_batch_job_queues do it { should exist } @@ -12,14 +12,14 @@ class AWSBatchJobQueues < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:job_queue_names, field: :job_queue_name) - .register_column(:job_queue_arns, field: :job_queue_arn) - .register_column(:states, field: :state) - .register_column(:statuses, field: :status) - .register_column(:status_reasons, field: :status_reason) - .register_column(:priorities, field: :priority) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:job_queue_names, field: :job_queue_name) + .register_column(:job_queue_arns, field: :job_queue_arn) + .register_column(:states, field: :state) + .register_column(:statuses, field: :status) + .register_column(:status_reasons, field: :status_reason) + .register_column(:priorities, field: :priority) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloud_formation_stack_set.rb b/libraries/aws_cloud_formation_stack_set.rb index 10e80e0c3..dc38961eb 100644 --- a/libraries/aws_cloud_formation_stack_set.rb +++ b/libraries/aws_cloud_formation_stack_set.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudFormationStackSet < AwsResourceBase - name 'aws_cloud_formation_stack_set' - desc 'Describes the specified stack set.' + name "aws_cloud_formation_stack_set" + desc "Describes the specified stack set." example <<-EXAMPLE describe aws_cloud_formation_stack_set(stack_set_name: 'STACK_SET_NAME') do it { should exist } diff --git a/libraries/aws_cloud_formation_stack_sets.rb b/libraries/aws_cloud_formation_stack_sets.rb index 32824718e..8b34ce329 100644 --- a/libraries/aws_cloud_formation_stack_sets.rb +++ b/libraries/aws_cloud_formation_stack_sets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudFormationStackSets < AwsResourceBase - name 'aws_cloud_formation_stack_sets' - desc 'Describes all the specified stack set.' + name "aws_cloud_formation_stack_sets" + desc "Describes all the specified stack set." example <<-EXAMPLE describe aws_cloud_formation_stack_sets do it { should exist } @@ -18,15 +18,15 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:stack_set_names, field: :stack_set_name) - .register_column(:stack_set_ids, field: :stack_set_id) - .register_column(:descriptions, field: :description) - .register_column(:statuses, field: :status) - .register_column(:auto_deployments, field: :auto_deployment) - .register_column(:permission_models, field: :permission_model) - .register_column(:drift_statuses, field: :drift_status) - .register_column(:last_drift_check_timestamps, field: :last_drift_check_timestamp) - .install_filter_methods_on_resource(self, :table) + .register_column(:stack_set_names, field: :stack_set_name) + .register_column(:stack_set_ids, field: :stack_set_id) + .register_column(:descriptions, field: :description) + .register_column(:statuses, field: :status) + .register_column(:auto_deployments, field: :auto_deployment) + .register_column(:permission_models, field: :permission_model) + .register_column(:drift_statuses, field: :drift_status) + .register_column(:last_drift_check_timestamps, field: :last_drift_check_timestamp) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_cloudformation_stack.rb b/libraries/aws_cloudformation_stack.rb index db8246a50..0c3970c38 100644 --- a/libraries/aws_cloudformation_stack.rb +++ b/libraries/aws_cloudformation_stack.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudformationStack < AwsResourceBase - name 'aws_cloudformation_stack' - desc 'Verifies settings for an aws CloudFormation Stack.' + name "aws_cloudformation_stack" + desc "Verifies settings for an aws CloudFormation Stack." example <<-EXAMPLE describe aws_cloudformation_stack('STACK_NAME') do it { should exist } diff --git a/libraries/aws_cloudformation_stacks.rb b/libraries/aws_cloudformation_stacks.rb index ca47d55c4..afd4db397 100644 --- a/libraries/aws_cloudformation_stacks.rb +++ b/libraries/aws_cloudformation_stacks.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudformationStacks < AwsResourceBase - name 'aws_cloudformation_stacks' - desc 'Verifies settings for aws CloudFormation Stacks.' + name "aws_cloudformation_stacks" + desc "Verifies settings for aws CloudFormation Stacks." example <<-EXAMPLE describe aws_cloudformation_stacks do it { should exist } @@ -12,14 +12,14 @@ class AwsCloudformationStacks < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:creation_times, field: :creation_time) - .register_column(:stack_ids, field: :stack_id) - .register_column(:notification_arns, field: :notification_arn) - .register_column(:role_arns, field: :role_arn) - .register_column(:parent_ids, field: :parent_id) - .register_column(:root_ids, field: :root_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:creation_times, field: :creation_time) + .register_column(:stack_ids, field: :stack_id) + .register_column(:notification_arns, field: :notification_arn) + .register_column(:role_arns, field: :role_arn) + .register_column(:parent_ids, field: :parent_id) + .register_column(:root_ids, field: :root_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudformation_template.rb b/libraries/aws_cloudformation_template.rb index e2ed154ab..86cf6a48c 100644 --- a/libraries/aws_cloudformation_template.rb +++ b/libraries/aws_cloudformation_template.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudFormationTemplate < AwsResourceBase - name 'aws_cloudformation_template' - desc 'Returns information about a new or existing template.' + name "aws_cloudformation_template" + desc "Returns information about a new or existing template." example <<-EXAMPLE describe aws_cloudformation_template(stack_name: 'STACK_NAME') do it { should exist } diff --git a/libraries/aws_cloudfront_cache_policies.rb b/libraries/aws_cloudfront_cache_policies.rb index 4929a0d5e..cc6e57d06 100644 --- a/libraries/aws_cloudfront_cache_policies.rb +++ b/libraries/aws_cloudfront_cache_policies.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudFrontCachePolicies < AwsResourceBase - name 'aws_cloudfront_cache_policies' - desc 'Gets a list of cache policies.' + name "aws_cloudfront_cache_policies" + desc "Gets a list of cache policies." example <<-EXAMPLE describe aws_cloudfront_cache_policies do it { should exist } @@ -12,20 +12,20 @@ class AWSCloudFrontCachePolicies < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:types, field: :type) - .register_column(:ids, field: :id) - .register_column(:last_modified_times, field: :last_modified_time) - .register_column(:comments, field: :comment) - .register_column(:names, field: :name) - .register_column(:default_ttls, field: :default_ttl) - .register_column(:max_ttls, field: :max_ttl) - .register_column(:min_ttls, field: :min_ttl) - .register_column(:enable_accept_encoding_gzips, field: :enable_accept_encoding_gzip) - .register_column(:enable_accept_encoding_brotlis, field: :enable_accept_encoding_brotli) - .register_column(:header_behaviors, field: :header_behavior) - .register_column(:cookie_behaviors, field: :cookie_behavior) - .register_column(:query_string_behaviors, field: :query_string_behavior) - .install_filter_methods_on_resource(self, :table) + .register_column(:types, field: :type) + .register_column(:ids, field: :id) + .register_column(:last_modified_times, field: :last_modified_time) + .register_column(:comments, field: :comment) + .register_column(:names, field: :name) + .register_column(:default_ttls, field: :default_ttl) + .register_column(:max_ttls, field: :max_ttl) + .register_column(:min_ttls, field: :min_ttl) + .register_column(:enable_accept_encoding_gzips, field: :enable_accept_encoding_gzip) + .register_column(:enable_accept_encoding_brotlis, field: :enable_accept_encoding_brotli) + .register_column(:header_behaviors, field: :header_behavior) + .register_column(:cookie_behaviors, field: :cookie_behavior) + .register_column(:query_string_behaviors, field: :query_string_behavior) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudfront_cache_policy.rb b/libraries/aws_cloudfront_cache_policy.rb index b6b87b04f..79498bdc8 100644 --- a/libraries/aws_cloudfront_cache_policy.rb +++ b/libraries/aws_cloudfront_cache_policy.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudFrontCachePolicy < AwsResourceBase - name 'aws_cloudfront_cache_policy' - desc 'Gets a cache policy.' + name "aws_cloudfront_cache_policy" + desc "Gets a cache policy." example <<-EXAMPLE describe aws_cloudfront_cache_policy(id: 'CLOUDFRONT_CACHE_POLICY_ID') do it { should exist } diff --git a/libraries/aws_cloudfront_distribution.rb b/libraries/aws_cloudfront_distribution.rb index b8a762ff2..e42999dfd 100644 --- a/libraries/aws_cloudfront_distribution.rb +++ b/libraries/aws_cloudfront_distribution.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudFrontDistribution < AwsResourceBase - name 'aws_cloudfront_distribution' - desc 'Verifies settings for a CloudFront Distribution.' + name "aws_cloudfront_distribution" + desc "Verifies settings for a CloudFront Distribution." example <<-EXAMPLE describe aws_cloudfront_distribution('CLOUDFRONT_DISTRIBUTION_ID') do it { should exist } @@ -92,7 +92,7 @@ def resource_id end def exists? - !@distribution_arn.nil? && @distribution_arn.start_with?('arn') + !@distribution_arn.nil? && @distribution_arn.start_with?("arn") end def has_access_logging_enabled? @@ -100,7 +100,7 @@ def has_access_logging_enabled? end def has_viewer_protocol_policies_allowing_http? - @viewer_protocol_policies.include? 'allow-all' + @viewer_protocol_policies.include? "allow-all" end def has_disallowed_viewer_certificate_minimum_ssl_protocol? diff --git a/libraries/aws_cloudfront_distributions.rb b/libraries/aws_cloudfront_distributions.rb index 8aaccfdd0..7d0eb2829 100644 --- a/libraries/aws_cloudfront_distributions.rb +++ b/libraries/aws_cloudfront_distributions.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudFrontDistributions < AwsResourceBase - name 'aws_cloudfront_distributions' - desc 'Verifies settings for a collection AWS CloudFront Distributions.' + name "aws_cloudfront_distributions" + desc "Verifies settings for a collection AWS CloudFront Distributions." example <<-EXAMPLE describe aws_cloudfront_distributions do it { should exist } @@ -12,21 +12,21 @@ class AwsCloudFrontDistributions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:distribution_ids, field: :distribution_ids) - .register_column(:distribution_arns, field: :distribution_arns) - .register_column(:statuses, field: :statuses) - .register_column(:domain_names, field: :domain_names) - .register_column(:origin_domain_names, field: :origin_domain_names) - .register_column(:default_cache_viewer_protocol_policies, field: :default_cache_viewer_protocol_policies) - .register_column(:cache_viewer_protocol_policies, field: :cache_viewer_protocol_policies) - .register_column(:custom_origin_ssl_protocols, field: :custom_origin_ssl_protocols) - .register_column(:price_classes, field: :price_classes) - .register_column(:enabled, field: :enabled) - .register_column(:viewer_certificate_ssl_support_methods, field: :viewer_certificate_ssl_support_methods) - .register_column(:viewer_certificate_minimum_ssl_protocols, field: :viewer_certificate_minimum_ssl_protocols) - .register_column(:http_versions, field: :http_version) - .register_column(:ipv6_enabled, field: :ipv6_enabled) - .install_filter_methods_on_resource(self, :table) + .register_column(:distribution_ids, field: :distribution_ids) + .register_column(:distribution_arns, field: :distribution_arns) + .register_column(:statuses, field: :statuses) + .register_column(:domain_names, field: :domain_names) + .register_column(:origin_domain_names, field: :origin_domain_names) + .register_column(:default_cache_viewer_protocol_policies, field: :default_cache_viewer_protocol_policies) + .register_column(:cache_viewer_protocol_policies, field: :cache_viewer_protocol_policies) + .register_column(:custom_origin_ssl_protocols, field: :custom_origin_ssl_protocols) + .register_column(:price_classes, field: :price_classes) + .register_column(:enabled, field: :enabled) + .register_column(:viewer_certificate_ssl_support_methods, field: :viewer_certificate_ssl_support_methods) + .register_column(:viewer_certificate_minimum_ssl_protocols, field: :viewer_certificate_minimum_ssl_protocols) + .register_column(:http_versions, field: :http_version) + .register_column(:ipv6_enabled, field: :ipv6_enabled) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudfront_key_group.rb b/libraries/aws_cloudfront_key_group.rb index 2e934d4a9..8460e0368 100644 --- a/libraries/aws_cloudfront_key_group.rb +++ b/libraries/aws_cloudfront_key_group.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudFrontKeyGroup < AwsResourceBase - name 'aws_cloudfront_key_group' - desc 'Describes one Key Group.' + name "aws_cloudfront_key_group" + desc "Describes one Key Group." example <<-EXAMPLE describe aws_cloudfront_key_group(id: 'KEY_GROUP_ID') do it { should exist } diff --git a/libraries/aws_cloudfront_key_groups.rb b/libraries/aws_cloudfront_key_groups.rb index d5e14abb7..ad32642b5 100644 --- a/libraries/aws_cloudfront_key_groups.rb +++ b/libraries/aws_cloudfront_key_groups.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudFrontKeyGroups < AwsResourceBase - name 'aws_cloudfront_key_groups' - desc 'Describes one or more of Key Group.' + name "aws_cloudfront_key_groups" + desc "Describes one or more of Key Group." example <<-EXAMPLE describe aws_cloudfront_key_groups do it { should exist } @@ -12,12 +12,12 @@ class AwsCloudFrontKeyGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:last_modified_time, field: :last_modified_time) - .register_column(:key_group_config_names, field: :key_group_config_name) - .register_column(:key_group_config_items, field: :key_group_config_items, style: :simple) - .register_column(:key_group_config_comments, field: :key_group_config_comment, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:last_modified_time, field: :last_modified_time) + .register_column(:key_group_config_names, field: :key_group_config_name) + .register_column(:key_group_config_items, field: :key_group_config_items, style: :simple) + .register_column(:key_group_config_comments, field: :key_group_config_comment, style: :simple) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudfront_origin_access_identities.rb b/libraries/aws_cloudfront_origin_access_identities.rb index b1cc6af9f..fc8c997f7 100644 --- a/libraries/aws_cloudfront_origin_access_identities.rb +++ b/libraries/aws_cloudfront_origin_access_identities.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudFrontOriginAccessIdentities < AwsResourceBase - name 'aws_cloudfront_origin_access_identities' - desc 'Lists origin access identities.' + name "aws_cloudfront_origin_access_identities" + desc "Lists origin access identities." example <<-EXAMPLE describe aws_cloudfront_origin_access_identities do it { should exist } @@ -12,10 +12,10 @@ class AWSCloudFrontOriginAccessIdentities < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:s3_canonical_user_ids, field: :s3_canonical_user_id) - .register_column(:comments, field: :comment) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:s3_canonical_user_ids, field: :s3_canonical_user_id) + .register_column(:comments, field: :comment) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudfront_origin_access_identity.rb b/libraries/aws_cloudfront_origin_access_identity.rb index b2e0f04ea..9a1583733 100644 --- a/libraries/aws_cloudfront_origin_access_identity.rb +++ b/libraries/aws_cloudfront_origin_access_identity.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudFrontOriginAccessIdentity < AwsResourceBase - name 'aws_cloudfront_origin_access_identity' - desc 'Get the information about an origin access identity.' + name "aws_cloudfront_origin_access_identity" + desc "Get the information about an origin access identity." example <<-EXAMPLE describe aws_cloudfront_origin_access_identity(id: 'ID') do it { should exist } diff --git a/libraries/aws_cloudfront_origin_request_policy.rb b/libraries/aws_cloudfront_origin_request_policy.rb index de7e3dbf1..4e7292543 100644 --- a/libraries/aws_cloudfront_origin_request_policy.rb +++ b/libraries/aws_cloudfront_origin_request_policy.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudFrontOriginRequestPolicy < AwsResourceBase - name 'aws_cloudfront_origin_request_policy' - desc 'Describes an origin request policy.' + name "aws_cloudfront_origin_request_policy" + desc "Describes an origin request policy." example <<-EXAMPLE describe aws_cloudfront_origin_request_policy(id: 'ID') do it { should exist } diff --git a/libraries/aws_cloudfront_public_key.rb b/libraries/aws_cloudfront_public_key.rb index d3f38b94b..7255d9b8f 100644 --- a/libraries/aws_cloudfront_public_key.rb +++ b/libraries/aws_cloudfront_public_key.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudFrontPublicKey < AwsResourceBase - name 'aws_cloudfront_public_key' - desc 'Get the information about a Public Key.' + name "aws_cloudfront_public_key" + desc "Get the information about a Public Key." example <<-EXAMPLE describe aws_cloudfront_public_key(id: 'ID') do it { should exist } diff --git a/libraries/aws_cloudfront_public_keys.rb b/libraries/aws_cloudfront_public_keys.rb index e4ff3c1e4..cc15a4dc0 100644 --- a/libraries/aws_cloudfront_public_keys.rb +++ b/libraries/aws_cloudfront_public_keys.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudFrontPublicKeys < AwsResourceBase - name 'aws_cloudfront_public_keys' - desc 'Lists all Public Keys.' + name "aws_cloudfront_public_keys" + desc "Lists all Public Keys." example <<-EXAMPLE describe aws_cloudfront_public_keys do it { should exist } @@ -12,12 +12,12 @@ class AWSCloudFrontPublicKeys < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:created_time, field: :created_time) - .register_column(:encoded_keys, field: :encoded_key) - .register_column(:comments, field: :comment) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:created_time, field: :created_time) + .register_column(:encoded_keys, field: :encoded_key) + .register_column(:comments, field: :comment) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudfront_realtime_log_config.rb b/libraries/aws_cloudfront_realtime_log_config.rb index 526631d55..42eb72689 100644 --- a/libraries/aws_cloudfront_realtime_log_config.rb +++ b/libraries/aws_cloudfront_realtime_log_config.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudFrontRealtimeLogConfig < AwsResourceBase - name 'aws_cloudfront_realtime_log_config' - desc 'Gets a real-time log configuration.' + name "aws_cloudfront_realtime_log_config" + desc "Gets a real-time log configuration." example <<-EXAMPLE describe aws_cloudfront_realtime_log_config(name: 'CONFIG_NAME') do it { should exist } diff --git a/libraries/aws_cloudfront_realtime_log_configs.rb b/libraries/aws_cloudfront_realtime_log_configs.rb index d3ef59927..196b9edeb 100644 --- a/libraries/aws_cloudfront_realtime_log_configs.rb +++ b/libraries/aws_cloudfront_realtime_log_configs.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudFrontRealtimeLogConfigs < AwsResourceBase - name 'aws_cloudfront_realtime_log_configs' - desc 'Gets a list of real-time log configurations.' + name "aws_cloudfront_realtime_log_configs" + desc "Gets a list of real-time log configurations." example <<-EXAMPLE describe aws_cloudfront_realtime_log_configs do it { should exist } @@ -12,12 +12,12 @@ class AwsCloudFrontRealtimeLogConfigs < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:names, field: :name) - .register_column(:sampling_rates, field: :sampling_rate) - .register_column(:end_points, field: :end_points) - .register_column(:fields, field: :fields) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:names, field: :name) + .register_column(:sampling_rates, field: :sampling_rate) + .register_column(:end_points, field: :end_points) + .register_column(:fields, field: :fields) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudfront_streaming_distribution.rb b/libraries/aws_cloudfront_streaming_distribution.rb index 69e0fba30..b2fd6eb35 100644 --- a/libraries/aws_cloudfront_streaming_distribution.rb +++ b/libraries/aws_cloudfront_streaming_distribution.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudFrontStreamingDistribution < AwsResourceBase - name 'aws_cloudfront_streaming_distribution' - desc 'Get the information about a distribution.' + name "aws_cloudfront_streaming_distribution" + desc "Get the information about a distribution." example <<-EXAMPLE describe aws_cloudfront_streaming_distribution(id: 'ID') do it { should exist } diff --git a/libraries/aws_cloudfront_streaming_distributions.rb b/libraries/aws_cloudfront_streaming_distributions.rb index 6df1e0aa0..93dd65ac5 100644 --- a/libraries/aws_cloudfront_streaming_distributions.rb +++ b/libraries/aws_cloudfront_streaming_distributions.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudFrontStreamingDistributions < AwsResourceBase - name 'aws_cloudfront_streaming_distributions' - desc 'List streaming distributions.' + name "aws_cloudfront_streaming_distributions" + desc "List streaming distributions." example <<-EXAMPLE describe aws_cloudfront_streaming_distributions do it { should exist } @@ -12,18 +12,18 @@ class AWSCloudFrontStreamingDistributions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:arns, field: :arn) - .register_column(:statuses, field: :status) - .register_column(:last_modified_time, field: :last_modified_time) - .register_column(:domain_names, field: :domain_name) - .register_column(:s3_origins, field: :s3_origin) - .register_column(:aliases, field: :aliases) - .register_column(:trusted_signers, field: :trusted_signers) - .register_column(:comments, field: :comment) - .register_column(:price_classes, field: :price_class) - .register_column(:enabled, field: :enabled) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:arns, field: :arn) + .register_column(:statuses, field: :status) + .register_column(:last_modified_time, field: :last_modified_time) + .register_column(:domain_names, field: :domain_name) + .register_column(:s3_origins, field: :s3_origin) + .register_column(:aliases, field: :aliases) + .register_column(:trusted_signers, field: :trusted_signers) + .register_column(:comments, field: :comment) + .register_column(:price_classes, field: :price_class) + .register_column(:enabled, field: :enabled) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudtrail_trail.rb b/libraries/aws_cloudtrail_trail.rb index f790778e4..dfe079373 100644 --- a/libraries/aws_cloudtrail_trail.rb +++ b/libraries/aws_cloudtrail_trail.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudTrailTrail < AwsResourceBase - name 'aws_cloudtrail_trail' - desc 'Verifies settings for an individual AWS CloudTrail Trail.' + name "aws_cloudtrail_trail" + desc "Verifies settings for an individual AWS CloudTrail Trail." example <<-EXAMPLE describe aws_cloudtrail_trail('TRIAL_NAME') do it { should exist } @@ -73,8 +73,8 @@ def encrypted? def get_log_group_for_multi_region_active_mgmt_rw_all return unless exists? return unless @cloud_watch_logs_log_group_arn - return if @cloud_watch_logs_log_group_arn.split(':').count < 6 - return @cloud_watch_logs_log_group_arn.split(':')[6] if has_event_selector_mgmt_events_rw_type_all? && logging? + return if @cloud_watch_logs_log_group_arn.split(":").count < 6 + return @cloud_watch_logs_log_group_arn.split(":")[6] if has_event_selector_mgmt_events_rw_type_all? && logging? end def has_event_selector_mgmt_events_rw_type_all? @@ -83,7 +83,7 @@ def has_event_selector_mgmt_events_rw_type_all? begin event_selectors = @aws.cloudtrail_client.get_event_selectors(trail_name: @trail_name) event_selectors.event_selectors.each do |es| - event_selector_found = true if es.read_write_type == 'All' && es.include_management_events == true + event_selector_found = true if es.read_write_type == "All" && es.include_management_events == true end rescue Aws::CloudTrail::Errors::TrailNotFoundException event_selector_found diff --git a/libraries/aws_cloudtrail_trails.rb b/libraries/aws_cloudtrail_trails.rb index 6cc7738fd..d32543abd 100644 --- a/libraries/aws_cloudtrail_trails.rb +++ b/libraries/aws_cloudtrail_trails.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudTrailTrails < AwsResourceBase - name 'aws_cloudtrail_trails' - desc 'Verifies settings for AWS CloudTrail Trails in bulk.' + name "aws_cloudtrail_trails" + desc "Verifies settings for AWS CloudTrail Trails in bulk." example <<-EXAMPLE describe aws_cloudtrail_trails do it { should exist } @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:trail_arns, field: :trail_arn) - .register_column(:names, field: :name) - .install_filter_methods_on_resource(self, :table) + .register_column(:trail_arns, field: :trail_arn) + .register_column(:names, field: :name) + .install_filter_methods_on_resource(self, :table) def fetch_data cloudtrail_rows = [] diff --git a/libraries/aws_cloudwatch_alarm.rb b/libraries/aws_cloudwatch_alarm.rb index c0bd3c14c..4def6985b 100644 --- a/libraries/aws_cloudwatch_alarm.rb +++ b/libraries/aws_cloudwatch_alarm.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudwatchAlarm < AwsResourceBase - name 'aws_cloudwatch_alarm' - desc 'Verifies settings for an AWS CloudWatch Alarm.' + name "aws_cloudwatch_alarm" + desc "Verifies settings for an AWS CloudWatch Alarm." example <<-EXAMPLE # Look for a specific alarm describe aws_cloudwatch_alarm(metric_name: 'METRIC_NAME', metric_namespace: 'METRIV_NAMESPACE') do @@ -39,14 +39,14 @@ def initialize(opts = {}) return false if @metric_alarms.empty? - raise "Found multiple CloudWatch Alarms. The following matched: #{@metric_alarms.join(', ')}. Try to restrict your resource criteria." if @metric_alarms.count > 1 + raise "Found multiple CloudWatch Alarms. The following matched: #{@metric_alarms.join(", ")}. Try to restrict your resource criteria." if @metric_alarms.count > 1 @alarm_actions = @metric_alarms.first.alarm_actions @alarm_name = @metric_alarms.first.alarm_name end def resource_id - "#{@metric_alarms? @metric_name: ''}_#{@metric_alarms? @metric_namespace: ''}" + "#{@metric_alarms? @metric_name: ""}_#{@metric_alarms? @metric_namespace: ""}" end def exists? diff --git a/libraries/aws_cloudwatch_anomaly_detector.rb b/libraries/aws_cloudwatch_anomaly_detector.rb index 46610d750..e5312fe9c 100644 --- a/libraries/aws_cloudwatch_anomaly_detector.rb +++ b/libraries/aws_cloudwatch_anomaly_detector.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudwatchAnomalyDetector < AwsResourceBase - name 'aws_cloudwatch_anomaly_detector' - desc 'Lists the anomaly detection models that you have created in your account.' + name "aws_cloudwatch_anomaly_detector" + desc "Lists the anomaly detection models that you have created in your account." example <<-EXAMPLE describe aws_cloudwatch_anomaly_detector(metric_name: 'METRIC_NAME') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts = {}) end def resource_id - "#{@res? @res[:metric_name]: ''}_#{@res? @res[:namespace]: ''}" + "#{@res? @res[:metric_name]: ""}_#{@res? @res[:namespace]: ""}" end def metric_name diff --git a/libraries/aws_cloudwatch_anomaly_detectors.rb b/libraries/aws_cloudwatch_anomaly_detectors.rb index a981a21a4..2b2651dcd 100644 --- a/libraries/aws_cloudwatch_anomaly_detectors.rb +++ b/libraries/aws_cloudwatch_anomaly_detectors.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudwatchAnomalyDetectors < AwsResourceBase - name 'aws_cloudwatch_anomaly_detectors' - desc 'Lists the anomaly detection models that you have created in your account.' + name "aws_cloudwatch_anomaly_detectors" + desc "Lists the anomaly detection models that you have created in your account." example <<-EXAMPLE describe aws_cloudwatch_anomaly_detectors do it { should exist } @@ -12,13 +12,13 @@ class AwsCloudwatchAnomalyDetectors < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:namespaces, field: :namespace) - .register_column(:metric_names, field: :metric_name) - .register_column(:dimensions, field: :dimensions) - .register_column(:stats, field: :stat) - .register_column(:configurations, field: :configuration) - .register_column(:state_values, field: :state_value) - .install_filter_methods_on_resource(self, :table) + .register_column(:namespaces, field: :namespace) + .register_column(:metric_names, field: :metric_name) + .register_column(:dimensions, field: :dimensions) + .register_column(:stats, field: :stat) + .register_column(:configurations, field: :configuration) + .register_column(:state_values, field: :state_value) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudwatch_composite_alarm.rb b/libraries/aws_cloudwatch_composite_alarm.rb index 0b970980e..7e8b28995 100644 --- a/libraries/aws_cloudwatch_composite_alarm.rb +++ b/libraries/aws_cloudwatch_composite_alarm.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudwatchCompositeAlarm < AwsResourceBase - name 'aws_cloudwatch_composite_alarm' - desc 'Gets a composite alarm.' + name "aws_cloudwatch_composite_alarm" + desc "Gets a composite alarm." example <<-EXAMPLE describe aws_cloudwatch_composite_alarm(alarm_name: 'COMPOSITE_ALARM_NAME') do it { should exist } @@ -16,7 +16,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: alarm_name must be provided" unless opts[:alarm_name] && !opts[:alarm_name].empty? @display_name = opts[:alarm_name] catch_aws_errors do - resp = @aws.cloudwatch_client.describe_alarms({ alarm_names: [opts[:alarm_name]], alarm_types: ['CompositeAlarm'] }) + resp = @aws.cloudwatch_client.describe_alarms({ alarm_names: [opts[:alarm_name]], alarm_types: ["CompositeAlarm"] }) @res = resp.composite_alarms[0].to_h @alarm_arn = @res[:alarm_arn] create_resource_methods(@res) diff --git a/libraries/aws_cloudwatch_composite_alarms.rb b/libraries/aws_cloudwatch_composite_alarms.rb index a179d4c83..59ab4f5e6 100644 --- a/libraries/aws_cloudwatch_composite_alarms.rb +++ b/libraries/aws_cloudwatch_composite_alarms.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudwatchCompositeAlarms < AwsResourceBase - name 'aws_cloudwatch_composite_alarms' - desc 'Lists all composite alarms.' + name "aws_cloudwatch_composite_alarms" + desc "Lists all composite alarms." example <<-EXAMPLE describe aws_cloudwatch_composite_alarms do it { should exist } @@ -12,20 +12,20 @@ class AwsCloudwatchCompositeAlarms < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:actions_enabled, field: :actions_enabled) - .register_column(:alarm_actions, field: :alarm_actions) - .register_column(:alarm_arns, field: :alarm_arn) - .register_column(:alarm_configuration_updated_timestamp, field: :alarm_configuration_updated_timestamp) - .register_column(:alarm_descriptions, field: :alarm_description) - .register_column(:alarm_names, field: :alarm_name) - .register_column(:alarm_rules, field: :alarm_rule) - .register_column(:insufficient_data_actions, field: :insufficient_data_actions) - .register_column(:ok_actions, field: :ok_actions) - .register_column(:state_reasons, field: :state_reason) - .register_column(:state_reason_data, field: :state_reason_data) - .register_column(:state_updated_timestamp, field: :state_updated_timestamp) - .register_column(:state_values, field: :state_value) - .install_filter_methods_on_resource(self, :table) + .register_column(:actions_enabled, field: :actions_enabled) + .register_column(:alarm_actions, field: :alarm_actions) + .register_column(:alarm_arns, field: :alarm_arn) + .register_column(:alarm_configuration_updated_timestamp, field: :alarm_configuration_updated_timestamp) + .register_column(:alarm_descriptions, field: :alarm_description) + .register_column(:alarm_names, field: :alarm_name) + .register_column(:alarm_rules, field: :alarm_rule) + .register_column(:insufficient_data_actions, field: :insufficient_data_actions) + .register_column(:ok_actions, field: :ok_actions) + .register_column(:state_reasons, field: :state_reason) + .register_column(:state_reason_data, field: :state_reason_data) + .register_column(:state_updated_timestamp, field: :state_updated_timestamp) + .register_column(:state_values, field: :state_value) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -35,7 +35,7 @@ def initialize(opts = {}) def fetch_data catch_aws_errors do - @table = @aws.cloudwatch_client.describe_alarms(alarm_types: ['CompositeAlarm']).map do |table| + @table = @aws.cloudwatch_client.describe_alarms(alarm_types: ["CompositeAlarm"]).map do |table| table.composite_alarms.map { |table_name| { actions_enabled: table_name.actions_enabled, alarm_actions: table_name.alarm_actions, diff --git a/libraries/aws_cloudwatch_dashboard.rb b/libraries/aws_cloudwatch_dashboard.rb index 13e45fe88..b94f52d6d 100644 --- a/libraries/aws_cloudwatch_dashboard.rb +++ b/libraries/aws_cloudwatch_dashboard.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudwatchDashboard < AwsResourceBase - name 'aws_cloudwatch_dashboard ' - desc 'Returns the configuration information and metadata of the specified cloudwatch dashboard.' + name "aws_cloudwatch_dashboard " + desc "Returns the configuration information and metadata of the specified cloudwatch dashboard." example <<-EXAMPLE describe aws_cloudwatch_dashboard(dashboard_name: 'DASHBOARD_NAME') do it { should exist } diff --git a/libraries/aws_cloudwatch_dashboards.rb b/libraries/aws_cloudwatch_dashboards.rb index 81084e262..a5ac58aa7 100644 --- a/libraries/aws_cloudwatch_dashboards.rb +++ b/libraries/aws_cloudwatch_dashboards.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudwatchDashboards < AwsResourceBase - name 'aws_cloudwatch_dashboards' - desc 'Verifies settings for Cloudwatch Dashboard in bulk.' + name "aws_cloudwatch_dashboards" + desc "Verifies settings for Cloudwatch Dashboard in bulk." example <<-EXAMPLE describe aws_cloudwatch_dashboards do it { should exist } @@ -18,11 +18,11 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:dashboard_names, field: :dashboard_name) - .register_column(:dashboard_arns, field: :dashboard_arn) - .register_column(:last_modified, field: :last_modified) - .register_column(:sizes, field: :size) - .install_filter_methods_on_resource(self, :table) + .register_column(:dashboard_names, field: :dashboard_name) + .register_column(:dashboard_arns, field: :dashboard_arn) + .register_column(:last_modified, field: :last_modified) + .register_column(:sizes, field: :size) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_cloudwatch_insight_rules.rb b/libraries/aws_cloudwatch_insight_rules.rb index 9616561f7..9cfcd403b 100644 --- a/libraries/aws_cloudwatch_insight_rules.rb +++ b/libraries/aws_cloudwatch_insight_rules.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudwatchInsightRules < AwsResourceBase - name 'aws_cloudwatch_insight_rules' - desc 'Verifies settings for Cloudwatch insight rules in bulk.' + name "aws_cloudwatch_insight_rules" + desc "Verifies settings for Cloudwatch insight rules in bulk." example <<-EXAMPLE describe aws_cloudwatch_insight_rules do it { should exist } @@ -18,11 +18,11 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:names, field: :name) - .register_column(:states, field: :state) - .register_column(:schemas, field: :schema) - .register_column(:definitions, field: :definition) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:states, field: :state) + .register_column(:schemas, field: :schema) + .register_column(:definitions, field: :definition) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_cloudwatch_log_group.rb b/libraries/aws_cloudwatch_log_group.rb index 1282663dc..f35886711 100644 --- a/libraries/aws_cloudwatch_log_group.rb +++ b/libraries/aws_cloudwatch_log_group.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudWatchLogGroup < AwsResourceBase - name 'aws_cloudwatch_log_group' - desc 'Verifies settings for an AWS CloudWatch Log Group.' + name "aws_cloudwatch_log_group" + desc "Verifies settings for an AWS CloudWatch Log Group." example <<-EXAMPLE describe aws_cloudwatch_log_group(log_group_name: 'LOG_GROUP_NAME') do it { should exist } @@ -30,7 +30,7 @@ def initialize(opts = {}) return false if @log_groups.empty? - raise "Found multiple CloudWatch Log Groups. The following matched: #{@log_groups.join(', ')}. Try to restrict your resource criteria." if @log_groups.count > 1 + raise "Found multiple CloudWatch Log Groups. The following matched: #{@log_groups.join(", ")}. Try to restrict your resource criteria." if @log_groups.count > 1 @retention_in_days = @log_groups.first.retention_in_days @metric_filter_count = @log_groups.first.metric_filter_count diff --git a/libraries/aws_cloudwatch_log_metric_filter.rb b/libraries/aws_cloudwatch_log_metric_filter.rb index 39688db7a..6c01f6d17 100644 --- a/libraries/aws_cloudwatch_log_metric_filter.rb +++ b/libraries/aws_cloudwatch_log_metric_filter.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsCloudwatchLogMetricFilter < AwsResourceBase - name 'aws_cloudwatch_log_metric_filter' - desc 'Verifies individual Cloudwatch Log Metric Filters.' + name "aws_cloudwatch_log_metric_filter" + desc "Verifies individual Cloudwatch Log Metric Filters." example <<-EXAMPLE # Look for a Log Metric Filter. Results may be narrowed by a combination of filter name, log group name, or pattern. # If more than one Filter is returned, an error will be raised. @@ -36,7 +36,7 @@ def initialize(opts = {}) return false if @metric_filters.empty? if @metric_filters.count > 1 - raise 'More than one result was returned. Consider passing more parameters or a more specific pattern to narrow down results.' + raise "More than one result was returned. Consider passing more parameters or a more specific pattern to narrow down results." end @filter_name = @metric_filters.first.filter_name diff --git a/libraries/aws_cloudwatch_metric_stream.rb b/libraries/aws_cloudwatch_metric_stream.rb index d0b08464e..4c54d9f58 100644 --- a/libraries/aws_cloudwatch_metric_stream.rb +++ b/libraries/aws_cloudwatch_metric_stream.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudwatchMetricStream < AwsResourceBase - name 'aws_cloudwatch_metric_stream' - desc 'Returns the configuration information and metadata of the specified cloudwatch stream.' + name "aws_cloudwatch_metric_stream" + desc "Returns the configuration information and metadata of the specified cloudwatch stream." example <<-EXAMPLE describe aws_cloudwatch_metric_stream (metric_stream_name: 'METRIC_STREAM_NAME') do it { should exist } diff --git a/libraries/aws_cloudwatch_metric_streams.rb b/libraries/aws_cloudwatch_metric_streams.rb index 02015a0bf..b93573ede 100644 --- a/libraries/aws_cloudwatch_metric_streams.rb +++ b/libraries/aws_cloudwatch_metric_streams.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudwatchMetricStreams < AwsResourceBase - name 'aws_cloudwatch_metric_streams' - desc 'Returns a list of metric streams in this account.' + name "aws_cloudwatch_metric_streams" + desc "Returns a list of metric streams in this account." example <<-EXAMPLE describe aws_cloudwatch_metric_streams do it { should exist } @@ -18,14 +18,14 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:creation_date, field: :creation_date) - .register_column(:last_update_date, field: :last_update_date) - .register_column(:names, field: :name) - .register_column(:firehose_arns, field: :firehose_arn) - .register_column(:states, field: :state) - .register_column(:output_formats, field: :output_format) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:creation_date, field: :creation_date) + .register_column(:last_update_date, field: :last_update_date) + .register_column(:names, field: :name) + .register_column(:firehose_arns, field: :firehose_arn) + .register_column(:states, field: :state) + .register_column(:output_formats, field: :output_format) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_cloudwatchlogs_destinantion.rb b/libraries/aws_cloudwatchlogs_destinantion.rb index 81fb2481b..af41eaa22 100644 --- a/libraries/aws_cloudwatchlogs_destinantion.rb +++ b/libraries/aws_cloudwatchlogs_destinantion.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudWatchLogsDestination < AwsResourceBase - name 'aws_cloudwatchlogs_destination' - desc 'Describes a log destination.' + name "aws_cloudwatchlogs_destination" + desc "Describes a log destination." example <<-EXAMPLE describe aws_cloudwatchlogs_destination(destination_name_prefix: 'DESTINATION_NAME') do it { should exist } diff --git a/libraries/aws_cloudwatchlogs_destinantions.rb b/libraries/aws_cloudwatchlogs_destinantions.rb index c49e7f238..8e7b0bdd5 100644 --- a/libraries/aws_cloudwatchlogs_destinantions.rb +++ b/libraries/aws_cloudwatchlogs_destinantions.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudWatchLogsDestinations < AwsResourceBase - name 'aws_cloudwatchlogs_destinations' - desc 'Lists all cloudwatchlogs destinations.' + name "aws_cloudwatchlogs_destinations" + desc "Lists all cloudwatchlogs destinations." example <<-EXAMPLE describe aws_cloudwatchlogs_destinations do it { should exist } @@ -12,13 +12,13 @@ class AWSCloudWatchLogsDestinations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:destination_names, field: :destination_name) - .register_column(:target_arns, field: :target_arn) - .register_column(:role_arns, field: :role_arn) - .register_column(:access_policies, field: :access_policy) - .register_column(:arns, field: :arn) - .register_column(:creation_time, field: :creation_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:destination_names, field: :destination_name) + .register_column(:target_arns, field: :target_arn) + .register_column(:role_arns, field: :role_arn) + .register_column(:access_policies, field: :access_policy) + .register_column(:arns, field: :arn) + .register_column(:creation_time, field: :creation_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudwatchlogs_log_stream.rb b/libraries/aws_cloudwatchlogs_log_stream.rb index 4bfb0fb1c..59a4fb56f 100644 --- a/libraries/aws_cloudwatchlogs_log_stream.rb +++ b/libraries/aws_cloudwatchlogs_log_stream.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudWatchLogsLogStream < AwsResourceBase - name 'aws_cloudwatchlogs_log_stream' - desc 'Describes one or more of your logs Stream.' + name "aws_cloudwatchlogs_log_stream" + desc "Describes one or more of your logs Stream." example <<-EXAMPLE describe aws_cloudwatch_logs_log_stream(log_stream_name_prefix: 'LOG_STREAM_NAME', log_group_name: 'LOG_GROUP_NAME') do it { should exist } diff --git a/libraries/aws_cloudwatchlogs_log_streams.rb b/libraries/aws_cloudwatchlogs_log_streams.rb index 7b3ac169e..e0470015a 100644 --- a/libraries/aws_cloudwatchlogs_log_streams.rb +++ b/libraries/aws_cloudwatchlogs_log_streams.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudWatchLogsLogStreams < AwsResourceBase - name 'aws_cloudwatchlogs_log_streams' - desc 'Lists all Log Streams.' + name "aws_cloudwatchlogs_log_streams" + desc "Lists all Log Streams." example <<-EXAMPLE describe aws_cloudwatch_logs_log_streams(log_group_name: 'LOG_GROUP_NAME') do it { should exist } @@ -12,15 +12,15 @@ class AWSCloudWatchLogsLogStreams < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:log_stream_names, field: :log_stream_name) - .register_column(:creation_time, field: :creation_time) - .register_column(:first_event_timestamps, field: :first_event_timestamp) - .register_column(:last_event_timestamps, field: :last_event_timestamp) - .register_column(:last_ingestion_time, field: :last_ingestion_time) - .register_column(:upload_sequence_tokens, field: :upload_sequence_token) - .register_column(:arns, field: :arn) - .register_column(:stored_bytes, field: :stored_bytes) - .install_filter_methods_on_resource(self, :table) + .register_column(:log_stream_names, field: :log_stream_name) + .register_column(:creation_time, field: :creation_time) + .register_column(:first_event_timestamps, field: :first_event_timestamp) + .register_column(:last_event_timestamps, field: :last_event_timestamp) + .register_column(:last_ingestion_time, field: :last_ingestion_time) + .register_column(:upload_sequence_tokens, field: :upload_sequence_token) + .register_column(:arns, field: :arn) + .register_column(:stored_bytes, field: :stored_bytes) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cloudwatchlogs_subscription_filter.rb b/libraries/aws_cloudwatchlogs_subscription_filter.rb index e685be88d..975afcd49 100644 --- a/libraries/aws_cloudwatchlogs_subscription_filter.rb +++ b/libraries/aws_cloudwatchlogs_subscription_filter.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudWatchLogsSubscriptionFilter < AwsResourceBase - name 'aws_cloudwatchlogs_subscription_filter' - desc 'Describes single subscription filter.' + name "aws_cloudwatchlogs_subscription_filter" + desc "Describes single subscription filter." example <<-EXAMPLE describe aws_cloudwatchlogs_subscription_filter(log_group_name: 'LOG_GROUP_NAME', filter_name_prefix: 'FILTER_NAME') do it { should exist } diff --git a/libraries/aws_cloudwatchlogs_subscription_filters.rb b/libraries/aws_cloudwatchlogs_subscription_filters.rb index 510ce6a01..8aedf2b03 100644 --- a/libraries/aws_cloudwatchlogs_subscription_filters.rb +++ b/libraries/aws_cloudwatchlogs_subscription_filters.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCloudWatchLogsSubscriptionFilters < AwsResourceBase - name 'aws_cloudwatchlogs_subscription_filters' - desc 'Describes multiple subscription filter.' + name "aws_cloudwatchlogs_subscription_filters" + desc "Describes multiple subscription filter." example <<-EXAMPLE describe aws_cloudwatchlogs_subscription_filters(log_group_name: 'LOG_GROUP_NAME') do it { should exist } @@ -12,14 +12,14 @@ class AWSCloudWatchLogsSubscriptionFilters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:filter_names, field: :filter_name) - .register_column(:log_group_names, field: :log_group_name) - .register_column(:filter_patterns, field: :filter_pattern) - .register_column(:destination_arns, field: :destination_arn) - .register_column(:role_arns, field: :role_arn) - .register_column(:distributions, field: :distribution) - .register_column(:creation_time, field: :creation_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:filter_names, field: :filter_name) + .register_column(:log_group_names, field: :log_group_name) + .register_column(:filter_patterns, field: :filter_pattern) + .register_column(:destination_arns, field: :destination_arn) + .register_column(:role_arns, field: :role_arn) + .register_column(:distributions, field: :distribution) + .register_column(:creation_time, field: :creation_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cognito_identity_pool.rb b/libraries/aws_cognito_identity_pool.rb index cd7315dcc..c1ab07f71 100644 --- a/libraries/aws_cognito_identity_pool.rb +++ b/libraries/aws_cognito_identity_pool.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCognitoIdentityPool < AwsResourceBase - name 'aws_cognito_identity_pool' - desc 'Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users.' + name "aws_cognito_identity_pool" + desc "Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users." example <<-EXAMPLE describe aws_cognito_identity_pool(identity_pool_id: 'IDENTIRY_POOL_ID') do it { should exist } diff --git a/libraries/aws_cognito_identity_pools.rb b/libraries/aws_cognito_identity_pools.rb index 53e530de1..81b566ac2 100644 --- a/libraries/aws_cognito_identity_pools.rb +++ b/libraries/aws_cognito_identity_pools.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCognitoIdentityPools < AwsResourceBase - name 'aws_cognito_identity_pools' - desc 'Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users.' + name "aws_cognito_identity_pools" + desc "Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users." example <<-EXAMPLE describe aws_cognito_identity_pools do it { should exist } @@ -12,9 +12,9 @@ class AWSCognitoIdentityPools < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:identity_pool_ids, field: :identity_pool_id) - .register_column(:identity_pool_names, field: :identity_pool_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:identity_pool_ids, field: :identity_pool_id) + .register_column(:identity_pool_names, field: :identity_pool_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cognito_userpool.rb b/libraries/aws_cognito_userpool.rb index a66137a3a..6338a8f63 100644 --- a/libraries/aws_cognito_userpool.rb +++ b/libraries/aws_cognito_userpool.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCognitoUserPool < AwsResourceBase - name 'aws_cognito_userpool' - desc 'Returns the configuration information and metadata of the specified user pool.' + name "aws_cognito_userpool" + desc "Returns the configuration information and metadata of the specified user pool." example <<-EXAMPLE describe aws_cognito_userpool(user_pool_id: 'USER_POOL_ID') do it { should exist } diff --git a/libraries/aws_cognito_userpool_client.rb b/libraries/aws_cognito_userpool_client.rb index de7fdf576..5d2d907c5 100644 --- a/libraries/aws_cognito_userpool_client.rb +++ b/libraries/aws_cognito_userpool_client.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCognitoUserPoolClient < AwsResourceBase - name 'aws_cognito_userpool_client' - desc 'Client method for returning the configuration information and metadata of the specified user pool app client.' + name "aws_cognito_userpool_client" + desc "Client method for returning the configuration information and metadata of the specified user pool app client." example <<-EXAMPLE describe aws_cognito_userpool_client(user_pool_id: 'USER_POOL_ID', client_id: 'CLIENT_ID') do it { should exist } diff --git a/libraries/aws_cognito_userpool_clients.rb b/libraries/aws_cognito_userpool_clients.rb index 941007adb..581be4063 100644 --- a/libraries/aws_cognito_userpool_clients.rb +++ b/libraries/aws_cognito_userpool_clients.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCognitoUserPoolClients < AwsResourceBase - name 'aws_cognito_userpool_clients' - desc 'Lists the clients that have been created for the specified user pool.' + name "aws_cognito_userpool_clients" + desc "Lists the clients that have been created for the specified user pool." example <<-EXAMPLE describe aws_cognito_userpool_clients(user_pool_id: 'USER_POOL_ID') do its('count') { should eq 3 } @@ -12,10 +12,10 @@ class AWSCognitoUserPoolClients < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:client_ids, field: :client_id) - .register_column(:user_pool_ids, field: :user_pool_id) - .register_column(:client_names, field: :client_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:client_ids, field: :client_id) + .register_column(:user_pool_ids, field: :user_pool_id) + .register_column(:client_names, field: :client_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_cognito_userpools.rb b/libraries/aws_cognito_userpools.rb index a63ffbe83..18d36365f 100644 --- a/libraries/aws_cognito_userpools.rb +++ b/libraries/aws_cognito_userpools.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSCognitoUserPools < AwsResourceBase - name 'aws_cognito_userpools' - desc 'Lists the user pools associated with an AWS account.' + name "aws_cognito_userpools" + desc "Lists the user pools associated with an AWS account." example <<-EXAMPLE describe aws_cognito_userpools do it { should exist } @@ -12,13 +12,13 @@ class AWSCognitoUserPools < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:lambda_configs, field: :lambda_config) - .register_column(:statuses, field: :status) - .register_column(:last_modified_dates, field: :last_modified_date) - .register_column(:creation_dates, field: :creation_date) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:lambda_configs, field: :lambda_config) + .register_column(:statuses, field: :status) + .register_column(:last_modified_dates, field: :last_modified_date) + .register_column(:creation_dates, field: :creation_date) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_config_delivery_channel.rb b/libraries/aws_config_delivery_channel.rb index c13c4fd89..9f33e5cdf 100644 --- a/libraries/aws_config_delivery_channel.rb +++ b/libraries/aws_config_delivery_channel.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsConfigDeliveryChannel < AwsResourceBase - name 'aws_config_delivery_channel' - desc 'Verifies settings for AWS Config Delivery Channel.' + name "aws_config_delivery_channel" + desc "Verifies settings for AWS Config Delivery Channel." example <<-EXAMPLE describe aws_config_delivery_channel do it { should exist } @@ -34,11 +34,11 @@ def initialize(opts = {}) @sns_topic_arn = channel[:sns_topic_arn] @delivery_frequency_in_hours = channel.dig(:config_snapshot_delivery_properties, :delivery_frequency) frequencies = { - 'One_Hour' => 1, - 'TwentyFour_Hours' => 24, - 'Three_Hours' => 3, - 'Six_Hours' => 6, - 'Twelve_Hours' => 12, + "One_Hour" => 1, + "TwentyFour_Hours" => 24, + "Three_Hours" => 3, + "Six_Hours" => 6, + "Twelve_Hours" => 12, } @delivery_frequency_in_hours = frequencies[@delivery_frequency_in_hours] end diff --git a/libraries/aws_config_recorder.rb b/libraries/aws_config_recorder.rb index 28fff92f0..ea7c3b1a7 100644 --- a/libraries/aws_config_recorder.rb +++ b/libraries/aws_config_recorder.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsConfigurationRecorder < AwsResourceBase - name 'aws_config_recorder' - desc 'Verifies settings for AWS Configuration Recorder.' + name "aws_config_recorder" + desc "Verifies settings for AWS Configuration Recorder." example <<-EXAMPLE describe aws_config_recorder('CONFIG_RECORDER_NAME') do it { should exist } diff --git a/libraries/aws_db_parameter_group.rb b/libraries/aws_db_parameter_group.rb index 5b8d921a2..88d459c36 100644 --- a/libraries/aws_db_parameter_group.rb +++ b/libraries/aws_db_parameter_group.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsDbParameterGroup < AwsResourceBase - name 'aws_db_parameter_group' - desc 'Verifies settings for a Parameter Group.' + name "aws_db_parameter_group" + desc "Verifies settings for a Parameter Group." example <<-EXAMPLE describe aws_db_parameter_group(db_parameter_group_name: 'DB_PARAMETER_GROUP_NAME') do it { should exist } diff --git a/libraries/aws_db_parameter_groups.rb b/libraries/aws_db_parameter_groups.rb index d3170abf6..2a7a7b6ef 100644 --- a/libraries/aws_db_parameter_groups.rb +++ b/libraries/aws_db_parameter_groups.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsDbParameterGroups < AwsResourceBase - name 'aws_db_parameter_groups' - desc 'Verifies settings for a Parameter Group in bulk.' + name "aws_db_parameter_groups" + desc "Verifies settings for a Parameter Group in bulk." example <<-EXAMPLE describe aws_db_parameter_groups do it { should exist } @@ -12,11 +12,11 @@ class AwsDbParameterGroups < AwsResourceBase attr_reader :table, :api_response FilterTable.create - .register_column(:db_parameter_group_names, field: :db_parameter_group_name) - .register_column(:db_parameter_group_families, field: :db_parameter_group_family) - .register_column(:descriptions, field: :description) - .register_column(:db_parameter_group_arns, field: :db_parameter_group_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:db_parameter_group_names, field: :db_parameter_group_name) + .register_column(:db_parameter_group_families, field: :db_parameter_group_family) + .register_column(:descriptions, field: :description) + .register_column(:db_parameter_group_arns, field: :db_parameter_group_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_db_subnet_group.rb b/libraries/aws_db_subnet_group.rb index d13e683aa..088b16596 100644 --- a/libraries/aws_db_subnet_group.rb +++ b/libraries/aws_db_subnet_group.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsDbSubnetGroup < AwsResourceBase - name 'aws_db_subnet_group' - desc 'Verifies settings for a Subnet Group.' + name "aws_db_subnet_group" + desc "Verifies settings for a Subnet Group." example <<-EXAMPLE describe aws_subnet_group(db_subnet_group_name: 'DB_SUBNET_GROUP_NAME') do it { should exist } diff --git a/libraries/aws_db_subnet_groups.rb b/libraries/aws_db_subnet_groups.rb index b05c31262..56373f772 100644 --- a/libraries/aws_db_subnet_groups.rb +++ b/libraries/aws_db_subnet_groups.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsDbSubnetGroups < AwsResourceBase - name 'aws_db_subnet_groups' - desc 'Verifies settings for a Subnet Group in bulk.' + name "aws_db_subnet_groups" + desc "Verifies settings for a Subnet Group in bulk." example <<-EXAMPLE describe aws_db_subnet_groups do it { should exist } @@ -12,13 +12,13 @@ class AwsDbSubnetGroups < AwsResourceBase attr_reader :table, :subnet_rows, :api_response FilterTable.create - .register_column(:db_subnet_group_names, field: :db_subnet_group_name) - .register_column(:db_subnet_group_descriptions, field: :db_subnet_group_description) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:subnet_group_status, field: :subnet_group_status) - .register_column(:subnets, field: :subnets) - .register_column(:db_subnet_group_arns, field: :db_subnet_group_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:db_subnet_group_names, field: :db_subnet_group_name) + .register_column(:db_subnet_group_descriptions, field: :db_subnet_group_description) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:subnet_group_status, field: :subnet_group_status) + .register_column(:subnets, field: :subnets) + .register_column(:db_subnet_group_arns, field: :db_subnet_group_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_dhcp_options.rb b/libraries/aws_dhcp_options.rb index 5dd82abb1..cb6cbec5e 100644 --- a/libraries/aws_dhcp_options.rb +++ b/libraries/aws_dhcp_options.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsDhcpOptions < AwsResourceBase - name 'aws_dhcp_options' - desc 'Verifies settings for an AWS DHCP Options.' + name "aws_dhcp_options" + desc "Verifies settings for an AWS DHCP Options." example <<-EXAMPLE describe aws_dhcp_options(dhcp_options_id: 'DHCP_OPTIONS_ID) do it { should exist } @@ -20,7 +20,7 @@ def initialize(opts = {}) end @display_name = opts[:dhcp_options_id] - filter = { name: 'dhcp-options-id', values: [opts[:dhcp_options_id]] } + filter = { name: "dhcp-options-id", values: [opts[:dhcp_options_id]] } catch_aws_errors do resp = @aws.compute_client.describe_dhcp_options({ filters: [filter] }) @@ -34,11 +34,11 @@ def exists? end def domain_name_servers - _dhcp_config('domain-name-servers') + _dhcp_config("domain-name-servers") end def ntp_servers - _dhcp_config('ntp-servers') + _dhcp_config("ntp-servers") end def resource_id @@ -58,7 +58,7 @@ def _dhcp_config(key) end def deprecation_notice - 'DEPRECATION: `aws_dhcp_options` will be deprecated soon and it is advised to switch to the new resource `aws_ec2_dhcp_option`. '\ - 'Please see the documentation for the additional features available.' + "DEPRECATION: `aws_dhcp_options` will be deprecated soon and it is advised to switch to the new resource `aws_ec2_dhcp_option`. "\ + "Please see the documentation for the additional features available." end end diff --git a/libraries/aws_dms_endpoint.rb b/libraries/aws_dms_endpoint.rb index 0a3e8e7dc..7126198ef 100644 --- a/libraries/aws_dms_endpoint.rb +++ b/libraries/aws_dms_endpoint.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSDMSEndpoint < AwsResourceBase - name 'aws_dms_endpoint' - desc 'Returns information about the endpoints for your account in the current region.' + name "aws_dms_endpoint" + desc "Returns information about the endpoints for your account in the current region." example <<-EXAMPLE describe aws_dms_endpoint(endpoint_arn: 'DMS_ENDPOINT_ARN') do it { should exist } @@ -17,7 +17,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: endpoint_arn must be provided" unless opts[:endpoint_arn] && !opts[:endpoint_arn].empty? @display_name = opts[:endpoint_arn] - filter = { name: 'endpoint-arn', values: [opts[:endpoint_arn]] } + filter = { name: "endpoint-arn", values: [opts[:endpoint_arn]] } catch_aws_errors do resp = @aws.dmsmigrationservice_client.describe_endpoints({ filters: [filter] }) @endpoints = resp.endpoints[0].to_h diff --git a/libraries/aws_dms_endpoints.rb b/libraries/aws_dms_endpoints.rb index 66b0c16a2..5d8b1bdad 100644 --- a/libraries/aws_dms_endpoints.rb +++ b/libraries/aws_dms_endpoints.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSDMSEndpoints < AwsResourceBase - name 'aws_dms_endpoints' - desc 'Returns information about the endpoints for your account in the current region.' + name "aws_dms_endpoints" + desc "Returns information about the endpoints for your account in the current region." example <<-EXAMPLE describe aws_dms_endpoints do it { should exist } @@ -12,40 +12,40 @@ class AWSDMSEndpoints < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:endpoint_identifiers, field: :endpoint_identifier) - .register_column(:endpoint_types, field: :endpoint_type) - .register_column(:engine_names, field: :engine_name) - .register_column(:engine_display_names, field: :engine_display_name) - .register_column(:usernames, field: :username) - .register_column(:server_names, field: :server_name) - .register_column(:ports, field: :port) - .register_column(:database_names, field: :database_name) - .register_column(:extra_connection_attributes, field: :extra_connection_attributes) - .register_column(:statuses, field: :status) - .register_column(:kms_key_ids, field: :kms_key_id) - .register_column(:endpoint_arns, field: :endpoint_arn) - .register_column(:certificate_arns, field: :certificate_arn) - .register_column(:ssl_modes, field: :ssl_mode) - .register_column(:service_access_role_arns, field: :service_access_role_arn) - .register_column(:external_table_definitions, field: :external_table_definition) - .register_column(:external_ids, field: :external_id) - .register_column(:dynamo_db_settings, field: :dynamo_db_settings) - .register_column(:s3_settings, field: :s3_settings) - .register_column(:dms_transfer_settings, field: :dms_transfer_settings) - .register_column(:mongo_db_settings, field: :mongo_db_settings) - .register_column(:kinesis_settings, field: :kinesis_settings) - .register_column(:kafka_settings, field: :kafka_settings) - .register_column(:elasticsearch_settings, field: :elasticsearch_settings) - .register_column(:neptune_settings, field: :neptune_settings) - .register_column(:redshift_settings, field: :redshift_settings) - .register_column(:postgre_sql_settings, field: :postgre_sql_settings) - .register_column(:my_sql_settings, field: :my_sql_settings) - .register_column(:oracle_settings, field: :oracle_settings) - .register_column(:sybase_settings, field: :sybase_settings) - .register_column(:microsoft_sql_server_settings, field: :microsoft_sql_server_settings) - .register_column(:ibm_db_2_settings, field: :ibm_db_2_settings) - .register_column(:doc_db_settings, field: :doc_db_settings) - .install_filter_methods_on_resource(self, :table) + .register_column(:endpoint_identifiers, field: :endpoint_identifier) + .register_column(:endpoint_types, field: :endpoint_type) + .register_column(:engine_names, field: :engine_name) + .register_column(:engine_display_names, field: :engine_display_name) + .register_column(:usernames, field: :username) + .register_column(:server_names, field: :server_name) + .register_column(:ports, field: :port) + .register_column(:database_names, field: :database_name) + .register_column(:extra_connection_attributes, field: :extra_connection_attributes) + .register_column(:statuses, field: :status) + .register_column(:kms_key_ids, field: :kms_key_id) + .register_column(:endpoint_arns, field: :endpoint_arn) + .register_column(:certificate_arns, field: :certificate_arn) + .register_column(:ssl_modes, field: :ssl_mode) + .register_column(:service_access_role_arns, field: :service_access_role_arn) + .register_column(:external_table_definitions, field: :external_table_definition) + .register_column(:external_ids, field: :external_id) + .register_column(:dynamo_db_settings, field: :dynamo_db_settings) + .register_column(:s3_settings, field: :s3_settings) + .register_column(:dms_transfer_settings, field: :dms_transfer_settings) + .register_column(:mongo_db_settings, field: :mongo_db_settings) + .register_column(:kinesis_settings, field: :kinesis_settings) + .register_column(:kafka_settings, field: :kafka_settings) + .register_column(:elasticsearch_settings, field: :elasticsearch_settings) + .register_column(:neptune_settings, field: :neptune_settings) + .register_column(:redshift_settings, field: :redshift_settings) + .register_column(:postgre_sql_settings, field: :postgre_sql_settings) + .register_column(:my_sql_settings, field: :my_sql_settings) + .register_column(:oracle_settings, field: :oracle_settings) + .register_column(:sybase_settings, field: :sybase_settings) + .register_column(:microsoft_sql_server_settings, field: :microsoft_sql_server_settings) + .register_column(:ibm_db_2_settings, field: :ibm_db_2_settings) + .register_column(:doc_db_settings, field: :doc_db_settings) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_dms_replication_instance.rb b/libraries/aws_dms_replication_instance.rb index 11e868c4e..9da08ff43 100644 --- a/libraries/aws_dms_replication_instance.rb +++ b/libraries/aws_dms_replication_instance.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSDMSReplicationInstance < AwsResourceBase - name 'aws_dms_replication_instance' - desc 'Returns information about the replication instance types that can be created in the specified region.' + name "aws_dms_replication_instance" + desc "Returns information about the replication instance types that can be created in the specified region." example <<-EXAMPLE describe aws_dms_replication_instance do it { should exist } @@ -20,7 +20,7 @@ def initialize(opts = {}) end def resource_id - "#{@orderable_replication_instances? @orderable_replication_instances[:replication_instance_class]: ''}_#{@orderable_replication_instances? @orderable_replication_instances[:engine_version]: ''}" + "#{@orderable_replication_instances? @orderable_replication_instances[:replication_instance_class]: ""}_#{@orderable_replication_instances? @orderable_replication_instances[:engine_version]: ""}" end def replication_instance_class diff --git a/libraries/aws_dms_replication_instances.rb b/libraries/aws_dms_replication_instances.rb index 8eb78bfb4..98a885021 100644 --- a/libraries/aws_dms_replication_instances.rb +++ b/libraries/aws_dms_replication_instances.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSDMSReplicationInstances < AwsResourceBase - name 'aws_dms_replication_instances' - desc 'Returns information about the replication instance types that can be created in the specified region.' + name "aws_dms_replication_instances" + desc "Returns information about the replication instance types that can be created in the specified region." example <<-EXAMPLE describe aws_dms_replication_instances do it { should exist } @@ -12,16 +12,16 @@ class AWSDMSReplicationInstances < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:engine_versions, field: :engine_version) - .register_column(:replication_instance_classes, field: :replication_instance_class) - .register_column(:storage_types, field: :storage_type) - .register_column(:min_allocated_storages, field: :min_allocated_storage) - .register_column(:max_allocated_storages, field: :max_allocated_storage) - .register_column(:default_allocated_storages, field: :default_allocated_storage) - .register_column(:included_allocated_storages, field: :included_allocated_storage) - .register_column(:availability_zones, field: :availability_zones) - .register_column(:release_statuses, field: :release_status) - .install_filter_methods_on_resource(self, :table) + .register_column(:engine_versions, field: :engine_version) + .register_column(:replication_instance_classes, field: :replication_instance_class) + .register_column(:storage_types, field: :storage_type) + .register_column(:min_allocated_storages, field: :min_allocated_storage) + .register_column(:max_allocated_storages, field: :max_allocated_storage) + .register_column(:default_allocated_storages, field: :default_allocated_storage) + .register_column(:included_allocated_storages, field: :included_allocated_storage) + .register_column(:availability_zones, field: :availability_zones) + .register_column(:release_statuses, field: :release_status) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_dms_replication_subnet_group.rb b/libraries/aws_dms_replication_subnet_group.rb index 4becc12dc..c8337ce4c 100644 --- a/libraries/aws_dms_replication_subnet_group.rb +++ b/libraries/aws_dms_replication_subnet_group.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSDMSReplicationSubnetGroup < AwsResourceBase - name 'aws_dms_replication_subnet_group' - desc 'Returns information about the replication subnet groups.' + name "aws_dms_replication_subnet_group" + desc "Returns information about the replication subnet groups." example <<-EXAMPLE describe aws_dms_replication_subnet_group(replication_subnet_group_identifier: 'REPLICATION_SUBNET_GROUP_IDENTIFIER') do it { should exits } @@ -20,7 +20,7 @@ def initialize(opts = {}) { filters: [ { - name: 'replication-subnet-group-id', + name: "replication-subnet-group-id", values: [opts[:replication_subnet_group_identifier]], }, ], diff --git a/libraries/aws_dms_replication_subnet_groups.rb b/libraries/aws_dms_replication_subnet_groups.rb index f2c2ec96a..b40c20d57 100644 --- a/libraries/aws_dms_replication_subnet_groups.rb +++ b/libraries/aws_dms_replication_subnet_groups.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSDMSReplicationSubnetGroups < AwsResourceBase - name 'aws_dms_replication_subnet_groups' - desc 'Returns information about the replication subnet groups.' + name "aws_dms_replication_subnet_groups" + desc "Returns information about the replication subnet groups." example <<-EXAMPLE describe aws_dms_replication_subnet_groups do it { should exist } @@ -12,12 +12,12 @@ class AWSDMSReplicationSubnetGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:replication_subnet_group_identifiers, field: :replication_subnet_group_identifier) - .register_column(:replication_subnet_group_descriptions, field: :replication_subnet_group_description) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:subnet_group_statuses, field: :subnet_group_status) - .register_column(:subnets, field: :subnets) - .install_filter_methods_on_resource(self, :table) + .register_column(:replication_subnet_group_identifiers, field: :replication_subnet_group_identifier) + .register_column(:replication_subnet_group_descriptions, field: :replication_subnet_group_description) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:subnet_group_statuses, field: :subnet_group_status) + .register_column(:subnets, field: :subnets) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_dynamodb_table.rb b/libraries/aws_dynamodb_table.rb index 5c9cfe3dd..f4c1abab8 100644 --- a/libraries/aws_dynamodb_table.rb +++ b/libraries/aws_dynamodb_table.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsDynamoDbTable < AwsResourceBase - name 'aws_dynamodb_table' - desc 'Verifies the settings for a DynamoDB table.' + name "aws_dynamodb_table" + desc "Verifies the settings for a DynamoDB table." example <<-EXAMPLE describe aws_dynamodb_table(table_name: 'DYNAMODB_TABLE_NAME') do it { should exist } @@ -29,7 +29,7 @@ def initialize(opts = {}) @table_name = @dynamodb_table[:table_name] @table_status = @dynamodb_table[:table_status] @table_arn = @dynamodb_table[:table_arn] - @creation_date = @dynamodb_table[:creation_date_time].strftime('%m/%d/%Y') + @creation_date = @dynamodb_table[:creation_date_time].strftime("%m/%d/%Y") @number_of_decreases_today = @dynamodb_table[:provisioned_throughput][:number_of_decreases_today] @write_capacity_units = @dynamodb_table[:provisioned_throughput][:write_capacity_units] @read_capacity_units = @dynamodb_table[:provisioned_throughput][:read_capacity_units] @@ -68,7 +68,7 @@ def resource_id end def encrypted? - @dynamodb_table.dig(:sse_description, :status)&.upcase == 'ENABLED' || false + @dynamodb_table.dig(:sse_description, :status)&.upcase == "ENABLED" || false end def exists? diff --git a/libraries/aws_dynamodb_tables.rb b/libraries/aws_dynamodb_tables.rb index 3f8053dab..05a7f4b08 100644 --- a/libraries/aws_dynamodb_tables.rb +++ b/libraries/aws_dynamodb_tables.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsDynamoDbTables < AwsResourceBase - name 'aws_dynamodb_tables' - desc 'Verifies settings for a DynamoDB table in bulk.' + name "aws_dynamodb_tables" + desc "Verifies settings for a DynamoDB table in bulk." example <<-EXAMPLE describe aws_dynamodb_tables do it { should exist } @@ -19,8 +19,8 @@ class AwsDynamoDbTables < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:table_names, field: :table_names) - .install_filter_methods_on_resource(self, :table) + .register_column(:table_names, field: :table_names) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ebs_snapshot.rb b/libraries/aws_ebs_snapshot.rb index a9789ef87..2be593f1c 100644 --- a/libraries/aws_ebs_snapshot.rb +++ b/libraries/aws_ebs_snapshot.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEbsSnapshot < AwsResourceBase - name 'aws_ebs_snapshot' - desc 'Verifies settings for an EBS snapshot.' + name "aws_ebs_snapshot" + desc "Verifies settings for an EBS snapshot." example <<-EXAMPLE describe aws_ebs_snapshot('SNAPSHOT_ID') do it { should_not be_public } @@ -51,7 +51,7 @@ def exists? end def public? - (@group == 'all') + (@group == "all") end def private? @@ -76,7 +76,7 @@ def fetch_snapshot_properties if opts[:snapshot_id] && !opts[:snapshot_id].empty? snapshot_arguments = { snapshot_ids: [opts[:snapshot_id]] } elsif opts[:name] && !opts[:name].empty? - snapshot_arguments = { filters: [{ name: 'tag:Name', values: [opts[:name]] }] } + snapshot_arguments = { filters: [{ name: "tag:Name", values: [opts[:name]] }] } end catch_aws_errors do @@ -90,7 +90,7 @@ def fetch_snapshot_properties # Getting snapshot's attribute required for checking its accessiblility (using createVolumePermission) - public/private catch_aws_errors do @resp_snapshot_attributes = @aws.compute_client.describe_snapshot_attribute( - attribute: 'createVolumePermission', + attribute: "createVolumePermission", snapshot_id: @snapshot_id, ) @snapshot_attributes_hash = @resp_snapshot_attributes.to_h @@ -99,7 +99,7 @@ def fetch_snapshot_properties @group = nil @user_ids = [] @create_volume_permissions.each do |perms| - @group = 'all' if perms[:group] == 'all' + @group = "all" if perms[:group] == "all" @user_ids << perms[:user_id] unless perms[:user_id].nil? end end diff --git a/libraries/aws_ebs_snapshots.rb b/libraries/aws_ebs_snapshots.rb index 92513e602..3a063ba4c 100644 --- a/libraries/aws_ebs_snapshots.rb +++ b/libraries/aws_ebs_snapshots.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEbsSnapshots < AwsResourceBase - name 'aws_ebs_snapshots' - desc 'Verifies settings for a collection of AWS EBS Snapshots.' + name "aws_ebs_snapshots" + desc "Verifies settings for a collection of AWS EBS Snapshots." example <<-EXAMPLE describe aws_ebs_snapshots do it { should exist } @@ -12,11 +12,11 @@ class AwsEbsSnapshots < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:snapshot_ids, field: :snapshot_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:encrypted, field: :encrypted) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:snapshot_ids, field: :snapshot_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:encrypted, field: :encrypted) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ebs_volume.rb b/libraries/aws_ebs_volume.rb index 04112b9a6..cea84b9da 100644 --- a/libraries/aws_ebs_volume.rb +++ b/libraries/aws_ebs_volume.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEbsVolume < AwsResourceBase - name 'aws_ebs_volume' - desc 'Verifies settings for an EBS volume.' + name "aws_ebs_volume" + desc "Verifies settings for an EBS volume." example <<-EXAMPLE describe aws_ebs_volume('EBS_VOLUME_ID') do it { should be_encrypted } @@ -26,7 +26,7 @@ def initialize(opts = {}) volume_arguments = { volume_ids: [opts[:volume_id]] } elsif opts[:name] && !opts[:name].empty? @display_name = opts[:name] - filter = { name: 'tag:Name', values: [opts[:name]] } + filter = { name: "tag:Name", values: [opts[:name]] } volume_arguments = { filters: [filter] } else raise ArgumentError, "#{@__resource_name__}: `volume_id` or `name` must be provided" diff --git a/libraries/aws_ebs_volumes.rb b/libraries/aws_ebs_volumes.rb index 7a97f7073..754b835e6 100644 --- a/libraries/aws_ebs_volumes.rb +++ b/libraries/aws_ebs_volumes.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEbsVolumes < AwsResourceBase - name 'aws_ebs_volumes' - desc 'Verifies settings for a collection of AWS EBS Volumes.' + name "aws_ebs_volumes" + desc "Verifies settings for a collection of AWS EBS Volumes." example <<-EXAMPLE describe aws_ebs_volumes do it { should exist } @@ -12,22 +12,22 @@ class AwsEbsVolumes < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:attachments, field: :attachments) - .register_column(:availability_zones, field: :availability_zone) - .register_column(:create_times, field: :create_time) - .register_column(:encrypted, field: :encrypted) - .register_column(:kms_key_ids, field: :kms_key_id) - .register_column(:outpost_arns, field: :outpost_arn) - .register_column(:sizes, field: :size) - .register_column(:snapshot_ids, field: :snapshot_id) - .register_column(:states, field: :state) - .register_column(:volume_ids, field: :volume_id) - .register_column(:iops, field: :iops) - .register_column(:tags, field: :tags) - .register_column(:volume_types, field: :volume_type) - .register_column(:fast_restored, field: :fast_restored) - .register_column(:multi_attach_enabled, field: :multi_attach_enabled) - .install_filter_methods_on_resource(self, :table) + .register_column(:attachments, field: :attachments) + .register_column(:availability_zones, field: :availability_zone) + .register_column(:create_times, field: :create_time) + .register_column(:encrypted, field: :encrypted) + .register_column(:kms_key_ids, field: :kms_key_id) + .register_column(:outpost_arns, field: :outpost_arn) + .register_column(:sizes, field: :size) + .register_column(:snapshot_ids, field: :snapshot_id) + .register_column(:states, field: :state) + .register_column(:volume_ids, field: :volume_id) + .register_column(:iops, field: :iops) + .register_column(:tags, field: :tags) + .register_column(:volume_types, field: :volume_type) + .register_column(:fast_restored, field: :fast_restored) + .register_column(:multi_attach_enabled, field: :multi_attach_enabled) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_capacity_reservation.rb b/libraries/aws_ec2_capacity_reservation.rb index 2a532c1cd..862a99dd5 100644 --- a/libraries/aws_ec2_capacity_reservation.rb +++ b/libraries/aws_ec2_capacity_reservation.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2CapacityReservation < AwsResourceBase - name 'aws_ec2_capacity_reservation' - desc 'Describes one Capacity Reservations.' + name "aws_ec2_capacity_reservation" + desc "Describes one Capacity Reservations." example <<-EXAMPLE describe aws_ec2_capacity_reservation(capacity_reservation_id: 'CAPACITY_RESERVATION_ID') do it { should exist } diff --git a/libraries/aws_ec2_capacity_reservations.rb b/libraries/aws_ec2_capacity_reservations.rb index 5f32ed139..c135c40a8 100644 --- a/libraries/aws_ec2_capacity_reservations.rb +++ b/libraries/aws_ec2_capacity_reservations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2CapacityReservations < AwsResourceBase - name 'aws_ec2_capacity_reservations' - desc 'Describes one or more of your Capacity Reservations.' + name "aws_ec2_capacity_reservations" + desc "Describes one or more of your Capacity Reservations." example <<-EXAMPLE describe aws_ec2_capacity_reservations do it { should exist } @@ -12,27 +12,27 @@ class AWSEC2CapacityReservations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:capacity_reservation_ids, field: :capacity_reservation_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:capacity_reservation_arns, field: :capacity_reservation_arn) - .register_column(:availability_zone_ids, field: :availability_zone_id) - .register_column(:instance_types, field: :instance_type) - .register_column(:instance_platforms, field: :instance_platform) - .register_column(:availability_zones, field: :availability_zone) - .register_column(:tenancies, field: :tenancy) - .register_column(:total_instance_counts, field: :total_instance_count) - .register_column(:available_instance_counts, field: :available_instance_count) - .register_column(:ebs_optimized, field: :ebs_optimized) - .register_column(:ephemeral_storages, field: :ephemeral_storage) - .register_column(:states, field: :state) - .register_column(:start_dates, field: :start_date) - .register_column(:end_dates, field: :end_date) - .register_column(:end_date_types, field: :end_date_type) - .register_column(:instance_match_criterias, field: :instance_match_criteria) - .register_column(:create_dates, field: :create_date) - .register_column(:tags, field: :tags) - .register_column(:outpost_arns, field: :outpost_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:capacity_reservation_ids, field: :capacity_reservation_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:capacity_reservation_arns, field: :capacity_reservation_arn) + .register_column(:availability_zone_ids, field: :availability_zone_id) + .register_column(:instance_types, field: :instance_type) + .register_column(:instance_platforms, field: :instance_platform) + .register_column(:availability_zones, field: :availability_zone) + .register_column(:tenancies, field: :tenancy) + .register_column(:total_instance_counts, field: :total_instance_count) + .register_column(:available_instance_counts, field: :available_instance_count) + .register_column(:ebs_optimized, field: :ebs_optimized) + .register_column(:ephemeral_storages, field: :ephemeral_storage) + .register_column(:states, field: :state) + .register_column(:start_dates, field: :start_date) + .register_column(:end_dates, field: :end_date) + .register_column(:end_date_types, field: :end_date_type) + .register_column(:instance_match_criterias, field: :instance_match_criteria) + .register_column(:create_dates, field: :create_date) + .register_column(:tags, field: :tags) + .register_column(:outpost_arns, field: :outpost_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_carrier_gateway.rb b/libraries/aws_ec2_carrier_gateway.rb index f318b443d..fde5c8716 100644 --- a/libraries/aws_ec2_carrier_gateway.rb +++ b/libraries/aws_ec2_carrier_gateway.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2CarrierGateway < AwsResourceBase - name 'aws_ec2_carrier_gateway' - desc 'Describes single carrier gateway.' + name "aws_ec2_carrier_gateway" + desc "Describes single carrier gateway." example <<-EXAMPLE describe aws_ec2_carrier_gateway(carrier_gateway_id: 'CARRIER_GATEWAY_ID') do it { should exist } diff --git a/libraries/aws_ec2_carrier_gateways.rb b/libraries/aws_ec2_carrier_gateways.rb index 15703b2c9..649f8524c 100644 --- a/libraries/aws_ec2_carrier_gateways.rb +++ b/libraries/aws_ec2_carrier_gateways.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2CarrierGateways < AwsResourceBase - name 'aws_ec2_carrier_gateways' - desc 'Describes multiple carrier gateways.' + name "aws_ec2_carrier_gateways" + desc "Describes multiple carrier gateways." example <<-EXAMPLE describe aws_ec2_carrier_gateways do it { should exist } @@ -12,12 +12,12 @@ class AWSEC2CarrierGateways < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:carrier_gateway_ids, field: :carrier_gateway_id) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:states, field: :state) - .register_column(:owner_ids, field: :owner_id) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:carrier_gateway_ids, field: :carrier_gateway_id) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:states, field: :state) + .register_column(:owner_ids, field: :owner_id) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_client_vpn_authorization_rule.rb b/libraries/aws_ec2_client_vpn_authorization_rule.rb index fa3973537..056349862 100644 --- a/libraries/aws_ec2_client_vpn_authorization_rule.rb +++ b/libraries/aws_ec2_client_vpn_authorization_rule.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2ClientVPNAuthorizationRule < AwsResourceBase - name 'aws_ec2_client_vpn_authorization_rule' - desc 'Describes a VPN authorization rule.' + name "aws_ec2_client_vpn_authorization_rule" + desc "Describes a VPN authorization rule." example <<-EXAMPLE describe aws_ec2_client_vpn_authorization_rule(client_vpn_endpoint_id: 'CLIENT_VPN_ENDPOINT_ID', group_id: 'GROUP_ID') do it { should exist } @@ -16,7 +16,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: client_vpn_endpoint_id must be provided" unless opts[:client_vpn_endpoint_id] && !opts[:client_vpn_endpoint_id].empty? raise ArgumentError, "#{@__resource_name__}: group_id must be provided" unless opts[:group_id] && !opts[:group_id].empty? @display_name = opts[:client_vpn_endpoint_id] - filter = [{ name: 'group-id', + filter = [{ name: "group-id", values: [opts[:group_id]] }] catch_aws_errors do resp = @aws.compute_client.describe_client_vpn_authorization_rules({ client_vpn_endpoint_id: opts[:client_vpn_endpoint_id], filters: filter }) @@ -35,7 +35,7 @@ def exists? end def resource_id - "#{@res ? @res[:client_vpn_endpoint_id] : ''}_#{@res ? @res[:group_id] : ''}" + "#{@res ? @res[:client_vpn_endpoint_id] : ""}_#{@res ? @res[:group_id] : ""}" end def to_s diff --git a/libraries/aws_ec2_client_vpn_authorization_rules.rb b/libraries/aws_ec2_client_vpn_authorization_rules.rb index 7f8a73316..a6ba04c6b 100644 --- a/libraries/aws_ec2_client_vpn_authorization_rules.rb +++ b/libraries/aws_ec2_client_vpn_authorization_rules.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2ClientVPNAuthorizationRules < AwsResourceBase - name 'aws_ec2_client_vpn_authorization_rules' - desc 'Describes all the VPN rules.' + name "aws_ec2_client_vpn_authorization_rules" + desc "Describes all the VPN rules." example <<-EXAMPLE describe aws_ec2_client_vpn_authorization_rules(client_vpn_endpoint_id: 'CLIENT_VPN_ENDPOINT_ID') do it { should exist } @@ -12,14 +12,14 @@ class AWSEC2ClientVPNAuthorizationRules < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) - .register_column(:destination_cidr, field: :destination_cidr) - .register_column(:group_ids, field: :group_id) - .register_column(:access_all, field: :access_all) - .register_column(:status_codes, field: :status_code) - .register_column(:status_messages, field: :status_message) - .register_column(:descriptions, field: :description) - .install_filter_methods_on_resource(self, :table) + .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) + .register_column(:destination_cidr, field: :destination_cidr) + .register_column(:group_ids, field: :group_id) + .register_column(:access_all, field: :access_all) + .register_column(:status_codes, field: :status_code) + .register_column(:status_messages, field: :status_message) + .register_column(:descriptions, field: :description) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_client_vpn_endpoint.rb b/libraries/aws_ec2_client_vpn_endpoint.rb index 59224d7e6..9bc9dbf1c 100644 --- a/libraries/aws_ec2_client_vpn_endpoint.rb +++ b/libraries/aws_ec2_client_vpn_endpoint.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2ClientVPNEndpoint < AwsResourceBase - name 'aws_ec2_client_vpn_endpoint' - desc 'Describes a VPN endpoint.' + name "aws_ec2_client_vpn_endpoint" + desc "Describes a VPN endpoint." example <<-EXAMPLE describe aws_ec2_client_vpn_endpoint(client_vpn_endpoint_id: 'CLIENT_VPN_ENDPOINT_ID') do it { should exist } @@ -32,7 +32,7 @@ def exists? end def resource_id - @res ? @res[:client_vpn_endpoint_id] : '' + @res ? @res[:client_vpn_endpoint_id] : "" end def to_s diff --git a/libraries/aws_ec2_client_vpn_endpoints.rb b/libraries/aws_ec2_client_vpn_endpoints.rb index 32e9bf0b0..0cfa4f7b4 100644 --- a/libraries/aws_ec2_client_vpn_endpoints.rb +++ b/libraries/aws_ec2_client_vpn_endpoints.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2ClientVPNEndpoints < AwsResourceBase - name 'aws_ec2_client_vpn_endpoints' - desc 'Describes all the VPN endpoint.' + name "aws_ec2_client_vpn_endpoints" + desc "Describes all the VPN endpoint." example <<-EXAMPLE describe aws_ec2_client_vpn_endpoints do it { should exist } @@ -12,18 +12,18 @@ class AWSEC2ClientVPNEndpoints < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) - .register_column(:descriptions, field: :description) - .register_column(:creation_time, field: :creation_time) - .register_column(:deletion_time, field: :deletion_time) - .register_column(:dns_names, field: :dns_name) - .register_column(:split_tunnels, field: :split_tunnel) - .register_column(:vpn_protocols, field: :vpn_protocol) - .register_column(:transport_protocols, field: :transport_protocol) - .register_column(:vpn_ports, field: :vpn_port) - .register_column(:server_certificate_arns, field: :server_certificate_arn) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) + .register_column(:descriptions, field: :description) + .register_column(:creation_time, field: :creation_time) + .register_column(:deletion_time, field: :deletion_time) + .register_column(:dns_names, field: :dns_name) + .register_column(:split_tunnels, field: :split_tunnel) + .register_column(:vpn_protocols, field: :vpn_protocol) + .register_column(:transport_protocols, field: :transport_protocol) + .register_column(:vpn_ports, field: :vpn_port) + .register_column(:server_certificate_arns, field: :server_certificate_arn) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_client_vpn_route.rb b/libraries/aws_ec2_client_vpn_route.rb index f62bf5c58..686b3cfcb 100644 --- a/libraries/aws_ec2_client_vpn_route.rb +++ b/libraries/aws_ec2_client_vpn_route.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2ClientVPNRoute < AwsResourceBase - name 'aws_ec2_client_vpn_route' - desc 'Describes a VPN route.' + name "aws_ec2_client_vpn_route" + desc "Describes a VPN route." example <<-EXAMPLE describe aws_ec2_client_vpn_route(client_vpn_endpoint_id: 'CLIENT_VPN_ENDPOINT_ID', target_subnet: 'TARGET_SUBNET') do it { should exist } @@ -16,7 +16,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: client_vpn_endpoint_id must be provided" unless opts[:client_vpn_endpoint_id] && !opts[:client_vpn_endpoint_id].empty? raise ArgumentError, "#{@__resource_name__}: target_subnet must be provided" unless opts[:target_subnet] && !opts[:target_subnet].empty? @display_name = opts[:client_vpn_endpoint_id] - filter = [{ name: 'target-subnet', + filter = [{ name: "target-subnet", values: [opts[:target_subnet]] }] catch_aws_errors do resp = @aws.compute_client.describe_client_vpn_routes({ client_vpn_endpoint_id: opts[:client_vpn_endpoint_id], filters: filter }) @@ -35,7 +35,7 @@ def exists? end def resource_id - "#{@res ? @res[:client_vpn_endpoint_id] : ''}_#{@res ? @res[:target_subnet] : ''}" + "#{@res ? @res[:client_vpn_endpoint_id] : ""}_#{@res ? @res[:target_subnet] : ""}" end def to_s diff --git a/libraries/aws_ec2_client_vpn_routes.rb b/libraries/aws_ec2_client_vpn_routes.rb index f032c90d0..1ec224d6a 100644 --- a/libraries/aws_ec2_client_vpn_routes.rb +++ b/libraries/aws_ec2_client_vpn_routes.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2ClientVPNRoutes < AwsResourceBase - name 'aws_ec2_client_vpn_routes' - desc 'Describes all the VPN routes.' + name "aws_ec2_client_vpn_routes" + desc "Describes all the VPN routes." example <<-EXAMPLE describe aws_ec2_client_vpn_routes(client_vpn_endpoint_id: 'CLIENT_VPN_ENDPOINT_ID') do it { should exist } @@ -12,15 +12,15 @@ class AWSEC2ClientVPNRoutes < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) - .register_column(:destination_cidr, field: :destination_cidr) - .register_column(:target_subnets, field: :target_subnet) - .register_column(:types, field: :type) - .register_column(:origins, field: :origin) - .register_column(:status_codes, field: :status_code) - .register_column(:status_messages, field: :status_message) - .register_column(:descriptions, field: :description) - .install_filter_methods_on_resource(self, :table) + .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) + .register_column(:destination_cidr, field: :destination_cidr) + .register_column(:target_subnets, field: :target_subnet) + .register_column(:types, field: :type) + .register_column(:origins, field: :origin) + .register_column(:status_codes, field: :status_code) + .register_column(:status_messages, field: :status_message) + .register_column(:descriptions, field: :description) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_client_vpn_target_network_association.rb b/libraries/aws_ec2_client_vpn_target_network_association.rb index 207a62d5d..526126e20 100644 --- a/libraries/aws_ec2_client_vpn_target_network_association.rb +++ b/libraries/aws_ec2_client_vpn_target_network_association.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2ClientVPNTargetNetworkAssociation < AwsResourceBase - name 'aws_ec2_client_vpn_target_network_association' - desc 'Describes a single AWS EC2 Client Vpn Target Network Association.' + name "aws_ec2_client_vpn_target_network_association" + desc "Describes a single AWS EC2 Client Vpn Target Network Association." example <<-EXAMPLE describe aws_ec2_client_vpn_target_network_association(client_vpn_endpoint_id: 'CLIENT_VPN_ENDPOINT_ID', association_id: 'ASSOCIATION_ID') do it { should exist } @@ -18,7 +18,7 @@ def initialize(opts = {}) @display_name = opts[:client_vpn_endpoint_id] filter = [ { - name: 'association-id', + name: "association-id", values: [opts[:association_id]], }, ] @@ -39,7 +39,7 @@ def exists? end def resource_id - "#{@display_name}_#{@res ? @res[:association_id] : ''}" + "#{@display_name}_#{@res ? @res[:association_id] : ""}" end def to_s diff --git a/libraries/aws_ec2_client_vpn_target_network_associations.rb b/libraries/aws_ec2_client_vpn_target_network_associations.rb index 071bec11a..d1762897e 100644 --- a/libraries/aws_ec2_client_vpn_target_network_associations.rb +++ b/libraries/aws_ec2_client_vpn_target_network_associations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2ClientVPNTargetNetworkAssociations < AwsResourceBase - name 'aws_ec2_client_vpn_target_network_associations' - desc 'Describes all the AWS EC2 Client Vpn Target Network Association.' + name "aws_ec2_client_vpn_target_network_associations" + desc "Describes all the AWS EC2 Client Vpn Target Network Association." example <<-EXAMPLE describe aws_ec2_client_vpn_target_network_associations(client_vpn_endpoint_id: 'CLIENT_VPN_ENDPOINT_ID') do it { should exist } @@ -12,14 +12,14 @@ class AWSEC2ClientVPNTargetNetworkAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:association_ids, field: :association_id) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:target_network_ids, field: :target_network_id) - .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) - .register_column(:status_codes, field: :status_code) - .register_column(:status_messages, field: :status_message) - .register_column(:security_groups, field: :security_groups, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:association_ids, field: :association_id) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:target_network_ids, field: :target_network_id) + .register_column(:client_vpn_endpoint_ids, field: :client_vpn_endpoint_id) + .register_column(:status_codes, field: :status_code) + .register_column(:status_messages, field: :status_message) + .register_column(:security_groups, field: :security_groups, style: :simple) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_customer_gateway.rb b/libraries/aws_ec2_customer_gateway.rb index f799b164b..8ee158fc9 100644 --- a/libraries/aws_ec2_customer_gateway.rb +++ b/libraries/aws_ec2_customer_gateway.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2CustomerGateway < AwsResourceBase - name 'aws_ec2_customer_gateway' - desc 'Describes one VPN customer gateways.' + name "aws_ec2_customer_gateway" + desc "Describes one VPN customer gateways." example <<-EXAMPLE describe aws_ec2_customer_gateway(customer_gateway_id: 'CUSTOMER_GATEWAY_ID') do it { should exist } diff --git a/libraries/aws_ec2_customer_gateways.rb b/libraries/aws_ec2_customer_gateways.rb index d5ac40804..8c72e71b6 100644 --- a/libraries/aws_ec2_customer_gateways.rb +++ b/libraries/aws_ec2_customer_gateways.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2CustomerGateways < AwsResourceBase - name 'aws_ec2_customer_gateways' - desc 'Describes one or more of your VPN customer gateways.' + name "aws_ec2_customer_gateways" + desc "Describes one or more of your VPN customer gateways." example <<-EXAMPLE describe aws_ec2_customer_gateways do it { should exist } @@ -12,15 +12,15 @@ class AWSEC2CustomerGateways < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:bgp_asns, field: :bgp_asn) - .register_column(:customer_gateway_ids, field: :customer_gateway_id) - .register_column(:ip_addresses, field: :ip_address) - .register_column(:certificate_arns, field: :certificate_arn) - .register_column(:states, field: :state) - .register_column(:types, field: :type) - .register_column(:device_names, field: :device_name) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:bgp_asns, field: :bgp_asn) + .register_column(:customer_gateway_ids, field: :customer_gateway_id) + .register_column(:ip_addresses, field: :ip_address) + .register_column(:certificate_arns, field: :certificate_arn) + .register_column(:states, field: :state) + .register_column(:types, field: :type) + .register_column(:device_names, field: :device_name) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_dhcp_option.rb b/libraries/aws_ec2_dhcp_option.rb index cf6db2a41..3ae31501f 100644 --- a/libraries/aws_ec2_dhcp_option.rb +++ b/libraries/aws_ec2_dhcp_option.rb @@ -1,9 +1,9 @@ -require 'aws_backend' +require "aws_backend" class AwsEc2DHCPOption < AwsResourceBase SERVER_TYPES = %w{domain-name-servers netbios-name-servers ntp-servers}.freeze - name 'aws_ec2_dhcp_option' - desc 'Verifies settings for an AWS EC2 DHCP Option.' + name "aws_ec2_dhcp_option" + desc "Verifies settings for an AWS EC2 DHCP Option." example " describe aws_ec2_dhcp_option('dotp-12345678') do @@ -46,14 +46,14 @@ def to_s end def netbios_node_type - netbios_node_type = config_for('netbios-node-type') + netbios_node_type = config_for("netbios-node-type") return NullResponse unless netbios_node_type netbios_node_type[:values].first[:value].to_i end def domain_name - domain_name = config_for('domain-name') + domain_name = config_for("domain-name") return NullResponse unless domain_name domain_name[:values].first[:value] @@ -65,7 +65,7 @@ def domain_name def define_server_types SERVER_TYPES.each do |server| - method_name = server.gsub('-', '_') + method_name = server.gsub("-", "_") define_singleton_method(method_name) do server_configuration = config_for(server) return [] unless server_configuration @@ -96,7 +96,7 @@ def instance_arguments end def build_filters_from(value) - { filters: [{ name: 'tag:Name', values: [value] }] } + { filters: [{ name: "tag:Name", values: [value] }] } end def validate_and_assign_from(opts) diff --git a/libraries/aws_ec2_dhcp_options.rb b/libraries/aws_ec2_dhcp_options.rb index 3cdca3551..663be4173 100644 --- a/libraries/aws_ec2_dhcp_options.rb +++ b/libraries/aws_ec2_dhcp_options.rb @@ -1,9 +1,9 @@ -require 'aws_backend' +require "aws_backend" class AwsEc2DHCPOptions< AwsResourceBase SERVER_TYPES = %w{domain-name-servers netbios-name-servers ntp-servers}.freeze - name 'aws_ec2_dhcp_options' - desc 'Verifies settings for AWS EC2 DHCP Options.' + name "aws_ec2_dhcp_options" + desc "Verifies settings for AWS EC2 DHCP Options." example " describe aws_ec2_dhcp_options do @@ -14,15 +14,15 @@ class AwsEc2DHCPOptions< AwsResourceBase attr_reader :table FilterTable.create - .register_column(:dhcp_options_ids, field: :dhcp_options_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:tags, field: :tags) - .register_column(:domain_names, field: :domain_name) - .register_column(:domain_name_servers, field: :domain_name_servers, style: :simple) - .register_column(:netbios_name_servers, field: :netbios_name_servers, style: :simple) - .register_column(:netbios_node_types, field: :netbios_node_type) - .register_column(:ntp_servers, field: :ntp_servers, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:dhcp_options_ids, field: :dhcp_options_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:tags, field: :tags) + .register_column(:domain_names, field: :domain_name) + .register_column(:domain_name_servers, field: :domain_name_servers, style: :simple) + .register_column(:netbios_name_servers, field: :netbios_name_servers, style: :simple) + .register_column(:netbios_node_types, field: :netbios_node_type) + .register_column(:ntp_servers, field: :ntp_servers, style: :simple) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -63,13 +63,13 @@ def flat_hash_from(dhcp_option) hash[:domain_name] = domain_name_for(dhcp_configs) hash[:netbios_node_type] = netbios_node_type_for(dhcp_configs) SERVER_TYPES.each do |server_type| - hash[server_type.gsub('-', '_').to_sym] = servers_for(dhcp_configs, type: server_type) + hash[server_type.gsub("-", "_").to_sym] = servers_for(dhcp_configs, type: server_type) end end end def domain_name_for(dhcp_configurations) - domain_name = find_config_for(dhcp_configurations, type: 'domain-name') + domain_name = find_config_for(dhcp_configurations, type: "domain-name") return NullResponse unless domain_name # this is not possible though! domain_name[:values].first[:value] @@ -83,7 +83,7 @@ def servers_for(dhcp_configurations, type:) end def netbios_node_type_for(dhcp_configurations) - netbios_node_type = find_config_for(dhcp_configurations, type: 'netbios-node-type') + netbios_node_type = find_config_for(dhcp_configurations, type: "netbios-node-type") return NullResponse unless netbios_node_type netbios_node_type[:values].first[:value].to_i diff --git a/libraries/aws_ec2_egress_only_internet_gateway.rb b/libraries/aws_ec2_egress_only_internet_gateway.rb index a545fb776..9a9e6b388 100644 --- a/libraries/aws_ec2_egress_only_internet_gateway.rb +++ b/libraries/aws_ec2_egress_only_internet_gateway.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2EgressOnlyInternetGateway < AwsResourceBase - name 'aws_ec2_egress_only_internet_gateway' - desc 'Describes one egress-only internet gateways.' + name "aws_ec2_egress_only_internet_gateway" + desc "Describes one egress-only internet gateways." example " describe aws_ec2_egress_only_internet_gateway(egress_only_internet_gateway_id: 'EGRESS_ONLY_INTERNET_GATEWAY_ID') do diff --git a/libraries/aws_ec2_egress_only_internet_gateways.rb b/libraries/aws_ec2_egress_only_internet_gateways.rb index cd8103322..1156966a5 100644 --- a/libraries/aws_ec2_egress_only_internet_gateways.rb +++ b/libraries/aws_ec2_egress_only_internet_gateways.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2EgressOnlyInternetGateways < AwsResourceBase - name 'aws_ec2_egress_only_internet_gateways' - desc 'Describes one or more of your egress-only internet gateways.' + name "aws_ec2_egress_only_internet_gateways" + desc "Describes one or more of your egress-only internet gateways." example " describe aws_ec2_egress_only_internet_gateways do @@ -13,10 +13,10 @@ class AWSEC2EgressOnlyInternetGateways < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:attachments, field: :attachments) - .register_column(:egress_only_internet_gateway_ids, field: :egress_only_internet_gateway_id) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:attachments, field: :attachments) + .register_column(:egress_only_internet_gateway_ids, field: :egress_only_internet_gateway_id) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_eip.rb b/libraries/aws_ec2_eip.rb index b4f2f0c2a..8fa40ffaa 100644 --- a/libraries/aws_ec2_eip.rb +++ b/libraries/aws_ec2_eip.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEc2Eip < AwsResourceBase - name 'aws_ec2_eip' - desc 'Specifies an Elastic IP (EIP) address and can, optionally, associate it with an Amazon EC2 instance.' + name "aws_ec2_eip" + desc "Specifies an Elastic IP (EIP) address and can, optionally, associate it with an Amazon EC2 instance." example " describe aws_ec2_eip(public_ip: '192.0.2.0') do diff --git a/libraries/aws_ec2_eip_association.rb b/libraries/aws_ec2_eip_association.rb index 79a5a0ec1..de5864a7b 100644 --- a/libraries/aws_ec2_eip_association.rb +++ b/libraries/aws_ec2_eip_association.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2EIPAssociation < AwsResourceBase - name 'aws_ec2_eip_association' - desc 'Describes the specified Elastic IP addresses or all of your Elastic IP addresses.' + name "aws_ec2_eip_association" + desc "Describes the specified Elastic IP addresses or all of your Elastic IP addresses." example " describe aws_ec2_eip_association(association_id: 'ASSOCIATION_ID') do @@ -17,7 +17,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: association_id must be provided" unless opts[:association_id] && !opts[:association_id].empty? filter = [ { - name: 'association-id', + name: "association-id", values: [opts[:association_id]], }, ] diff --git a/libraries/aws_ec2_eip_associations.rb b/libraries/aws_ec2_eip_associations.rb index b846d8ddf..3e62b81c3 100644 --- a/libraries/aws_ec2_eip_associations.rb +++ b/libraries/aws_ec2_eip_associations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2EIPAssociations < AwsResourceBase - name 'aws_ec2_eip_associations' - desc 'Describes the specified Elastic IP addresses or all of your Elastic IP addresses.' + name "aws_ec2_eip_associations" + desc "Describes the specified Elastic IP addresses or all of your Elastic IP addresses." example " describe aws_ec2_eip_associations do @@ -13,8 +13,8 @@ class AWSEC2EIPAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:association_ids, field: :association_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:association_ids, field: :association_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_eips.rb b/libraries/aws_ec2_eips.rb index 2a3dbcfa3..aaad48347 100644 --- a/libraries/aws_ec2_eips.rb +++ b/libraries/aws_ec2_eips.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEc2Eips < AwsResourceBase - name 'aws_ec2_eips' - desc 'Specifies an Elastic IP (EIP) address and can, optionally, associate it with an Amazon EC2 instance.' + name "aws_ec2_eips" + desc "Specifies an Elastic IP (EIP) address and can, optionally, associate it with an Amazon EC2 instance." example " describe aws_ec2_eips do @@ -12,17 +12,17 @@ class AwsEc2Eips < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:instance_ids, field: :instance_id) - .register_column(:public_ips, field: :public_ip) - .register_column(:allocation_ids, field: :allocation_id) - .register_column(:domains, field: :domain) - .register_column(:association_ids, field: :association_id) - .register_column(:network_interface_ids, field: :network_interface_id) - .register_column(:network_interface_owner_ids, field: :network_interface_owner_id) - .register_column(:private_ip_addresss, field: :private_ip_address) - .register_column(:public_ipv_4_pools, field: :public_ipv_4_pool) - .register_column(:network_border_groups, field: :network_border_group) - .install_filter_methods_on_resource(self, :table) + .register_column(:instance_ids, field: :instance_id) + .register_column(:public_ips, field: :public_ip) + .register_column(:allocation_ids, field: :allocation_id) + .register_column(:domains, field: :domain) + .register_column(:association_ids, field: :association_id) + .register_column(:network_interface_ids, field: :network_interface_id) + .register_column(:network_interface_owner_ids, field: :network_interface_owner_id) + .register_column(:private_ip_addresss, field: :private_ip_address) + .register_column(:public_ipv_4_pools, field: :public_ipv_4_pool) + .register_column(:network_border_groups, field: :network_border_group) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_fleet.rb b/libraries/aws_ec2_fleet.rb index 1488119ec..80a52261b 100644 --- a/libraries/aws_ec2_fleet.rb +++ b/libraries/aws_ec2_fleet.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2Fleet < AwsResourceBase - name 'aws_ec2_fleet' - desc 'Describes the specified EC2 Fleets or all of your EC2 Fleets.' + name "aws_ec2_fleet" + desc "Describes the specified EC2 Fleets or all of your EC2 Fleets." example " describe aws_ec2_fleet(fleet_id: 'FLEET_ID') do diff --git a/libraries/aws_ec2_fleets.rb b/libraries/aws_ec2_fleets.rb index 3dae5310f..940f22787 100644 --- a/libraries/aws_ec2_fleets.rb +++ b/libraries/aws_ec2_fleets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2Fleets < AwsResourceBase - name 'aws_ec2_fleets' - desc 'Describes the specified EC2 Fleets or all of your EC2 Fleets.' + name "aws_ec2_fleets" + desc "Describes the specified EC2 Fleets or all of your EC2 Fleets." example " describe aws_ec2_fleets do @@ -13,28 +13,28 @@ class AWSEC2Fleets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:activity_statuses, field: :activity_status) - .register_column(:create_times, field: :create_time) - .register_column(:fleet_ids, field: :fleet_id) - .register_column(:fleet_states, field: :fleet_state) - .register_column(:client_tokens, field: :client_token) - .register_column(:excess_capacity_termination_policies, field: :excess_capacity_termination_policy) - .register_column(:fulfilled_capacities, field: :fulfilled_capacity) - .register_column(:fulfilled_on_demand_capacities, field: :fulfilled_on_demand_capacity) - .register_column(:launch_template_configs, field: :launch_template_configs) - .register_column(:target_capacity_specifications, field: :target_capacity_specification) - .register_column(:terminate_instances_with_expiration, field: :terminate_instances_with_expiration) - .register_column(:types, field: :type) - .register_column(:valid_from, field: :valid_from) - .register_column(:valid_until, field: :valid_until) - .register_column(:replace_unhealthy_instances, field: :replace_unhealthy_instances) - .register_column(:spot_options, field: :spot_options) - .register_column(:on_demand_options, field: :on_demand_options) - .register_column(:tags, field: :tags) - .register_column(:errors, field: :errors) - .register_column(:instances, field: :instances) - .register_column(:contexts, field: :context) - .install_filter_methods_on_resource(self, :table) + .register_column(:activity_statuses, field: :activity_status) + .register_column(:create_times, field: :create_time) + .register_column(:fleet_ids, field: :fleet_id) + .register_column(:fleet_states, field: :fleet_state) + .register_column(:client_tokens, field: :client_token) + .register_column(:excess_capacity_termination_policies, field: :excess_capacity_termination_policy) + .register_column(:fulfilled_capacities, field: :fulfilled_capacity) + .register_column(:fulfilled_on_demand_capacities, field: :fulfilled_on_demand_capacity) + .register_column(:launch_template_configs, field: :launch_template_configs) + .register_column(:target_capacity_specifications, field: :target_capacity_specification) + .register_column(:terminate_instances_with_expiration, field: :terminate_instances_with_expiration) + .register_column(:types, field: :type) + .register_column(:valid_from, field: :valid_from) + .register_column(:valid_until, field: :valid_until) + .register_column(:replace_unhealthy_instances, field: :replace_unhealthy_instances) + .register_column(:spot_options, field: :spot_options) + .register_column(:on_demand_options, field: :on_demand_options) + .register_column(:tags, field: :tags) + .register_column(:errors, field: :errors) + .register_column(:instances, field: :instances) + .register_column(:contexts, field: :context) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_host.rb b/libraries/aws_ec2_host.rb index 72d50c8df..db1856cce 100644 --- a/libraries/aws_ec2_host.rb +++ b/libraries/aws_ec2_host.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2Host < AwsResourceBase - name 'aws_ec2_host' - desc 'Describes the specified Dedicated Host.' + name "aws_ec2_host" + desc "Describes the specified Dedicated Host." example " describe aws_ec2_host(host_id: 'DEDICATED_HOST_ID') do diff --git a/libraries/aws_ec2_hosts.rb b/libraries/aws_ec2_hosts.rb index 6a3ee4725..5054fd8d3 100644 --- a/libraries/aws_ec2_hosts.rb +++ b/libraries/aws_ec2_hosts.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2Hosts < AwsResourceBase - name 'aws_ec2_hosts' - desc 'Describes the specified Dedicated Hosts or all your Dedicated Hosts.' + name "aws_ec2_hosts" + desc "Describes the specified Dedicated Hosts or all your Dedicated Hosts." example " describe aws_ec2_hosts do @@ -13,22 +13,22 @@ class AWSEC2Hosts < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:auto_placements, field: :auto_placement) - .register_column(:availability_zones, field: :availability_zone) - .register_column(:available_capacities, field: :available_capacity) - .register_column(:client_tokens, field: :client_token) - .register_column(:host_ids, field: :host_id) - .register_column(:host_properties, field: :host_properties) - .register_column(:instances, field: :instances) - .register_column(:states, field: :state) - .register_column(:allocation_times, field: :allocation_time) - .register_column(:tags, field: :tags) - .register_column(:host_recoveries, field: :host_recovery) - .register_column(:allows_multiple_instance_types, field: :allows_multiple_instance_types) - .register_column(:owner_ids, field: :owner_id) - .register_column(:availability_zone_ids, field: :availability_zone_id) - .register_column(:member_of_service_linked_resource_groups, field: :member_of_service_linked_resource_group) - .install_filter_methods_on_resource(self, :table) + .register_column(:auto_placements, field: :auto_placement) + .register_column(:availability_zones, field: :availability_zone) + .register_column(:available_capacities, field: :available_capacity) + .register_column(:client_tokens, field: :client_token) + .register_column(:host_ids, field: :host_id) + .register_column(:host_properties, field: :host_properties) + .register_column(:instances, field: :instances) + .register_column(:states, field: :state) + .register_column(:allocation_times, field: :allocation_time) + .register_column(:tags, field: :tags) + .register_column(:host_recoveries, field: :host_recovery) + .register_column(:allows_multiple_instance_types, field: :allows_multiple_instance_types) + .register_column(:owner_ids, field: :owner_id) + .register_column(:availability_zone_ids, field: :availability_zone_id) + .register_column(:member_of_service_linked_resource_groups, field: :member_of_service_linked_resource_group) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_instance.rb b/libraries/aws_ec2_instance.rb index ba2eeea42..da7491ccd 100644 --- a/libraries/aws_ec2_instance.rb +++ b/libraries/aws_ec2_instance.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEc2Instance < AwsResourceBase - name 'aws_ec2_instance' - desc 'Verifies settings for an AWS EC2 instance.' + name "aws_ec2_instance" + desc "Verifies settings for an AWS EC2 instance." example " describe aws_ec2_instance('i-12345678') do @@ -29,7 +29,7 @@ def initialize(opts = {}) instance_arguments = { instance_ids: [opts[:instance_id]] } elsif opts[:name] && !opts[:name].empty? # Otherwise use name, if provided @display_name = opts[:name] - instance_arguments = { filters: [{ name: 'tag:Name', values: [opts[:name]] }] } + instance_arguments = { filters: [{ name: "tag:Name", values: [opts[:name]] }] } else raise ArgumentError, "#{@__resource_name__}: either instance_id or name must be provided." end @@ -97,7 +97,7 @@ def network_interface_ids def has_roles? return false unless @instance[:iam_instance_profile] && @instance[:iam_instance_profile][:arn] - instance_profile = @instance[:iam_instance_profile][:arn].split('/').last + instance_profile = @instance[:iam_instance_profile][:arn].split("/").last @returned_roles = nil # Check if there is a role created at the attached profile catch_aws_errors do @@ -118,7 +118,7 @@ def role # Generate a matcher for each state %w{pending running shutting-down terminated stopping stopped unknown}.each do |state_name| - define_method "#{state_name.tr('-', '_')}?" do + define_method "#{state_name.tr("-", "_")}?" do state == state_name end end diff --git a/libraries/aws_ec2_instances.rb b/libraries/aws_ec2_instances.rb index 646ca99ab..984071dc9 100644 --- a/libraries/aws_ec2_instances.rb +++ b/libraries/aws_ec2_instances.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEc2Instances < AwsResourceBase - name 'aws_ec2_instances' - desc 'Verifies settings for a collection of AWS EC2 Instances.' + name "aws_ec2_instances" + desc "Verifies settings for a collection of AWS EC2 Instances." example " describe aws_ec2_instances do it { should exist } @@ -12,14 +12,14 @@ class AwsEc2Instances < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:instance_ids, field: :instance_id) - .register_column(:names, field: :name) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:subnet_ids, field: :subnet_id) - .register_column(:instance_types, field: :instance_type) - .register_column(:tags, field: :tags) - .register_column(:iam_profiles, field: :iam_profile) - .install_filter_methods_on_resource(self, :table) + .register_column(:instance_ids, field: :instance_id) + .register_column(:names, field: :name) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:subnet_ids, field: :subnet_id) + .register_column(:instance_types, field: :instance_type) + .register_column(:tags, field: :tags) + .register_column(:iam_profiles, field: :iam_profile) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -44,8 +44,8 @@ def fetch_data subnet_id: instance.subnet_id, instance_type: instance.instance_type, tags: instance_tags, - name: instance_tags['Name'], - iam_profile: instance.iam_instance_profile&.arn&.split('/')&.last, + name: instance_tags["Name"], + iam_profile: instance.iam_instance_profile&.arn&.split("/")&.last, }] end end diff --git a/libraries/aws_ec2_internet_gateway.rb b/libraries/aws_ec2_internet_gateway.rb index b6915a4ef..d9ccbe02a 100644 --- a/libraries/aws_ec2_internet_gateway.rb +++ b/libraries/aws_ec2_internet_gateway.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2InternetGateway < AwsResourceBase - name 'aws_ec2_internet_gateway' - desc 'Describes a ec2 internet gateway.' + name "aws_ec2_internet_gateway" + desc "Describes a ec2 internet gateway." example " describe aws_ec2_internet_gateway(internet_gateway_id: 'InternetGatewayId') do diff --git a/libraries/aws_ec2_internet_gateways.rb b/libraries/aws_ec2_internet_gateways.rb index 5a104fb7d..0c9fad413 100644 --- a/libraries/aws_ec2_internet_gateways.rb +++ b/libraries/aws_ec2_internet_gateways.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2InternetGateways < AwsResourceBase - name 'aws_ec2_internet_gateways' - desc 'List all the internet gateways.' + name "aws_ec2_internet_gateways" + desc "List all the internet gateways." example " describe aws_ec2_internet_gateways do @@ -13,13 +13,13 @@ class AWSEC2InternetGateways < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:attachments, field: :attachments) - .register_column(:attachments_states, field: :attachments_states, style: :simple) - .register_column(:attachments_vpc_ids, field: :attachments_vpc_ids) - .register_column(:internet_gateway_ids, field: :internet_gateway_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:attachments, field: :attachments) + .register_column(:attachments_states, field: :attachments_states, style: :simple) + .register_column(:attachments_vpc_ids, field: :attachments_vpc_ids) + .register_column(:internet_gateway_ids, field: :internet_gateway_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_launch_template.rb b/libraries/aws_ec2_launch_template.rb index 67d53d184..c8060ff25 100644 --- a/libraries/aws_ec2_launch_template.rb +++ b/libraries/aws_ec2_launch_template.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEc2LaunchTemplate < AwsResourceBase - name 'aws_ec2_launch_template' - desc 'Audits Launch Template.' + name "aws_ec2_launch_template" + desc "Audits Launch Template." example "describe aws_ec2_launch_template(launch_template_name: 'test-launch-temlate') do it { should exist } end diff --git a/libraries/aws_ec2_launch_templates.rb b/libraries/aws_ec2_launch_templates.rb index 3e0e6b4ab..d9aa1fd57 100644 --- a/libraries/aws_ec2_launch_templates.rb +++ b/libraries/aws_ec2_launch_templates.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEc2LaunchTemplates < AwsResourceBase - name 'aws_ec2_launch_templates' - desc 'Verifies settings for a collection of launch templates.' + name "aws_ec2_launch_templates" + desc "Verifies settings for a collection of launch templates." example " describe aws_ec2_launch_templates do @@ -13,14 +13,14 @@ class AWSEc2LaunchTemplates < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:launch_template_ids, field: :launch_template_id) - .register_column(:launch_template_names, field: :launch_template_name) - .register_column(:create_time, field: :create_time) - .register_column(:created_by, field: :created_by) - .register_column(:default_version_number, field: :default_version_number) - .register_column(:tags, field: :tags) - .register_column(:latest_version_number, field: :launch_template_number) - .install_filter_methods_on_resource(self, :table) + .register_column(:launch_template_ids, field: :launch_template_id) + .register_column(:launch_template_names, field: :launch_template_name) + .register_column(:create_time, field: :create_time) + .register_column(:created_by, field: :created_by) + .register_column(:default_version_number, field: :default_version_number) + .register_column(:tags, field: :tags) + .register_column(:latest_version_number, field: :launch_template_number) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -44,7 +44,7 @@ def fetch_data create_time: launch_template.create_time, created_by: launch_template.created_by, tags: launch_template_tags, - launch_template_tags_name: launch_template_tags['Name'], + launch_template_tags_name: launch_template_tags["Name"], default_version_number: launch_template.default_version_number, latest_version_number: launch_template.latest_version_number, }] diff --git a/libraries/aws_ec2_network_insights_analysis.rb b/libraries/aws_ec2_network_insights_analysis.rb index ef174d67b..e8e2a5f38 100644 --- a/libraries/aws_ec2_network_insights_analysis.rb +++ b/libraries/aws_ec2_network_insights_analysis.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2NetworkInsightsAnalysis < AwsResourceBase - name 'aws_ec2_network_insights_analysis' - desc 'Describes one or more of your network insights analyses.' + name "aws_ec2_network_insights_analysis" + desc "Describes one or more of your network insights analyses." example " describe aws_ec2_network_insights_analysis(network_insights_analysis_id: 'NetworkInsightsAnalysisId') do diff --git a/libraries/aws_ec2_network_insights_analysis_plural.rb b/libraries/aws_ec2_network_insights_analysis_plural.rb index 6d0a990b9..2c085085c 100644 --- a/libraries/aws_ec2_network_insights_analysis_plural.rb +++ b/libraries/aws_ec2_network_insights_analysis_plural.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2NetworkInsightsAnalysisPlural < AwsResourceBase - name 'aws_ec2_network_insights_analysis_plural' - desc 'List all the network insights analyses.' + name "aws_ec2_network_insights_analysis_plural" + desc "List all the network insights analyses." example " describe aws_ec2_network_insights_analysis_plural do @@ -13,20 +13,20 @@ class AWSEC2NetworkInsightsAnalysisPlural < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:network_insights_analysis_ids, field: :network_insights_analysis_id) - .register_column(:network_insights_analysis_arns, field: :network_insights_analysis_arn) - .register_column(:network_insights_path_ids, field: :network_insights_path_id) - .register_column(:filter_in_arns, field: :filter_in_arns) - .register_column(:start_dates, field: :start_date) - .register_column(:statuses, field: :status) - .register_column(:status_messages, field: :status_message) - .register_column(:network_path_found, field: :network_path_found) - .register_column(:forward_path_components, field: :forward_path_components) - .register_column(:return_path_components, field: :return_path_components) - .register_column(:explanations, field: :explanations) - .register_column(:alternate_path_hints, field: :alternate_path_hints) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:network_insights_analysis_ids, field: :network_insights_analysis_id) + .register_column(:network_insights_analysis_arns, field: :network_insights_analysis_arn) + .register_column(:network_insights_path_ids, field: :network_insights_path_id) + .register_column(:filter_in_arns, field: :filter_in_arns) + .register_column(:start_dates, field: :start_date) + .register_column(:statuses, field: :status) + .register_column(:status_messages, field: :status_message) + .register_column(:network_path_found, field: :network_path_found) + .register_column(:forward_path_components, field: :forward_path_components) + .register_column(:return_path_components, field: :return_path_components) + .register_column(:explanations, field: :explanations) + .register_column(:alternate_path_hints, field: :alternate_path_hints) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_network_insights_path.rb b/libraries/aws_ec2_network_insights_path.rb index cad5c0870..8a7db60bd 100644 --- a/libraries/aws_ec2_network_insights_path.rb +++ b/libraries/aws_ec2_network_insights_path.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2NetworkInsightsPath < AwsResourceBase - name 'aws_ec2_network_insights_path' - desc 'Returns' + name "aws_ec2_network_insights_path" + desc "Returns" example " describe aws_ec2_network_insights_path(network_insights_path_id: 'NetworkInsightsPathId') do diff --git a/libraries/aws_ec2_network_insights_paths.rb b/libraries/aws_ec2_network_insights_paths.rb index bc57cda2d..69b432e6b 100644 --- a/libraries/aws_ec2_network_insights_paths.rb +++ b/libraries/aws_ec2_network_insights_paths.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2NetworkInsightsPaths < AwsResourceBase - name 'aws_ec2_network_insights_paths' - desc 'List all the network insights paths.' + name "aws_ec2_network_insights_paths" + desc "List all the network insights paths." example " describe aws_ec2_network_insights_paths do @@ -13,17 +13,17 @@ class AWSEC2NetworkInsightsPaths < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:network_insights_path_ids, field: :network_insights_path_id) - .register_column(:network_insights_path_arns, field: :network_insights_path_arn) - .register_column(:created_dates, field: :created_date) - .register_column(:sources, field: :source) - .register_column(:destinations, field: :destination) - .register_column(:source_ips, field: :source_ip) - .register_column(:destination_ips, field: :destination_ip) - .register_column(:protocols, field: :protocol) - .register_column(:destination_ports, field: :destination_port) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:network_insights_path_ids, field: :network_insights_path_id) + .register_column(:network_insights_path_arns, field: :network_insights_path_arn) + .register_column(:created_dates, field: :created_date) + .register_column(:sources, field: :source) + .register_column(:destinations, field: :destination) + .register_column(:source_ips, field: :source_ip) + .register_column(:destination_ips, field: :destination_ip) + .register_column(:protocols, field: :protocol) + .register_column(:destination_ports, field: :destination_port) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_network_interface.rb b/libraries/aws_ec2_network_interface.rb index 43675e1d9..5dbad8b96 100644 --- a/libraries/aws_ec2_network_interface.rb +++ b/libraries/aws_ec2_network_interface.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2NetworkInterface < AwsResourceBase - name 'aws_ec2_network_interface' - desc 'Describes one or more of your network interfaces.' + name "aws_ec2_network_interface" + desc "Describes one or more of your network interfaces." example " describe aws_ec2_network_interface(network_interface_id: 'NetworkInterfaceId') do diff --git a/libraries/aws_ec2_network_interface_attachment.rb b/libraries/aws_ec2_network_interface_attachment.rb index b27e0d981..6bf481b60 100644 --- a/libraries/aws_ec2_network_interface_attachment.rb +++ b/libraries/aws_ec2_network_interface_attachment.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2NetworkInterfaceAttachment < AwsResourceBase - name 'aws_ec2_network_interface_attachment' - desc 'Describes one or more of your network interface attachment.' + name "aws_ec2_network_interface_attachment" + desc "Describes one or more of your network interface attachment." example " describe aws_ec2_network_interface_attachment(network_interface_id: 'NetworkInterfaceId') do @@ -28,7 +28,7 @@ def exists? end def resource_id - @res ? @display_name : '' + @res ? @display_name : "" end def to_s diff --git a/libraries/aws_ec2_network_interface_attachments.rb b/libraries/aws_ec2_network_interface_attachments.rb index 2cdc494c2..6d3356730 100644 --- a/libraries/aws_ec2_network_interface_attachments.rb +++ b/libraries/aws_ec2_network_interface_attachments.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2NetworkInterfaceAttachments < AwsResourceBase - name 'aws_ec2_network_interface_attachments' - desc 'List all the network interface attachments.' + name "aws_ec2_network_interface_attachments" + desc "List all the network interface attachments." example " describe aws_ec2_network_interface_attachments do @@ -13,15 +13,15 @@ class AWSEC2NetworkInterfaceAttachments < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:attach_times, field: :attach_time) - .register_column(:attachment_ids, field: :attachment_id) - .register_column(:delete_on_terminations, field: :delete_on_termination) - .register_column(:device_indexes, field: :device_index) - .register_column(:network_card_indexes, field: :network_card_index) - .register_column(:instance_ids, field: :instance_id) - .register_column(:instance_owner_ids, field: :instance_owner_id) - .register_column(:statuses, field: :status) - .install_filter_methods_on_resource(self, :table) + .register_column(:attach_times, field: :attach_time) + .register_column(:attachment_ids, field: :attachment_id) + .register_column(:delete_on_terminations, field: :delete_on_termination) + .register_column(:device_indexes, field: :device_index) + .register_column(:network_card_indexes, field: :network_card_index) + .register_column(:instance_ids, field: :instance_id) + .register_column(:instance_owner_ids, field: :instance_owner_id) + .register_column(:statuses, field: :status) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_network_interfaces.rb b/libraries/aws_ec2_network_interfaces.rb index 68f90349c..e6316ab26 100644 --- a/libraries/aws_ec2_network_interfaces.rb +++ b/libraries/aws_ec2_network_interfaces.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2NetworkInterfaces < AwsResourceBase - name 'aws_ec2_network_interfaces' - desc 'List all the network interfaces.' + name "aws_ec2_network_interfaces" + desc "List all the network interfaces." example " describe aws_ec2_network_interfaces do @@ -13,27 +13,27 @@ class AWSEC2NetworkInterfaces < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:associations, field: :association) - .register_column(:attachments, field: :attachment) - .register_column(:availability_zones, field: :availability_zone) - .register_column(:descriptions, field: :description) - .register_column(:groups, field: :groups) - .register_column(:interface_types, field: :interface_type) - .register_column(:ipv_6_addresses, field: :ipv_6_addresses) - .register_column(:mac_addresses, field: :mac_address) - .register_column(:network_interface_ids, field: :network_interface_id) - .register_column(:outpost_arns, field: :outpost_arn) - .register_column(:owner_ids, field: :owner_id) - .register_column(:private_dns_names, field: :private_dns_name) - .register_column(:private_ip_addresses, field: :private_ip_address) - .register_column(:requester_ids, field: :requester_id) - .register_column(:requester_managed, field: :requester_managed) - .register_column(:source_dest_checks, field: :source_dest_check) - .register_column(:statuses, field: :status) - .register_column(:subnet_ids, field: :subnet_id) - .register_column(:tag_sets, field: :tag_set) - .register_column(:vpc_ids, field: :vpc_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:associations, field: :association) + .register_column(:attachments, field: :attachment) + .register_column(:availability_zones, field: :availability_zone) + .register_column(:descriptions, field: :description) + .register_column(:groups, field: :groups) + .register_column(:interface_types, field: :interface_type) + .register_column(:ipv_6_addresses, field: :ipv_6_addresses) + .register_column(:mac_addresses, field: :mac_address) + .register_column(:network_interface_ids, field: :network_interface_id) + .register_column(:outpost_arns, field: :outpost_arn) + .register_column(:owner_ids, field: :owner_id) + .register_column(:private_dns_names, field: :private_dns_name) + .register_column(:private_ip_addresses, field: :private_ip_address) + .register_column(:requester_ids, field: :requester_id) + .register_column(:requester_managed, field: :requester_managed) + .register_column(:source_dest_checks, field: :source_dest_check) + .register_column(:statuses, field: :status) + .register_column(:subnet_ids, field: :subnet_id) + .register_column(:tag_sets, field: :tag_set) + .register_column(:vpc_ids, field: :vpc_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_placement_group.rb b/libraries/aws_ec2_placement_group.rb index d064c0e5b..a70e1a627 100644 --- a/libraries/aws_ec2_placement_group.rb +++ b/libraries/aws_ec2_placement_group.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2PlacementGroup < AwsResourceBase - name 'aws_ec2_placement_group' - desc 'Describes the specified placement groups or all of your placement groups.' + name "aws_ec2_placement_group" + desc "Describes the specified placement groups or all of your placement groups." example " describe aws_ec2_placement_group(placement_group_name: 'PLACEMENT_GROUP_NAME') do diff --git a/libraries/aws_ec2_placement_groups.rb b/libraries/aws_ec2_placement_groups.rb index 658fed84e..26b66671a 100644 --- a/libraries/aws_ec2_placement_groups.rb +++ b/libraries/aws_ec2_placement_groups.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2PlacementGroups < AwsResourceBase - name 'aws_ec2_placement_groups' - desc 'Describes the specified placement groups or all of your placement groups.' + name "aws_ec2_placement_groups" + desc "Describes the specified placement groups or all of your placement groups." example " describe aws_ec2_placement_groups do @@ -13,27 +13,27 @@ class AWSEC2PlacementGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:group_names, field: :group_name) - .register_column(:states, field: :state) - .register_column(:strategies, field: :strategy) - .register_column(:partition_counts, field: :partition_count) - .register_column(:group_ids, field: :group_id) - .register_column(:tags, field: :tags) - .register_column(:availability_zones, field: :availability_zone) - .register_column(:tenancies, field: :tenancy) - .register_column(:total_instance_counts, field: :total_instance_count) - .register_column(:available_instance_counts, field: :available_instance_count) - .register_column(:ebs_optimized, field: :ebs_optimized) - .register_column(:ephemeral_storages, field: :ephemeral_storage) - .register_column(:states, field: :state) - .register_column(:start_dates, field: :start_date) - .register_column(:end_dates, field: :end_date) - .register_column(:end_date_types, field: :end_date_type) - .register_column(:instance_match_criterias, field: :instance_match_criteria) - .register_column(:create_dates, field: :create_date) - .register_column(:tags, field: :tags) - .register_column(:outpost_arns, field: :outpost_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:group_names, field: :group_name) + .register_column(:states, field: :state) + .register_column(:strategies, field: :strategy) + .register_column(:partition_counts, field: :partition_count) + .register_column(:group_ids, field: :group_id) + .register_column(:tags, field: :tags) + .register_column(:availability_zones, field: :availability_zone) + .register_column(:tenancies, field: :tenancy) + .register_column(:total_instance_counts, field: :total_instance_count) + .register_column(:available_instance_counts, field: :available_instance_count) + .register_column(:ebs_optimized, field: :ebs_optimized) + .register_column(:ephemeral_storages, field: :ephemeral_storage) + .register_column(:states, field: :state) + .register_column(:start_dates, field: :start_date) + .register_column(:end_dates, field: :end_date) + .register_column(:end_date_types, field: :end_date_type) + .register_column(:instance_match_criterias, field: :instance_match_criteria) + .register_column(:create_dates, field: :create_date) + .register_column(:tags, field: :tags) + .register_column(:outpost_arns, field: :outpost_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_prefix_list.rb b/libraries/aws_ec2_prefix_list.rb index 797555d32..c5e0d0b46 100644 --- a/libraries/aws_ec2_prefix_list.rb +++ b/libraries/aws_ec2_prefix_list.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2PrefixList < AwsResourceBase - name 'aws_ec2_prefix_list' - desc 'Describes your managed prefix lists and any Amazon Web Services-managed prefix lists.' + name "aws_ec2_prefix_list" + desc "Describes your managed prefix lists and any Amazon Web Services-managed prefix lists." example " describe aws_ec2_prefix_list(prefix_list_id: 'test1') do diff --git a/libraries/aws_ec2_prefix_lists.rb b/libraries/aws_ec2_prefix_lists.rb index 48919b96d..919f80783 100644 --- a/libraries/aws_ec2_prefix_lists.rb +++ b/libraries/aws_ec2_prefix_lists.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2PrefixLists < AwsResourceBase - name 'aws_ec2_prefix_lists' - desc 'List all the prefix list.' + name "aws_ec2_prefix_lists" + desc "List all the prefix list." example " describe aws_ec2_prefix_lists do @@ -13,17 +13,17 @@ class AWSEC2PrefixLists < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:prefix_list_ids, field: :prefix_list_id) - .register_column(:address_families, field: :address_family) - .register_column(:states, field: :state) - .register_column(:state_messages, field: :state_message) - .register_column(:prefix_list_arns, field: :prefix_list_arn) - .register_column(:prefix_list_names, field: :prefix_list_name) - .register_column(:max_entries, field: :max_entries) - .register_column(:versions, field: :version) - .register_column(:tags, field: :tags) - .register_column(:owner_ids, field: :owner_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:prefix_list_ids, field: :prefix_list_id) + .register_column(:address_families, field: :address_family) + .register_column(:states, field: :state) + .register_column(:state_messages, field: :state_message) + .register_column(:prefix_list_arns, field: :prefix_list_arn) + .register_column(:prefix_list_names, field: :prefix_list_name) + .register_column(:max_entries, field: :max_entries) + .register_column(:versions, field: :version) + .register_column(:tags, field: :tags) + .register_column(:owner_ids, field: :owner_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_spot_fleet.rb b/libraries/aws_ec2_spot_fleet.rb index c1250c7cf..37d9e4d11 100644 --- a/libraries/aws_ec2_spot_fleet.rb +++ b/libraries/aws_ec2_spot_fleet.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2SpotFleet < AwsResourceBase - name 'aws_ec2_spot_fleet' - desc 'Describes your Spot Fleet requests.' + name "aws_ec2_spot_fleet" + desc "Describes your Spot Fleet requests." example " describe aws_ec2_spot_fleet(spot_fleet_request_id: 'SpotFleetRequestID') do diff --git a/libraries/aws_ec2_spot_fleets.rb b/libraries/aws_ec2_spot_fleets.rb index 21aa0f470..5398e758e 100644 --- a/libraries/aws_ec2_spot_fleets.rb +++ b/libraries/aws_ec2_spot_fleets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2SpotFleets < AwsResourceBase - name 'aws_ec2_spot_fleets' - desc 'Describes your Spot Fleet requests.' + name "aws_ec2_spot_fleets" + desc "Describes your Spot Fleet requests." example " describe aws_ec2_spot_fleets do @@ -13,13 +13,13 @@ class AWSEC2SpotFleets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:activity_statuses, field: :activity_status) - .register_column(:create_times, field: :create_time) - .register_column(:spot_fleet_request_configs, field: :spot_fleet_request_config) - .register_column(:spot_fleet_request_ids, field: :spot_fleet_request_id) - .register_column(:spot_fleet_request_states, field: :spot_fleet_request_state) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:activity_statuses, field: :activity_status) + .register_column(:create_times, field: :create_time) + .register_column(:spot_fleet_request_configs, field: :spot_fleet_request_config) + .register_column(:spot_fleet_request_ids, field: :spot_fleet_request_id) + .register_column(:spot_fleet_request_states, field: :spot_fleet_request_state) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_traffic_mirror_filter.rb b/libraries/aws_ec2_traffic_mirror_filter.rb index 89caf4e50..d5c8d0ab1 100644 --- a/libraries/aws_ec2_traffic_mirror_filter.rb +++ b/libraries/aws_ec2_traffic_mirror_filter.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEc2TrafficMirrorFilter < AwsResourceBase - name 'aws_ec2_traffic_mirror_filter.md' - desc 'Describes one or more Traffic Mirror filters.' + name "aws_ec2_traffic_mirror_filter.md" + desc "Describes one or more Traffic Mirror filters." example " describe aws_ec2_traffic_mirror_filter_rule(traffic_mirror_filter_id: 'tmf-1234567890') do diff --git a/libraries/aws_ec2_traffic_mirror_filters.rb b/libraries/aws_ec2_traffic_mirror_filters.rb index 6271aa15b..d000249f4 100644 --- a/libraries/aws_ec2_traffic_mirror_filters.rb +++ b/libraries/aws_ec2_traffic_mirror_filters.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEc2TrafficMirrorFilters < AwsResourceBase - name 'aws_ec2_traffic_mirror_filters' - desc 'Describes one or more Traffic Mirror filters.' + name "aws_ec2_traffic_mirror_filters" + desc "Describes one or more Traffic Mirror filters." example " describe aws_ec2_traffic_mirror_filters do @@ -13,10 +13,10 @@ class AWSEc2TrafficMirrorFilters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:traffic_mirror_filter_ids, field: :traffic_mirror_filter_id) - .register_column(:descriptions, field: :description) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:traffic_mirror_filter_ids, field: :traffic_mirror_filter_id) + .register_column(:descriptions, field: :description) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_traffic_mirror_session.rb b/libraries/aws_ec2_traffic_mirror_session.rb index 19f0f83e0..a15a63a8c 100644 --- a/libraries/aws_ec2_traffic_mirror_session.rb +++ b/libraries/aws_ec2_traffic_mirror_session.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEc2TrafficMirrorSession < AwsResourceBase - name 'aws_ec2_traffic_mirror_session' - desc 'Describes one or more Traffic Mirror session.' + name "aws_ec2_traffic_mirror_session" + desc "Describes one or more Traffic Mirror session." example " describe aws_ec2_traffic_mirror_session(traffic_mirror_session_id: 'test-traffic_mirror_session_id') do diff --git a/libraries/aws_ec2_traffic_mirror_sessions.rb b/libraries/aws_ec2_traffic_mirror_sessions.rb index e216e31c8..20b2a0d6e 100644 --- a/libraries/aws_ec2_traffic_mirror_sessions.rb +++ b/libraries/aws_ec2_traffic_mirror_sessions.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEc2TrafficMirrorSessions < AwsResourceBase - name 'aws_ec2_traffic_mirror_sessions' - desc 'Verifies settings for a collection of AWS EC2 Traffic Mirror Sessions.' + name "aws_ec2_traffic_mirror_sessions" + desc "Verifies settings for a collection of AWS EC2 Traffic Mirror Sessions." example " describe aws_ec2_traffic_mirror_sessions do @@ -13,17 +13,17 @@ class AWSEc2TrafficMirrorSessions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:traffic_mirror_session_ids, field: :traffic_mirror_session_id) - .register_column(:traffic_mirror_target_ids, field: :traffic_mirror_target_id) - .register_column(:descriptions, field: :description) - .register_column(:traffic_mirror_filter_ids, field: :traffic_mirror_filter_id) - .register_column(:network_interface_ids, field: :network_interface_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:packet_lengths, field: :packet_length) - .register_column(:session_numbers, field: :session_number) - .register_column(:virtual_network_ids, field: :virtual_network_id) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:traffic_mirror_session_ids, field: :traffic_mirror_session_id) + .register_column(:traffic_mirror_target_ids, field: :traffic_mirror_target_id) + .register_column(:descriptions, field: :description) + .register_column(:traffic_mirror_filter_ids, field: :traffic_mirror_filter_id) + .register_column(:network_interface_ids, field: :network_interface_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:packet_lengths, field: :packet_length) + .register_column(:session_numbers, field: :session_number) + .register_column(:virtual_network_ids, field: :virtual_network_id) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_traffic_mirror_target.rb b/libraries/aws_ec2_traffic_mirror_target.rb index 23b8344dc..6ba6648d4 100644 --- a/libraries/aws_ec2_traffic_mirror_target.rb +++ b/libraries/aws_ec2_traffic_mirror_target.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEc2TrafficMirrorTarget < AwsResourceBase - name 'aws_ec2_traffic_mirror_target' - desc 'Information about one or more Traffic Mirror targets.' + name "aws_ec2_traffic_mirror_target" + desc "Information about one or more Traffic Mirror targets." example " describe aws_ec2_traffic_mirror_target(traffic_mirror_target_id: 'TrafficMirrorTargetId') do diff --git a/libraries/aws_ec2_traffic_mirror_targets.rb b/libraries/aws_ec2_traffic_mirror_targets.rb index 75c133b6b..f7435f5b8 100644 --- a/libraries/aws_ec2_traffic_mirror_targets.rb +++ b/libraries/aws_ec2_traffic_mirror_targets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEc2TrafficMirrorTargets < AwsResourceBase - name 'aws_ec2_traffic_mirror_targets' - desc 'Verifies settings for a collection of AWS EC2 Traffic Mirror targets' + name "aws_ec2_traffic_mirror_targets" + desc "Verifies settings for a collection of AWS EC2 Traffic Mirror targets" example " describe aws_ec2_traffic_mirror_targets do @@ -13,14 +13,14 @@ class AWSEc2TrafficMirrorTargets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:traffic_mirror_target_ids, field: :traffic_mirror_target_id) - .register_column(:network_interface_ids, field: :network_interface_id) - .register_column(:network_load_balancer_arns, field: :network_load_balancer_arn) - .register_column(:types, field: :type) - .register_column(:descriptions, field: :description) - .register_column(:owner_ids, field: :owner_id) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:traffic_mirror_target_ids, field: :traffic_mirror_target_id) + .register_column(:network_interface_ids, field: :network_interface_id) + .register_column(:network_load_balancer_arns, field: :network_load_balancer_arn) + .register_column(:types, field: :type) + .register_column(:descriptions, field: :description) + .register_column(:owner_ids, field: :owner_id) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_transit_gateway_attachment.rb b/libraries/aws_ec2_transit_gateway_attachment.rb index 9068eff93..a0f322b0b 100644 --- a/libraries/aws_ec2_transit_gateway_attachment.rb +++ b/libraries/aws_ec2_transit_gateway_attachment.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEc2TransitGatewayAttachment < AwsResourceBase - name 'aws_ec2_transit_gateway_attachment' - desc 'Describes one or more attachments between resources and transit gateways. By default, all attachments are described. Alternatively, you can filter the results by attachment ID, attachment state, resource ID, or resource owner.' + name "aws_ec2_transit_gateway_attachment" + desc "Describes one or more attachments between resources and transit gateways. By default, all attachments are described. Alternatively, you can filter the results by attachment ID, attachment state, resource ID, or resource owner." example " describe aws_ec2_transit_gateway_attachment(transit_gateway_attachment_id: 'tgw-attach-0123456789') do diff --git a/libraries/aws_ec2_transit_gateway_attachments.rb b/libraries/aws_ec2_transit_gateway_attachments.rb index e7b1ca70b..ee1cad8a1 100644 --- a/libraries/aws_ec2_transit_gateway_attachments.rb +++ b/libraries/aws_ec2_transit_gateway_attachments.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEc2TransitGatewayAttachments < AwsResourceBase - name 'aws_ec2_transit_gateway_attachments' - desc 'Describes one or more attachments between resources and transit gateways. By default, all attachments are described. Alternatively, you can filter the results by attachment ID, attachment state, resource ID, or resource owner.' + name "aws_ec2_transit_gateway_attachments" + desc "Describes one or more attachments between resources and transit gateways. By default, all attachments are described. Alternatively, you can filter the results by attachment ID, attachment state, resource ID, or resource owner." example " describe aws_ec2_transit_gateway_attachements do it { should exist } @@ -12,17 +12,17 @@ class AwsEc2TransitGatewayAttachments < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) - .register_column(:transit_gateway_ids, field: :transit_gateway_id) - .register_column(:transit_gateway_owner_ids, field: :transit_gateway_owner_id) - .register_column(:resource_owner_ids, field: :resource_owner_id) - .register_column(:resource_types, field: :resource_type) - .register_column(:resource_ids, field: :resource_id) - .register_column(:states, field: :state) - .register_column(:associations, field: :association) - .register_column(:creation_times, field: :creation_time) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) + .register_column(:transit_gateway_ids, field: :transit_gateway_id) + .register_column(:transit_gateway_owner_ids, field: :transit_gateway_owner_id) + .register_column(:resource_owner_ids, field: :resource_owner_id) + .register_column(:resource_types, field: :resource_type) + .register_column(:resource_ids, field: :resource_id) + .register_column(:states, field: :state) + .register_column(:associations, field: :association) + .register_column(:creation_times, field: :creation_time) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_transit_gateway_route_table.rb b/libraries/aws_ec2_transit_gateway_route_table.rb index 8332380b8..179456b3c 100644 --- a/libraries/aws_ec2_transit_gateway_route_table.rb +++ b/libraries/aws_ec2_transit_gateway_route_table.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEc2TransitGatewayRouteTable < AwsResourceBase - name 'aws_ec2_transit_gateway_route_table' - desc 'Describes one or more transit gateway route tables. By default, all transit gateway route tables are described. Alternatively, you can filter the results.' + name "aws_ec2_transit_gateway_route_table" + desc "Describes one or more transit gateway route tables. By default, all transit gateway route tables are described. Alternatively, you can filter the results." example " describe aws_ec2_transit_gateway_route_table(transit_gateway_route_table_id: 'tgw-rtb-0123456789') do diff --git a/libraries/aws_ec2_transit_gateway_route_table_association.rb b/libraries/aws_ec2_transit_gateway_route_table_association.rb index f2502d2a2..76144faef 100644 --- a/libraries/aws_ec2_transit_gateway_route_table_association.rb +++ b/libraries/aws_ec2_transit_gateway_route_table_association.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEc2TransitGatewayRouteTableAssociation < AwsResourceBase - name 'aws_ec2_transit_gateway_route_table_association' - desc 'Gets information about the associations for the specified transit gateway route table.' + name "aws_ec2_transit_gateway_route_table_association" + desc "Gets information about the associations for the specified transit gateway route table." example " describe aws_ec2_transit_gateway_route_table_association(transit_gateway_route_table_id: 'tgw-attach-0123456789') do diff --git a/libraries/aws_ec2_transit_gateway_route_table_associations.rb b/libraries/aws_ec2_transit_gateway_route_table_associations.rb index 4fd6f9e5e..db5dc0d3b 100644 --- a/libraries/aws_ec2_transit_gateway_route_table_associations.rb +++ b/libraries/aws_ec2_transit_gateway_route_table_associations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEc2TransitGatewayRouteTableAssociations < AwsResourceBase - name 'aws_ec2_transit_gateway_route_table_associations' - desc 'Gets information about the associations for the specified transit gateway route table.' + name "aws_ec2_transit_gateway_route_table_associations" + desc "Gets information about the associations for the specified transit gateway route table." example " describe aws_ec2_transit_gateway_route_table_associations(transit_gateway_route_table_id: 'tgw-attach-0123456789') do it { should exist } @@ -12,11 +12,11 @@ class AwsEc2TransitGatewayRouteTableAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) - .register_column(:resource_ids, field: :resource_id) - .register_column(:resource_types, field: :resource_type) - .register_column(:states, field: :state) - .install_filter_methods_on_resource(self, :table) + .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) + .register_column(:resource_ids, field: :resource_id) + .register_column(:resource_types, field: :resource_type) + .register_column(:states, field: :state) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_transit_gateway_route_table_propagation.rb b/libraries/aws_ec2_transit_gateway_route_table_propagation.rb index 501524072..e41937f87 100644 --- a/libraries/aws_ec2_transit_gateway_route_table_propagation.rb +++ b/libraries/aws_ec2_transit_gateway_route_table_propagation.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEc2TransitGatewayRouteTablePropagation < AwsResourceBase - name 'aws_ec2_transit_gateway_route_table_propagation' - desc 'Describes information about the route table propagations for the specified transit gateway route table.' + name "aws_ec2_transit_gateway_route_table_propagation" + desc "Describes information about the route table propagations for the specified transit gateway route table." example " describe aws_ec2_transit_gateway_route_table_propagation(transit_gateway_route_table_id: 'test1') do it { should exist } @@ -21,7 +21,7 @@ def initialize(opts = {}) @display_name = opts[:transit_gateway_attachment_id] filter = [ { - name: 'transit-gateway-attachment-id', + name: "transit-gateway-attachment-id", values: [opts[:transit_gateway_attachment_id]], }, ] diff --git a/libraries/aws_ec2_transit_gateway_route_table_propagations.rb b/libraries/aws_ec2_transit_gateway_route_table_propagations.rb index 17f3d2627..cf63d2dd7 100644 --- a/libraries/aws_ec2_transit_gateway_route_table_propagations.rb +++ b/libraries/aws_ec2_transit_gateway_route_table_propagations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEc2TransitGatewayRouteTablePropagations < AwsResourceBase - name 'aws_ec2_transit_gateway_route_table_propagations' - desc 'List information about the route table propagations for the specified transit gateway route table.' + name "aws_ec2_transit_gateway_route_table_propagations" + desc "List information about the route table propagations for the specified transit gateway route table." example " describe aws_ec2_transit_gateway_route_table_propagations(transit_gateway_route_table_id: 'test1') do @@ -13,11 +13,11 @@ class AWSEc2TransitGatewayRouteTablePropagations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) - .register_column(:resource_ids, field: :resource_id) - .register_column(:resource_types, field: :resource_type) - .register_column(:states, field: :state) - .install_filter_methods_on_resource(self, :table) + .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) + .register_column(:resource_ids, field: :resource_id) + .register_column(:resource_types, field: :resource_type) + .register_column(:states, field: :state) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_transit_gateway_route_tables.rb b/libraries/aws_ec2_transit_gateway_route_tables.rb index 19f60fe90..cc6a765bc 100644 --- a/libraries/aws_ec2_transit_gateway_route_tables.rb +++ b/libraries/aws_ec2_transit_gateway_route_tables.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEc2TransitGatewayRouteTables < AwsResourceBase - name 'aws_ec2_transit_gateway_route_tables' - desc 'Describes one or more transit gateway route tables. By default, all transit gateway route tables are described. Alternatively, you can filter the results.' + name "aws_ec2_transit_gateway_route_tables" + desc "Describes one or more transit gateway route tables. By default, all transit gateway route tables are described. Alternatively, you can filter the results." example " describe aws_ec2_transit_gateway_route_tables do @@ -13,14 +13,14 @@ class AwsEc2TransitGatewayRouteTables < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:transit_gateway_route_table_ids, field: :transit_gateway_route_table_id) - .register_column(:transit_gateway_ids, field: :transit_gateway_id) - .register_column(:states, field: :state) - .register_column(:default_association_route_tables, field: :default_association_route_table) - .register_column(:default_propagation_route_tables, field: :default_propagation_route_table) - .register_column(:creation_times, field: :creation_time) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:transit_gateway_route_table_ids, field: :transit_gateway_route_table_id) + .register_column(:transit_gateway_ids, field: :transit_gateway_id) + .register_column(:states, field: :state) + .register_column(:default_association_route_tables, field: :default_association_route_table) + .register_column(:default_propagation_route_tables, field: :default_propagation_route_table) + .register_column(:creation_times, field: :creation_time) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_volume_attachment.rb b/libraries/aws_ec2_volume_attachment.rb index 6edfc0657..71fb2dd62 100644 --- a/libraries/aws_ec2_volume_attachment.rb +++ b/libraries/aws_ec2_volume_attachment.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2VolumeAttachment < AwsResourceBase - name 'aws_ec2_volume_attachment' - desc 'Describes the specified EBS volumes attachments or all of your EBS volumes attachments.' + name "aws_ec2_volume_attachment" + desc "Describes the specified EBS volumes attachments or all of your EBS volumes attachments." example " describe aws_ec2_volume_attachment(volume_id: 'VolumeID') do diff --git a/libraries/aws_ec2_volume_attachments.rb b/libraries/aws_ec2_volume_attachments.rb index d4fc60c90..e10d986cd 100644 --- a/libraries/aws_ec2_volume_attachments.rb +++ b/libraries/aws_ec2_volume_attachments.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2VolumeAttachments < AwsResourceBase - name 'aws_ec2_volume_attachments' - desc 'Describes the specified EBS volumes attachments or all of your EBS volumes attachments.' + name "aws_ec2_volume_attachments" + desc "Describes the specified EBS volumes attachments or all of your EBS volumes attachments." example " describe aws_ec2_volume_attachments do @@ -13,13 +13,13 @@ class AWSEC2VolumeAttachments < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:attach_times, field: :attach_time) - .register_column(:devices, field: :device) - .register_column(:instance_ids, field: :instance_id) - .register_column(:states, field: :state) - .register_column(:volume_ids, field: :volume_id) - .register_column(:delete_on_terminations, field: :delete_on_termination) - .install_filter_methods_on_resource(self, :table) + .register_column(:attach_times, field: :attach_time) + .register_column(:devices, field: :device) + .register_column(:instance_ids, field: :instance_id) + .register_column(:states, field: :state) + .register_column(:volume_ids, field: :volume_id) + .register_column(:delete_on_terminations, field: :delete_on_termination) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_vpc_peering_connection.rb b/libraries/aws_ec2_vpc_peering_connection.rb index a8392a37e..d9491e918 100644 --- a/libraries/aws_ec2_vpc_peering_connection.rb +++ b/libraries/aws_ec2_vpc_peering_connection.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2VPCPeeringConnection < AwsResourceBase - name 'aws_ec2_vpc_peering_connection' - desc 'Describes a vpc peering connection.' + name "aws_ec2_vpc_peering_connection" + desc "Describes a vpc peering connection." example " describe aws_ec2_vpc_peering_connection(vpc_peering_connection_id: 'VpcPeeringConnectionId') do diff --git a/libraries/aws_ec2_vpc_peering_connections.rb b/libraries/aws_ec2_vpc_peering_connections.rb index c1391e4ba..fc44b5121 100644 --- a/libraries/aws_ec2_vpc_peering_connections.rb +++ b/libraries/aws_ec2_vpc_peering_connections.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2VPCPeeringConnections < AwsResourceBase - name 'aws_ec2_vpc_peering_connections' - desc 'Describes a vpc peering connection.' + name "aws_ec2_vpc_peering_connections" + desc "Describes a vpc peering connection." example " describe aws_ec2_vpc_peering_connections do @@ -13,13 +13,13 @@ class AWSEC2VPCPeeringConnections < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:accepter_vpc_infos, field: :accepter_vpc_info) - .register_column(:expiration_times, field: :expiration_time) - .register_column(:requester_vpc_infos, field: :requester_vpc_info) - .register_column(:statuses, field: :status) - .register_column(:tags, field: :tags) - .register_column(:vpc_peering_connection_ids, field: :vpc_peering_connection_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:accepter_vpc_infos, field: :accepter_vpc_info) + .register_column(:expiration_times, field: :expiration_time) + .register_column(:requester_vpc_infos, field: :requester_vpc_info) + .register_column(:statuses, field: :status) + .register_column(:tags, field: :tags) + .register_column(:vpc_peering_connection_ids, field: :vpc_peering_connection_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_vpn_connection_routes.rb b/libraries/aws_ec2_vpn_connection_routes.rb index a754bdfcb..8479c65f9 100644 --- a/libraries/aws_ec2_vpn_connection_routes.rb +++ b/libraries/aws_ec2_vpn_connection_routes.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEC2VPNConnectionRoutes < AwsResourceBase - name 'aws_ec2_vpn_connection_routes' - desc 'Describes one or more of your VPN connections route.' + name "aws_ec2_vpn_connection_routes" + desc "Describes one or more of your VPN connections route." example " describe aws_ec2_vpn_connection_routes(vpn_connection_id: 'VPNConnectionID') do @@ -13,10 +13,10 @@ class AWSEC2VPNConnectionRoutes < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:destination_cidr_blocks, field: :destination_cidr_block) - .register_column(:sources, field: :source) - .register_column(:states, field: :state) - .install_filter_methods_on_resource(self, :table) + .register_column(:destination_cidr_blocks, field: :destination_cidr_block) + .register_column(:sources, field: :source) + .register_column(:states, field: :state) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ec2_vpn_gateway_route_propagation.rb b/libraries/aws_ec2_vpn_gateway_route_propagation.rb index f94ce1252..deb5a5e99 100644 --- a/libraries/aws_ec2_vpn_gateway_route_propagation.rb +++ b/libraries/aws_ec2_vpn_gateway_route_propagation.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEc2VPNGatewayRoutePropagation < AwsResourceBase - name 'aws_ec2_vpn_gateway_route_propagation' - desc 'Describes virtual private gateway (VGW) to propagate routes to the specified route table of a VPC.' + name "aws_ec2_vpn_gateway_route_propagation" + desc "Describes virtual private gateway (VGW) to propagate routes to the specified route table of a VPC." example " describe aws_ec2_vpn_gateway_route_propagation(route_table_id: 'rtb-1234567890') do diff --git a/libraries/aws_ec2_vpn_gateway_route_propagations.rb b/libraries/aws_ec2_vpn_gateway_route_propagations.rb index 48cc7c4da..ad23d85ec 100644 --- a/libraries/aws_ec2_vpn_gateway_route_propagations.rb +++ b/libraries/aws_ec2_vpn_gateway_route_propagations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEc2VPNGatewayRoutePropagations < AwsResourceBase - name 'aws_ec2_vpn_gateway_route_propagations' - desc 'List the properties.' + name "aws_ec2_vpn_gateway_route_propagations" + desc "List the properties." example " describe aws_ec2_vpn_gateway_route_propagations do @@ -16,9 +16,9 @@ class AWSEc2VPNGatewayRoutePropagations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:route_table_ids, field: :route_table_id) - .register_column(:propagating_vgws_gateway_ids, field: :propagating_vgws_gateway_ids, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:route_table_ids, field: :route_table_id) + .register_column(:propagating_vgws_gateway_ids, field: :propagating_vgws_gateway_ids, style: :simple) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -55,7 +55,7 @@ def flat_hash_from(route_table) propagating_vgws = route_table.propagating_vgws { route_table_id: route_table.route_table_id, - propagating_vgws_gateway_ids: map(propagating_vgws, 'gateway_id'), + propagating_vgws_gateway_ids: map(propagating_vgws, "gateway_id"), } end diff --git a/libraries/aws_ecr.rb b/libraries/aws_ecr.rb index 49ac85a26..06ebdffbe 100644 --- a/libraries/aws_ecr.rb +++ b/libraries/aws_ecr.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEcr < AwsResourceBase - name 'aws_ecr' - desc 'Verifies settings for an Elastic Container Registry.' + name "aws_ecr" + desc "Verifies settings for an Elastic Container Registry." example " describe aws_ecr('container-registry') do diff --git a/libraries/aws_ecr_image.rb b/libraries/aws_ecr_image.rb index 64d6b1db6..33aa55dad 100644 --- a/libraries/aws_ecr_image.rb +++ b/libraries/aws_ecr_image.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEcrImage < AwsResourceBase - name 'aws_ecr_image' - desc 'Verifies settings for an AWS ECR Image.' + name "aws_ecr_image" + desc "Verifies settings for an AWS ECR Image." example " describe aws_ecr_image(repository_name: 'my-repo', image_tag: 'latest') do @@ -17,15 +17,15 @@ class AwsEcrImage < AwsResourceBase def initialize(opts = {}) super(opts) validate_parameters(required: %i(repository_name), require_any_of: %i(image_tag image_digest), allow: %i(registry_id)) - @display_name = opts.values.join(' ') + @display_name = opts.values.join(" ") # Validate repository_name. pattern = %r{(?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._\-][a-z0-9]+)*} matched_str = opts[:repository_name].match(pattern) unless (opts[:repository_name] == matched_str[0]) && (matched_str.length == 1) && opts[:repository_name].length.between?(2, 256) raise ArgumentError, "#{@__resource_name__}: `repository_name` is not in a valid format. " \ - 'Please check the docs for more info '\ - 'https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html' \ + "Please check the docs for more info "\ + "https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html" \ end # Validate image identifiers: @@ -37,7 +37,7 @@ def initialize(opts = {}) query_params = { repository_name: opts[:repository_name], image_ids: [ - opts.select { |k, _v| k.to_s.start_with?('image') }, + opts.select { |k, _v| k.to_s.start_with?("image") }, ], } @@ -67,7 +67,7 @@ def vulnerabilities # https://docs.aws.amazon.com/cli/latest/reference/ecr/describe-image-scan-findings.html query_params = { repository_name: @opts[:repository_name], - image_id: @opts.select { |k, _v| k.to_s.start_with?('image') }, + image_id: @opts.select { |k, _v| k.to_s.start_with?("image") }, max_results: 1000, } @scan_findings = [] diff --git a/libraries/aws_ecr_images.rb b/libraries/aws_ecr_images.rb index b311e846f..c22805762 100644 --- a/libraries/aws_ecr_images.rb +++ b/libraries/aws_ecr_images.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEcrImages < AwsResourceBase - name 'aws_ecr_images' - desc 'Verifies settings for a collection of AWS ECR Images in a repository.' + name "aws_ecr_images" + desc "Verifies settings for a collection of AWS ECR Images in a repository." example " describe aws_ecr_images(repository_name: 'my-repo') do @@ -13,13 +13,13 @@ class AwsEcrImages < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:digests, field: :digest) - .register_column(:tags, field: :tags) - .register_column(:size_in_bytes, field: :size_in_bytes) - .register_column(:pushed_at_dates, field: :pushed_at_date) - .register_column(:vulnerability_scan_status, field: :vulnerability_scan_status) - .register_column(:vulnerability_severity_counts, field: :vulnerability_severity_counts) - .install_filter_methods_on_resource(self, :table) + .register_column(:digests, field: :digest) + .register_column(:tags, field: :tags) + .register_column(:size_in_bytes, field: :size_in_bytes) + .register_column(:pushed_at_dates, field: :pushed_at_date) + .register_column(:vulnerability_scan_status, field: :vulnerability_scan_status) + .register_column(:vulnerability_severity_counts, field: :vulnerability_severity_counts) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -30,8 +30,8 @@ def initialize(opts = {}) matched_str = opts[:repository_name].match(pattern) unless (opts[:repository_name] == matched_str[0]) && (matched_str.length == 1) && opts[:repository_name].length.between?(2, 256) raise ArgumentError, "#{@__resource_name__}: `repository_name` is not in a valid format. " \ - 'Please check the docs for more info '\ - 'https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html' \ + "Please check the docs for more info "\ + "https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html" \ end @query_params[:repository_name] = opts[:repository_name] # Validate registry_id. (Optional. If not provided, AWS account ID will be used by the AWS API.) diff --git a/libraries/aws_ecr_repositories.rb b/libraries/aws_ecr_repositories.rb index e19b5029e..d569d3b92 100644 --- a/libraries/aws_ecr_repositories.rb +++ b/libraries/aws_ecr_repositories.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEcrRepositories < AwsResourceBase - name 'aws_ecr_repositories' - desc 'Verifies settings for a collection of AWS ECR Repositories.' + name "aws_ecr_repositories" + desc "Verifies settings for a collection of AWS ECR Repositories." example " describe aws_ecr_repositories do @@ -17,13 +17,13 @@ class AwsEcrRepositories < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:names, field: :name) - .register_column(:uris, field: :uri) - .register_column(:created_at_dates, field: :created_at) - .register_column(:image_tag_mutability_status, field: :image_tag_mutability) - .register_column(:image_scanning_on_push_status, field: :image_scanning_on_push_status) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:names, field: :name) + .register_column(:uris, field: :uri) + .register_column(:created_at_dates, field: :created_at) + .register_column(:image_tag_mutability_status, field: :image_tag_mutability) + .register_column(:image_scanning_on_push_status, field: :image_scanning_on_push_status) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ecr_repository.rb b/libraries/aws_ecr_repository.rb index 5512b882a..d1309a73d 100644 --- a/libraries/aws_ecr_repository.rb +++ b/libraries/aws_ecr_repository.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEcrRepository < AwsResourceBase - name 'aws_ecr_repository' - desc 'Verifies settings for an AWS ECR Repository.' + name "aws_ecr_repository" + desc "Verifies settings for an AWS ECR Repository." example " describe aws_ecr_repository('my-repository') do @@ -24,8 +24,8 @@ def initialize(opts = {}) matched_str = opts[:repository_name].match(pattern) unless (opts[:repository_name] == matched_str[0]) && (matched_str.length == 1) && opts[:repository_name].length.between?(2, 256) raise ArgumentError, "#{@__resource_name__}: `repository_name` is not in a valid format. " \ - 'Please check the docs for more info '\ - 'https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html' \ + "Please check the docs for more info "\ + "https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html" \ end @display_name = opts[:repository_name] diff --git a/libraries/aws_ecr_repository_policy.rb b/libraries/aws_ecr_repository_policy.rb index 9ecea55b5..33e72212e 100644 --- a/libraries/aws_ecr_repository_policy.rb +++ b/libraries/aws_ecr_repository_policy.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEcrPolicy < AwsResourceBase - name 'aws_ecr_repository_policy' - desc 'Verifies policy settings for an AWS ECR Repository.' + name "aws_ecr_repository_policy" + desc "Verifies policy settings for an AWS ECR Repository." example " describe aws_ecr_repository_policy(repository_name: 'my-repository') do diff --git a/libraries/aws_ecrpublic_repositories.rb b/libraries/aws_ecrpublic_repositories.rb index 3cd4ecac2..9a594fe80 100644 --- a/libraries/aws_ecrpublic_repositories.rb +++ b/libraries/aws_ecrpublic_repositories.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEcrPublicRepositories < AwsResourceBase - name 'aws_ecrpublic_repositories' - desc 'Verifies settings for a collection of AWS ECR Public Repositories.' + name "aws_ecrpublic_repositories" + desc "Verifies settings for a collection of AWS ECR Public Repositories." example " describe aws_ecrpublic_repositories do @@ -17,11 +17,11 @@ class AwsEcrPublicRepositories < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:names, field: :name) - .register_column(:uris, field: :uri) - .register_column(:created_at_dates, field: :created_at) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:names, field: :name) + .register_column(:uris, field: :uri) + .register_column(:created_at_dates, field: :created_at) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ecrpublic_repository.rb b/libraries/aws_ecrpublic_repository.rb index 4b11624be..34804a14c 100644 --- a/libraries/aws_ecrpublic_repository.rb +++ b/libraries/aws_ecrpublic_repository.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEcrPublicRepository < AwsResourceBase - name 'aws_ecrpublic_repository' - desc 'Verifies settings for an AWS ECR Public Repository.' + name "aws_ecrpublic_repository" + desc "Verifies settings for an AWS ECR Public Repository." example " describe aws_ecrpublic_repository('my-public-repository') do @@ -24,8 +24,8 @@ def initialize(opts = {}) matched_str = opts[:repository_name].match(pattern) unless (opts[:repository_name] == matched_str[0]) && (matched_str.length == 1) && opts[:repository_name].length.between?(2, 256) raise ArgumentError, "#{@__resource_name__}: `repository_name` is not in a valid format. " \ - 'Please check the docs for more info '\ - 'https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html' \ + "Please check the docs for more info "\ + "https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html" \ end @display_name = opts[:repository_name] diff --git a/libraries/aws_ecs_cluster.rb b/libraries/aws_ecs_cluster.rb index 196475cdc..25e26fcc3 100644 --- a/libraries/aws_ecs_cluster.rb +++ b/libraries/aws_ecs_cluster.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEcsCluster < AwsResourceBase - name 'aws_ecs_cluster' - desc 'Verifies settings for an ECS cluster.' + name "aws_ecs_cluster" + desc "Verifies settings for an ECS cluster." example " describe aws_ecs_cluster('backup-cluster') do diff --git a/libraries/aws_ecs_clusters.rb b/libraries/aws_ecs_clusters.rb index 6add5ae04..74f9781e2 100644 --- a/libraries/aws_ecs_clusters.rb +++ b/libraries/aws_ecs_clusters.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEcsClusters < AwsResourceBase - name 'aws_ecs_clusters' - desc 'Verifies settings for a collection AWS ECS Clusters.' + name "aws_ecs_clusters" + desc "Verifies settings for a collection AWS ECS Clusters." example " describe aws_ecs_clusters do it { should exist } @@ -12,15 +12,15 @@ class AwsEcsClusters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:cluster_arns, field: :cluster_arn) - .register_column(:cluster_names, field: :cluster_name) - .register_column(:statuses, field: :status) - .register_column(:running_tasks_counts, field: :running_tasks_count) - .register_column(:pending_tasks_counts, field: :pending_tasks_count) - .register_column(:active_services_counts, field: :active_services_count) - .register_column(:statistics, field: :statistics) - .register_column(:registered_container_instances_counts, field: :registered_container_instances_count) - .install_filter_methods_on_resource(self, :table) + .register_column(:cluster_arns, field: :cluster_arn) + .register_column(:cluster_names, field: :cluster_name) + .register_column(:statuses, field: :status) + .register_column(:running_tasks_counts, field: :running_tasks_count) + .register_column(:pending_tasks_counts, field: :pending_tasks_count) + .register_column(:active_services_counts, field: :active_services_count) + .register_column(:statistics, field: :statistics) + .register_column(:registered_container_instances_counts, field: :registered_container_instances_count) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ecs_service.rb b/libraries/aws_ecs_service.rb index 5133298a4..b223ec298 100644 --- a/libraries/aws_ecs_service.rb +++ b/libraries/aws_ecs_service.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSECSService < AwsResourceBase - name 'aws_ecs_service' - desc 'Describes the specified services running in your cluster.' + name "aws_ecs_service" + desc "Describes the specified services running in your cluster." example " describe aws_ecs_service(cluster: 'test-cluster', services: 'test1') do diff --git a/libraries/aws_ecs_services.rb b/libraries/aws_ecs_services.rb index e22a89ff8..888d03004 100644 --- a/libraries/aws_ecs_services.rb +++ b/libraries/aws_ecs_services.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSECSServices < AwsResourceBase - name 'aws_ecs_services' - desc 'Lists the services that are running in a specified cluster.' + name "aws_ecs_services" + desc "Lists the services that are running in a specified cluster." example " describe aws_ecs_services(cluster: 'cluster_name') do @@ -13,17 +13,17 @@ class AWSECSServices < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:service_arns, field: :service_arn) - .register_column(:service_names, field: :service_name) - .register_column(:cluster_arns, field: :cluster_arn) - .register_column(:status, field: :status) - .register_column(:desired_count, field: :desired_count) - .register_column(:running_count, field: :running_count) - .register_column(:pending_count, field: :pending_count) - .register_column(:launch_types, field: :launch_type) - .register_column(:task_definitions, field: :task_definition) - .register_column(:platform_versions, field: :platform_version) - .install_filter_methods_on_resource(self, :table) + .register_column(:service_arns, field: :service_arn) + .register_column(:service_names, field: :service_name) + .register_column(:cluster_arns, field: :cluster_arn) + .register_column(:status, field: :status) + .register_column(:desired_count, field: :desired_count) + .register_column(:running_count, field: :running_count) + .register_column(:pending_count, field: :pending_count) + .register_column(:launch_types, field: :launch_type) + .register_column(:task_definitions, field: :task_definition) + .register_column(:platform_versions, field: :platform_version) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ecs_task_definition.rb b/libraries/aws_ecs_task_definition.rb index 8f7c778da..74c03fc30 100644 --- a/libraries/aws_ecs_task_definition.rb +++ b/libraries/aws_ecs_task_definition.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSECSTaskDefinition < AwsResourceBase - name 'aws_ecs_task_definition' - desc 'Describes a task definition.' + name "aws_ecs_task_definition" + desc "Describes a task definition." example " describe aws_ecs_task_definition(task_definition: 'hello_world:8') do diff --git a/libraries/aws_ecs_task_definitions.rb b/libraries/aws_ecs_task_definitions.rb index 3ba20ae7f..a1b235ae9 100644 --- a/libraries/aws_ecs_task_definitions.rb +++ b/libraries/aws_ecs_task_definitions.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSECSTaskDefinitions < AwsResourceBase - name 'aws_ecs_task_definitions' - desc 'Returns a list of task definitions that are registered to your account.' + name "aws_ecs_task_definitions" + desc "Returns a list of task definitions that are registered to your account." example " describe aws_ecs_task_definitions do @@ -13,8 +13,8 @@ class AWSECSTaskDefinitions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:task_definition_arns, field: :task_definition_arns) - .install_filter_methods_on_resource(self, :table) + .register_column(:task_definition_arns, field: :task_definition_arns) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_efs_file_system.rb b/libraries/aws_efs_file_system.rb index fd2d652b7..fb7b0df2f 100644 --- a/libraries/aws_efs_file_system.rb +++ b/libraries/aws_efs_file_system.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEfsFileSystem < AwsResourceBase - name 'aws_efs_file_system' - desc 'Verifies settings for an EFS File System.' + name "aws_efs_file_system" + desc "Verifies settings for an EFS File System." example " describe aws_efs_file_system('fs-12345678') do diff --git a/libraries/aws_efs_file_systems.rb b/libraries/aws_efs_file_systems.rb index a61603088..ed4d7d317 100644 --- a/libraries/aws_efs_file_systems.rb +++ b/libraries/aws_efs_file_systems.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEfsFileSystems < AwsResourceBase - name 'aws_efs_file_systems' - desc 'Verifies settings for a collection of AWS EFS File Systems.' + name "aws_efs_file_systems" + desc "Verifies settings for a collection of AWS EFS File Systems." example " describe aws_efs_file_systems do its('count') { should eq 3 } @@ -21,19 +21,19 @@ class AwsEfsFileSystems < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:tags, field: :tags) - .register_column(:file_system_ids, field: :file_system_id) - .register_column(:creation_tokens, field: :creation_token) - .register_column(:owner_ids, field: :owner_id) - .register_column(:creation_times, field: :creation_time) - .register_column(:performance_modes, field: :performance_mode) - .register_column(:encryption_status, field: :encrypted) - .register_column(:throughput_modes, field: :throughput_mode) - .register_column(:kms_key_ids, field: :kms_key_id) - .register_column(:size_in_bytes, field: :size_in_bytes) - .register_column(:life_cycle_states, field: :life_cycle_state) - .register_column(:names, field: :name) - .install_filter_methods_on_resource(self, :table) + .register_column(:tags, field: :tags) + .register_column(:file_system_ids, field: :file_system_id) + .register_column(:creation_tokens, field: :creation_token) + .register_column(:owner_ids, field: :owner_id) + .register_column(:creation_times, field: :creation_time) + .register_column(:performance_modes, field: :performance_mode) + .register_column(:encryption_status, field: :encrypted) + .register_column(:throughput_modes, field: :throughput_mode) + .register_column(:kms_key_ids, field: :kms_key_id) + .register_column(:size_in_bytes, field: :size_in_bytes) + .register_column(:life_cycle_states, field: :life_cycle_state) + .register_column(:names, field: :name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_efs_mount_target.rb b/libraries/aws_efs_mount_target.rb index bf5863fcc..946d28257 100644 --- a/libraries/aws_efs_mount_target.rb +++ b/libraries/aws_efs_mount_target.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEFSMountTarget < AwsResourceBase - name 'aws_efs_mount_target' - desc 'Returns the descriptions of all the current mount targets, or a specific mount target, for a file system. When requesting all of the current mount targets, the order of mount targets returned in the response is unspecified.' + name "aws_efs_mount_target" + desc "Returns the descriptions of all the current mount targets, or a specific mount target, for a file system. When requesting all of the current mount targets, the order of mount targets returned in the response is unspecified." example " describe aws_efs_mount_target(mount_target_id: 'test') do it { should exist } diff --git a/libraries/aws_efs_mount_targets.rb b/libraries/aws_efs_mount_targets.rb index 33a04e13a..06b2ea483 100644 --- a/libraries/aws_efs_mount_targets.rb +++ b/libraries/aws_efs_mount_targets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEFSMountTargets < AwsResourceBase - name 'aws_efs_mount_targets' - desc 'Returns the descriptions of all the current mount targets, or a specific mount target, for a file system. When requesting all of the current mount targets, the order of mount targets returned in the response is unspecified.' + name "aws_efs_mount_targets" + desc "Returns the descriptions of all the current mount targets, or a specific mount target, for a file system. When requesting all of the current mount targets, the order of mount targets returned in the response is unspecified." example " describe aws_efs_mount_targets(file_system_id: 'fs-01234567') do @@ -13,17 +13,17 @@ class AWSEFSMountTargets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:owner_ids, field: :owner_id) - .register_column(:mount_target_ids, field: :mount_target_id) - .register_column(:file_system_ids, field: :file_system_id) - .register_column(:subnet_ids, field: :subnet_id) - .register_column(:life_cycle_states, field: :life_cycle_state) - .register_column(:ip_addresses, field: :ip_address) - .register_column(:network_interface_ids, field: :network_interface_id) - .register_column(:availability_zone_ids, field: :availability_zone_id) - .register_column(:availability_zone_names, field: :availability_zone_name) - .register_column(:vpc_ids, field: :vpc_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:owner_ids, field: :owner_id) + .register_column(:mount_target_ids, field: :mount_target_id) + .register_column(:file_system_ids, field: :file_system_id) + .register_column(:subnet_ids, field: :subnet_id) + .register_column(:life_cycle_states, field: :life_cycle_state) + .register_column(:ip_addresses, field: :ip_address) + .register_column(:network_interface_ids, field: :network_interface_id) + .register_column(:availability_zone_ids, field: :availability_zone_id) + .register_column(:availability_zone_names, field: :availability_zone_name) + .register_column(:vpc_ids, field: :vpc_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_eks_cluster.rb b/libraries/aws_eks_cluster.rb index c2da7eb82..90c7c3bcd 100644 --- a/libraries/aws_eks_cluster.rb +++ b/libraries/aws_eks_cluster.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEksCluster < AwsResourceBase - name 'aws_eks_cluster' - desc 'Verifies settings for an EKS cluster.' + name "aws_eks_cluster" + desc "Verifies settings for an EKS cluster." example " describe aws_eks_cluster('cluster-name') do @@ -29,10 +29,10 @@ def initialize(opts = {}) @security_group_ids = @resp[:resources_vpc_config][:security_group_ids] @security_groups_count = @resp[:resources_vpc_config][:security_group_ids].length @vpc_id = @resp[:resources_vpc_config][:vpc_id] - @active = @resp[:status] == 'ACTIVE' - @failed = @resp[:status] == 'FAILED' - @creating = @resp[:status] == 'CREATING' - @deleting = @resp[:status] == 'DELETING' + @active = @resp[:status] == "ACTIVE" + @failed = @resp[:status] == "FAILED" + @creating = @resp[:status] == "CREATING" + @deleting = @resp[:status] == "DELETING" @enabled_logging_types = @resp.dig(:logging, :cluster_logging)&.select { |log| log[:enabled] }&.map { |type| type[:types] }&.flatten @disabled_logging_types= @resp.dig(:logging, :cluster_logging)&.reject { |log| log[:enabled] }&.map { |type| type[:types] }&.flatten @@ -44,7 +44,7 @@ def resource_id end def exists? - arn.start_with?('arn:') + arn.start_with?("arn:") end def to_s diff --git a/libraries/aws_eks_clusters.rb b/libraries/aws_eks_clusters.rb index b2074a1ec..13125483f 100644 --- a/libraries/aws_eks_clusters.rb +++ b/libraries/aws_eks_clusters.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEksClusters < AwsCollectionResourceBase - name 'aws_eks_clusters' - desc 'Verifies settings for a collection AWS EKS Clusters.' + name "aws_eks_clusters" + desc "Verifies settings for a collection AWS EKS Clusters." example " describe aws_eks_clusters do it { should exist } @@ -54,10 +54,10 @@ def cluster_attributes_from(cluster_name) role_arn: cluster.role_arn, vpc_id: cluster.resources_vpc_config.vpc_id, security_groups_count: cluster.resources_vpc_config.security_group_ids.length, - creating: cluster.status == 'CREATING', - active: cluster.status == 'ACTIVE', - failed: cluster.status == 'FAILED', - deleting: cluster.status == 'DELETING', + creating: cluster.status == "CREATING", + active: cluster.status == "ACTIVE", + failed: cluster.status == "FAILED", + deleting: cluster.status == "DELETING", }) end end diff --git a/libraries/aws_elasticache_cluster.rb b/libraries/aws_elasticache_cluster.rb index dcf056814..43754fe73 100644 --- a/libraries/aws_elasticache_cluster.rb +++ b/libraries/aws_elasticache_cluster.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsElastiCacheCluster < AwsResourceBase - name 'aws_elasticache_cluster' - desc 'Verifies settings for an AWS Elasticache Cluster.' + name "aws_elasticache_cluster" + desc "Verifies settings for an AWS Elasticache Cluster." example " describe aws_elasticache_cluster('my-cluster-001') do @@ -62,7 +62,7 @@ def node_ids end def ports - return unless status == 'available' + return unless status == "available" # This will return a hash with `node_id : port` pairs. @cache_cluster[:cache_nodes].map { |node| [node[:cache_node_id], node[:endpoint][:port]] }.to_h end diff --git a/libraries/aws_elasticache_cluster_node.rb b/libraries/aws_elasticache_cluster_node.rb index 81c9e3e47..6b7d53834 100644 --- a/libraries/aws_elasticache_cluster_node.rb +++ b/libraries/aws_elasticache_cluster_node.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsElastiCacheClusterNode < AwsResourceBase - name 'aws_elasticache_cluster_node' - desc 'Verifies settings for an AWS Elasticache Cluster Node.' + name "aws_elasticache_cluster_node" + desc "Verifies settings for an AWS Elasticache Cluster Node." example " describe aws_elasticache_cluster_node(cache_cluster_id: 'my-elasticache-cluster', node_id: '0001') do @@ -22,7 +22,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: cache_cluster_id must contain between 1 and 50 alphanumeric characters or hyphens, should start with a letter, and cannot end with a hyphen or contain two consecutive hyphens." end # node_id constraints: https://docs.aws.amazon.com/cli/latest/reference/elasticache/describe-cache-clusters.html - error_message = 'node_id must be a string containing 4 digits.' + error_message = "node_id must be a string containing 4 digits." raise ArgumentError, "#{@__resource_name__}: #{error_message}" unless opts[:node_id].is_a?(String) unless /^[\d]{4}$/.match?(opts[:node_id]) raise ArgumentError, "#{@__resource_name__}: #{error_message}" diff --git a/libraries/aws_elasticache_clusters.rb b/libraries/aws_elasticache_clusters.rb index 51001166e..2d4589c7f 100644 --- a/libraries/aws_elasticache_clusters.rb +++ b/libraries/aws_elasticache_clusters.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsElastiCacheClusters < AwsResourceBase - name 'aws_elasticache_clusters' - desc 'Verifies settings for a collection of AWS Elasticache Clusters.' + name "aws_elasticache_clusters" + desc "Verifies settings for a collection of AWS Elasticache Clusters." example " describe aws_elasticache_clusters do its('count') { should eq 3 } @@ -20,15 +20,15 @@ class AwsElastiCacheClusters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:node_types, field: :node_type) - .register_column(:engines, field: :engine) - .register_column(:status, field: :status) - .register_column(:zones, field: :zone) - .register_column(:subnet_group_names, field: :subnet_group_name) - .register_column(:encrypted_at_rest, field: :encrypted_at_rest) - .register_column(:encrypted_at_transit, field: :encrypted_at_transit) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:node_types, field: :node_type) + .register_column(:engines, field: :engine) + .register_column(:status, field: :status) + .register_column(:zones, field: :zone) + .register_column(:subnet_group_names, field: :subnet_group_name) + .register_column(:encrypted_at_rest, field: :encrypted_at_rest) + .register_column(:encrypted_at_transit, field: :encrypted_at_transit) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_elasticache_replication_group.rb b/libraries/aws_elasticache_replication_group.rb index ff0a96d8c..706c6aa1c 100644 --- a/libraries/aws_elasticache_replication_group.rb +++ b/libraries/aws_elasticache_replication_group.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsElastiCacheReplicationGroup < AwsResourceBase - name 'aws_elasticache_replication_group' - desc 'Verifies settings for an AWS Elasticache Replication Group' + name "aws_elasticache_replication_group" + desc "Verifies settings for an AWS Elasticache Replication Group" example " describe aws_elasticache_replication_group('my-replication_group-001') do diff --git a/libraries/aws_elasticache_replication_groups.rb b/libraries/aws_elasticache_replication_groups.rb index 09787f0e4..ff468f604 100644 --- a/libraries/aws_elasticache_replication_groups.rb +++ b/libraries/aws_elasticache_replication_groups.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsElastiCacheReplicationGroups < AwsResourceBase - name 'aws_elasticache_replication_groups' - desc 'Verifies settings for a collection of AWS Replication Groups' + name "aws_elasticache_replication_groups" + desc "Verifies settings for a collection of AWS Replication Groups" example " describe aws_elasticache_replication_groups do its('count') { should eq 3 } @@ -20,12 +20,12 @@ class AwsElastiCacheReplicationGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:node_types, field: :node_type) - .register_column(:status, field: :status) - .register_column(:encrypted_at_rest, field: :encrypted_at_rest) - .register_column(:encrypted_at_transit, field: :encrypted_at_transit) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:node_types, field: :node_type) + .register_column(:status, field: :status) + .register_column(:encrypted_at_rest, field: :encrypted_at_rest) + .register_column(:encrypted_at_transit, field: :encrypted_at_transit) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_elasticloadbalancingv2_listener.rb b/libraries/aws_elasticloadbalancingv2_listener.rb index 676da7180..a4b8ee0b5 100644 --- a/libraries/aws_elasticloadbalancingv2_listener.rb +++ b/libraries/aws_elasticloadbalancingv2_listener.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSElasticLoadBalancingV2Listener < AwsResourceBase - name 'aws_elasticloadbalancingv2_listener' - desc 'Returns information about the endpoints for your account in the current region.' + name "aws_elasticloadbalancingv2_listener" + desc "Returns information about the endpoints for your account in the current region." example " describe aws_elasticloadbalancingv2_listener(listener_arn: 'test') do diff --git a/libraries/aws_elasticloadbalancingv2_listener_certificate.rb b/libraries/aws_elasticloadbalancingv2_listener_certificate.rb index 860cb5afb..aad8297b5 100644 --- a/libraries/aws_elasticloadbalancingv2_listener_certificate.rb +++ b/libraries/aws_elasticloadbalancingv2_listener_certificate.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSElasticLoadBalancingV2ListenerCertificate < AwsResourceBase - name 'aws_elasticloadbalancingv2_listener_certificate' - desc 'Describes the default certificate and the certificate list for the specified HTTPS or TLS listener' + name "aws_elasticloadbalancingv2_listener_certificate" + desc "Describes the default certificate and the certificate list for the specified HTTPS or TLS listener" example " describe aws_elasticloadbalancingv2_listener_certificate(listener_arn: 'test') do diff --git a/libraries/aws_elasticloadbalancingv2_listener_certificates.rb b/libraries/aws_elasticloadbalancingv2_listener_certificates.rb index 5547e5c60..3b3544086 100644 --- a/libraries/aws_elasticloadbalancingv2_listener_certificates.rb +++ b/libraries/aws_elasticloadbalancingv2_listener_certificates.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSElasticLoadBalancingV2ListenerCertificates < AwsResourceBase - name 'aws_elasticloadbalancingv2_listener_certificates' - desc 'Describes the default certificate and the certificate list for the specified HTTPS or TLS listener' + name "aws_elasticloadbalancingv2_listener_certificates" + desc "Describes the default certificate and the certificate list for the specified HTTPS or TLS listener" example " describe aws_elasticloadbalancingv2_listener_certificates(listener_arn: 'test1') do @@ -16,9 +16,9 @@ class AWSElasticLoadBalancingV2ListenerCertificates < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:certificate_arns, field: :certificate_arn) - .register_column(:is_defaults, field: :is_default) - .install_filter_methods_on_resource(self, :table) + .register_column(:certificate_arns, field: :certificate_arn) + .register_column(:is_defaults, field: :is_default) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_elasticloadbalancingv2_listener_rule.rb b/libraries/aws_elasticloadbalancingv2_listener_rule.rb index 86d5d295a..a03f807e6 100644 --- a/libraries/aws_elasticloadbalancingv2_listener_rule.rb +++ b/libraries/aws_elasticloadbalancingv2_listener_rule.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSElasticLoadBalancingV2ListenerRule < AwsResourceBase - name 'aws_elasticloadbalancingv2_listener_rule' - desc 'Describes the specified rules or the rules for the specified listener. You must specify either a listener or one or more rules.' + name "aws_elasticloadbalancingv2_listener_rule" + desc "Describes the specified rules or the rules for the specified listener. You must specify either a listener or one or more rules." example " describe aws_elasticloadbalancingv2_listener_rule(rule_arn: 'test') do diff --git a/libraries/aws_elasticloadbalancingv2_listener_rules.rb b/libraries/aws_elasticloadbalancingv2_listener_rules.rb index 73d1d14b1..e14be8f50 100644 --- a/libraries/aws_elasticloadbalancingv2_listener_rules.rb +++ b/libraries/aws_elasticloadbalancingv2_listener_rules.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSElasticLoadBalancingV2ListenerRules < AwsResourceBase - name 'aws_elasticloadbalancingv2_listener_rules' - desc 'Describes the specified rules or the rules for the specified listener. You must specify either a listener or one or more rules.' + name "aws_elasticloadbalancingv2_listener_rules" + desc "Describes the specified rules or the rules for the specified listener. You must specify either a listener or one or more rules." example " describe aws_elasticloadbalancingv2_listener_rules(listener_arn: 'test1') do @@ -12,12 +12,12 @@ class AWSElasticLoadBalancingV2ListenerRules < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:rule_arns, field: :rule_arn) - .register_column(:priorities, field: :priority) - .register_column(:conditions, field: :conditions) - .register_column(:actions, field: :actions) - .register_column(:is_defaults, field: :is_default) - .install_filter_methods_on_resource(self, :table) + .register_column(:rule_arns, field: :rule_arn) + .register_column(:priorities, field: :priority) + .register_column(:conditions, field: :conditions) + .register_column(:actions, field: :actions) + .register_column(:is_defaults, field: :is_default) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_elasticloadbalancingv2_listeners.rb b/libraries/aws_elasticloadbalancingv2_listeners.rb index f26de9173..4d50f3c35 100644 --- a/libraries/aws_elasticloadbalancingv2_listeners.rb +++ b/libraries/aws_elasticloadbalancingv2_listeners.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSElasticLoadBalancingV2Listeners < AwsResourceBase - name 'aws_elasticloadbalancingv2_listeners' - desc 'Lists the clients that have been created for the specified user pool.' + name "aws_elasticloadbalancingv2_listeners" + desc "Lists the clients that have been created for the specified user pool." example " describe aws_elasticloadbalancingv2_listeners(load_balancer_arn: 'test1') do @@ -12,15 +12,15 @@ class AWSElasticLoadBalancingV2Listeners < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:listener_arns, field: :listener_arn) - .register_column(:load_balancer_arns, field: :load_balancer_arn) - .register_column(:ports, field: :port) - .register_column(:protocols, field: :protocol) - .register_column(:certificates, field: :certificates) - .register_column(:ssl_policies, field: :ssl_policy) - .register_column(:default_actions, field: :default_actions) - .register_column(:alpn_policies, field: :alpn_policy) - .install_filter_methods_on_resource(self, :table) + .register_column(:listener_arns, field: :listener_arn) + .register_column(:load_balancer_arns, field: :load_balancer_arn) + .register_column(:ports, field: :port) + .register_column(:protocols, field: :protocol) + .register_column(:certificates, field: :certificates) + .register_column(:ssl_policies, field: :ssl_policy) + .register_column(:default_actions, field: :default_actions) + .register_column(:alpn_policies, field: :alpn_policy) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_elasticloadbalancingv2_target_group.rb b/libraries/aws_elasticloadbalancingv2_target_group.rb index b42a0152b..5455ebb40 100644 --- a/libraries/aws_elasticloadbalancingv2_target_group.rb +++ b/libraries/aws_elasticloadbalancingv2_target_group.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSElasticLoadBalancingV2TargetGroup < AwsResourceBase - name 'aws_elasticloadbalancingv2_target_group' - desc 'Describes the specified target groups or all of your target groups. By default, all target groups are described. Alternatively, you can specify one of the following to filter the results: the ARN of the load balancer, the names of one or more target groups, or the ARNs of one or more target groups.' + name "aws_elasticloadbalancingv2_target_group" + desc "Describes the specified target groups or all of your target groups. By default, all target groups are described. Alternatively, you can specify one of the following to filter the results: the ARN of the load balancer, the names of one or more target groups, or the ARNs of one or more target groups." example " describe aws_elasticloadbalancingv2_target_group(target_group_arn: 'test-arn') do diff --git a/libraries/aws_elasticloadbalancingv2_target_groups.rb b/libraries/aws_elasticloadbalancingv2_target_groups.rb index 3bc5d22dc..4b8649362 100644 --- a/libraries/aws_elasticloadbalancingv2_target_groups.rb +++ b/libraries/aws_elasticloadbalancingv2_target_groups.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSElasticLoadBalancingV2TargetGroups < AwsResourceBase - name 'aws_elasticloadbalancingv2_target_groups' - desc 'Describes the specified target groups or all of your target groups. By default, all target groups are described. Alternatively, you can specify one of the following to filter the results: the ARN of the load balancer, the names of one or more target groups, or the ARNs of one or more target groups.' + name "aws_elasticloadbalancingv2_target_groups" + desc "Describes the specified target groups or all of your target groups. By default, all target groups are described. Alternatively, you can specify one of the following to filter the results: the ARN of the load balancer, the names of one or more target groups, or the ARNs of one or more target groups." example " describe aws_elasticloadbalancingv2_target_groups do @@ -12,24 +12,24 @@ class AWSElasticLoadBalancingV2TargetGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:target_group_arns, field: :target_group_arn) - .register_column(:target_group_names, field: :target_group_name) - .register_column(:protocols, field: :protocol) - .register_column(:ports, field: :port) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:health_check_protocols, field: :health_check_protocol) - .register_column(:health_check_ports, field: :health_check_port) - .register_column(:health_check_enableds, field: :health_check_enabled) - .register_column(:health_check_interval_seconds, field: :health_check_interval_seconds) - .register_column(:health_check_timeout_seconds, field: :health_check_timeout_seconds) - .register_column(:healthy_threshold_counts, field: :healthy_threshold_count) - .register_column(:unhealthy_threshold_counts, field: :unhealthy_threshold_count) - .register_column(:health_check_paths, field: :health_check_path) - .register_column(:matchers, field: :matcher) - .register_column(:load_balancer_arns, field: :load_balancer_arns) - .register_column(:target_types, field: :target_type) - .register_column(:protocol_versions, field: :protocol_version) - .install_filter_methods_on_resource(self, :table) + .register_column(:target_group_arns, field: :target_group_arn) + .register_column(:target_group_names, field: :target_group_name) + .register_column(:protocols, field: :protocol) + .register_column(:ports, field: :port) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:health_check_protocols, field: :health_check_protocol) + .register_column(:health_check_ports, field: :health_check_port) + .register_column(:health_check_enableds, field: :health_check_enabled) + .register_column(:health_check_interval_seconds, field: :health_check_interval_seconds) + .register_column(:health_check_timeout_seconds, field: :health_check_timeout_seconds) + .register_column(:healthy_threshold_counts, field: :healthy_threshold_count) + .register_column(:unhealthy_threshold_counts, field: :unhealthy_threshold_count) + .register_column(:health_check_paths, field: :health_check_path) + .register_column(:matchers, field: :matcher) + .register_column(:load_balancer_arns, field: :load_balancer_arns) + .register_column(:target_types, field: :target_type) + .register_column(:protocol_versions, field: :protocol_version) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_elasticsearchservice_domain.rb b/libraries/aws_elasticsearchservice_domain.rb index 5877a41cf..428a2f140 100644 --- a/libraries/aws_elasticsearchservice_domain.rb +++ b/libraries/aws_elasticsearchservice_domain.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSElasticSearchServiceDomain < AwsResourceBase - name 'aws_elasticsearchservice_domain' - desc 'Returns domain configuration information about the specified Elasticsearch domain, including the domain ID, domain endpoint, and domain ARN.' + name "aws_elasticsearchservice_domain" + desc "Returns domain configuration information about the specified Elasticsearch domain, including the domain ID, domain endpoint, and domain ARN." example " describe aws_elasticsearchservice_domain(domain_name: 'DomainName') do @@ -29,7 +29,7 @@ def domain_name end def resource_id - @domain_status? @domain_status[:domain_id]: '' + @domain_status? @domain_status[:domain_id]: "" end def exists? diff --git a/libraries/aws_elasticsearchservice_domains.rb b/libraries/aws_elasticsearchservice_domains.rb index d63c4bb3a..3784e3add 100644 --- a/libraries/aws_elasticsearchservice_domains.rb +++ b/libraries/aws_elasticsearchservice_domains.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSElasticSearchServiceDomains < AwsResourceBase - name 'aws_elasticsearchservice_domains' - desc 'Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users.' + name "aws_elasticsearchservice_domains" + desc "Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users." example " describe aws_elasticsearchservice_domains do @@ -13,8 +13,8 @@ class AWSElasticSearchServiceDomains < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:domain_names, field: :domain_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:domain_names, field: :domain_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_elb.rb b/libraries/aws_elb.rb index 8b9afd62f..0af0d3edf 100644 --- a/libraries/aws_elb.rb +++ b/libraries/aws_elb.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsElb < AwsResourceBase - name 'aws_elb' - desc 'Verifies settings for an Elastic Load Balancer.' + name "aws_elb" + desc "Verifies settings for an Elastic Load Balancer." example " describe aws_elb('load-balancer-1') do @@ -51,12 +51,12 @@ def access_log_enabled? def ssl_policies @ssl_policies ||= catch_aws_errors do elb_client.describe_load_balancer_policies(load_balancer_name: opts[:load_balancer_name]) - .policy_descriptions.select { |p| policies_in_use.include?(p.policy_name) } + .policy_descriptions.select { |p| policies_in_use.include?(p.policy_name) } end end def resource_id - @load_balancer_description? "#{@load_balancer_name}_#{@load_balancer_description[:availability_zones]}" : '' + @load_balancer_description? "#{@load_balancer_name}_#{@load_balancer_description[:availability_zones]}" : "" end private diff --git a/libraries/aws_elbs.rb b/libraries/aws_elbs.rb index ec06f5c39..ea07f33b9 100644 --- a/libraries/aws_elbs.rb +++ b/libraries/aws_elbs.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsElbs < AwsResourceBase - name 'aws_elbs' - desc 'Verifies settings for a collection AWS Elastic Load Balancers.' + name "aws_elbs" + desc "Verifies settings for a collection AWS Elastic Load Balancers." example " describe aws_elbs do it { should exist } @@ -12,16 +12,16 @@ class AwsElbs < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:availability_zones, field: :availability_zones) - .register_column(:dns_names, field: :dns_name) - .register_column(:load_balancer_names, field: :load_balancer_name) - .register_column(:external_ports, field: :external_ports) - .register_column(:instance_ids, field: :instance_ids) - .register_column(:internal_ports, field: :internal_ports) - .register_column(:security_group_ids, field: :security_group_ids) - .register_column(:subnet_ids, field: :subnet_ids) - .register_column(:vpc_ids, field: :vpc_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:availability_zones, field: :availability_zones) + .register_column(:dns_names, field: :dns_name) + .register_column(:load_balancer_names, field: :load_balancer_name) + .register_column(:external_ports, field: :external_ports) + .register_column(:instance_ids, field: :instance_ids) + .register_column(:internal_ports, field: :internal_ports) + .register_column(:security_group_ids, field: :security_group_ids) + .register_column(:subnet_ids, field: :subnet_ids) + .register_column(:vpc_ids, field: :vpc_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_emr_cluster.rb b/libraries/aws_emr_cluster.rb index 9f4e201f3..b8dc38452 100644 --- a/libraries/aws_emr_cluster.rb +++ b/libraries/aws_emr_cluster.rb @@ -1,9 +1,9 @@ -require 'aws_backend' -require 'json' +require "aws_backend" +require "json" class AwsEmrCluster < AwsResourceBase - name 'aws_emr_cluster' - desc 'Verifies settings for an EMR cluster.' + name "aws_emr_cluster" + desc "Verifies settings for an EMR cluster." example " describe aws_emr_cluster('CLUSTER_ID') do @@ -75,11 +75,11 @@ def exists? end def running? - !@status_state.nil? && @status_state == 'RUNNING' + !@status_state.nil? && @status_state == "RUNNING" end def waiting? - !@status_state.nil? && @status_state == 'WAITING' + !@status_state.nil? && @status_state == "WAITING" end def resource_id diff --git a/libraries/aws_emr_clusters.rb b/libraries/aws_emr_clusters.rb index b5a8ecab6..17ac1d4fd 100644 --- a/libraries/aws_emr_clusters.rb +++ b/libraries/aws_emr_clusters.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsEmrClusters < AwsResourceBase - name 'aws_emr_clusters' - desc 'Verifies settings for a collection of AWS EMR Clusters.' + name "aws_emr_clusters" + desc "Verifies settings for a collection of AWS EMR Clusters." example " describe aws_emr_clusters do it { should exist } @@ -11,25 +11,25 @@ class AwsEmrClusters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:cluster_ids, field: :cluster_id) - .register_column(:cluster_names, field: :cluster_name) - .register_column(:cluster_arns, field: :cluster_arn) - .register_column(:application_names, field: :application_names, style: :simple) # TODO: to be tested - .register_column(:status_states, field: :status_state) - .register_column(:auto_scaling_roles, field: :auto_scaling_role) - .register_column(:custom_ami_ids, field: :custom_ami_id) - .register_column(:ebs_root_volume_sizes, field: :ebs_root_volume_size) - .register_column(:kerberos_attributes_realms, field: :kerberos_attributes_realm) - .register_column(:kerberos_attributes_realm_ad_domain_join_users, field: :kerberos_attributes_realm_ad_domain_join_user) - .register_column(:log_encryption_kms_key_ids, field: :log_encryption_kms_key_id) - .register_column(:log_uris, field: :log_uri) - .register_column(:release_labels, field: :release_label) - .register_column(:scale_down_behaviors, field: :scale_down_behavior) - .register_column(:service_roles, field: :service_role) - .register_column(:step_concurrency_levels, field: :step_concurrency_level) - .register_column(:visible_to_all_users, field: :visible_to_all_users) - .register_column(:security_configuration_names, field: :security_configuration_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:cluster_ids, field: :cluster_id) + .register_column(:cluster_names, field: :cluster_name) + .register_column(:cluster_arns, field: :cluster_arn) + .register_column(:application_names, field: :application_names, style: :simple) # TODO: to be tested + .register_column(:status_states, field: :status_state) + .register_column(:auto_scaling_roles, field: :auto_scaling_role) + .register_column(:custom_ami_ids, field: :custom_ami_id) + .register_column(:ebs_root_volume_sizes, field: :ebs_root_volume_size) + .register_column(:kerberos_attributes_realms, field: :kerberos_attributes_realm) + .register_column(:kerberos_attributes_realm_ad_domain_join_users, field: :kerberos_attributes_realm_ad_domain_join_user) + .register_column(:log_encryption_kms_key_ids, field: :log_encryption_kms_key_id) + .register_column(:log_uris, field: :log_uri) + .register_column(:release_labels, field: :release_label) + .register_column(:scale_down_behaviors, field: :scale_down_behavior) + .register_column(:service_roles, field: :service_role) + .register_column(:step_concurrency_levels, field: :step_concurrency_level) + .register_column(:visible_to_all_users, field: :visible_to_all_users) + .register_column(:security_configuration_names, field: :security_configuration_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_emr_security_configuration.rb b/libraries/aws_emr_security_configuration.rb index 2c9f9b60b..b52396d48 100644 --- a/libraries/aws_emr_security_configuration.rb +++ b/libraries/aws_emr_security_configuration.rb @@ -1,9 +1,9 @@ -require 'aws_backend' -require 'json' +require "aws_backend" +require "json" class AwsEmrClusterSecurityConfiguration < AwsResourceBase - name 'aws_emr_security_configuration' - desc 'Verifies security configuration for an EMR cluster.' + name "aws_emr_security_configuration" + desc "Verifies security configuration for an EMR cluster." example " describe aws_emr_security_configuration('SECURITY_CONFIGURATION_NAME') do @@ -28,11 +28,11 @@ def initialize(opts = {}) json_security_configuration = resp.security_configuration return if json_security_configuration.nil? || json_security_configuration.empty? parsed_json = JSON.parse(json_security_configuration) - @encryption_at_rest = !parsed_json['EncryptionConfiguration']['EnableAtRestEncryption'].nil? && parsed_json['EncryptionConfiguration']['EnableAtRestEncryption'] - @encryption_in_transit = !parsed_json['EncryptionConfiguration']['EnableInTransitEncryption'].nil? && parsed_json['EncryptionConfiguration']['EnableInTransitEncryption'] - @local_disk_encryption = !parsed_json['EncryptionConfiguration']['AtRestEncryptionConfiguration'].nil? && - !parsed_json['EncryptionConfiguration']['AtRestEncryptionConfiguration']['LocalDiskEncryptionConfiguration'].nil? && - !parsed_json['EncryptionConfiguration']['AtRestEncryptionConfiguration']['LocalDiskEncryptionConfiguration'].empty? + @encryption_at_rest = !parsed_json["EncryptionConfiguration"]["EnableAtRestEncryption"].nil? && parsed_json["EncryptionConfiguration"]["EnableAtRestEncryption"] + @encryption_in_transit = !parsed_json["EncryptionConfiguration"]["EnableInTransitEncryption"].nil? && parsed_json["EncryptionConfiguration"]["EnableInTransitEncryption"] + @local_disk_encryption = !parsed_json["EncryptionConfiguration"]["AtRestEncryptionConfiguration"].nil? && + !parsed_json["EncryptionConfiguration"]["AtRestEncryptionConfiguration"]["LocalDiskEncryptionConfiguration"].nil? && + !parsed_json["EncryptionConfiguration"]["AtRestEncryptionConfiguration"]["LocalDiskEncryptionConfiguration"].empty? end end diff --git a/libraries/aws_emr_security_configurations.rb b/libraries/aws_emr_security_configurations.rb index 6e9e36064..26efdc7a8 100644 --- a/libraries/aws_emr_security_configurations.rb +++ b/libraries/aws_emr_security_configurations.rb @@ -1,9 +1,9 @@ -require 'aws_backend' -require 'json' +require "aws_backend" +require "json" class AwsEmrClusterSecurityConfigurations < AwsResourceBase - name 'aws_emr_security_configurations' - desc 'Verifies collection of security configuration for an EMR cluster.' + name "aws_emr_security_configurations" + desc "Verifies collection of security configuration for an EMR cluster." example " describe aws_emr_security_configurations do it { should exist } @@ -12,11 +12,11 @@ class AwsEmrClusterSecurityConfigurations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:security_configuration_names, field: :security_configuration_name) - .register_column(:encryption_at_rests, field: :encryption_at_rest) - .register_column(:encryption_in_transits, field: :encryption_in_transit) - .register_column(:local_disk_encryptions, field: :local_disk_encryption) - .install_filter_methods_on_resource(self, :table) + .register_column(:security_configuration_names, field: :security_configuration_name) + .register_column(:encryption_at_rests, field: :encryption_at_rest) + .register_column(:encryption_in_transits, field: :encryption_in_transit) + .register_column(:local_disk_encryptions, field: :local_disk_encryption) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -37,11 +37,11 @@ def fetch_data resp_security_configurations.security_configurations.each do |s| resp_security_configuration = @aws.emr_client.describe_security_configuration({ name: s.name }) parsed_json = JSON.parse(resp_security_configuration.security_configuration) - encryption_at_rest = !parsed_json['EncryptionConfiguration']['EnableAtRestEncryption'].nil? && parsed_json['EncryptionConfiguration']['EnableAtRestEncryption'] - encryption_in_transit = !parsed_json['EncryptionConfiguration']['EnableInTransitEncryption'].nil? && parsed_json['EncryptionConfiguration']['EnableInTransitEncryption'] - local_disk_encryption = !parsed_json['EncryptionConfiguration']['AtRestEncryptionConfiguration'].nil? && - !parsed_json['EncryptionConfiguration']['AtRestEncryptionConfiguration']['LocalDiskEncryptionConfiguration'].nil? && - !parsed_json['EncryptionConfiguration']['AtRestEncryptionConfiguration']['LocalDiskEncryptionConfiguration'].empty? + encryption_at_rest = !parsed_json["EncryptionConfiguration"]["EnableAtRestEncryption"].nil? && parsed_json["EncryptionConfiguration"]["EnableAtRestEncryption"] + encryption_in_transit = !parsed_json["EncryptionConfiguration"]["EnableInTransitEncryption"].nil? && parsed_json["EncryptionConfiguration"]["EnableInTransitEncryption"] + local_disk_encryption = !parsed_json["EncryptionConfiguration"]["AtRestEncryptionConfiguration"].nil? && + !parsed_json["EncryptionConfiguration"]["AtRestEncryptionConfiguration"]["LocalDiskEncryptionConfiguration"].nil? && + !parsed_json["EncryptionConfiguration"]["AtRestEncryptionConfiguration"]["LocalDiskEncryptionConfiguration"].empty? security_configuration_rows += [{ security_configuration_name: s.name, encryption_at_rest: encryption_at_rest, diff --git a/libraries/aws_eventbridge_rule.rb b/libraries/aws_eventbridge_rule.rb index bc9d3ac80..7b778a5c0 100644 --- a/libraries/aws_eventbridge_rule.rb +++ b/libraries/aws_eventbridge_rule.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEventBridgeRule < AwsResourceBase - name 'aws_eventbridge_rule' - desc 'Describes the specified rule.' + name "aws_eventbridge_rule" + desc "Describes the specified rule." example " describe aws_eventbridge_rule(name: 'test_rule') do diff --git a/libraries/aws_eventbridge_rules.rb b/libraries/aws_eventbridge_rules.rb index 8901449df..f9abc8e1e 100644 --- a/libraries/aws_eventbridge_rules.rb +++ b/libraries/aws_eventbridge_rules.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSEventBridgeRules < AwsResourceBase - name 'aws_eventbridge_rules' - desc 'Lists your Amazon EventBridge rules.' + name "aws_eventbridge_rules" + desc "Lists your Amazon EventBridge rules." example " describe aws_eventbridge_rules do @@ -13,16 +13,16 @@ class AWSEventBridgeRules < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:arns, field: :arn) - .register_column(:event_patterns, field: :event_pattern) - .register_column(:states, field: :state) - .register_column(:descriptions, field: :description) - .register_column(:schedule_expressions, field: :schedule_expression) - .register_column(:role_arns, field: :role_arn) - .register_column(:managed_bys, field: :managed_by) - .register_column(:event_bus_names, field: :event_bus_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:arns, field: :arn) + .register_column(:event_patterns, field: :event_pattern) + .register_column(:states, field: :state) + .register_column(:descriptions, field: :description) + .register_column(:schedule_expressions, field: :schedule_expression) + .register_column(:role_arns, field: :role_arn) + .register_column(:managed_bys, field: :managed_by) + .register_column(:event_bus_names, field: :event_bus_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_flow_log.rb b/libraries/aws_flow_log.rb index 49c44286d..62fa2d60f 100644 --- a/libraries/aws_flow_log.rb +++ b/libraries/aws_flow_log.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsFlowLog < AwsResourceBase - name 'aws_flow_log' - desc 'Verifies settings for an AWS VPC flow logs.' + name "aws_flow_log" + desc "Verifies settings for an AWS VPC flow logs." example " describe aws_flow_log('fl-9c718cf5') do @@ -16,9 +16,9 @@ def initialize(opts = {}) super(opts) validate_parameters(require_any_of: %i(flow_log_id subnet_id vpc_id)) - query = { filter: [{ name: 'flow-log-id', values: [opts[:flow_log_id]] }] } if opts[:flow_log_id] - query = { filter: [{ name: 'resource-id', values: [opts[:subnet_id]] }] } if opts[:subnet_id] - query = { filter: [{ name: 'resource-id', values: [opts[:vpc_id]] }] } if opts[:vpc_id] + query = { filter: [{ name: "flow-log-id", values: [opts[:flow_log_id]] }] } if opts[:flow_log_id] + query = { filter: [{ name: "resource-id", values: [opts[:subnet_id]] }] } if opts[:subnet_id] + query = { filter: [{ name: "resource-id", values: [opts[:vpc_id]] }] } if opts[:vpc_id] catch_aws_errors do resp = @aws.compute_client.describe_flow_logs(query) @@ -35,24 +35,24 @@ def initialize(opts = {}) def resource_type case @resource_id when /^eni/ - @resource_type = 'eni' + @resource_type = "eni" when /^subnet/ - @resource_type = 'subnet' + @resource_type = "subnet" when /^vpc/ - @resource_type = 'vpc' + @resource_type = "vpc" end end def attached_to_eni? - resource_type.eql?('eni') + resource_type.eql?("eni") end def attached_to_subnet? - resource_type.eql?('subnet') + resource_type.eql?("subnet") end def attached_to_vpc? - resource_type.eql?('vpc') + resource_type.eql?("vpc") end def exists? diff --git a/libraries/aws_glue_crawler.rb b/libraries/aws_glue_crawler.rb index f5b1b3433..c26d4bd0f 100644 --- a/libraries/aws_glue_crawler.rb +++ b/libraries/aws_glue_crawler.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSGlueCrawler < AwsResourceBase - name 'aws_glue_crawler' - desc 'Retrieves metadata for a crawler defined in the customer account.' + name "aws_glue_crawler" + desc "Retrieves metadata for a crawler defined in the customer account." example " describe aws_glue_crawler(name: 'crawler_name') do diff --git a/libraries/aws_glue_crawlers.rb b/libraries/aws_glue_crawlers.rb index b47ed559e..3d60ee7aa 100644 --- a/libraries/aws_glue_crawlers.rb +++ b/libraries/aws_glue_crawlers.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSGlueCrawlers < AwsResourceBase - name 'aws_glue_crawlers' - desc 'Retrieves metadata for all crawlers defined in the customer account.' + name "aws_glue_crawlers" + desc "Retrieves metadata for all crawlers defined in the customer account." example " describe aws_glue_crawlers do @@ -13,25 +13,25 @@ class AWSGlueCrawlers < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:roles, field: :role) - .register_column(:targets, field: :targets) - .register_column(:database_names, field: :database_name) - .register_column(:descriptions, field: :description) - .register_column(:classifiers, field: :classifiers) - .register_column(:recrawl_policies, field: :recrawl_policy) - .register_column(:schema_change_policies, field: :schema_change_policy) - .register_column(:states, field: :state) - .register_column(:table_prefixes, field: :table_prefix) - .register_column(:schedules, field: :schedule) - .register_column(:crawl_elapsed_times, field: :crawl_elapsed_time) - .register_column(:creation_times, field: :creation_time) - .register_column(:last_updated, field: :last_updated) - .register_column(:last_crawls, field: :last_crawl) - .register_column(:versions, field: :version) - .register_column(:configurations, field: :configuration) - .register_column(:crawler_security_configuration, field: :crawler_security_configuration) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:roles, field: :role) + .register_column(:targets, field: :targets) + .register_column(:database_names, field: :database_name) + .register_column(:descriptions, field: :description) + .register_column(:classifiers, field: :classifiers) + .register_column(:recrawl_policies, field: :recrawl_policy) + .register_column(:schema_change_policies, field: :schema_change_policy) + .register_column(:states, field: :state) + .register_column(:table_prefixes, field: :table_prefix) + .register_column(:schedules, field: :schedule) + .register_column(:crawl_elapsed_times, field: :crawl_elapsed_time) + .register_column(:creation_times, field: :creation_time) + .register_column(:last_updated, field: :last_updated) + .register_column(:last_crawls, field: :last_crawl) + .register_column(:versions, field: :version) + .register_column(:configurations, field: :configuration) + .register_column(:crawler_security_configuration, field: :crawler_security_configuration) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_glue_database.rb b/libraries/aws_glue_database.rb index 66e0eb550..316a8a879 100644 --- a/libraries/aws_glue_database.rb +++ b/libraries/aws_glue_database.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSGlueDatabase < AwsResourceBase - name 'aws_glue_database' - desc 'Retrieves the definition of a specified database.' + name "aws_glue_database" + desc "Retrieves the definition of a specified database." example " describe aws_glue_database(name: 'db_name') do diff --git a/libraries/aws_glue_databases.rb b/libraries/aws_glue_databases.rb index 36258474f..f82ab8b88 100644 --- a/libraries/aws_glue_databases.rb +++ b/libraries/aws_glue_databases.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSGlueDatabases < AwsResourceBase - name 'aws_glue_databases' - desc 'Retrieves all databases defined in a given Data Catalog.' + name "aws_glue_databases" + desc "Retrieves all databases defined in a given Data Catalog." example " describe aws_glue_databases do @@ -13,15 +13,15 @@ class AWSGlueDatabases < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:descriptions, field: :description) - .register_column(:location_uris, field: :location_uri) - .register_column(:parameters, field: :parameters) - .register_column(:create_times, field: :create_time) - .register_column(:create_table_default_permissions, field: :create_table_default_permissions) - .register_column(:target_databases, field: :target_database) - .register_column(:catalog_ids, field: :catalog_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:descriptions, field: :description) + .register_column(:location_uris, field: :location_uri) + .register_column(:parameters, field: :parameters) + .register_column(:create_times, field: :create_time) + .register_column(:create_table_default_permissions, field: :create_table_default_permissions) + .register_column(:target_databases, field: :target_database) + .register_column(:catalog_ids, field: :catalog_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_guardduty_detector.rb b/libraries/aws_guardduty_detector.rb index afaff5c0d..bf8b558b9 100644 --- a/libraries/aws_guardduty_detector.rb +++ b/libraries/aws_guardduty_detector.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsGuardDutyDetector < AwsResourceBase - name 'aws_guardduty_detector' - desc 'Verifies settings for a Detector.' + name "aws_guardduty_detector" + desc "Verifies settings for a Detector." example " describe aws_guardduty_detector(detector_id: 'detector-id') do it { should exist } @@ -28,7 +28,7 @@ def initialize(opts = {}) end def resource_id - "#{@res? @display_name: ''}_#{@res? @created_at: ''}" + "#{@res? @display_name: ""}_#{@res? @created_at: ""}" end def exists? @@ -36,7 +36,7 @@ def exists? end def enabled? - status.upcase == 'ENABLED' + status.upcase == "ENABLED" end def to_s diff --git a/libraries/aws_guardduty_detectors.rb b/libraries/aws_guardduty_detectors.rb index 554b90254..f4f0f220a 100644 --- a/libraries/aws_guardduty_detectors.rb +++ b/libraries/aws_guardduty_detectors.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsGuardDutyDetectors < AwsResourceBase - name 'aws_guardduty_detectors' - desc 'Verifies settings for a Detector in bulk.' + name "aws_guardduty_detectors" + desc "Verifies settings for a Detector in bulk." example " describe aws_guardduty_detectors do it { should exist } @@ -12,8 +12,8 @@ class AwsGuardDutyDetectors < AwsResourceBase attr_reader :table, :detector_rows, :api_response FilterTable.create - .register_column(:detector_ids, field: :detector_ids) - .install_filter_methods_on_resource(self, :table) + .register_column(:detector_ids, field: :detector_ids) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_hosted_zone.rb b/libraries/aws_hosted_zone.rb index 07627d57c..8881bd683 100644 --- a/libraries/aws_hosted_zone.rb +++ b/libraries/aws_hosted_zone.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsHostedZone < AwsResourceBase - name 'aws_hosted_zone' - desc 'Verifies hosted zone settings are correct.' + name "aws_hosted_zone" + desc "Verifies hosted zone settings are correct." example " describe aws_hosted_zone('zone-name') do @@ -16,13 +16,13 @@ class AwsHostedZone < AwsResourceBase attr_reader :records FilterTable.create - .register_column(:record_names, field: :record_name) - .register_column(:ids, field: :id) - .register_column(:private, field: :private) - .register_column(:ttls, field: :ttl) - .register_column(:types, field: :type) - .register_column(:values, field: :value) - .install_filter_methods_on_resource(self, :records) + .register_column(:record_names, field: :record_name) + .register_column(:ids, field: :id) + .register_column(:private, field: :private) + .register_column(:ttls, field: :ttl) + .register_column(:types, field: :type) + .register_column(:values, field: :value) + .install_filter_methods_on_resource(self, :records) def initialize(opts = {}) opts = { zone_name: opts } if opts.is_a?(String) diff --git a/libraries/aws_hosted_zones.rb b/libraries/aws_hosted_zones.rb index b54ab299a..b05c7fe2e 100644 --- a/libraries/aws_hosted_zones.rb +++ b/libraries/aws_hosted_zones.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSHostedZones < AwsResourceBase - name 'aws_hosted_zones' - desc 'Retrieves a list of the public and private hosted zones that are associated with the current Amazon Web Services account.' + name "aws_hosted_zones" + desc "Retrieves a list of the public and private hosted zones that are associated with the current Amazon Web Services account." example " describe aws_hosted_zones do @@ -19,13 +19,13 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:caller_references, field: :caller_reference) - .register_column(:configs, field: :config) - .register_column(:resource_record_set_counts, field: :resource_record_set_count) - .register_column(:linked_services, field: :linked_service) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:caller_references, field: :caller_reference) + .register_column(:configs, field: :config) + .register_column(:resource_record_set_counts, field: :resource_record_set_count) + .register_column(:linked_services, field: :linked_service) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_iam_access_key.rb b/libraries/aws_iam_access_key.rb index 5765f0e74..279847cdb 100644 --- a/libraries/aws_iam_access_key.rb +++ b/libraries/aws_iam_access_key.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamAccessKey < AwsResourceBase - name 'aws_iam_access_key' - desc 'Verifies settings for an AWS IAM Access Key.' + name "aws_iam_access_key" + desc "Verifies settings for an AWS IAM Access Key." example " describe aws_iam_access_key(username: 'username', access_key_id: 'access-key id') do it { should exist } @@ -19,7 +19,7 @@ class AwsIamAccessKey < AwsResourceBase def initialize(opts = {}) if opts.is_a?(String) # If String passed, determine if username or ID. - if opts.start_with?('AKIA') + if opts.start_with?("AKIA") opts = { access_key_id: opts } else opts = { username: opts } @@ -74,7 +74,7 @@ def resource_id def active? return unless exists? - status == 'Active' + status == "Active" end def exists? @@ -90,8 +90,8 @@ def last_used_date return @last_used_date if defined? @last_used_date catch_aws_errors do @last_used_date = @aws.iam_client.get_access_key_last_used({ access_key_id: @access_key_id }) - .access_key_last_used - .last_used_date + .access_key_last_used + .last_used_date end end end diff --git a/libraries/aws_iam_access_keys.rb b/libraries/aws_iam_access_keys.rb index a52f4aa0e..af5bc4e1b 100644 --- a/libraries/aws_iam_access_keys.rb +++ b/libraries/aws_iam_access_keys.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamAccessKeys < AwsCollectionResourceBase - name 'aws_iam_access_keys' - desc 'Verifies settings for a collection of AWS IAM Access Keys.' + name "aws_iam_access_keys" + desc "Verifies settings for a collection of AWS IAM Access Keys." example " describe aws_iam_access_keys do it { should_not exist } @@ -12,22 +12,22 @@ class AwsIamAccessKeys < AwsCollectionResourceBase attr_reader :table FilterTable.create - .register_column(:usernames, field: :username) - .register_column(:access_key_ids, field: :access_key_id) - .register_column(:created_date, field: :create_date) - .register_column(:created_days_ago, field: :created_days_ago) - .register_column(:created_with_user, field: :created_with_user) - .register_column(:created_hours_ago, field: :created_hours_ago) - .register_column(:active, field: :active) - .register_column(:inactive, field: :inactive) - .register_column(:last_used_date, field: :last_used_date, lazy_instance: :lazy_load_last_used_date) - .register_column(:last_used_hours_ago, field: :last_used_hours_ago, lazy_instance: :lazy_load_last_used_hours_ago) - .register_column(:last_used_days_ago, field: :last_used_days_ago, lazy_instance: :lazy_load_last_used_days_ago) - .register_column(:ever_used, field: :ever_used, lazy_instance: :lazy_load_ever_used) - .register_column(:never_used, field: :never_used, lazy_instance: :lazy_load_never_used_time) - .register_column(:user_created_date, field: :user_created_date) - .register_custom_matcher(:exists?) { |x| !x.entries.empty? } - .install_filter_methods_on_resource(self, :table) + .register_column(:usernames, field: :username) + .register_column(:access_key_ids, field: :access_key_id) + .register_column(:created_date, field: :create_date) + .register_column(:created_days_ago, field: :created_days_ago) + .register_column(:created_with_user, field: :created_with_user) + .register_column(:created_hours_ago, field: :created_hours_ago) + .register_column(:active, field: :active) + .register_column(:inactive, field: :inactive) + .register_column(:last_used_date, field: :last_used_date, lazy_instance: :lazy_load_last_used_date) + .register_column(:last_used_hours_ago, field: :last_used_hours_ago, lazy_instance: :lazy_load_last_used_hours_ago) + .register_column(:last_used_days_ago, field: :last_used_days_ago, lazy_instance: :lazy_load_last_used_days_ago) + .register_column(:ever_used, field: :ever_used, lazy_instance: :lazy_load_ever_used) + .register_column(:never_used, field: :never_used, lazy_instance: :lazy_load_never_used_time) + .register_column(:user_created_date, field: :user_created_date) + .register_custom_matcher(:exists?) { |x| !x.entries.empty? } + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) opts = { username: opts } if opts.is_a?(String) @@ -37,7 +37,7 @@ def initialize(opts = {}) end def to_s - 'IAM Access Keys' + "IAM Access Keys" end private @@ -92,8 +92,8 @@ def fetch_keys(username) access_key_hash = access_key.to_h access_key_hash[:username] = access_key_hash[:user_name] access_key_hash[:id] = access_key_hash[:access_key_id] - access_key_hash[:active] = access_key_hash[:status] == 'Active' - access_key_hash[:inactive] = access_key_hash[:status] != 'Active' + access_key_hash[:active] = access_key_hash[:status] == "Active" + access_key_hash[:inactive] = access_key_hash[:status] != "Active" access_key_hash[:created_hours_ago] = ((Time.now - access_key_hash[:create_date]) / (60*60)).to_i access_key_hash[:created_days_ago] = (access_key_hash[:created_hours_ago] / 24).to_i access_key_hash[:user_created_date] = @_users.find { |user| user.user_name == access_key_hash[:username] }.create_date @@ -106,7 +106,7 @@ def fetch_keys(username) def last_used(row, _condition, _table) catch_aws_errors do iam_client.get_access_key_last_used({ access_key_id: row[:access_key_id] }) - .access_key_last_used + .access_key_last_used end end diff --git a/libraries/aws_iam_account_alias.rb b/libraries/aws_iam_account_alias.rb index e5fa73bf9..25e69a865 100644 --- a/libraries/aws_iam_account_alias.rb +++ b/libraries/aws_iam_account_alias.rb @@ -1,13 +1,13 @@ class AwsIamAccountAlias < AwsResourceBase - name 'aws_iam_account_alias' - desc 'Verifies settings for an AWS IAM Account Alias.' + name "aws_iam_account_alias" + desc "Verifies settings for an AWS IAM Account Alias." example " describe aws_iam_account_alias do it { should exist } its('alias') { should match /^fancy-/ } end " - supports platform: 'aws' + supports platform: "aws" attr_reader :alias diff --git a/libraries/aws_iam_credential_report.rb b/libraries/aws_iam_credential_report.rb index b5a6db968..29fc4d044 100644 --- a/libraries/aws_iam_credential_report.rb +++ b/libraries/aws_iam_credential_report.rb @@ -14,29 +14,29 @@ class AwsIamCredentialReport < AwsCollectionResourceBase attr_reader :table FilterTable.create - .register_column(:user, field: :user) - .register_column(:arn, field: :arn) - .register_column(:user_creation_time, field: :user_creation_time) - .register_column(:password_enabled, field: :password_enabled) - .register_column(:password_last_used, field: :password_last_used) - .register_column(:password_last_changed, field: :password_last_changed) - .register_column(:password_next_rotation, field: :password_next_rotation) - .register_column(:mfa_active, field: :mfa_active) - .register_column(:access_key_1_active, field: :access_key_1_active) - .register_column(:access_key_1_last_rotated, field: :access_key_1_last_rotated) - .register_column(:access_key_1_last_used_date, field: :access_key_1_last_used_date) - .register_column(:access_key_1_last_used_region, field: :access_key_1_last_used_region) - .register_column(:access_key_1_last_used_service, field: :access_key_1_last_used_service) - .register_column(:access_key_2_active, field: :access_key_2_active) - .register_column(:access_key_2_last_rotated, field: :access_key_2_last_rotated) - .register_column(:access_key_2_last_used_date, field: :access_key_2_last_used_date) - .register_column(:access_key_2_last_used_region, field: :access_key_2_last_used_region) - .register_column(:access_key_2_last_used_service, field: :access_key_2_last_used_service) - .register_column(:cert_1_active, field: :cert_1_active) - .register_column(:cert_1_last_rotated, field: :cert_1_last_rotated) - .register_column(:cert_2_active, field: :cert_2_active) - .register_column(:cert_2_last_rotated, field: :cert_2_last_rotated) - .install_filter_methods_on_resource(self, :table) + .register_column(:user, field: :user) + .register_column(:arn, field: :arn) + .register_column(:user_creation_time, field: :user_creation_time) + .register_column(:password_enabled, field: :password_enabled) + .register_column(:password_last_used, field: :password_last_used) + .register_column(:password_last_changed, field: :password_last_changed) + .register_column(:password_next_rotation, field: :password_next_rotation) + .register_column(:mfa_active, field: :mfa_active) + .register_column(:access_key_1_active, field: :access_key_1_active) + .register_column(:access_key_1_last_rotated, field: :access_key_1_last_rotated) + .register_column(:access_key_1_last_used_date, field: :access_key_1_last_used_date) + .register_column(:access_key_1_last_used_region, field: :access_key_1_last_used_region) + .register_column(:access_key_1_last_used_service, field: :access_key_1_last_used_service) + .register_column(:access_key_2_active, field: :access_key_2_active) + .register_column(:access_key_2_last_rotated, field: :access_key_2_last_rotated) + .register_column(:access_key_2_last_used_date, field: :access_key_2_last_used_date) + .register_column(:access_key_2_last_used_region, field: :access_key_2_last_used_region) + .register_column(:access_key_2_last_used_service, field: :access_key_2_last_used_service) + .register_column(:cert_1_active, field: :cert_1_active) + .register_column(:cert_1_last_rotated, field: :cert_1_last_rotated) + .register_column(:cert_2_active, field: :cert_2_active) + .register_column(:cert_2_last_rotated, field: :cert_2_last_rotated) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -67,12 +67,12 @@ def fetch_data end end report = CSV.parse(response.content, headers: true, header_converters: :symbol, converters: [:date_time, lambda { |field| - if field == "true" - true - else - field == "false" ? false : field - end - }]) + if field == "true" + true + else + field == "false" ? false : field + end + }]) report.map(&:to_h) end end diff --git a/libraries/aws_iam_group.rb b/libraries/aws_iam_group.rb index 15a5584be..24d6e1d8d 100644 --- a/libraries/aws_iam_group.rb +++ b/libraries/aws_iam_group.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamGroup < AwsResourceBase - name 'aws_iam_group' - desc 'Verifies settings for an AWS IAM Group.' + name "aws_iam_group" + desc "Verifies settings for an AWS IAM Group." example " describe aws_iam_group('group-1') do @@ -36,7 +36,7 @@ def resource_id end def exists? - @arn.start_with?('arn:') + @arn.start_with?("arn:") end def to_s diff --git a/libraries/aws_iam_groups.rb b/libraries/aws_iam_groups.rb index 131e35a97..5eb2e4d1c 100644 --- a/libraries/aws_iam_groups.rb +++ b/libraries/aws_iam_groups.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamGroups < AwsResourceBase - name 'aws_iam_groups' - desc 'Verifies settings for a collection AWS IAM Groups.' + name "aws_iam_groups" + desc "Verifies settings for a collection AWS IAM Groups." example " describe aws_iam_groups do it { should exist } @@ -12,13 +12,13 @@ class AwsIamGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:group_names, field: :group_name) - .register_column(:group_ids, field: :group_id) - .register_column(:arns, field: :arn) - .register_column(:users, field: :users) - .register_column(:has_inline_policies, field: :has_inline_policies) - .register_column(:inline_policy_names, field: :inline_policy_names) - .install_filter_methods_on_resource(self, :table) + .register_column(:group_names, field: :group_name) + .register_column(:group_ids, field: :group_id) + .register_column(:arns, field: :arn) + .register_column(:users, field: :users) + .register_column(:has_inline_policies, field: :has_inline_policies) + .register_column(:inline_policy_names, field: :inline_policy_names) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_inline_policy.rb b/libraries/aws_iam_inline_policy.rb index 6d49b6dec..098e15211 100644 --- a/libraries/aws_iam_inline_policy.rb +++ b/libraries/aws_iam_inline_policy.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamInlinePolicy < AwsResourceBase - name 'aws_iam_inline_policy' - desc 'Verifies settings for an Iam Inline Policy, attached to a user, role or group.' + name "aws_iam_inline_policy" + desc "Verifies settings for an Iam Inline Policy, attached to a user, role or group." example " describe aws_iam_inline_policy(role_name: 'rolename-a', policy_name: 'policy-1') do diff --git a/libraries/aws_iam_instance_profile.rb b/libraries/aws_iam_instance_profile.rb index ed4763c3d..33f40fa14 100644 --- a/libraries/aws_iam_instance_profile.rb +++ b/libraries/aws_iam_instance_profile.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSIAMInstanceProfile < AwsResourceBase - name 'aws_iam_instance_profile' - desc 'Retrieves information about the specified instance profile, including the instance profiles path, GUID, ARN, and role.' + name "aws_iam_instance_profile" + desc "Retrieves information about the specified instance profile, including the instance profiles path, GUID, ARN, and role." example " describe aws_iam_instance_profile(instance_profile_name: 'test1') do diff --git a/libraries/aws_iam_instance_profiles.rb b/libraries/aws_iam_instance_profiles.rb index 5ac017fd0..5f69c357d 100644 --- a/libraries/aws_iam_instance_profiles.rb +++ b/libraries/aws_iam_instance_profiles.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSIAMInstanceProfiles < AwsResourceBase - name 'aws_iam_instance_profiles' - desc 'Lists the instance profiles that have the specified path prefix.' + name "aws_iam_instance_profiles" + desc "Lists the instance profiles that have the specified path prefix." example " describe aws_iam_instance_profiles do @@ -13,13 +13,13 @@ class AWSIAMInstanceProfiles < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:paths, field: :path) - .register_column(:instance_profile_names, field: :instance_profile_name) - .register_column(:instance_profile_ids, field: :instance_profile_id) - .register_column(:arns, field: :arn) - .register_column(:create_dates, field: :create_date) - .register_column(:roles, field: :roles) - .install_filter_methods_on_resource(self, :table) + .register_column(:paths, field: :path) + .register_column(:instance_profile_names, field: :instance_profile_name) + .register_column(:instance_profile_ids, field: :instance_profile_id) + .register_column(:arns, field: :arn) + .register_column(:create_dates, field: :create_date) + .register_column(:roles, field: :roles) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_managed_policies.rb b/libraries/aws_iam_managed_policies.rb index 47a1a94b9..03afd952b 100644 --- a/libraries/aws_iam_managed_policies.rb +++ b/libraries/aws_iam_managed_policies.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamManagedPolicies < AwsResourceBase - name 'aws_iam_managed_policies' - desc 'Lists all IAM users, groups, and roles that the specified managed policy is attached to.' + name "aws_iam_managed_policies" + desc "Lists all IAM users, groups, and roles that the specified managed policy is attached to." example " describe aws_iam_managed_policies do @@ -17,17 +17,17 @@ class AwsIamManagedPolicies < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:attachment_counts, field: :attachment_count) - .register_column(:default_version_ids, field: :default_version_id) - .register_column(:policy_names, field: :policy_name) - .register_column(:policy_ids, field: :policy_id) - .register_column(:permissions_boundary_usage_count, field: :permissions_boundary_usage_count) - .register_column(:descriptions, field: :description) - .register_column(:create_date, field: :create_date) - .register_column(:update_date, field: :update_date) - .register_column(:update_date, field: :update_date) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:attachment_counts, field: :attachment_count) + .register_column(:default_version_ids, field: :default_version_id) + .register_column(:policy_names, field: :policy_name) + .register_column(:policy_ids, field: :policy_id) + .register_column(:permissions_boundary_usage_count, field: :permissions_boundary_usage_count) + .register_column(:descriptions, field: :description) + .register_column(:create_date, field: :create_date) + .register_column(:update_date, field: :update_date) + .register_column(:update_date, field: :update_date) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_managed_policy.rb b/libraries/aws_iam_managed_policy.rb index 5959916e1..f9538a295 100644 --- a/libraries/aws_iam_managed_policy.rb +++ b/libraries/aws_iam_managed_policy.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamManagedPolicy < AwsResourceBase - name 'aws_iam_managed_policy' - desc 'Verifies settings for an Iam Policy.' + name "aws_iam_managed_policy" + desc "Verifies settings for an Iam Policy." example " describe aws_iam_managed_policy(policy_arn: 'PolicyARN') do diff --git a/libraries/aws_iam_oidc_provider.rb b/libraries/aws_iam_oidc_provider.rb index 9791c13f0..db7e32859 100644 --- a/libraries/aws_iam_oidc_provider.rb +++ b/libraries/aws_iam_oidc_provider.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSIAMOIDCProvider < AwsResourceBase - name 'aws_iam_oidc_provider' - desc 'Retrieves information about the specified specified OpenID Connect (OIDC) provider resource.' + name "aws_iam_oidc_provider" + desc "Retrieves information about the specified specified OpenID Connect (OIDC) provider resource." example " describe aws_iam_oidc_provider(open_id_connect_provider_arn: 'test1') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def resource_id - @res? @display_name: '' + @res? @display_name: "" end def exists? diff --git a/libraries/aws_iam_oidc_providers.rb b/libraries/aws_iam_oidc_providers.rb index a72faf317..54fbbbdfc 100644 --- a/libraries/aws_iam_oidc_providers.rb +++ b/libraries/aws_iam_oidc_providers.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSIAMOIDCProviders < AwsResourceBase - name 'aws_iam_oidc_providers' - desc 'Lists all OIDC Providers.' + name "aws_iam_oidc_providers" + desc "Lists all OIDC Providers." example " describe aws_iam_oidc_providers do @@ -13,8 +13,8 @@ class AWSIAMOIDCProviders < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_password_policy.rb b/libraries/aws_iam_password_policy.rb index 67c51d350..987eef54b 100644 --- a/libraries/aws_iam_password_policy.rb +++ b/libraries/aws_iam_password_policy.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamPasswordPolicy < AwsResourceBase - name 'aws_iam_password_policy' - desc 'Verifies settings for an IAM Password Policy.' + name "aws_iam_password_policy" + desc "Verifies settings for an IAM Password Policy." example " describe aws_iam_password_policy do @@ -30,13 +30,13 @@ def minimum_password_length def max_password_age_in_days return if !exists? - raise 'this policy does not expire passwords' unless expire_passwords? + raise "this policy does not expire passwords" unless expire_passwords? @policy.max_password_age end def number_of_passwords_to_remember return if !exists? - raise 'this policy does not prevent password reuse' \ + raise "this policy does not prevent password reuse" \ unless prevent_password_reuse? @policy.password_reuse_prevention end @@ -99,6 +99,6 @@ def resource_id end def to_s - 'AWS IAM Password Policy' + "AWS IAM Password Policy" end end diff --git a/libraries/aws_iam_policies.rb b/libraries/aws_iam_policies.rb index f419e3cdd..2a37e5154 100644 --- a/libraries/aws_iam_policies.rb +++ b/libraries/aws_iam_policies.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamPolicies < AwsResourceBase - name 'aws_iam_policies' - desc 'Verifies settings for a collection AWS IAM Policies.' + name "aws_iam_policies" + desc "Verifies settings for a collection AWS IAM Policies." example " describe aws_iam_policies do it { should exist } @@ -12,15 +12,15 @@ class AwsIamPolicies < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:attachment_counts, field: :attachment_count) - .register_column(:default_version_ids, field: :default_version_id) - .register_column(:policy_names, field: :policy_name) - .register_column(:policy_ids, field: :policy_id) - .register_column(:attached_groups, field: :attached_groups) - .register_column(:attached_roles, field: :attached_roles) - .register_column(:attached_users, field: :attached_users) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:attachment_counts, field: :attachment_count) + .register_column(:default_version_ids, field: :default_version_id) + .register_column(:policy_names, field: :policy_name) + .register_column(:policy_ids, field: :policy_id) + .register_column(:attached_groups, field: :attached_groups) + .register_column(:attached_roles, field: :attached_roles) + .register_column(:attached_users, field: :attached_users) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_policy.rb b/libraries/aws_iam_policy.rb index d79d08af7..cf39790a9 100644 --- a/libraries/aws_iam_policy.rb +++ b/libraries/aws_iam_policy.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamPolicy < AwsResourceBase - name 'aws_iam_policy' - desc 'Verifies settings for an IAM Policy.' + name "aws_iam_policy" + desc "Verifies settings for an IAM Policy." example " describe aws_iam_policy('policy-1') do diff --git a/libraries/aws_iam_role.rb b/libraries/aws_iam_role.rb index 667005852..77f8427c0 100644 --- a/libraries/aws_iam_role.rb +++ b/libraries/aws_iam_role.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamRole < AwsResourceBase - name 'aws_iam_role' - desc 'Verifies settings for an IAM Role.' + name "aws_iam_role" + desc "Verifies settings for an IAM Role." example " describe aws_iam_role('my-role') do it { should exist } diff --git a/libraries/aws_iam_roles.rb b/libraries/aws_iam_roles.rb index 428e6bc09..7a44331dd 100644 --- a/libraries/aws_iam_roles.rb +++ b/libraries/aws_iam_roles.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamRoles < AwsResourceBase - name 'aws_iam_roles' - desc 'Verifies settings for a collection AWS IAM Roles.' + name "aws_iam_roles" + desc "Verifies settings for a collection AWS IAM Roles." example " describe aws_iam_roles do it { should exist } @@ -12,17 +12,17 @@ class AwsIamRoles < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:role_names, field: :role_name) - .register_column(:role_ids, field: :role_id) - .register_column(:paths, field: :path) - .register_column(:arns, field: :arn) - .register_column(:create_date, field: :create_date) - .register_column(:description, field: :description) - .register_column(:assume_role_policy_document, field: :assume_role_policy_document) - .register_column(:max_session_duration, field: :max_session_duration) - .register_column(:permissions_boundary_type, field: :permissions_boundary_type) - .register_column(:permissions_boundary_arn, field: :permissions_boundary_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:role_names, field: :role_name) + .register_column(:role_ids, field: :role_id) + .register_column(:paths, field: :path) + .register_column(:arns, field: :arn) + .register_column(:create_date, field: :create_date) + .register_column(:description, field: :description) + .register_column(:assume_role_policy_document, field: :assume_role_policy_document) + .register_column(:max_session_duration, field: :max_session_duration) + .register_column(:permissions_boundary_type, field: :permissions_boundary_type) + .register_column(:permissions_boundary_arn, field: :permissions_boundary_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_root_user.rb b/libraries/aws_iam_root_user.rb index 1cd721394..b012eb5df 100644 --- a/libraries/aws_iam_root_user.rb +++ b/libraries/aws_iam_root_user.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamRootUser < AwsResourceBase - name 'aws_iam_root_user' - desc 'Verifies settings for AWS Root Account.' + name "aws_iam_root_user" + desc "Verifies settings for AWS Root Account." example " describe aws_iam_root_user do it { should have_access_key } @@ -27,11 +27,11 @@ def resource_id end def has_access_key? - @summary_account['AccountAccessKeysPresent'] == 1 + @summary_account["AccountAccessKeysPresent"] == 1 end def has_mfa_enabled? - @summary_account['AccountMFAEnabled'] == 1 + @summary_account["AccountMFAEnabled"] == 1 end def has_hardware_mfa_enabled? @@ -40,7 +40,7 @@ def has_hardware_mfa_enabled? # Virtual MFA devices have suffix 'root-account-mfa-device' def has_virtual_mfa_enabled? - virtual_mfa_suffix = 'root-account-mfa-device' + virtual_mfa_suffix = "root-account-mfa-device" @virtual_devices.any? { |device| device[:serial_number].end_with?(virtual_mfa_suffix) } end @@ -49,6 +49,6 @@ def exists? end def to_s - 'AWS Root-User' + "AWS Root-User" end end diff --git a/libraries/aws_iam_saml_provider.rb b/libraries/aws_iam_saml_provider.rb index f6ee2ee66..989a05183 100644 --- a/libraries/aws_iam_saml_provider.rb +++ b/libraries/aws_iam_saml_provider.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamSamlProvider < AwsResourceBase - name 'aws_iam_saml_provider' - desc 'Verifies settings for a SAML Provider.' + name "aws_iam_saml_provider" + desc "Verifies settings for a SAML Provider." example " describe aws_iam_saml_provider('arn:aws:iam::123456789012:saml-provider/FANCY') do it { should exist } @@ -10,7 +10,7 @@ class AwsIamSamlProvider < AwsResourceBase its('valid_until') { should be > Time.now + 90 * 86400 } end " - supports platform: 'aws' + supports platform: "aws" attr_reader :provider, :arn, :saml_metadata_document, :create_date, :valid_until diff --git a/libraries/aws_iam_saml_providers.rb b/libraries/aws_iam_saml_providers.rb index 7711661f5..b17fc1c25 100644 --- a/libraries/aws_iam_saml_providers.rb +++ b/libraries/aws_iam_saml_providers.rb @@ -1,21 +1,21 @@ -require 'aws_backend' +require "aws_backend" class AwsIamSamlProviders < AwsResourceBase - name 'aws_iam_saml_providers' - desc 'Verifies settings for a collection of SAML Providers.' + name "aws_iam_saml_providers" + desc "Verifies settings for a collection of SAML Providers." example " describe aws_iam_saml_providers do it { should exist } end " - supports platform: 'aws' + supports platform: "aws" attr_reader :table FilterTable.create - .register_column(:provider_arns, field: :arn) - .register_column(:valid_untils, field: :valid_until) - .install_filter_methods_on_resource(self, :table) + .register_column(:provider_arns, field: :arn) + .register_column(:valid_untils, field: :valid_until) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -40,6 +40,6 @@ def fetch_data end def to_s - 'AWS IAM SAML Providers' + "AWS IAM SAML Providers" end end diff --git a/libraries/aws_iam_server_certificate.rb b/libraries/aws_iam_server_certificate.rb index 3d81cad35..489b7e86f 100644 --- a/libraries/aws_iam_server_certificate.rb +++ b/libraries/aws_iam_server_certificate.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSIAMServerCertificate < AwsResourceBase - name 'aws_iam_server_certificate' - desc 'Retrieves information about the specified server certificate stored in IAM.' + name "aws_iam_server_certificate" + desc "Retrieves information about the specified server certificate stored in IAM." example " describe aws_iam_server_certificate(server_certificate_name: 'SERVER_CERTIFICATE_NAME') do diff --git a/libraries/aws_iam_server_certificates.rb b/libraries/aws_iam_server_certificates.rb index cb3ba3615..21e3e8d36 100644 --- a/libraries/aws_iam_server_certificates.rb +++ b/libraries/aws_iam_server_certificates.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSIAMServerCertificates < AwsResourceBase - name 'aws_iam_server_certificates' - desc 'Verifies the server certificates stored in IAM.' + name "aws_iam_server_certificates" + desc "Verifies the server certificates stored in IAM." example " describe aws_iam_server_certificates do @@ -13,13 +13,13 @@ class AWSIAMServerCertificates < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:paths, field: :path) - .register_column(:server_certificate_names, field: :server_certificate_name) - .register_column(:server_certificate_ids, field: :server_certificate_id) - .register_column(:arns, field: :arn) - .register_column(:upload_date, field: :upload_date) - .register_column(:expiration_date, field: :expiration_date) - .install_filter_methods_on_resource(self, :table) + .register_column(:paths, field: :path) + .register_column(:server_certificate_names, field: :server_certificate_name) + .register_column(:server_certificate_ids, field: :server_certificate_id) + .register_column(:arns, field: :arn) + .register_column(:upload_date, field: :upload_date) + .register_column(:expiration_date, field: :expiration_date) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_service_linked_role_deletion_status.rb b/libraries/aws_iam_service_linked_role_deletion_status.rb index f81746452..ea1af627a 100644 --- a/libraries/aws_iam_service_linked_role_deletion_status.rb +++ b/libraries/aws_iam_service_linked_role_deletion_status.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSIAMServiceLinkedRoleDeletionStatus < AwsResourceBase - name 'aws_iam_service_linked_role_deletion_status' - desc 'Retrieves the status of your service-linked role deletion.' + name "aws_iam_service_linked_role_deletion_status" + desc "Retrieves the status of your service-linked role deletion." example " describe aws_iam_service_linked_role_deletion_status(deletion_task_id: 'test1') do @@ -29,7 +29,7 @@ def status end def resource_id - @res? @display_name: '' + @res? @display_name: "" end def exists? diff --git a/libraries/aws_iam_ssh_public_key.rb b/libraries/aws_iam_ssh_public_key.rb index dbc380d60..db6990cba 100644 --- a/libraries/aws_iam_ssh_public_key.rb +++ b/libraries/aws_iam_ssh_public_key.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSIAMSSHPublicKey < AwsResourceBase - name 'aws_iam_ssh_public_key' - desc 'Retrieves the specified SSH public key, including metadata about the key.' + name "aws_iam_ssh_public_key" + desc "Retrieves the specified SSH public key, including metadata about the key." example " describe aws_iam_ssh_public_key(user_name: 'USER_NAME', ssh_public_key_id: 'SSH_PUBLIC_KEY_ID', encoding: 'SSH') do diff --git a/libraries/aws_iam_ssh_public_keys.rb b/libraries/aws_iam_ssh_public_keys.rb index 72f97d002..2899105d1 100644 --- a/libraries/aws_iam_ssh_public_keys.rb +++ b/libraries/aws_iam_ssh_public_keys.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSIAMSSHPublicKeys < AwsResourceBase - name 'aws_iam_ssh_public_keys' - desc 'Returns information about the SSH public keys associated with the specified IAM user. If none exists, the operation returns an empty list.' + name "aws_iam_ssh_public_keys" + desc "Returns information about the SSH public keys associated with the specified IAM user. If none exists, the operation returns an empty list." example " describe aws_iam_ssh_public_keys(user_name: 'USER_NAME') do @@ -16,11 +16,11 @@ class AWSIAMSSHPublicKeys < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:user_names, field: :user_name) - .register_column(:ssh_public_key_ids, field: :ssh_public_key_id) - .register_column(:statuses, field: :status) - .register_column(:upload_dates, field: :upload_date) - .install_filter_methods_on_resource(self, :table) + .register_column(:user_names, field: :user_name) + .register_column(:ssh_public_key_ids, field: :ssh_public_key_id) + .register_column(:statuses, field: :status) + .register_column(:upload_dates, field: :upload_date) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_iam_user.rb b/libraries/aws_iam_user.rb index 3227fc443..361db92e4 100644 --- a/libraries/aws_iam_user.rb +++ b/libraries/aws_iam_user.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamUser < AwsResourceBase - name 'aws_iam_user' - desc 'Verifies settings for an AWS IAM User.' + name "aws_iam_user" + desc "Verifies settings for an AWS IAM User." example " describe aws_iam_user(user_name: 'TEST_USER_NAME') do it { should exist } diff --git a/libraries/aws_iam_users.rb b/libraries/aws_iam_users.rb index 02b76060f..10f87d931 100644 --- a/libraries/aws_iam_users.rb +++ b/libraries/aws_iam_users.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsIamUsers < AwsCollectionResourceBase - name 'aws_iam_users' - desc 'Verifies settings for a collection of AWS IAM Users.' + name "aws_iam_users" + desc "Verifies settings for a collection of AWS IAM Users." example " describe aws_iam_users(user_name: 'psmith') do @@ -13,20 +13,20 @@ class AwsIamUsers < AwsCollectionResourceBase attr_reader :table FilterTable.create - .register_column(:usernames, field: :username) - .register_column(:user_arns, field: :user_arn) - .register_column(:user_ids, field: :user_id) - .register_column(:access_keys, field: :access_keys, lazy_instance: :lazy_load_access_keys) - .register_column(:has_attached_policies, field: :has_attached_policies, lazy_instance: :lazy_load_attached_policies) - .register_column(:attached_policy_names, field: :attached_policy_names, lazy_instance: :lazy_load_attached_policy_names) - .register_column(:attached_policy_arns, field: :attached_policy_arns, lazy_instance: :lazy_load_attached_policy_arns) - .register_column(:has_console_password, field: :has_console_password, lazy_instance: :lazy_load_has_console_password) - .register_column(:has_inline_policies, field: :has_inline_policies, lazy_instance: :lazy_load_has_inline_policies) - .register_column(:inline_policy_names, field: :inline_policy_names, lazy_instance: :lazy_load_inline_policies) - .register_column(:has_mfa_enabled, field: :has_mfa_enabled, lazy_instance: :lazy_load_has_mfa_enabled) - .register_column(:password_ever_used?, field: :password_ever_used?) - .register_column(:password_last_used_days_ago, field: :password_last_used_days_ago) - .install_filter_methods_on_resource(self, :table) + .register_column(:usernames, field: :username) + .register_column(:user_arns, field: :user_arn) + .register_column(:user_ids, field: :user_id) + .register_column(:access_keys, field: :access_keys, lazy_instance: :lazy_load_access_keys) + .register_column(:has_attached_policies, field: :has_attached_policies, lazy_instance: :lazy_load_attached_policies) + .register_column(:attached_policy_names, field: :attached_policy_names, lazy_instance: :lazy_load_attached_policy_names) + .register_column(:attached_policy_arns, field: :attached_policy_arns, lazy_instance: :lazy_load_attached_policy_arns) + .register_column(:has_console_password, field: :has_console_password, lazy_instance: :lazy_load_has_console_password) + .register_column(:has_inline_policies, field: :has_inline_policies, lazy_instance: :lazy_load_has_inline_policies) + .register_column(:inline_policy_names, field: :inline_policy_names, lazy_instance: :lazy_load_inline_policies) + .register_column(:has_mfa_enabled, field: :has_mfa_enabled, lazy_instance: :lazy_load_has_mfa_enabled) + .register_column(:password_ever_used?, field: :password_ever_used?) + .register_column(:password_last_used_days_ago, field: :password_last_used_days_ago) + .install_filter_methods_on_resource(self, :table) alias has_mfa_enabled? has_mfa_enabled alias has_console_password? has_console_password @@ -44,7 +44,7 @@ def fetch_data @aws.iam_client.list_users.flat_map do |response| response.users.map do |user| { - username: user.arn.split('/').last, + username: user.arn.split("/").last, user_arn: user.arn, user_id: user.user_id, password_ever_used?: user.password_last_used.present?, @@ -57,17 +57,17 @@ def fetch_data def lazy_load_has_console_password(row, _condition, _table) row[:has_console_password] = fetch(client: :iam_client, operation: :get_login_profile, kwargs: { user_name: row[:username] }) - .present? + .present? end def lazy_load_access_keys(row, _condition, _table) row[:access_keys] = fetch(client: :iam_client, operation: :list_access_keys, kwargs: { user_name: row[:username] }) - .flat_map(&:access_key_metadata) || [] + .flat_map(&:access_key_metadata) || [] end def lazy_load_attached_policies(row, _condition, _table) row[:has_attached_policies] ||= fetch(client: :iam_client, operation: :list_attached_user_policies, kwargs: { user_name: row[:username] }) - .flat_map(&:attached_policies) + .flat_map(&:attached_policies) end def lazy_load_attached_policy_names(row, condition, table) @@ -80,7 +80,7 @@ def lazy_load_attached_policy_arns(row, condition, table) def lazy_load_inline_policies(row, _condition, _table) row[:inline_policy_names] ||= fetch(client: :iam_client, operation: :list_user_policies, kwargs: { user_name: row[:username] }) - .flat_map(&:policy_names) + .flat_map(&:policy_names) end def lazy_load_has_inline_policies(row, condition, table) diff --git a/libraries/aws_iam_virtual_mfa_devices.rb b/libraries/aws_iam_virtual_mfa_devices.rb index 3611e0804..631b9616e 100644 --- a/libraries/aws_iam_virtual_mfa_devices.rb +++ b/libraries/aws_iam_virtual_mfa_devices.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSIAMVirtualMFADevices < AwsResourceBase - name 'aws_iam_virtual_mfa_devices' - desc 'Lists all virtual MFA devices.' + name "aws_iam_virtual_mfa_devices" + desc "Lists all virtual MFA devices." example " describe aws_iam_virtual_mfa_devices do @@ -13,15 +13,15 @@ class AWSIAMVirtualMFADevices < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:serial_numbers, field: :serial_number) - .register_column(:paths, field: :path) - .register_column(:user_names, field: :user_name) - .register_column(:user_ids, field: :user_id) - .register_column(:arns, field: :arn) - .register_column(:tags, field: :tags) - .register_column(:enable_dates, field: :enable_date) - .register_column(:create_dates, field: :create_date) - .install_filter_methods_on_resource(self, :table) + .register_column(:serial_numbers, field: :serial_number) + .register_column(:paths, field: :path) + .register_column(:user_names, field: :user_name) + .register_column(:user_ids, field: :user_id) + .register_column(:arns, field: :arn) + .register_column(:tags, field: :tags) + .register_column(:enable_dates, field: :enable_date) + .register_column(:create_dates, field: :create_date) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_internet_gateway.rb b/libraries/aws_internet_gateway.rb index eb695b1c3..4c3305306 100644 --- a/libraries/aws_internet_gateway.rb +++ b/libraries/aws_internet_gateway.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsInternetGateway < AwsResourceBase - name 'aws_internet_gateway' - desc 'Verifies settings for an AWS Internet Gateway.' + name "aws_internet_gateway" + desc "Verifies settings for an AWS Internet Gateway." example " describe aws_internet_gateway(id: 'igw-abc12450edc87a8bd') do @@ -29,16 +29,16 @@ def initialize(opts = {}) elsif opts.key?(:name) && !opts.key?(:id) name = opts[:name] tag_error = "#{@__resource_name__}: `name` should be maximum 255 characters long and contain "\ - 'letters, numbers, spaces and the following characters only: + - = . _ : / @' + "letters, numbers, spaces and the following characters only: + - = . _ : / @" raise ArgumentError, tag_error unless name.match?(%r{^[\w+\- =._:/@]{1,256}$}) && name.length.between?(1, 255) query_params = { filters: [ - name: 'tag:Name', + name: "tag:Name", values: [name], ] } else raise ArgumentError, "#{@__resource_name__}: either `id` or `name` must be provided." end - @display_name = opts.values.join(' ') + @display_name = opts.values.join(" ") catch_aws_errors do resp = @aws.compute_client.describe_internet_gateways(query_params) @@ -54,7 +54,7 @@ def initialize(opts = {}) if gateways.length > 1 fail_resource("#{@__resource_name__}: Multiple internet gateways were returned for the provided parameter:"\ " `#{@display_name}`. If you wish to test multiple internet gateways, "\ - 'please use the aws_internet_gateways resource.') + "please use the aws_internet_gateways resource.") @failed_resource = true return end @@ -74,7 +74,7 @@ def id def name return unless exists? - tags['Name'] if tags.key?('Name') + tags["Name"] if tags.key?("Name") end def tags @@ -99,7 +99,7 @@ def attached? return false if attachments.empty? # available means it is attached to a VPC. # https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_InternetGatewayAttachment.html - attachments.first.state == 'available' + attachments.first.state == "available" end def detached? diff --git a/libraries/aws_internet_gateways.rb b/libraries/aws_internet_gateways.rb index 3cbbdae9d..c0d85e18d 100644 --- a/libraries/aws_internet_gateways.rb +++ b/libraries/aws_internet_gateways.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsInternetGateways < AwsResourceBase - name 'aws_internet_gateways' - desc 'Verifies settings for a collection of AWS internet gateways.' + name "aws_internet_gateways" + desc "Verifies settings for a collection of AWS internet gateways." example " describe aws_internet_gateways do @@ -17,13 +17,13 @@ class AwsInternetGateways < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:tags, field: :tags) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:attachment_states, field: :attachment_state) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:tags, field: :tags) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:attachment_states, field: :attachment_state) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -43,11 +43,11 @@ def fetch_data @api_response.internet_gateways.each do |igw| igw_rows += [{ id: igw.internet_gateway_id, - name: igw[:tags].select { |tag| tag[:key] == 'Name' }.first&.dig(:value), + name: igw[:tags].select { |tag| tag[:key] == "Name" }.first&.dig(:value), tags: igw.tags, owner_id: igw.owner_id, vpc_id: igw.attachments.empty? ? nil : igw.attachments.first[:vpc_id], - attachment_state: igw.attachments.empty? ? 'detached' : 'attached', + attachment_state: igw.attachments.empty? ? "detached" : "attached", }] end break unless @api_response.next_token diff --git a/libraries/aws_kms_key.rb b/libraries/aws_kms_key.rb index ffdf6990c..bf4f03eb2 100644 --- a/libraries/aws_kms_key.rb +++ b/libraries/aws_kms_key.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsKmsKey < AwsResourceBase - name 'aws_kms_key' - desc 'Verifies settings for an individual AWS KMS Key.' + name "aws_kms_key" + desc "Verifies settings for an individual AWS KMS Key." example " describe aws_kms_key(key_id: 'arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do it { should exist } @@ -63,7 +63,7 @@ def invalidation_time end def external? - key_metadata[:origin] == 'EXTERNAL' + key_metadata[:origin] == "EXTERNAL" end def enabled? @@ -71,11 +71,11 @@ def enabled? end def managed_by_aws? - key_metadata[:key_manager] == 'AWS' + key_metadata[:key_manager] == "AWS" end def has_key_expiration? - key_metadata[:expiration_model] == 'KEY_MATERIAL_EXPIRES' + key_metadata[:expiration_model] == "KEY_MATERIAL_EXPIRES" end def has_rotation_enabled? @@ -92,8 +92,8 @@ def fetch_key_id end if response.present? response.aliases.each do |alias_entry| - if alias_entry['alias_name'] == @alias && alias_entry['target_key_id'] - return alias_entry['target_key_id'] + if alias_entry["alias_name"] == @alias && alias_entry["target_key_id"] + return alias_entry["target_key_id"] end end end @@ -111,7 +111,7 @@ def key_metadata end def key_rotation_response - return if key_metadata[:key_manager] == 'AWS' + return if key_metadata[:key_manager] == "AWS" @key_rotation_response ||= catch_aws_errors do kms_client.get_key_rotation_status({ key_id: opts[:key_id] }) end diff --git a/libraries/aws_kms_keys.rb b/libraries/aws_kms_keys.rb index f0c6f92cb..e5d97e700 100644 --- a/libraries/aws_kms_keys.rb +++ b/libraries/aws_kms_keys.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsKmsKeys < AwsResourceBase - name 'aws_kms_keys' - desc 'Verifies settings for AWS KMS Keys in bulk.' + name "aws_kms_keys" + desc "Verifies settings for AWS KMS Keys in bulk." example " describe aws_kms_keys do it { should exist } @@ -12,9 +12,9 @@ class AwsKmsKeys < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:key_ids, field: :key_id) - .register_column(:key_arns, field: :key_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:key_ids, field: :key_id) + .register_column(:key_arns, field: :key_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_lambda.rb b/libraries/aws_lambda.rb index f7964fb27..acc15258b 100644 --- a/libraries/aws_lambda.rb +++ b/libraries/aws_lambda.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsLambda < AwsResourceBase - name 'aws_lambda' - desc 'Verifies the settings for a set of lambda.' + name "aws_lambda" + desc "Verifies the settings for a set of lambda." example " describe aws_lambda('lambda_fred') do .... diff --git a/libraries/aws_lambda_alias.rb b/libraries/aws_lambda_alias.rb index 2ced312b3..de85e4c2c 100644 --- a/libraries/aws_lambda_alias.rb +++ b/libraries/aws_lambda_alias.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSLambdaAlias < AwsResourceBase - name 'aws_lambda_alias' - desc 'Retrieves information about a patch baseline.' + name "aws_lambda_alias" + desc "Retrieves information about a patch baseline." example " describe aws_lambda_alias(function_name: 'FUNCTION_NAME', function_alias_name: 'FUNCTION_ALIAS_NAME') do diff --git a/libraries/aws_lambda_aliases.rb b/libraries/aws_lambda_aliases.rb index 85a11de1e..07176d116 100644 --- a/libraries/aws_lambda_aliases.rb +++ b/libraries/aws_lambda_aliases.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSLambdaAliases < AwsResourceBase - name 'aws_lambda_aliases' - desc 'Returns a list of aliases for a Lambda function.' + name "aws_lambda_aliases" + desc "Returns a list of aliases for a Lambda function." example " describe aws_lambda_aliases(function_name: 'FUNCTION_NAME') do @@ -13,13 +13,13 @@ class AWSLambdaAliases < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:alias_arns, field: :alias_arn) - .register_column(:names, field: :name) - .register_column(:function_versions, field: :function_version) - .register_column(:descriptions, field: :description) - .register_column(:routing_configs, field: :routing_config) - .register_column(:revision_ids, field: :revision_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:alias_arns, field: :alias_arn) + .register_column(:names, field: :name) + .register_column(:function_versions, field: :function_version) + .register_column(:descriptions, field: :description) + .register_column(:routing_configs, field: :routing_config) + .register_column(:revision_ids, field: :revision_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_lambda_code_signing_config.rb b/libraries/aws_lambda_code_signing_config.rb index 74b82c58d..be7dac880 100644 --- a/libraries/aws_lambda_code_signing_config.rb +++ b/libraries/aws_lambda_code_signing_config.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSLambdaCodeSigningConfig < AwsResourceBase - name 'aws_lambda_code_signing_config' - desc 'Returns information about the specified code signing configuration.' + name "aws_lambda_code_signing_config" + desc "Returns information about the specified code signing configuration." example " describe aws_lambda_code_signing_config(code_signing_config_arn: 'CODE_SIGNING_CONFIG_ARN') do diff --git a/libraries/aws_lambda_code_signing_configs.rb b/libraries/aws_lambda_code_signing_configs.rb index 47f7208ff..790bf9177 100644 --- a/libraries/aws_lambda_code_signing_configs.rb +++ b/libraries/aws_lambda_code_signing_configs.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSLambdaCodeSigningConfigs < AwsResourceBase - name 'aws_lambda_code_signing_configs' - desc 'Returns a list of code signing configurations.' + name "aws_lambda_code_signing_configs" + desc "Returns a list of code signing configurations." example " describe aws_lambda_code_signing_configs do @@ -13,13 +13,13 @@ class AWSLambdaCodeSigningConfigs < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:code_signing_config_ids, field: :code_signing_config_id) - .register_column(:code_signing_config_arns, field: :code_signing_config_arn) - .register_column(:descriptions, field: :description) - .register_column(:allowed_publishers, field: :allowed_publishers) - .register_column(:code_signing_policies, field: :code_signing_policies) - .register_column(:last_modified, field: :last_modified) - .install_filter_methods_on_resource(self, :table) + .register_column(:code_signing_config_ids, field: :code_signing_config_id) + .register_column(:code_signing_config_arns, field: :code_signing_config_arn) + .register_column(:descriptions, field: :description) + .register_column(:allowed_publishers, field: :allowed_publishers) + .register_column(:code_signing_policies, field: :code_signing_policies) + .register_column(:last_modified, field: :last_modified) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_lambda_event_invoke_config.rb b/libraries/aws_lambda_event_invoke_config.rb index 7fd3b9757..b48f85399 100644 --- a/libraries/aws_lambda_event_invoke_config.rb +++ b/libraries/aws_lambda_event_invoke_config.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSLambdaEventInvokeConfig < AwsResourceBase - name 'aws_lambda_event_invoke_config' - desc 'Retrieves the configuration for asynchronous invocation for a function, version, or alias.' + name "aws_lambda_event_invoke_config" + desc "Retrieves the configuration for asynchronous invocation for a function, version, or alias." example " describe aws_lambda_event_invoke_config(function_name: 'FUNCTION_NAME') do diff --git a/libraries/aws_lambda_event_invoke_configs.rb b/libraries/aws_lambda_event_invoke_configs.rb index 3852fd5de..800aa0336 100644 --- a/libraries/aws_lambda_event_invoke_configs.rb +++ b/libraries/aws_lambda_event_invoke_configs.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSLambdaEventInvokeConfigs < AwsResourceBase - name 'aws_lambda_event_invoke_configs' - desc 'Gets information about the scalable targets in the specified namespace.' + name "aws_lambda_event_invoke_configs" + desc "Gets information about the scalable targets in the specified namespace." example " describe aws_lambda_event_invoke_configs(function_name: 'FUNCTION_NAME') do @@ -13,12 +13,12 @@ class AWSLambdaEventInvokeConfigs < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:last_modified, field: :last_modified) - .register_column(:function_arns, field: :function_arn) - .register_column(:maximum_retry_attempts, field: :maximum_retry_attempts) - .register_column(:maximum_event_age_in_seconds, field: :maximum_event_age_in_seconds) - .register_column(:destination_configs, field: :destination_config) - .install_filter_methods_on_resource(self, :table) + .register_column(:last_modified, field: :last_modified) + .register_column(:function_arns, field: :function_arn) + .register_column(:maximum_retry_attempts, field: :maximum_retry_attempts) + .register_column(:maximum_event_age_in_seconds, field: :maximum_event_age_in_seconds) + .register_column(:destination_configs, field: :destination_config) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_lambda_event_source_mapping.rb b/libraries/aws_lambda_event_source_mapping.rb index 3cc74dce2..17b58a0c1 100644 --- a/libraries/aws_lambda_event_source_mapping.rb +++ b/libraries/aws_lambda_event_source_mapping.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSLambdaEventSourceMapping < AwsResourceBase - name 'aws_lambda_event_source_mapping' - desc 'Returns details about an event source mapping.' + name "aws_lambda_event_source_mapping" + desc "Returns details about an event source mapping." example " describe aws_lambda_event_source_mapping(uuid: 'test1') do @@ -29,7 +29,7 @@ def uuid end def resource_id - return '' unless exists? + return "" unless exists? @res[:uuid] end diff --git a/libraries/aws_lambda_event_source_mappings.rb b/libraries/aws_lambda_event_source_mappings.rb index 8e366a366..fe1058349 100644 --- a/libraries/aws_lambda_event_source_mappings.rb +++ b/libraries/aws_lambda_event_source_mappings.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSLambdaEventSourceMappings < AwsResourceBase - name 'aws_lambda_event_source_mappings' - desc 'Lists event source mappings.' + name "aws_lambda_event_source_mappings" + desc "Lists event source mappings." example " describe aws_lambda_event_source_mappings do @@ -13,26 +13,26 @@ class AWSLambdaEventSourceMappings < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:uuids, field: :uuid) - .register_column(:starting_positions, field: :starting_position) - .register_column(:starting_position_timestamps, field: :starting_position_timestamp) - .register_column(:batch_sizes, field: :batch_size) - .register_column(:maximum_batching_window_in_seconds, field: :maximum_batching_window_in_seconds) - .register_column(:parallelization_factors, field: :parallelization_factor) - .register_column(:event_source_arns, field: :event_source_arn) - .register_column(:function_arns, field: :function_arn) - .register_column(:last_modified, field: :last_modified) - .register_column(:last_processing_results, field: :last_processing_result) - .register_column(:states, field: :state) - .register_column(:state_transition_reasons, field: :state_transition_reason) - .register_column(:destination_configs, field: :destination_config) - .register_column(:topics, field: :topics) - .register_column(:queues, field: :queues) - .register_column(:source_access_configurations, field: :source_access_configurations) - .register_column(:maximum_record_age_in_seconds, field: :maximum_record_age_in_seconds) - .register_column(:bisect_batch_on_function_errors, field: :bisect_batch_on_function_error) - .register_column(:maximum_retry_attempts, field: :maximum_retry_attempts) - .install_filter_methods_on_resource(self, :table) + .register_column(:uuids, field: :uuid) + .register_column(:starting_positions, field: :starting_position) + .register_column(:starting_position_timestamps, field: :starting_position_timestamp) + .register_column(:batch_sizes, field: :batch_size) + .register_column(:maximum_batching_window_in_seconds, field: :maximum_batching_window_in_seconds) + .register_column(:parallelization_factors, field: :parallelization_factor) + .register_column(:event_source_arns, field: :event_source_arn) + .register_column(:function_arns, field: :function_arn) + .register_column(:last_modified, field: :last_modified) + .register_column(:last_processing_results, field: :last_processing_result) + .register_column(:states, field: :state) + .register_column(:state_transition_reasons, field: :state_transition_reason) + .register_column(:destination_configs, field: :destination_config) + .register_column(:topics, field: :topics) + .register_column(:queues, field: :queues) + .register_column(:source_access_configurations, field: :source_access_configurations) + .register_column(:maximum_record_age_in_seconds, field: :maximum_record_age_in_seconds) + .register_column(:bisect_batch_on_function_errors, field: :bisect_batch_on_function_error) + .register_column(:maximum_retry_attempts, field: :maximum_retry_attempts) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_lambda_layer_version_permission.rb b/libraries/aws_lambda_layer_version_permission.rb index c7a429027..7b17791b3 100644 --- a/libraries/aws_lambda_layer_version_permission.rb +++ b/libraries/aws_lambda_layer_version_permission.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSLambdaLayerVersionPermission < AwsResourceBase - name 'aws_lambda_layer_version_permission' - desc 'Returns the permission policy for a version of an Lambda layer.' + name "aws_lambda_layer_version_permission" + desc "Returns the permission policy for a version of an Lambda layer." example " describe aws_lambda_layer_version_permission(layer_name: 'LAYER_NAME', version_number: 'VERSION_NUMBER') do diff --git a/libraries/aws_lambda_permission.rb b/libraries/aws_lambda_permission.rb index 6339159b4..7fa649b20 100644 --- a/libraries/aws_lambda_permission.rb +++ b/libraries/aws_lambda_permission.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSLambdaPermission < AwsResourceBase - name 'aws_lambda_permission' - desc 'Returns the resource-based IAM policy for a function, version, or alias.' + name "aws_lambda_permission" + desc "Returns the resource-based IAM policy for a function, version, or alias." example " describe aws_lambda_permission(function_name: 'LambdaFunctionName', Sid: 'StatementID') do @@ -19,15 +19,15 @@ def initialize(opts = {}) row = {} catch_aws_errors do resp = @aws.lambda_client.get_policy({ function_name: opts[:function_name] }) - statements = JSON.parse(resp.policy)['Statement'] + statements = JSON.parse(resp.policy)["Statement"] statements.each do |value| - next if value['Sid'] != opts[:Sid] + next if value["Sid"] != opts[:Sid] row = { - sid: value['Sid'], - effect: value['Effect'], - principal: value['Principal']['Service'], - action: value['Action'], - resource: value['Resource'], + sid: value["Sid"], + effect: value["Effect"], + principal: value["Principal"]["Service"], + action: value["Action"], + resource: value["Resource"], } end create_resource_methods(row.to_h) diff --git a/libraries/aws_lambda_permissions.rb b/libraries/aws_lambda_permissions.rb index d0de017d9..c16294e26 100644 --- a/libraries/aws_lambda_permissions.rb +++ b/libraries/aws_lambda_permissions.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSLambdaPermissions < AwsResourceBase - name 'aws_lambda_permissions' - desc 'Returns the resource-based IAM policy for a function, version, or alias.' + name "aws_lambda_permissions" + desc "Returns the resource-based IAM policy for a function, version, or alias." example " describe aws_lambda_permissions(function_name: 'LambdaFunctionName') do @@ -13,12 +13,12 @@ class AWSLambdaPermissions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:sids, field: :sid) - .register_column(:effects, field: :effect) - .register_column(:principals, field: :principal) - .register_column(:actions, field: :action) - .register_column(:resources, field: :resource) - .install_filter_methods_on_resource(self, :table) + .register_column(:sids, field: :sid) + .register_column(:effects, field: :effect) + .register_column(:principals, field: :principal) + .register_column(:actions, field: :action) + .register_column(:resources, field: :resource) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -31,14 +31,14 @@ def fetch_data rows = [] catch_aws_errors do resp = @aws.lambda_client.get_policy({ function_name: opts[:function_name] }) - statements = JSON.parse(resp.policy)['Statement'] + statements = JSON.parse(resp.policy)["Statement"] statements.each do |value| rows += [{ - sid: value['Sid'], - effect: value['Effect'], - principal: value['Principal']['Service'], - action: value['Action'], - resource: value['Resource'], + sid: value["Sid"], + effect: value["Effect"], + principal: value["Principal"]["Service"], + action: value["Action"], + resource: value["Resource"], }] end rows diff --git a/libraries/aws_lambda_version.rb b/libraries/aws_lambda_version.rb index 9f3075419..5f7deeb71 100644 --- a/libraries/aws_lambda_version.rb +++ b/libraries/aws_lambda_version.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSLambdaVersion < AwsResourceBase - name 'aws_lambda_version' - desc 'Returns information about a version of an Lambda layer.' + name "aws_lambda_version" + desc "Returns information about a version of an Lambda layer." example " describe aws_lambda_version(layer_name: 'LAYER_NAME', version_number: 1) do diff --git a/libraries/aws_lambda_versions.rb b/libraries/aws_lambda_versions.rb index a7ee67c04..d1265fa18 100644 --- a/libraries/aws_lambda_versions.rb +++ b/libraries/aws_lambda_versions.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSLambdaVersions < AwsResourceBase - name 'aws_lambda_versions' - desc 'Lists the versions of an Lambda layer.' + name "aws_lambda_versions" + desc "Lists the versions of an Lambda layer." example " describe aws_lambda_versions(layer_name: 'LAYER_NAME') do @@ -13,14 +13,14 @@ class AWSLambdaVersions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:layer_version_arns, field: :layer_version_arn) - .register_column(:versions, field: :version) - .register_column(:descriptions, field: :description) - .register_column(:created_dates, field: :created_date) - .register_column(:compatible_runtimes, field: :compatible_runtimes) - .register_column(:license_infos, field: :license_info) - .register_column(:compatible_architectures, field: :compatible_architectures) - .install_filter_methods_on_resource(self, :table) + .register_column(:layer_version_arns, field: :layer_version_arn) + .register_column(:versions, field: :version) + .register_column(:descriptions, field: :description) + .register_column(:created_dates, field: :created_date) + .register_column(:compatible_runtimes, field: :compatible_runtimes) + .register_column(:license_infos, field: :license_info) + .register_column(:compatible_architectures, field: :compatible_architectures) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_lambdas.rb b/libraries/aws_lambdas.rb index 159631b68..40cffc32d 100644 --- a/libraries/aws_lambdas.rb +++ b/libraries/aws_lambdas.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsLambdas < AwsResourceBase - name 'aws_lambdas' - desc 'Verifies generic settings for a set of lambdas.' + name "aws_lambdas" + desc "Verifies generic settings for a set of lambdas." example " describe aws_lambdas() do its ('count') { should eq 6} @@ -11,10 +11,10 @@ class AwsLambdas < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:arns, field: :arn) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:arns, field: :arn) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_launch_configuration.rb b/libraries/aws_launch_configuration.rb index 6acfbf49e..54dcfefbb 100644 --- a/libraries/aws_launch_configuration.rb +++ b/libraries/aws_launch_configuration.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsLaunchConfiguration < AwsResourceBase - name 'aws_launch_configuration' - desc 'Verifies settings for an AWS Launch Configuration.' + name "aws_launch_configuration" + desc "Verifies settings for an AWS Launch Configuration." example " describe aws_launch_configuration('config-name') do @@ -32,7 +32,7 @@ def initialize(opts = {}) @associate_public_ip_address = configuration[:associate_public_ip_address].nil? ? false : true @ebs_optimized = configuration[:ebs_optimized] @spot_price = configuration[:spot_price].to_f - @instance_monitoring = configuration[:instance_monitoring][:enabled] ? 'detailed': 'basic' + @instance_monitoring = configuration[:instance_monitoring][:enabled] ? "detailed": "basic" @user_data = configuration[:user_data] ? Base64.decode64(configuration[:user_data]) : nil end end diff --git a/libraries/aws_launch_configurations.rb b/libraries/aws_launch_configurations.rb index 9fcb59599..2b296c3fc 100644 --- a/libraries/aws_launch_configurations.rb +++ b/libraries/aws_launch_configurations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsLaunchConfigurations < AwsResourceBase - name 'aws_launch_configurations' - desc 'Verifies settings for a collection AWS Launch Configurations.' + name "aws_launch_configurations" + desc "Verifies settings for a collection AWS Launch Configurations." example " describe aws_launch_configurations do it { should exist } @@ -12,19 +12,19 @@ class AwsLaunchConfigurations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:names, field: :name) - .register_column(:image_ids, field: :image_id) - .register_column(:instance_types, field: :instance_type) - .register_column(:iam_instance_profiles, field: :iam_instance_profile) - .register_column(:key_names, field: :key_name) - .register_column(:security_groups, field: :security_groups) - .register_column(:associate_public_ip_addresses, field: :associate_public_ip_address) - .register_column(:ebs_optimizeds, field: :ebs_optimized) - .register_column(:spot_prices, field: :spot_price) - .register_column(:instance_monitoring, field: :instance_monitoring) - .register_column(:user_data, field: :user_data) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:names, field: :name) + .register_column(:image_ids, field: :image_id) + .register_column(:instance_types, field: :instance_type) + .register_column(:iam_instance_profiles, field: :iam_instance_profile) + .register_column(:key_names, field: :key_name) + .register_column(:security_groups, field: :security_groups) + .register_column(:associate_public_ip_addresses, field: :associate_public_ip_address) + .register_column(:ebs_optimizeds, field: :ebs_optimized) + .register_column(:spot_prices, field: :spot_price) + .register_column(:instance_monitoring, field: :instance_monitoring) + .register_column(:user_data, field: :user_data) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -48,7 +48,7 @@ def fetch_data associate_public_ip_address: config[:associate_public_ip_address].nil? ? false : true, ebs_optimized: config[:ebs_optimized], spot_price: config[:spot_price].to_f, - instance_monitoring: config[:instance_monitoring][:enabled] ? 'detailed': 'basic', + instance_monitoring: config[:instance_monitoring][:enabled] ? "detailed": "basic", user_data: config[:user_data] ? Base64.decode64(config[:user_data]) : nil }] end end diff --git a/libraries/aws_logs_metric_filter.rb b/libraries/aws_logs_metric_filter.rb index 8ad48c50c..a1896849a 100644 --- a/libraries/aws_logs_metric_filter.rb +++ b/libraries/aws_logs_metric_filter.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSLogsMetricFilter < AwsResourceBase - name 'aws_logs_metric_filter' - desc 'Lists the specified metric filters.' + name "aws_logs_metric_filter" + desc "Lists the specified metric filters." example " describe aws_logs_metric_filter(filter_name: 'FilterName') do diff --git a/libraries/aws_logs_metric_filters.rb b/libraries/aws_logs_metric_filters.rb index e71af7f31..6f262c090 100644 --- a/libraries/aws_logs_metric_filters.rb +++ b/libraries/aws_logs_metric_filters.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSLogsMetricFilters < AwsResourceBase - name 'aws_logs_metric_filters' - desc 'Lists the specified metric filters.' + name "aws_logs_metric_filters" + desc "Lists the specified metric filters." example " describe aws_logs_metric_filters do @@ -13,12 +13,12 @@ class AWSLogsMetricFilters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:filter_names, field: :filter_name) - .register_column(:filter_patterns, field: :filter_pattern) - .register_column(:metric_transformations, field: :metric_transformations) - .register_column(:creation_times, field: :creation_time) - .register_column(:log_group_names, field: :log_group_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:filter_names, field: :filter_name) + .register_column(:filter_patterns, field: :filter_pattern) + .register_column(:metric_transformations, field: :metric_transformations) + .register_column(:creation_times, field: :creation_time) + .register_column(:log_group_names, field: :log_group_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_mq_broker.rb b/libraries/aws_mq_broker.rb index 48a524948..139ff6773 100644 --- a/libraries/aws_mq_broker.rb +++ b/libraries/aws_mq_broker.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSMQBroker < AwsResourceBase - name 'aws_mq_broker' - desc 'Describes a Amazon MQ broker.' + name "aws_mq_broker" + desc "Describes a Amazon MQ broker." example " describe aws_mq_broker(broker_id: 'test1') do diff --git a/libraries/aws_mq_brokers.rb b/libraries/aws_mq_brokers.rb index 6d5358a6d..83a53131e 100644 --- a/libraries/aws_mq_brokers.rb +++ b/libraries/aws_mq_brokers.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSMQBrokers < AwsResourceBase - name 'aws_mq_brokers' - desc 'Describes a list of aws mq broker.' + name "aws_mq_brokers" + desc "Describes a list of aws mq broker." example " describe aws_mq_brokers do @@ -13,16 +13,16 @@ class AWSMQBrokers < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:broker_arns, field: :broker_arn) - .register_column(:broker_ids, field: :broker_id) - .register_column(:broker_names, field: :broker_name) - .register_column(:broker_states, field: :broker_state) - .register_column(:created, field: :created) - .register_column(:deployment_modes, field: :deployment_mode) - .register_column(:engine_types, field: :engine_type) - .register_column(:propagate_tags, field: :propagate_tags) - .register_column(:host_instance_types, field: :host_instance_type) - .install_filter_methods_on_resource(self, :table) + .register_column(:broker_arns, field: :broker_arn) + .register_column(:broker_ids, field: :broker_id) + .register_column(:broker_names, field: :broker_name) + .register_column(:broker_states, field: :broker_state) + .register_column(:created, field: :created) + .register_column(:deployment_modes, field: :deployment_mode) + .register_column(:engine_types, field: :engine_type) + .register_column(:propagate_tags, field: :propagate_tags) + .register_column(:host_instance_types, field: :host_instance_type) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_mq_configuration.rb b/libraries/aws_mq_configuration.rb index bf21dde48..e12315c65 100644 --- a/libraries/aws_mq_configuration.rb +++ b/libraries/aws_mq_configuration.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSMQConfiguration < AwsResourceBase - name 'aws_mq_configuration' - desc 'Returns information about the specified configuration.' + name "aws_mq_configuration" + desc "Returns information about the specified configuration." example <<-EXAMPLE describe aws_mq_configuration(configuration_id: 'CONFIGURATION_ID') do it { should exist } diff --git a/libraries/aws_mq_configurations.rb b/libraries/aws_mq_configurations.rb index 43410921a..539e9acf7 100644 --- a/libraries/aws_mq_configurations.rb +++ b/libraries/aws_mq_configurations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSMQConfigurations < AwsResourceBase - name 'aws_mq_configurations' - desc 'Describes a list of aws mq broker.' + name "aws_mq_configurations" + desc "Describes a list of aws mq broker." example " describe aws_mq_configurations do @@ -13,16 +13,16 @@ class AWSMQConfigurations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:authentication_strategies, field: :authentication_strategy) - .register_column(:description, field: :description) - .register_column(:created, field: :created) - .register_column(:engine_types, field: :engine_type) - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:engine_version, field: :engine_version) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:authentication_strategies, field: :authentication_strategy) + .register_column(:description, field: :description) + .register_column(:created, field: :created) + .register_column(:engine_types, field: :engine_type) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:engine_version, field: :engine_version) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_nat_gateway.rb b/libraries/aws_nat_gateway.rb index e4ef66cdc..586ea2274 100644 --- a/libraries/aws_nat_gateway.rb +++ b/libraries/aws_nat_gateway.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsNatGateway < AwsResourceBase - name 'aws_nat_gateway' - desc 'Verifies settings for an AWS NAT Gateway.' + name "aws_nat_gateway" + desc "Verifies settings for an AWS NAT Gateway." example " describe aws_nat_gateway(id: 'nat-11aa578bffadf6ba6') do @@ -31,24 +31,24 @@ def initialize(opts = {}) if opts.key?(:id) id = opts[:id].to_s raise ArgumentError, "#{@__resource_name__}: `id` must be a string in the format of 'nat-' followed by 8 or 17 hexadecimal characters." unless /^nat-[0-9a-f]{8,17}$/.match?(id) - filter << { name: 'nat-gateway-id', values: [id] } + filter << { name: "nat-gateway-id", values: [id] } end if opts.key?(:name) name = opts[:name].to_s raise ArgumentError, "#{@__resource_name__}: `name` must be maximum 255 characters long." unless name.length < 256 - filter << { name: 'tag:Name', values: [name] } + filter << { name: "tag:Name", values: [name] } end if opts.key?(:vpc_id) vpc_id = opts[:vpc_id].to_s raise ArgumentError, "#{@__resource_name__}: `vpc_id` must be a string in the format of 'vpc-' followed by 8 or 17 hexadecimal characters." unless /^vpc-[0-9a-f]{8,17}$/.match?(vpc_id) - filter << { name: 'vpc-id', values: [vpc_id] } + filter << { name: "vpc-id", values: [vpc_id] } end if opts.key?(:subnet_id) subnet_id = opts[:subnet_id].to_s raise ArgumentError, "#{@__resource_name__}: `subnet_id` must be a string in the format of 'subnet-' followed by 8 or 17 hexadecimal characters." unless /^subnet-[0-9a-f]{8,17}$/.match?(subnet_id) - filter << { name: 'subnet-id', values: [subnet_id] } + filter << { name: "subnet-id", values: [subnet_id] } end - @display_name = opts.slice(:id, :subnet_id, :name, :vpc_id).values.join(' ') + @display_name = opts.slice(:id, :subnet_id, :name, :vpc_id).values.join(" ") query_params = { filter: filter } catch_aws_errors do diff --git a/libraries/aws_nat_gateways.rb b/libraries/aws_nat_gateways.rb index 1c2d89b2b..422523ff9 100644 --- a/libraries/aws_nat_gateways.rb +++ b/libraries/aws_nat_gateways.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsNatGateways < AwsResourceBase - name 'aws_nat_gateways' - desc 'Verifies settings for a collection of AWS NAT gateways.' + name "aws_nat_gateways" + desc "Verifies settings for a collection of AWS NAT gateways." example " describe aws_nat_gateways do @@ -17,14 +17,14 @@ class AwsNatGateways < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:tags, field: :tags) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:subnet_ids, field: :subnet_id) - .register_column(:states, field: :state) - .register_column(:nat_gateways, field: :nat_gateway) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:tags, field: :tags) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:subnet_ids, field: :subnet_id) + .register_column(:states, field: :state) + .register_column(:nat_gateways, field: :nat_gateway) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -50,7 +50,7 @@ def fetch_data ngw_rows += [{ id: ngw.nat_gateway_id, tags: ngw_tags, - name: ngw_tags['Name'], + name: ngw_tags["Name"], subnet_id: ngw.subnet_id, vpc_id: ngw.vpc_id, state: ngw.state, diff --git a/libraries/aws_network_acl.rb b/libraries/aws_network_acl.rb index 6ae4c8420..1ed0e6155 100644 --- a/libraries/aws_network_acl.rb +++ b/libraries/aws_network_acl.rb @@ -1,10 +1,10 @@ -require 'aws_backend' +require "aws_backend" class AwsNetworkACL < AwsResourceBase - EGRESS = 'egress'.freeze - INGRESS = 'ingress'.freeze - name 'aws_network_acl' - desc 'Verifies settings for a single AWS Network ACL' + EGRESS = "egress".freeze + INGRESS = "ingress".freeze + name "aws_network_acl" + desc "Verifies settings for a single AWS Network ACL" example " describe aws_network_acl(network_acl_id: '014aef8a0689b8f43') do it { should exist } @@ -54,7 +54,7 @@ def has_associations?(subnet_id: nil) def has_acl_entry_value?(cidr_block:, egress:, rule_action:) invalid_args = method(__method__).parameters.select { |param| param.nil? || param.empty? } - raise ArgumentError, "params #{invalid_args.map { |i| "`#{i}`" }.join(',')} cannot be blank" if cidr_block.nil? || cidr_block.empty? + raise ArgumentError, "params #{invalid_args.map { |i| "`#{i}`" }.join(",")} cannot be blank" if cidr_block.nil? || cidr_block.empty? return false unless acl_entries acl_entries.any? { |entry| entry.egress == egress && entry.cidr_block == cidr_block && entry.rule_action == rule_action } @@ -83,7 +83,7 @@ def ingress end def resource_id - @response ? @response.network_acls.first.network_acl_id : '' + @response ? @response.network_acls.first.network_acl_id : "" end def to_s @@ -141,8 +141,8 @@ def create_rule_number_methods end def validate_identifier - raise ArgumentError, 'parameter `network_acl_id` cannot be blank' if @opts[:network_acl_id].nil? || @opts[:network_acl_id].empty? - raise ArgumentError, 'parameter `network_acl_id` should start with `acl-` followed by alpha numeric characters' if @opts[:network_acl_id] !~ /^acl-[a-z0-9]+$/ + raise ArgumentError, "parameter `network_acl_id` cannot be blank" if @opts[:network_acl_id].nil? || @opts[:network_acl_id].empty? + raise ArgumentError, "parameter `network_acl_id` should start with `acl-` followed by alpha numeric characters" if @opts[:network_acl_id] !~ /^acl-[a-z0-9]+$/ end def cidr_block_and_rule_action_exists_for?(collection, cidr_block, rule_action) diff --git a/libraries/aws_network_acls.rb b/libraries/aws_network_acls.rb index e4a46e4a0..c4d78fb2d 100644 --- a/libraries/aws_network_acls.rb +++ b/libraries/aws_network_acls.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsNetworkACLs < AwsResourceBase - name 'aws_network_acls' - desc 'Verifies settings for a collection of AWS internet gateways.' + name "aws_network_acls" + desc "Verifies settings for a collection of AWS internet gateways." example " describe aws_network_acls do @@ -17,11 +17,11 @@ class AwsNetworkACLs < AwsResourceBase attr_reader :table filter_table_config = FilterTable.create - .register_column(:network_acl_ids, field: :network_acl_id) - .register_column(:default, field: :default) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:tags, field: :tags) + .register_column(:network_acl_ids, field: :network_acl_id) + .register_column(:default, field: :default) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:tags, field: :tags) # fields that needs to be customized as flattened Arrays %i(default_network_acl_ids associated_subnet_ids network_acl_association_ids entries_cidr_blocks entries_cidr_egress entries_icmp_type_codes entries_icmp_type_code_types entries_ipv_6_cidr_blocks entries_port_ranges entries_protocols entries_rule_actions @@ -68,20 +68,20 @@ def flat_hash_from(network_acl) network_acl_hash[:default] = network_acl_hash[:is_default] network_acl_hash[:default_network_acl_ids] = network_acl_hash.delete(:is_default) ? network_acl.network_acl_id : nil # Associations - network_acl_hash[:associated_subnet_ids] = mappable_attribute_from(network_acl.associations, 'subnet_id') - network_acl_hash[:network_acl_association_ids] = mappable_attribute_from(network_acl.associations, 'network_acl_association_id') + network_acl_hash[:associated_subnet_ids] = mappable_attribute_from(network_acl.associations, "subnet_id") + network_acl_hash[:network_acl_association_ids] = mappable_attribute_from(network_acl.associations, "network_acl_association_id") # Entries - network_acl_hash[:entries_cidr_blocks] = mappable_attribute_from(network_acl.entries, 'cidr_block') - network_acl_hash[:entries_cidr_egress] = mappable_attribute_from(network_acl.entries, 'egress') - network_acl_hash[:entries_icmp_type_codes] = mappable_attribute_from(network_acl.entries, 'icmp_type_code&.code') - network_acl_hash[:entries_icmp_type_code_types] = mappable_attribute_from(network_acl.entries, 'icmp_type_code&.type') - network_acl_hash[:entries_ipv_6_cidr_blocks] = mappable_attribute_from(network_acl.entries, 'ipv_6_cidr_block') + network_acl_hash[:entries_cidr_blocks] = mappable_attribute_from(network_acl.entries, "cidr_block") + network_acl_hash[:entries_cidr_egress] = mappable_attribute_from(network_acl.entries, "egress") + network_acl_hash[:entries_icmp_type_codes] = mappable_attribute_from(network_acl.entries, "icmp_type_code&.code") + network_acl_hash[:entries_icmp_type_code_types] = mappable_attribute_from(network_acl.entries, "icmp_type_code&.type") + network_acl_hash[:entries_ipv_6_cidr_blocks] = mappable_attribute_from(network_acl.entries, "ipv_6_cidr_block") network_acl_hash[:entries_port_ranges] = mapped_port_ranges_for(network_acl.entries) - network_acl_hash[:entries_protocols] = mappable_attribute_from(network_acl.entries, 'protocol') - network_acl_hash[:entries_rule_actions] = mappable_attribute_from(network_acl.entries, 'rule_action') - network_acl_hash[:entries_rule_numbers] = mappable_attribute_from(network_acl.entries, 'rule_number') - network_acl_hash[:egress_rule_numbers] = mappable_attribute_from(network_acl.entries.select(&:egress), 'rule_number') - network_acl_hash[:ingress_rule_numbers] = mappable_attribute_from(network_acl.entries.reject(&:egress), 'rule_number') + network_acl_hash[:entries_protocols] = mappable_attribute_from(network_acl.entries, "protocol") + network_acl_hash[:entries_rule_actions] = mappable_attribute_from(network_acl.entries, "rule_action") + network_acl_hash[:entries_rule_numbers] = mappable_attribute_from(network_acl.entries, "rule_number") + network_acl_hash[:egress_rule_numbers] = mappable_attribute_from(network_acl.entries.select(&:egress), "rule_number") + network_acl_hash[:ingress_rule_numbers] = mappable_attribute_from(network_acl.entries.reject(&:egress), "rule_number") # Tags network_acl_hash[:tags] = network_acl.tags.empty? ? nil : map_tags(network_acl.tags) network_acl_hash.delete(:associations) diff --git a/libraries/aws_network_firewall_firewall.rb b/libraries/aws_network_firewall_firewall.rb index 06d6af58d..7d58ecce8 100644 --- a/libraries/aws_network_firewall_firewall.rb +++ b/libraries/aws_network_firewall_firewall.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSNetworkFirewallFirewall < AwsResourceBase - name 'aws_network_firewall_firewall' - desc 'Returns the data objects for the specified firewall.' + name "aws_network_firewall_firewall" + desc "Returns the data objects for the specified firewall." example " describe aws_network_firewall_firewall(firewall_name: 'FirewallName') do diff --git a/libraries/aws_network_firewall_firewall_policies.rb b/libraries/aws_network_firewall_firewall_policies.rb index 9217f195f..5eab80643 100644 --- a/libraries/aws_network_firewall_firewall_policies.rb +++ b/libraries/aws_network_firewall_firewall_policies.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsNetworkFirewallFirewallPolicies < AwsResourceBase - name 'aws_network_firewall_firewall_policies' - desc 'Retrieves the metadata for the firewall policies that you have defined.' + name "aws_network_firewall_firewall_policies" + desc "Retrieves the metadata for the firewall policies that you have defined." example " describe aws_network_firewall_firewalls do @@ -13,9 +13,9 @@ class AwsNetworkFirewallFirewallPolicies < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:arns, field: :arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:arns, field: :arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_network_firewall_firewall_policy.rb b/libraries/aws_network_firewall_firewall_policy.rb index c29b5d2e9..d199f1f82 100644 --- a/libraries/aws_network_firewall_firewall_policy.rb +++ b/libraries/aws_network_firewall_firewall_policy.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsNetworkFirewallFirewallPolicy < AwsResourceBase - name 'aws_network_firewall_firewall_policy' - desc 'Returns the data objects for the specified firewall policy.' + name "aws_network_firewall_firewall_policy" + desc "Returns the data objects for the specified firewall policy." example " describe aws_network_firewall_firewall_policy(firewall_policy_name: 'FirewallPolicyName') do diff --git a/libraries/aws_network_firewall_firewalls.rb b/libraries/aws_network_firewall_firewalls.rb index 76ea5b6b7..d98546202 100644 --- a/libraries/aws_network_firewall_firewalls.rb +++ b/libraries/aws_network_firewall_firewalls.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSNetworkFirewallFirewalls < AwsResourceBase - name 'aws_network_firewall_firewalls' - desc 'Retrieves the metadata for the firewalls that you have defined.' + name "aws_network_firewall_firewalls" + desc "Retrieves the metadata for the firewalls that you have defined." example " describe aws_network_firewall_firewalls do @@ -13,9 +13,9 @@ class AWSNetworkFirewallFirewalls < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:firewall_names, field: :firewall_name) - .register_column(:firewall_arns, field: :firewall_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:firewall_names, field: :firewall_name) + .register_column(:firewall_arns, field: :firewall_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_network_firewall_logging_configuration.rb b/libraries/aws_network_firewall_logging_configuration.rb index bd776db95..b9d90fc76 100644 --- a/libraries/aws_network_firewall_logging_configuration.rb +++ b/libraries/aws_network_firewall_logging_configuration.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSNetworkFirewallLoggingConfiguration < AwsResourceBase - name 'aws_network_firewall_logging_configuration' - desc 'Returns the logging configuration for the specified firewall.' + name "aws_network_firewall_logging_configuration" + desc "Returns the logging configuration for the specified firewall." example " describe aws_network_firewall_logging_configuration(firewall_name: 'FirewallName') do @@ -29,7 +29,7 @@ def firewall_name end def resource_id - @res? @res[:firewall_arn]: '' + @res? @res[:firewall_arn]: "" end def exists? diff --git a/libraries/aws_network_firewall_rule_group.rb b/libraries/aws_network_firewall_rule_group.rb index 49f838513..673f56532 100644 --- a/libraries/aws_network_firewall_rule_group.rb +++ b/libraries/aws_network_firewall_rule_group.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSNetworkFirewallRuleGroup < AwsResourceBase - name 'aws_network_firewall_rule_group' - desc 'Returns the data objects for the specified rule group.' + name "aws_network_firewall_rule_group" + desc "Returns the data objects for the specified rule group." example " describe aws_network_firewall_rule_group(rule_group_arn: 'RuleGroupName') do diff --git a/libraries/aws_network_firewall_rule_groups.rb b/libraries/aws_network_firewall_rule_groups.rb index 49e1570ec..c34ddd03c 100644 --- a/libraries/aws_network_firewall_rule_groups.rb +++ b/libraries/aws_network_firewall_rule_groups.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSNetworkFirewallRuleGroups < AwsResourceBase - name 'aws_network_firewall_rule_groups' - desc 'Retrieves the metadata for the rule groups that you have defined.' + name "aws_network_firewall_rule_groups" + desc "Retrieves the metadata for the rule groups that you have defined." example " describe aws_network_firewall_rule_groups do @@ -13,9 +13,9 @@ class AWSNetworkFirewallRuleGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:arns, field: :arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:arns, field: :arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_network_manager_customer_gateway_association.rb b/libraries/aws_network_manager_customer_gateway_association.rb index 4e126044d..2a89e284d 100644 --- a/libraries/aws_network_manager_customer_gateway_association.rb +++ b/libraries/aws_network_manager_customer_gateway_association.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSNetworkManagerCustomerGatewayAssociation < AwsResourceBase - name 'aws_network_manager_customer_gateway_association' - desc 'Gets the association information for customer gateways that are associated with devices and links in your global network.' + name "aws_network_manager_customer_gateway_association" + desc "Gets the association information for customer gateways that are associated with devices and links in your global network." example " describe aws_network_manager_customer_gateway_association(global_network_id: 'GlobalNetworkID', customer_gateway_arn: 'CustomerGatewayARN') do diff --git a/libraries/aws_network_manager_customer_gateway_associations.rb b/libraries/aws_network_manager_customer_gateway_associations.rb index 43e7f22e4..609af714c 100644 --- a/libraries/aws_network_manager_customer_gateway_associations.rb +++ b/libraries/aws_network_manager_customer_gateway_associations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSNetworkManagerCustomerGatewayAssociations < AwsResourceBase - name 'aws_network_manager_customer_gateway_associations' - desc 'Gets the association information for customer gateways that are associated with devices and links in your global network.' + name "aws_network_manager_customer_gateway_associations" + desc "Gets the association information for customer gateways that are associated with devices and links in your global network." example " describe aws_network_manager_customer_gateway_associations(global_network_id: 'GlobalNetworkID') do @@ -13,13 +13,13 @@ class AWSNetworkManagerCustomerGatewayAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:customer_gateway_arns, field: :customer_gateway_arn) - .register_column(:global_network_ids, field: :global_network_id) - .register_column(:device_ids, field: :device_id) - .register_column(:link_ids, field: :link_id) - .register_column(:states, field: :state) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:customer_gateway_arns, field: :customer_gateway_arn) + .register_column(:global_network_ids, field: :global_network_id) + .register_column(:device_ids, field: :device_id) + .register_column(:link_ids, field: :link_id) + .register_column(:states, field: :state) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_network_manager_device.rb b/libraries/aws_network_manager_device.rb index 2d9878ea6..f046f5520 100644 --- a/libraries/aws_network_manager_device.rb +++ b/libraries/aws_network_manager_device.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSNetworkManagerDevice < AwsResourceBase - name 'aws_network_manager_device' - desc 'Gets information about one or more of your devices in a global network.' + name "aws_network_manager_device" + desc "Gets information about one or more of your devices in a global network." example " describe aws_network_manager_device(device_id: 'test1', global_network_id: 'test1') do diff --git a/libraries/aws_network_manager_devices.rb b/libraries/aws_network_manager_devices.rb index 98341751b..00a61a92f 100644 --- a/libraries/aws_network_manager_devices.rb +++ b/libraries/aws_network_manager_devices.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSNetworkManagerDevices < AwsResourceBase - name 'aws_network_manager_devices' - desc 'List all the devices.' + name "aws_network_manager_devices" + desc "List all the devices." example " describe aws_network_manager_devices(global_network_id: 'GlobalNetworkID') do @@ -13,24 +13,24 @@ class AWSNetworkManagerDevices < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:device_ids, field: :device_id) - .register_column(:device_arns, field: :device_arn) - .register_column(:global_network_ids, field: :global_network_id) - .register_column(:location_zones, field: :location_zones, style: :simple) - .register_column(:location_subnet_arns, field: :location_subnet_arn, style: :simple) - .register_column(:descriptions, field: :description) - .register_column(:types, field: :type) - .register_column(:vendors, field: :vendor) - .register_column(:models, field: :model) - .register_column(:serial_numbers, field: :serial_number) - .register_column(:addresses, field: :address, style: :simple) - .register_column(:latitudes, field: :latitude, style: :simple) - .register_column(:longitudes, field: :longitude, style: :simple) - .register_column(:site_ids, field: :site_id) - .register_column(:created_at, field: :created_at) - .register_column(:states, field: :state) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:device_ids, field: :device_id) + .register_column(:device_arns, field: :device_arn) + .register_column(:global_network_ids, field: :global_network_id) + .register_column(:location_zones, field: :location_zones, style: :simple) + .register_column(:location_subnet_arns, field: :location_subnet_arn, style: :simple) + .register_column(:descriptions, field: :description) + .register_column(:types, field: :type) + .register_column(:vendors, field: :vendor) + .register_column(:models, field: :model) + .register_column(:serial_numbers, field: :serial_number) + .register_column(:addresses, field: :address, style: :simple) + .register_column(:latitudes, field: :latitude, style: :simple) + .register_column(:longitudes, field: :longitude, style: :simple) + .register_column(:site_ids, field: :site_id) + .register_column(:created_at, field: :created_at) + .register_column(:states, field: :state) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_network_manager_global_network.rb b/libraries/aws_network_manager_global_network.rb index a50b740de..653fbef24 100644 --- a/libraries/aws_network_manager_global_network.rb +++ b/libraries/aws_network_manager_global_network.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSNetworkManagerGlobalNetwork < AwsResourceBase - name 'aws_network_manager_global_network' - desc 'Describes one or more global networks.' + name "aws_network_manager_global_network" + desc "Describes one or more global networks." example " describe aws_network_manager_global_network(global_network_id: 'test1') do diff --git a/libraries/aws_network_manager_global_networks.rb b/libraries/aws_network_manager_global_networks.rb index ffa2cd3e5..78c4b55ba 100644 --- a/libraries/aws_network_manager_global_networks.rb +++ b/libraries/aws_network_manager_global_networks.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSNetworkManagerGlobalNetworks < AwsResourceBase - name 'aws_network_manager_global_networks' - desc 'List all the global networks.' + name "aws_network_manager_global_networks" + desc "List all the global networks." example " describe aws_network_manager_global_networks do @@ -13,13 +13,13 @@ class AWSNetworkManagerGlobalNetworks < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:global_network_ids, field: :global_network_id) - .register_column(:global_network_arns, field: :global_network_arn) - .register_column(:descriptions, field: :description) - .register_column(:created_at, field: :created_at) - .register_column(:states, field: :state) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:global_network_ids, field: :global_network_id) + .register_column(:global_network_arns, field: :global_network_arn) + .register_column(:descriptions, field: :description) + .register_column(:created_at, field: :created_at) + .register_column(:states, field: :state) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_organizations_member.rb b/libraries/aws_organizations_member.rb index 391408be9..54c62fb92 100644 --- a/libraries/aws_organizations_member.rb +++ b/libraries/aws_organizations_member.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsOrganizationsMember < AwsResourceBase - name 'aws_organizations_member' - desc 'Verifies status of the current AWWS Account within Organizations service.' + name "aws_organizations_member" + desc "Verifies status of the current AWWS Account within Organizations service." example " describe aws_organizations_member do it { should_not be_master } @@ -15,11 +15,11 @@ class AwsOrganizationsMember < AwsResourceBase alias master? master def initialize(opts = {}) - raise 'Expected parameter opts to be a Hash.' if !opts.nil? && !opts.is_a?(Hash) + raise "Expected parameter opts to be a Hash." if !opts.nil? && !opts.is_a?(Hash) # Operations on Organizations must target us-east-1, see # https://docs.aws.amazon.com/organizations/latest/APIReference/Welcome.html - opts[:aws_region] = 'us-east-1' + opts[:aws_region] = "us-east-1" super(opts) validate_parameters @@ -58,7 +58,7 @@ def exists? end def to_s - 'Organizations Member Status' + "Organizations Member Status" end private @@ -66,6 +66,6 @@ def to_s # Fetch AWS Account Number def fetch_id arn = @aws.sts_client.get_caller_identity({}).arn - arn.split(':')[4] + arn.split(":")[4] end end diff --git a/libraries/aws_ram_resource_share.rb b/libraries/aws_ram_resource_share.rb index 62831d95a..7d37e6d21 100644 --- a/libraries/aws_ram_resource_share.rb +++ b/libraries/aws_ram_resource_share.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRAMResourceShare < AwsResourceBase - name 'aws_ram_resource_share' - desc 'Describes the resource shares of the ram.' + name "aws_ram_resource_share" + desc "Describes the resource shares of the ram." example " describe aws_ram_resource_share(resource_owner: 'SELF', resource_share_arn: 'resource_share_arn_test') do diff --git a/libraries/aws_ram_resource_shares.rb b/libraries/aws_ram_resource_shares.rb index ab2b01051..5aaed54df 100644 --- a/libraries/aws_ram_resource_shares.rb +++ b/libraries/aws_ram_resource_shares.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRAMResourceShares < AwsResourceBase - name 'aws_ram_resource_shares' - desc 'Lists the resources that you added to a resource shares or the resources that are shared with you.' + name "aws_ram_resource_shares" + desc "Lists the resources that you added to a resource shares or the resources that are shared with you." example " describe aws_ram_resource_shares(resource_owner: 'SELF') do @@ -13,17 +13,17 @@ class AWSRAMResourceShares < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:resource_share_arns, field: :resource_share_arn) - .register_column(:names, field: :name) - .register_column(:owning_account_ids, field: :owning_account_id) - .register_column(:allow_external_principals, field: :allow_external_principals) - .register_column(:statuses, field: :status) - .register_column(:status_messages, field: :status_message) - .register_column(:tags, field: :tags) - .register_column(:creation_times, field: :creation_time) - .register_column(:last_updated_times, field: :last_updated_time) - .register_column(:feature_sets, field: :feature_set) - .install_filter_methods_on_resource(self, :table) + .register_column(:resource_share_arns, field: :resource_share_arn) + .register_column(:names, field: :name) + .register_column(:owning_account_ids, field: :owning_account_id) + .register_column(:allow_external_principals, field: :allow_external_principals) + .register_column(:statuses, field: :status) + .register_column(:status_messages, field: :status_message) + .register_column(:tags, field: :tags) + .register_column(:creation_times, field: :creation_time) + .register_column(:last_updated_times, field: :last_updated_time) + .register_column(:feature_sets, field: :feature_set) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_cluster.rb b/libraries/aws_rds_cluster.rb index cdb46ba13..cd61f81d0 100644 --- a/libraries/aws_rds_cluster.rb +++ b/libraries/aws_rds_cluster.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRdsCluster < AwsResourceBase - name 'aws_rds_cluster' - desc 'Verifies settings for an RDS Cluster.' + name "aws_rds_cluster" + desc "Verifies settings for an RDS Cluster." example " describe aws_rds_cluster(db_cluster_identifier: 'test-cluster-id') do diff --git a/libraries/aws_rds_clusters.rb b/libraries/aws_rds_clusters.rb index 8d1ab6f43..a65e3b256 100644 --- a/libraries/aws_rds_clusters.rb +++ b/libraries/aws_rds_clusters.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRdsClusters < AwsResourceBase - name 'aws_rds_clusters' - desc 'Verifies settings for a collection AWS RDS Clusters.' + name "aws_rds_clusters" + desc "Verifies settings for a collection AWS RDS Clusters." example " describe aws_rds_clusters do it { should exist } @@ -12,18 +12,18 @@ class AwsRdsClusters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:cluster_identifier, field: :cluster_identifier) - .register_column(:database_name, field: :database_name) - .register_column(:cluster_members, field: :cluster_members) - .register_column(:engine, field: :engine) - .register_column(:engine_version, field: :engine_version) - .register_column(:status, field: :status) - .register_column(:allocated_storage, field: :allocated_storage) - .register_column(:storage_encrypted, field: :storage_encrypted) - .register_column(:availability_zones, field: :availability_zones) - .register_column(:multi_az, field: :multi_az) - .register_column(:arn, field: :arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:cluster_identifier, field: :cluster_identifier) + .register_column(:database_name, field: :database_name) + .register_column(:cluster_members, field: :cluster_members) + .register_column(:engine, field: :engine) + .register_column(:engine_version, field: :engine_version) + .register_column(:status, field: :status) + .register_column(:allocated_storage, field: :allocated_storage) + .register_column(:storage_encrypted, field: :storage_encrypted) + .register_column(:availability_zones, field: :availability_zones) + .register_column(:multi_az, field: :multi_az) + .register_column(:arn, field: :arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_db_cluster_snapshot.rb b/libraries/aws_rds_db_cluster_snapshot.rb index 95f72c70f..c6f461be7 100644 --- a/libraries/aws_rds_db_cluster_snapshot.rb +++ b/libraries/aws_rds_db_cluster_snapshot.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRDSDBClusterSnapShot < AwsResourceBase - name 'aws_rds_db_cluster_snapshot' - desc 'Returns information about DB cluster snapshots.' + name "aws_rds_db_cluster_snapshot" + desc "Returns information about DB cluster snapshots." example " describe aws_rds_db_cluster_snapshot(db_cluster_snapshot_id: 'DBSnapshotID') do @@ -18,7 +18,7 @@ def initialize(opts = {}) @display_name = opts[:db_cluster_snapshot_id] filter = [ { - name: 'db-cluster-snapshot-id', + name: "db-cluster-snapshot-id", values: [opts[:db_cluster_snapshot_id]], }, ] diff --git a/libraries/aws_rds_db_cluster_snapshots.rb b/libraries/aws_rds_db_cluster_snapshots.rb index 83d6c520e..723748d6f 100644 --- a/libraries/aws_rds_db_cluster_snapshots.rb +++ b/libraries/aws_rds_db_cluster_snapshots.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRDSDBClusterSnapShots < AwsResourceBase - name 'aws_rds_db_cluster_snapshots' - desc 'Returns information about DB cluster snapshots.' + name "aws_rds_db_cluster_snapshots" + desc "Returns information about DB cluster snapshots." example " describe aws_rds_db_cluster_snapshots do @@ -13,29 +13,29 @@ class AWSRDSDBClusterSnapShots < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:availability_zones, field: :availability_zones) - .register_column(:db_cluster_snapshot_identifiers, field: :db_cluster_snapshot_identifier) - .register_column(:db_cluster_identifiers, field: :db_cluster_identifier) - .register_column(:snapshot_create_times, field: :snapshot_create_time) - .register_column(:engines, field: :engine) - .register_column(:engine_modes, field: :engine_mode) - .register_column(:allocated_storages, field: :allocated_storage) - .register_column(:statuses, field: :status) - .register_column(:ports, field: :port) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:cluster_create_times, field: :cluster_create_time) - .register_column(:master_usernames, field: :master_username) - .register_column(:engine_versions, field: :engine_version) - .register_column(:license_models, field: :license_model) - .register_column(:snapshot_types, field: :snapshot_type) - .register_column(:percent_progresses, field: :percent_progress) - .register_column(:storage_encrypted, field: :storage_encrypted) - .register_column(:kms_key_ids, field: :kms_key_id) - .register_column(:db_cluster_snapshot_arns, field: :db_cluster_snapshot_arn) - .register_column(:source_db_cluster_snapshot_arns, field: :source_db_cluster_snapshot_arn) - .register_column(:iam_database_authentication_enabled, field: :iam_database_authentication_enabled) - .register_column(:tag_lists, field: :tag_list) - .install_filter_methods_on_resource(self, :table) + .register_column(:availability_zones, field: :availability_zones) + .register_column(:db_cluster_snapshot_identifiers, field: :db_cluster_snapshot_identifier) + .register_column(:db_cluster_identifiers, field: :db_cluster_identifier) + .register_column(:snapshot_create_times, field: :snapshot_create_time) + .register_column(:engines, field: :engine) + .register_column(:engine_modes, field: :engine_mode) + .register_column(:allocated_storages, field: :allocated_storage) + .register_column(:statuses, field: :status) + .register_column(:ports, field: :port) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:cluster_create_times, field: :cluster_create_time) + .register_column(:master_usernames, field: :master_username) + .register_column(:engine_versions, field: :engine_version) + .register_column(:license_models, field: :license_model) + .register_column(:snapshot_types, field: :snapshot_type) + .register_column(:percent_progresses, field: :percent_progress) + .register_column(:storage_encrypted, field: :storage_encrypted) + .register_column(:kms_key_ids, field: :kms_key_id) + .register_column(:db_cluster_snapshot_arns, field: :db_cluster_snapshot_arn) + .register_column(:source_db_cluster_snapshot_arns, field: :source_db_cluster_snapshot_arn) + .register_column(:iam_database_authentication_enabled, field: :iam_database_authentication_enabled) + .register_column(:tag_lists, field: :tag_list) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_db_proxy.rb b/libraries/aws_rds_db_proxy.rb index 9b1fd5f83..bb174c736 100644 --- a/libraries/aws_rds_db_proxy.rb +++ b/libraries/aws_rds_db_proxy.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRDSProxy < AwsResourceBase - name 'aws_rds_db_proxy' - desc 'Returns information about DB proxies.' + name "aws_rds_db_proxy" + desc "Returns information about DB proxies." example " describe aws_rds_db_proxy(db_proxy_name: 'DB_PROXY_NAME') do diff --git a/libraries/aws_rds_db_proxy_endpoint.rb b/libraries/aws_rds_db_proxy_endpoint.rb index 668059e04..fe9503bc1 100644 --- a/libraries/aws_rds_db_proxy_endpoint.rb +++ b/libraries/aws_rds_db_proxy_endpoint.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRDSProxyEndpoint < AwsResourceBase - name 'aws_rds_db_proxy_endpoint' - desc 'Retrieves information about a patch baseline.' + name "aws_rds_db_proxy_endpoint" + desc "Retrieves information about a patch baseline." example " describe aws_rds_db_proxy_endpoint(db_proxy_name: 'DB_PROXY_NAME', db_proxy_endpoint_name: 'DB_PROXY_ENDPOINT_NAME') do diff --git a/libraries/aws_rds_db_proxy_endpoints.rb b/libraries/aws_rds_db_proxy_endpoints.rb index 0892115e2..d17559422 100644 --- a/libraries/aws_rds_db_proxy_endpoints.rb +++ b/libraries/aws_rds_db_proxy_endpoints.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRDSProxyEndpoints < AwsResourceBase - name 'aws_rds_db_proxy_endpoints' - desc 'Returns information about DB proxy endpoints.' + name "aws_rds_db_proxy_endpoints" + desc "Returns information about DB proxy endpoints." example " describe aws_rds_db_proxy_endpoints(db_proxy_name: 'DB_PROXY_NAME') do @@ -13,18 +13,18 @@ class AWSRDSProxyEndpoints < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:db_proxy_endpoint_names, field: :db_proxy_endpoint_name) - .register_column(:db_proxy_endpoint_arns, field: :db_proxy_endpoint_arn) - .register_column(:db_proxy_names, field: :db_proxy_name) - .register_column(:statuses, field: :status) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:vpc_security_group_ids, field: :vpc_security_group_ids) - .register_column(:vpc_subnet_ids, field: :vpc_subnet_ids) - .register_column(:endpoints, field: :endpoint) - .register_column(:created_dates, field: :created_date) - .register_column(:target_roles, field: :target_role) - .register_column(:is_default, field: :is_default) - .install_filter_methods_on_resource(self, :table) + .register_column(:db_proxy_endpoint_names, field: :db_proxy_endpoint_name) + .register_column(:db_proxy_endpoint_arns, field: :db_proxy_endpoint_arn) + .register_column(:db_proxy_names, field: :db_proxy_name) + .register_column(:statuses, field: :status) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:vpc_security_group_ids, field: :vpc_security_group_ids) + .register_column(:vpc_subnet_ids, field: :vpc_subnet_ids) + .register_column(:endpoints, field: :endpoint) + .register_column(:created_dates, field: :created_date) + .register_column(:target_roles, field: :target_role) + .register_column(:is_default, field: :is_default) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_db_security_group.rb b/libraries/aws_rds_db_security_group.rb index 95682e692..390acb878 100644 --- a/libraries/aws_rds_db_security_group.rb +++ b/libraries/aws_rds_db_security_group.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRDSDBSecurityGroup < AwsResourceBase - name 'aws_rds_db_security_group' - desc 'Returns information about a db security group.' + name "aws_rds_db_security_group" + desc "Returns information about a db security group." example " describe aws_rds_db_security_group(db_security_group_name: 'SECURITY_GROUP_NAME') do diff --git a/libraries/aws_rds_db_security_groups.rb b/libraries/aws_rds_db_security_groups.rb index 84ddc21c5..e93982fec 100644 --- a/libraries/aws_rds_db_security_groups.rb +++ b/libraries/aws_rds_db_security_groups.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRDSDBSecurityGroups < AwsResourceBase - name 'aws_rds_db_security_groups' - desc 'Returns information about all the db security group.' + name "aws_rds_db_security_groups" + desc "Returns information about all the db security group." example " describe aws_rds_db_security_groups do @@ -13,14 +13,14 @@ class AWSRDSDBSecurityGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:owner_ids, field: :owner_id) - .register_column(:db_security_group_names, field: :db_security_group_name) - .register_column(:db_security_group_descriptions, field: :db_security_group_description) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:ec2_security_groups, field: :ec2_security_groups, style: :simple) - .register_column(:ip_ranges, field: :ip_ranges, style: :simple) - .register_column(:db_security_group_arns, field: :db_security_group_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:owner_ids, field: :owner_id) + .register_column(:db_security_group_names, field: :db_security_group_name) + .register_column(:db_security_group_descriptions, field: :db_security_group_description) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:ec2_security_groups, field: :ec2_security_groups, style: :simple) + .register_column(:ip_ranges, field: :ip_ranges, style: :simple) + .register_column(:db_security_group_arns, field: :db_security_group_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_event_subscription.rb b/libraries/aws_rds_event_subscription.rb index 03d11fb93..e5a8f354d 100644 --- a/libraries/aws_rds_event_subscription.rb +++ b/libraries/aws_rds_event_subscription.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRDSEventSubscription < AwsResourceBase - name 'aws_rds_event_subscription' - desc 'Returns information about a RDS Event Subscription.' + name "aws_rds_event_subscription" + desc "Returns information about a RDS Event Subscription." example " describe aws_rds_event_subscription(subscription_name: 'EVENT_SUBSCRIPTION_NAME') do @@ -23,7 +23,7 @@ def initialize(opts = {}) end def resource_id - "#{@res? @res[:customer_aws_id]: ''}_#{@res? @res[:cust_subscription_id]: ''}" + "#{@res? @res[:customer_aws_id]: ""}_#{@res? @res[:cust_subscription_id]: ""}" end def subscription_name diff --git a/libraries/aws_rds_event_subscriptions.rb b/libraries/aws_rds_event_subscriptions.rb index 1aafd8264..21002b254 100644 --- a/libraries/aws_rds_event_subscriptions.rb +++ b/libraries/aws_rds_event_subscriptions.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRDSEventSubscriptions < AwsResourceBase - name 'aws_rds_event_subscriptions' - desc 'Returns information about DB Event Subscription.' + name "aws_rds_event_subscriptions" + desc "Returns information about DB Event Subscription." example " describe aws_rds_event_subscriptions do @@ -13,17 +13,17 @@ class AWSRDSEventSubscriptions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:customer_aws_ids, field: :customer_aws_id) - .register_column(:cust_subscription_ids, field: :cust_subscription_id) - .register_column(:sns_topic_arns, field: :sns_topic_arn) - .register_column(:statuses, field: :status) - .register_column(:subscription_creation_times, field: :subscription_creation_time) - .register_column(:source_types, field: :source_type) - .register_column(:source_ids_list, field: :source_ids_list, style: :simple) - .register_column(:event_categories_list, field: :event_categories_list, style: :simple) - .register_column(:enabled, field: :enabled) - .register_column(:event_subscription_arns, field: :event_subscription_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:customer_aws_ids, field: :customer_aws_id) + .register_column(:cust_subscription_ids, field: :cust_subscription_id) + .register_column(:sns_topic_arns, field: :sns_topic_arn) + .register_column(:statuses, field: :status) + .register_column(:subscription_creation_times, field: :subscription_creation_time) + .register_column(:source_types, field: :source_type) + .register_column(:source_ids_list, field: :source_ids_list, style: :simple) + .register_column(:event_categories_list, field: :event_categories_list, style: :simple) + .register_column(:enabled, field: :enabled) + .register_column(:event_subscription_arns, field: :event_subscription_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_global_cluster.rb b/libraries/aws_rds_global_cluster.rb index a024d9ab5..dddbe35ba 100644 --- a/libraries/aws_rds_global_cluster.rb +++ b/libraries/aws_rds_global_cluster.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRDSGlobalCluster < AwsResourceBase - name 'aws_rds_global_cluster' - desc 'Returns information about Aurora global database clusters.' + name "aws_rds_global_cluster" + desc "Returns information about Aurora global database clusters." example " describe aws_rds_global_cluster(global_cluster_identifier: 'GLOBAL_CLUSTER_IDENTIFIER') do diff --git a/libraries/aws_rds_global_clusters.rb b/libraries/aws_rds_global_clusters.rb index d1dd6e3cc..27f97d616 100644 --- a/libraries/aws_rds_global_clusters.rb +++ b/libraries/aws_rds_global_clusters.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRDSGlobalClusters < AwsResourceBase - name 'aws_rds_global_clusters' - desc 'Returns information about DB Global Cluster.' + name "aws_rds_global_clusters" + desc "Returns information about DB Global Cluster." example " describe aws_rds_global_clusters do @@ -13,17 +13,17 @@ class AWSRDSGlobalClusters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:global_cluster_identifiers, field: :global_cluster_identifier) - .register_column(:global_cluster_resource_ids, field: :global_cluster_resource_id) - .register_column(:global_cluster_arns, field: :global_cluster_arn) - .register_column(:statuses, field: :status) - .register_column(:engines, field: :engine) - .register_column(:vpc_security_group_ids, field: :vpc_security_group_ids) - .register_column(:engine_versions, field: :engine_version) - .register_column(:database_names, field: :database_name) - .register_column(:storage_encrypted, field: :role_arn) - .register_column(:deletion_protection, field: :deletion_protection) - .install_filter_methods_on_resource(self, :table) + .register_column(:global_cluster_identifiers, field: :global_cluster_identifier) + .register_column(:global_cluster_resource_ids, field: :global_cluster_resource_id) + .register_column(:global_cluster_arns, field: :global_cluster_arn) + .register_column(:statuses, field: :status) + .register_column(:engines, field: :engine) + .register_column(:vpc_security_group_ids, field: :vpc_security_group_ids) + .register_column(:engine_versions, field: :engine_version) + .register_column(:database_names, field: :database_name) + .register_column(:storage_encrypted, field: :role_arn) + .register_column(:deletion_protection, field: :deletion_protection) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_instance.rb b/libraries/aws_rds_instance.rb index 55a6b7631..b233dec82 100644 --- a/libraries/aws_rds_instance.rb +++ b/libraries/aws_rds_instance.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRdsInstance < AwsResourceBase - name 'aws_rds_instance' - desc 'Verifies settings for an RDS instance.' + name "aws_rds_instance" + desc "Verifies settings for an RDS instance." example " describe aws_rds_instance(db_instance_identifier: 'test-instance-id') do @@ -23,7 +23,7 @@ def initialize(opts = {}) end def resource_id - "#{@rds_instance? @rds_instance[:db_instance_identifier]: ''}_#{@rds_instance? @rds_instance[:db_name]: ''}_#{@rds_instance? @rds_instance[:master_username]: ''}" + "#{@rds_instance? @rds_instance[:db_instance_identifier]: ""}_#{@rds_instance? @rds_instance[:db_name]: ""}_#{@rds_instance? @rds_instance[:master_username]: ""}" end def has_encrypted_storage? diff --git a/libraries/aws_rds_instances.rb b/libraries/aws_rds_instances.rb index 2f795a257..0b8fa576a 100644 --- a/libraries/aws_rds_instances.rb +++ b/libraries/aws_rds_instances.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRdsInstances < AwsCollectionResourceBase - name 'aws_rds_instances' - desc 'Verifies settings for AWS RDS instances in bulk.' + name "aws_rds_instances" + desc "Verifies settings for AWS RDS instances in bulk." example " describe aws_rds_instances do it { should exist } diff --git a/libraries/aws_rds_option_group.rb b/libraries/aws_rds_option_group.rb index 76245dc62..d2ed7170b 100644 --- a/libraries/aws_rds_option_group.rb +++ b/libraries/aws_rds_option_group.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRdsOptionGroup < AwsResourceBase - name 'aws_rds_option_group' - desc 'Verifies settings for an RDS Option Group.' + name "aws_rds_option_group" + desc "Verifies settings for an RDS Option Group." example " describe aws_rds_option_group(option_group_name: 'test-option_group_name') do @@ -32,7 +32,7 @@ def initialize(opts = {}) end def resource_id - @rds_cluster? @rds_cluster[:option_group_arn]: '' + @rds_cluster? @rds_cluster[:option_group_arn]: "" end def exists? diff --git a/libraries/aws_rds_option_groups.rb b/libraries/aws_rds_option_groups.rb index 32bf32a1e..48a2b706e 100644 --- a/libraries/aws_rds_option_groups.rb +++ b/libraries/aws_rds_option_groups.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRdsOptionGroups < AwsResourceBase - name 'aws_rds_option_groups' - desc 'Verifies settings for a collection AWS RDS Clusters.' + name "aws_rds_option_groups" + desc "Verifies settings for a collection AWS RDS Clusters." example " describe aws_rds_group_options do it { should exist } @@ -12,14 +12,14 @@ class AwsRdsOptionGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:option_group_names, field: :option_group_name) - .register_column(:option_group_description, field: :option_group_description) - .register_column(:engine_names, field: :engine_name) - .register_column(:major_engine_versions, field: :major_engine_version) - .register_column(:option_group_arns, field: :option_group_arn) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:allows_vpc_and_non_vpc_instance_memberships, field: :allows_vpc_and_non_vpc_instance_memberships) - .install_filter_methods_on_resource(self, :table) + .register_column(:option_group_names, field: :option_group_name) + .register_column(:option_group_description, field: :option_group_description) + .register_column(:engine_names, field: :engine_name) + .register_column(:major_engine_versions, field: :major_engine_version) + .register_column(:option_group_arns, field: :option_group_arn) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:allows_vpc_and_non_vpc_instance_memberships, field: :allows_vpc_and_non_vpc_instance_memberships) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_rds_snapshot.rb b/libraries/aws_rds_snapshot.rb index d4c6e9f63..6a6affabc 100644 --- a/libraries/aws_rds_snapshot.rb +++ b/libraries/aws_rds_snapshot.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRdsSnapshot < AwsResourceBase - name 'aws_rds_snapshot' - desc 'Verifies settings for an RDS snapshot.' + name "aws_rds_snapshot" + desc "Verifies settings for an RDS snapshot." example " describe aws_rds_snapshot(db_snapshot_identifier: 'test-snapshot-id') do @@ -23,7 +23,7 @@ def initialize(opts = {}) end def resource_id - @rds_snapshot? @rds_snapshot[:db_snapshot_identifier]: '' + @rds_snapshot? @rds_snapshot[:db_snapshot_identifier]: "" end def has_encrypted_snapshot? diff --git a/libraries/aws_rds_snapshot_attributes.rb b/libraries/aws_rds_snapshot_attributes.rb index b07ad7e41..638baf37d 100644 --- a/libraries/aws_rds_snapshot_attributes.rb +++ b/libraries/aws_rds_snapshot_attributes.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRdsSnapshotAttributes < AwsResourceBase - name 'aws_rds_snapshot_attributes' - desc 'Verifies settings for an RDS snapshot attributes.' + name "aws_rds_snapshot_attributes" + desc "Verifies settings for an RDS snapshot attributes." example ' describe aws_rds_snapshot_attributes(db_snapshot_identifier: "test") do @@ -13,10 +13,10 @@ class AwsRdsSnapshotAttributes < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:db_snapshot_identifier, field: :db_snapshot_identifier) - .register_column(:attribute_name, field: :attribute_name) - .register_column(:attribute_values, field: :attribute_values) - .install_filter_methods_on_resource(self, :table) + .register_column(:db_snapshot_identifier, field: :db_snapshot_identifier) + .register_column(:attribute_name, field: :attribute_name) + .register_column(:attribute_values, field: :attribute_values) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) opts = { db_snapshot_identifier: opts } if opts.is_a?(String) @@ -29,7 +29,7 @@ def initialize(opts = {}) begin @aws.rds_client.describe_db_snapshots(db_snapshot_identifier: opts[:db_snapshot_identifier]) rescue Aws::RDS::Errors::DBSnapshotNotFound - fail_resource('DBSnapshot does not exist') + fail_resource("DBSnapshot does not exist") end end @table = fetch_data diff --git a/libraries/aws_rds_snapshots.rb b/libraries/aws_rds_snapshots.rb index 849d794e2..aa5bccc3f 100644 --- a/libraries/aws_rds_snapshots.rb +++ b/libraries/aws_rds_snapshots.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRdsSnapshots < AwsCollectionResourceBase - name 'aws_rds_snapshots' - desc 'Verifies settings for AWS RDS snapshots in bulk.' + name "aws_rds_snapshots" + desc "Verifies settings for AWS RDS snapshots in bulk." example " describe aws_rds_snapshots do it { should exist } diff --git a/libraries/aws_redshift_cluster.rb b/libraries/aws_redshift_cluster.rb index 643c2cd99..194285c82 100644 --- a/libraries/aws_redshift_cluster.rb +++ b/libraries/aws_redshift_cluster.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRedshiftCluster < AwsResourceBase - name 'aws_redshift_cluster' - desc 'Verifies an Redshift Cluster.' + name "aws_redshift_cluster" + desc "Verifies an Redshift Cluster." example " describe aws_redshift_cluster(cluster_identifier: 'test-cluster-id') do diff --git a/libraries/aws_redshift_cluster_parameter_group.rb b/libraries/aws_redshift_cluster_parameter_group.rb index 8fd7af855..160e4f875 100644 --- a/libraries/aws_redshift_cluster_parameter_group.rb +++ b/libraries/aws_redshift_cluster_parameter_group.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRedshiftClusterParameterGroup < AwsResourceBase - name 'aws_redshift_cluster_parameter_group' - desc 'Describes a parameter group.' + name "aws_redshift_cluster_parameter_group" + desc "Describes a parameter group." example " describe aws_redshift_cluster_parameter_group(parameter_group_name: aws_parameter_group_name) do it { should exist } diff --git a/libraries/aws_redshift_cluster_parameter_groups.rb b/libraries/aws_redshift_cluster_parameter_groups.rb index 23606465f..1a550c2d2 100644 --- a/libraries/aws_redshift_cluster_parameter_groups.rb +++ b/libraries/aws_redshift_cluster_parameter_groups.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRedshiftClusterParameterGroups < AwsResourceBase - name 'aws_redshift_cluster_parameter_groups' - desc 'Describes a parameter group.' + name "aws_redshift_cluster_parameter_groups" + desc "Describes a parameter group." example " describe aws_redshift_cluster_parameter_groups do it { should exist } @@ -11,11 +11,11 @@ class AwsRedshiftClusterParameterGroups < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:parameter_group_names, field: :parameter_group_name) - .register_column(:parameter_group_families, field: :parameter_group_family) - .register_column(:descriptions, field: :description) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:parameter_group_names, field: :parameter_group_name) + .register_column(:parameter_group_families, field: :parameter_group_family) + .register_column(:descriptions, field: :description) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_redshift_clusters.rb b/libraries/aws_redshift_clusters.rb index 83bfe51a2..81c3bb3d8 100644 --- a/libraries/aws_redshift_clusters.rb +++ b/libraries/aws_redshift_clusters.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRedshiftClusters < AwsResourceBase - name 'aws_redshift_clusters' - desc 'Verifies settings for a collection AWS RDS Clusters.' + name "aws_redshift_clusters" + desc "Verifies settings for a collection AWS RDS Clusters." example " describe aws_redshift_clusters do it { should exist } @@ -12,21 +12,21 @@ class AwsRedshiftClusters < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:cluster_identifiers, field: :cluster_identifier) - .register_column(:node_types, field: :node_type) - .register_column(:cluster_status, field: :cluster_status) - .register_column(:cluster_availability_status, field: :cluster_availability_status) - .register_column(:db_names, field: :db_name) - .register_column(:modify_status, field: :modify_status) - .register_column(:master_usernames, field: :master_username) - .register_column(:cluster_create_time, field: :cluster_create_time) - .register_column(:cluster_subnet_group_names, field: :cluster_subnet_group_name) - .register_column(:availability_zones, field: :availability_zones) - .register_column(:allow_version_upgrade, field: :allow_version_upgrade) - .register_column(:encrypted, field: :encrypted) - .register_column(:iam_roles, field: :iam_roles) - .register_column(:vpc_ids, field: :vpc_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:cluster_identifiers, field: :cluster_identifier) + .register_column(:node_types, field: :node_type) + .register_column(:cluster_status, field: :cluster_status) + .register_column(:cluster_availability_status, field: :cluster_availability_status) + .register_column(:db_names, field: :db_name) + .register_column(:modify_status, field: :modify_status) + .register_column(:master_usernames, field: :master_username) + .register_column(:cluster_create_time, field: :cluster_create_time) + .register_column(:cluster_subnet_group_names, field: :cluster_subnet_group_name) + .register_column(:availability_zones, field: :availability_zones) + .register_column(:allow_version_upgrade, field: :allow_version_upgrade) + .register_column(:encrypted, field: :encrypted) + .register_column(:iam_roles, field: :iam_roles) + .register_column(:vpc_ids, field: :vpc_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_region.rb b/libraries/aws_region.rb index 29c0627fe..e3091a727 100644 --- a/libraries/aws_region.rb +++ b/libraries/aws_region.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRegion < AwsResourceBase - name 'aws_region' - desc 'Verifies settings for an AWS region.' + name "aws_region" + desc "Verifies settings for an AWS region." example " describe aws_region('eu-west-2') do diff --git a/libraries/aws_regions.rb b/libraries/aws_regions.rb index c258c26c4..4f527177c 100644 --- a/libraries/aws_regions.rb +++ b/libraries/aws_regions.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRegions < AwsResourceBase - name 'aws_regions' - desc 'Verifies settings for AWS Regions in bulk.' + name "aws_regions" + desc "Verifies settings for AWS Regions in bulk." example " describe aws_regions do @@ -13,9 +13,9 @@ class AwsRegions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:region_names, field: :region_name) - .register_column(:endpoints, field: :endpoint) - .install_filter_methods_on_resource(self, :table) + .register_column(:region_names, field: :region_name) + .register_column(:endpoints, field: :endpoint) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_route53_record_set.rb b/libraries/aws_route53_record_set.rb index 8a8244d43..cdb40a5b1 100644 --- a/libraries/aws_route53_record_set.rb +++ b/libraries/aws_route53_record_set.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRoute53RecordSet < AwsResourceBase - name 'aws_route53_record_set' - desc 'Describe a resource record sets in a specified hosted zone.' + name "aws_route53_record_set" + desc "Describe a resource record sets in a specified hosted zone." example " describe aws_route53_record_set(hosted_zone_id: 'ResourceId', start_record_name: 'DNSName') do @@ -30,7 +30,7 @@ def hosted_zone_id end def resource_id - "#{@res? @hosted_zone_id: ''}_#{@res? @start_record_name: ''}" + "#{@res? @hosted_zone_id: ""}_#{@res? @start_record_name: ""}" end def exists? diff --git a/libraries/aws_route53_record_sets.rb b/libraries/aws_route53_record_sets.rb index c128aa175..efd7736bc 100644 --- a/libraries/aws_route53_record_sets.rb +++ b/libraries/aws_route53_record_sets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRoute53RecordSets < AwsResourceBase - name 'aws_route53_record_sets' - desc 'Lists the resource record sets in a specified hosted zone.' + name "aws_route53_record_sets" + desc "Lists the resource record sets in a specified hosted zone." example " describe aws_route53_record_sets(hosted_zone_id: 'HOSTED_ZONE_ID') do @@ -13,20 +13,20 @@ class AWSRoute53RecordSets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:types, field: :type) - .register_column(:set_identifiers, field: :set_identifier) - .register_column(:weights, field: :weight) - .register_column(:regions, field: :region) - .register_column(:geo_locations, field: :geo_location) - .register_column(:failovers, field: :failover) - .register_column(:multi_value_answers, field: :multi_value_answer) - .register_column(:ttls, field: :ttl) - .register_column(:resource_records, field: :resource_records, style: :simple) - .register_column(:alias_targets, field: :alias_target) - .register_column(:health_check_ids, field: :health_check_id) - .register_column(:traffic_policy_instance_ids, field: :traffic_policy_instance_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:types, field: :type) + .register_column(:set_identifiers, field: :set_identifier) + .register_column(:weights, field: :weight) + .register_column(:regions, field: :region) + .register_column(:geo_locations, field: :geo_location) + .register_column(:failovers, field: :failover) + .register_column(:multi_value_answers, field: :multi_value_answer) + .register_column(:ttls, field: :ttl) + .register_column(:resource_records, field: :resource_records, style: :simple) + .register_column(:alias_targets, field: :alias_target) + .register_column(:health_check_ids, field: :health_check_id) + .register_column(:traffic_policy_instance_ids, field: :traffic_policy_instance_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_route53resolver_resolver_endpoint.rb b/libraries/aws_route53resolver_resolver_endpoint.rb index e5bdea4cc..1427331fd 100644 --- a/libraries/aws_route53resolver_resolver_endpoint.rb +++ b/libraries/aws_route53resolver_resolver_endpoint.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRoute53ResolverResolverEndpoint < AwsResourceBase - name 'aws_route53resolver_resolver_endpoint' - desc 'Gets information about a specified Resolver endpoint, such as whether its an inbound or an outbound Resolver endpoint, and the current status of the endpoint.' + name "aws_route53resolver_resolver_endpoint" + desc "Gets information about a specified Resolver endpoint, such as whether its an inbound or an outbound Resolver endpoint, and the current status of the endpoint." example " describe aws_route53resolver_resolver_endpoint(resolver_endpoint_id: 'ResourceId') do diff --git a/libraries/aws_route53resolver_resolver_endpoints.rb b/libraries/aws_route53resolver_resolver_endpoints.rb index cd1915b8e..184bcfed8 100644 --- a/libraries/aws_route53resolver_resolver_endpoints.rb +++ b/libraries/aws_route53resolver_resolver_endpoints.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRoute53ResolverResolverEndpoints < AwsResourceBase - name 'aws_route53resolver_resolver_endpoints' - desc 'Lists all the Resolver endpoints that were created using the current AWS account.' + name "aws_route53resolver_resolver_endpoints" + desc "Lists all the Resolver endpoints that were created using the current AWS account." example " describe aws_route53resolver_resolver_endpoints do @@ -13,19 +13,19 @@ class AWSRoute53ResolverResolverEndpoints < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:creator_request_ids, field: :creator_request_id) - .register_column(:arns, field: :arn) - .register_column(:names, field: :name) - .register_column(:security_group_ids, field: :security_group_ids) - .register_column(:directions, field: :direction) - .register_column(:ip_address_counts, field: :ip_address_count) - .register_column(:host_vpc_ids, field: :host_vpc_id) - .register_column(:statuses, field: :status) - .register_column(:status_messages, field: :status_message) - .register_column(:creation_times, field: :creation_time) - .register_column(:modification_times, field: :modification_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:creator_request_ids, field: :creator_request_id) + .register_column(:arns, field: :arn) + .register_column(:names, field: :name) + .register_column(:security_group_ids, field: :security_group_ids) + .register_column(:directions, field: :direction) + .register_column(:ip_address_counts, field: :ip_address_count) + .register_column(:host_vpc_ids, field: :host_vpc_id) + .register_column(:statuses, field: :status) + .register_column(:status_messages, field: :status_message) + .register_column(:creation_times, field: :creation_time) + .register_column(:modification_times, field: :modification_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_route53resolver_resolver_rule.rb b/libraries/aws_route53resolver_resolver_rule.rb index a4c02e48a..ea6033950 100644 --- a/libraries/aws_route53resolver_resolver_rule.rb +++ b/libraries/aws_route53resolver_resolver_rule.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRoute53ResolverResolverRule < AwsResourceBase - name 'aws_route53resolver_resolver_rule' - desc 'Gets information about a specified Resolver rule, such as the domain name that the rule forwards DNS queries for and the ID of the outbound Resolver endpoint that the rule is associated with.' + name "aws_route53resolver_resolver_rule" + desc "Gets information about a specified Resolver rule, such as the domain name that the rule forwards DNS queries for and the ID of the outbound Resolver endpoint that the rule is associated with." example " describe aws_route53resolver_resolver_rule(resolver_rule_id: 'resolver_rule_id_test') do diff --git a/libraries/aws_route53resolver_resolver_rule_association.rb b/libraries/aws_route53resolver_resolver_rule_association.rb index 5c70824c8..4c7f2a5e7 100644 --- a/libraries/aws_route53resolver_resolver_rule_association.rb +++ b/libraries/aws_route53resolver_resolver_rule_association.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRoute53ResolverResolverRuleAssociation < AwsResourceBase - name 'aws_route53resolver_resolver_rule_association' - desc 'Gets information about an association between a specified Resolver rule and a VPC.' + name "aws_route53resolver_resolver_rule_association" + desc "Gets information about an association between a specified Resolver rule and a VPC." example " describe aws_route53resolver_resolver_rule_association(resolver_rule_association_id: 'ResourceId') do diff --git a/libraries/aws_route53resolver_resolver_rule_associations.rb b/libraries/aws_route53resolver_resolver_rule_associations.rb index 6efbca11c..a84f83f1d 100644 --- a/libraries/aws_route53resolver_resolver_rule_associations.rb +++ b/libraries/aws_route53resolver_resolver_rule_associations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRoute53ResolverResolverRuleAssociations < AwsResourceBase - name 'aws_route53resolver_resolver_rule_associations' - desc 'Lists the associations that were created between Resolver rules and VPCs using the current AWS account.' + name "aws_route53resolver_resolver_rule_associations" + desc "Lists the associations that were created between Resolver rules and VPCs using the current AWS account." example " describe aws_route53resolver_resolver_rule_associations do @@ -13,13 +13,13 @@ class AWSRoute53ResolverResolverRuleAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:resolver_rule_ids, field: :resolver_rule_id) - .register_column(:names, field: :name) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:statuses, field: :status) - .register_column(:status_messages, field: :status_message) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:resolver_rule_ids, field: :resolver_rule_id) + .register_column(:names, field: :name) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:statuses, field: :status) + .register_column(:status_messages, field: :status_message) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_route53resolver_resolver_rules.rb b/libraries/aws_route53resolver_resolver_rules.rb index 54646bebc..09bebe2f7 100644 --- a/libraries/aws_route53resolver_resolver_rules.rb +++ b/libraries/aws_route53resolver_resolver_rules.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSRoute53ResolverResolverRules < AwsResourceBase - name 'aws_route53resolver_resolver_rules' - desc 'Lists the Resolver rules that were created using the current AWS account.' + name "aws_route53resolver_resolver_rules" + desc "Lists the Resolver rules that were created using the current AWS account." example " describe aws_route53resolver_resolver_rules do @@ -13,21 +13,21 @@ class AWSRoute53ResolverResolverRules < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:creator_request_ids, field: :creator_request_id) - .register_column(:arns, field: :arn) - .register_column(:domain_names, field: :domain_name) - .register_column(:statuses, field: :status) - .register_column(:status_messages, field: :status_message) - .register_column(:rule_types, field: :rule_type) - .register_column(:names, field: :name) - .register_column(:target_ips, field: :target_ips) - .register_column(:resolver_endpoint_ids, field: :resolver_endpoint_id) - .register_column(:owner_ids, field: :owner_id) - .register_column(:share_statuses, field: :share_status) - .register_column(:creation_times, field: :creation_time) - .register_column(:modification_times, field: :modification_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:creator_request_ids, field: :creator_request_id) + .register_column(:arns, field: :arn) + .register_column(:domain_names, field: :domain_name) + .register_column(:statuses, field: :status) + .register_column(:status_messages, field: :status_message) + .register_column(:rule_types, field: :rule_type) + .register_column(:names, field: :name) + .register_column(:target_ips, field: :target_ips) + .register_column(:resolver_endpoint_ids, field: :resolver_endpoint_id) + .register_column(:owner_ids, field: :owner_id) + .register_column(:share_statuses, field: :share_status) + .register_column(:creation_times, field: :creation_time) + .register_column(:modification_times, field: :modification_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_route_table.rb b/libraries/aws_route_table.rb index 574d8f17a..b4c4a03fe 100644 --- a/libraries/aws_route_table.rb +++ b/libraries/aws_route_table.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRouteTable < AwsResourceBase - name 'aws_route_table' - desc 'Verifies settings for an AWS Route Table.' + name "aws_route_table" + desc "Verifies settings for an AWS Route Table." example " describe aws_route_table(route_table_id: 'rtb-05462d2278326a79c') do its('route_table_id') { should cmp 'rtb-05462d2278326a79c' } @@ -14,9 +14,9 @@ class AwsRouteTable < AwsResourceBase " ASSOCIATION_STATES = { - associated: 'associated', - failed: 'failed', - disassociated: 'disassociated', + associated: "associated", + failed: "failed", + disassociated: "disassociated", }.freeze def initialize(opts = {}) @@ -27,7 +27,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: ID must be in the format 'rtb-' followed by 8 or 17 hexadecimal characters." if opts[:route_table_id] !~ /^rtb\-([0-9a-f]{8})|(^rtb\-[0-9a-f]{17})$/ @display_name = opts[:route_table_id] - filter = { name: 'route-table-id', values: [opts[:route_table_id]] } + filter = { name: "route-table-id", values: [opts[:route_table_id]] } catch_aws_errors do resp = @aws.compute_client.describe_route_tables({ filters: [filter] }) @route_table = resp.route_tables.first diff --git a/libraries/aws_route_tables.rb b/libraries/aws_route_tables.rb index 0e9d71be6..a26047afa 100644 --- a/libraries/aws_route_tables.rb +++ b/libraries/aws_route_tables.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsRouteTables < AwsResourceBase - name 'aws_route_tables' - desc 'Verifies settings for an AWS Route Tables in bulk.' + name "aws_route_tables" + desc "Verifies settings for an AWS Route Tables in bulk." example " describe aws_route_tables do @@ -13,31 +13,31 @@ class AwsRouteTables < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:route_table_ids, field: :route_table_id) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:destination_cidr_blocks, field: :destination_cidr_block, style: :simple) - .register_column(:destination_ipv_6_cidr_blocks, field: :destination_ipv_6_cidr_block, style: :simple) - .register_column(:destination_prefix_list_ids, field: :destination_prefix_list_id, style: :simple) - .register_column(:egress_only_internet_gateway_ids, field: :egress_only_internet_gateway_id, style: :simple) - .register_column(:gateway_ids, field: :gateway_id, style: :simple) - .register_column(:instance_ids, field: :instance_id, style: :simple) - .register_column(:instance_owner_ids, field: :instance_owner_id, style: :simple) - .register_column(:nat_gateway_ids, field: :nat_gateway_id, style: :simple) - .register_column(:transit_gateway_ids, field: :transit_gateway_id, style: :simple) - .register_column(:local_gateway_ids, field: :local_gateway_id, style: :simple) - .register_column(:carrier_gateway_ids, field: :carrier_gateway_id, style: :simple) - .register_column(:network_interface_ids, field: :network_interface_id, style: :simple) - .register_column(:origins, field: :origin, style: :simple) - .register_column(:states, field: :state, style: :simple) - .register_column(:vpc_peering_connection_ids, field: :vpc_peering_connection_id, style: :simple) - .register_column(:route_table_association_ids, field: :route_table_association_ids, style: :simple) - .register_column(:association_subnet_ids, field: :association_subnet_ids, style: :simple) - .register_column(:associated_subnet_ids, field: :associated_subnet_ids, style: :simple) - .register_column(:association_gateway_ids, field: :association_gateway_ids, style: :simple) - .register_column(:associated_gateway_ids, field: :associated_gateway_ids, style: :simple) - .register_column(:association_states, field: :association_states, style: :simple) - .register_column(:main, field: :main, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:route_table_ids, field: :route_table_id) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:destination_cidr_blocks, field: :destination_cidr_block, style: :simple) + .register_column(:destination_ipv_6_cidr_blocks, field: :destination_ipv_6_cidr_block, style: :simple) + .register_column(:destination_prefix_list_ids, field: :destination_prefix_list_id, style: :simple) + .register_column(:egress_only_internet_gateway_ids, field: :egress_only_internet_gateway_id, style: :simple) + .register_column(:gateway_ids, field: :gateway_id, style: :simple) + .register_column(:instance_ids, field: :instance_id, style: :simple) + .register_column(:instance_owner_ids, field: :instance_owner_id, style: :simple) + .register_column(:nat_gateway_ids, field: :nat_gateway_id, style: :simple) + .register_column(:transit_gateway_ids, field: :transit_gateway_id, style: :simple) + .register_column(:local_gateway_ids, field: :local_gateway_id, style: :simple) + .register_column(:carrier_gateway_ids, field: :carrier_gateway_id, style: :simple) + .register_column(:network_interface_ids, field: :network_interface_id, style: :simple) + .register_column(:origins, field: :origin, style: :simple) + .register_column(:states, field: :state, style: :simple) + .register_column(:vpc_peering_connection_ids, field: :vpc_peering_connection_id, style: :simple) + .register_column(:route_table_association_ids, field: :route_table_association_ids, style: :simple) + .register_column(:association_subnet_ids, field: :association_subnet_ids, style: :simple) + .register_column(:associated_subnet_ids, field: :associated_subnet_ids, style: :simple) + .register_column(:association_gateway_ids, field: :association_gateway_ids, style: :simple) + .register_column(:associated_gateway_ids, field: :associated_gateway_ids, style: :simple) + .register_column(:association_states, field: :association_states, style: :simple) + .register_column(:main, field: :main, style: :simple) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -74,32 +74,32 @@ def paginate_request def flat_hash_from(route_table) routes = route_table.routes associations = route_table.associations - associates = associations.select { |association| association.association_state.state == 'associated' } + associates = associations.select { |association| association.association_state.state == "associated" } { vpc_id: route_table.vpc_id, route_table_id: route_table.route_table_id, - destination_cidr_block: map(routes, 'destination_cidr_block'), - destination_ipv_6_cidr_block: map(routes, 'destination_ipv_6_cidr_block'), - destination_prefix_list_id: map(routes, 'destination_prefix_list_id'), - egress_only_internet_gateway_id: map(routes, 'egress_only_internet_gateway_id'), - gateway_id: map(routes, 'gateway_id'), - instance_id: map(routes, 'instance_id'), - instance_owner_id: map(routes, 'instance_owner_id'), - nat_gateway_id: map(routes, 'nat_gateway_id'), - transit_gateway_id: map(routes, 'transit_gateway_id'), - local_gateway_id: map(routes, 'local_gateway_id'), - carrier_gateway_id: map(routes, 'carrier_gateway_id'), - network_interface_id: map(routes, 'network_interface_id'), - origin: map(routes, 'origin'), - state: map(routes, 'state'), - vpc_peering_connection_id: map(routes, 'vpc_peering_connection_id'), + destination_cidr_block: map(routes, "destination_cidr_block"), + destination_ipv_6_cidr_block: map(routes, "destination_ipv_6_cidr_block"), + destination_prefix_list_id: map(routes, "destination_prefix_list_id"), + egress_only_internet_gateway_id: map(routes, "egress_only_internet_gateway_id"), + gateway_id: map(routes, "gateway_id"), + instance_id: map(routes, "instance_id"), + instance_owner_id: map(routes, "instance_owner_id"), + nat_gateway_id: map(routes, "nat_gateway_id"), + transit_gateway_id: map(routes, "transit_gateway_id"), + local_gateway_id: map(routes, "local_gateway_id"), + carrier_gateway_id: map(routes, "carrier_gateway_id"), + network_interface_id: map(routes, "network_interface_id"), + origin: map(routes, "origin"), + state: map(routes, "state"), + vpc_peering_connection_id: map(routes, "vpc_peering_connection_id"), main: associations.any?(&:main), - route_table_association_ids: map(associations, 'route_table_association_id'), - association_subnet_ids: map(associations, 'subnet_id'), - associated_subnet_ids: map(associates, 'subnet_id'), - association_gateway_ids: map(associations, 'gateway_id'), - associated_gateway_ids: map(associates, 'gateway_id'), - association_states: map(associations, 'association_state.state'), + route_table_association_ids: map(associations, "route_table_association_id"), + association_subnet_ids: map(associations, "subnet_id"), + associated_subnet_ids: map(associates, "subnet_id"), + association_gateway_ids: map(associations, "gateway_id"), + associated_gateway_ids: map(associates, "gateway_id"), + association_states: map(associations, "association_state.state"), } end diff --git a/libraries/aws_s3_access_point.rb b/libraries/aws_s3_access_point.rb index a7a089650..ac724f96a 100644 --- a/libraries/aws_s3_access_point.rb +++ b/libraries/aws_s3_access_point.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSS3AccessPoint < AwsResourceBase - name 'aws_s3_access_point' - desc 'Describes one S3 Access Points.' + name "aws_s3_access_point" + desc "Describes one S3 Access Points." example " describe aws_s3_access_point(bucket_name: 'BucketName', metrics_id: 'MetricsId') do diff --git a/libraries/aws_s3_access_points.rb b/libraries/aws_s3_access_points.rb index da0dc6436..aa86f6e3c 100644 --- a/libraries/aws_s3_access_points.rb +++ b/libraries/aws_s3_access_points.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSS3AccessPoints < AwsResourceBase - name 'aws_s3_access_points' - desc 'List one or more S3 Access Points.' + name "aws_s3_access_points" + desc "List one or more S3 Access Points." example " describe aws_s3_access_points(bucket_name: 'BucketName') do @@ -13,10 +13,10 @@ class AWSS3AccessPoints < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:filter_access_point_arns, field: :filter_access_point_arn) - .register_column(:filter_and_access_point_arns, field: :filter_and_access_point_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:filter_access_point_arns, field: :filter_access_point_arn) + .register_column(:filter_and_access_point_arns, field: :filter_and_access_point_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_s3_bucket.rb b/libraries/aws_s3_bucket.rb index e0d2f8d23..53b0ae6a0 100644 --- a/libraries/aws_s3_bucket.rb +++ b/libraries/aws_s3_bucket.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsS3Bucket < AwsResourceBase - name 'aws_s3_bucket' - desc 'Verifies settings for a s3 bucket.' + name "aws_s3_bucket" + desc "Verifies settings for a s3 bucket." example " describe aws_s3_bucket(bucket_name: 'test_bucket') do it { should exist } @@ -23,10 +23,10 @@ def initialize(opts = {}) @region = @aws.storage_client.get_bucket_location(bucket: @bucket_name).location_constraint # LocationConstraint "EU" correlates to the region "eu-west-1", but region "EU" does not exist as a "region", only a LocationConstraint # this currently is the only Location constraint that can have either of 2 values "EU" or "eu-west-1". But only "eu-west-1" is a region - @region = 'eu-west-1' if @region == 'EU' + @region = "eu-west-1" if @region == "EU" # Forcing bucket region for future bucket calls to avoid warnings about multiple unnecessary # redirects and signing attempts. - opts[:aws_region] = @region.empty? ? 'us-east-1' : @region + opts[:aws_region] = @region.empty? ? "us-east-1" : @region super(opts) rescue Aws::S3::Errors::NoSuchBucket @region = nil @@ -61,8 +61,8 @@ def public? @bucket_policy_status_public = false # preserves the original behaviour end @bucket_policy_status_public || \ - bucket_acl.any? { |g| g.grantee.type == 'Group' && g.grantee.uri =~ /AllUsers/ } || \ - bucket_acl.any? { |g| g.grantee.type == 'Group' && g.grantee.uri =~ /AuthenticatedUsers/ } + bucket_acl.any? { |g| g.grantee.type == "Group" && g.grantee.uri =~ /AllUsers/ } || \ + bucket_acl.any? { |g| g.grantee.type == "Group" && g.grantee.uri =~ /AuthenticatedUsers/ } end end @@ -97,12 +97,12 @@ def has_default_encryption_enabled? def has_versioning_enabled? return false unless exists? catch_aws_errors do - @has_versioning_enabled = @aws.storage_client.get_bucket_versioning(bucket: @bucket_name).status == 'Enabled' + @has_versioning_enabled = @aws.storage_client.get_bucket_versioning(bucket: @bucket_name).status == "Enabled" end end def has_secure_transport_enabled? - bucket_policy.any? { |s| s.effect == 'Deny' && s.condition && s.condition['Bool'] && s.condition['Bool']['aws:SecureTransport'] && s.condition['Bool']['aws:SecureTransport'] == 'false' } + bucket_policy.any? { |s| s.effect == "Deny" && s.condition && s.condition["Bool"] && s.condition["Bool"]["aws:SecureTransport"] && s.condition["Bool"]["aws:SecureTransport"] == "false" } end # below is to preserve the original 'unsupported' function but isn't used in the above @@ -117,7 +117,7 @@ def fetch_bucket_policy # AWS SDK returns a StringIO, we have to read() raw_policy = @aws.storage_client.get_bucket_policy(bucket: @bucket_name).to_h return [] if !raw_policy.key?(:policy) - JSON.parse(raw_policy[:policy].read)['Statement'].map do |statement| + JSON.parse(raw_policy[:policy].read)["Statement"].map do |statement| lowercase_hash = {} statement.each_key { |k| lowercase_hash[k.downcase] = statement[k] } policy_list += [OpenStruct.new(lowercase_hash)] diff --git a/libraries/aws_s3_bucket_object.rb b/libraries/aws_s3_bucket_object.rb index ef8d48dfa..b9c468249 100644 --- a/libraries/aws_s3_bucket_object.rb +++ b/libraries/aws_s3_bucket_object.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsS3BucketObject < AwsResourceBase - name 'aws_s3_bucket_object' - desc 'Verifies settings for a s3 bucket object.' + name "aws_s3_bucket_object" + desc "Verifies settings for a s3 bucket object." example " describe aws_s3_bucket_object(bucket_name: 'bucket_name', key: 'file_name') do it { should exist } @@ -40,8 +40,8 @@ def object_acl def public? # first line just for formatting false || \ - object_acl.any? { |g| g.grantee.type == 'Group' && g.grantee.uri =~ /AllUsers/ } || \ - object_acl.any? { |g| g.grantee.type == 'Group' && g.grantee.uri =~ /AuthenticatedUsers/ } + object_acl.any? { |g| g.grantee.type == "Group" && g.grantee.uri =~ /AllUsers/ } || \ + object_acl.any? { |g| g.grantee.type == "Group" && g.grantee.uri =~ /AuthenticatedUsers/ } end def exists? diff --git a/libraries/aws_s3_bucket_objects.rb b/libraries/aws_s3_bucket_objects.rb index fcd0f201d..bd66f265b 100644 --- a/libraries/aws_s3_bucket_objects.rb +++ b/libraries/aws_s3_bucket_objects.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsS3BucketObjects < AwsResourceBase - name 'aws_s3_bucket_objects' - desc 'List all the objects for a particular bucket.' + name "aws_s3_bucket_objects" + desc "List all the objects for a particular bucket." example " describe aws_s3_bucket_objects(bucket_name: 'test_bucket_name') do @@ -13,22 +13,22 @@ class AwsS3BucketObjects < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:contents, field: :contents) - .register_column(:contents_keys, field: :contents_keys, style: :simple) - .register_column(:contents_last_modified, field: :contents_last_modified, style: :simple) - .register_column(:contents_etags, field: :contents_etags, style: :simple) - .register_column(:contents_sizes, field: :contents_sizes, style: :simple) - .register_column(:contents_storage_classes, field: :contents_storage_classes, style: :simple) - .register_column(:contents_owners, field: :contents_owners, style: :simple) - .register_column(:names, field: :name) - .register_column(:prefixes, field: :prefix) - .register_column(:delimiters, field: :delimiter) - .register_column(:max_keys, field: :max_keys) - .register_column(:common_prefixes, field: :common_prefixes, style: :simple) - .register_column(:encoding_types, field: :encoding_type) - .register_column(:key_counts, field: :key_count) - .register_column(:continuation_tokens, field: :continuation_token) - .install_filter_methods_on_resource(self, :table) + .register_column(:contents, field: :contents) + .register_column(:contents_keys, field: :contents_keys, style: :simple) + .register_column(:contents_last_modified, field: :contents_last_modified, style: :simple) + .register_column(:contents_etags, field: :contents_etags, style: :simple) + .register_column(:contents_sizes, field: :contents_sizes, style: :simple) + .register_column(:contents_storage_classes, field: :contents_storage_classes, style: :simple) + .register_column(:contents_owners, field: :contents_owners, style: :simple) + .register_column(:names, field: :name) + .register_column(:prefixes, field: :prefix) + .register_column(:delimiters, field: :delimiter) + .register_column(:max_keys, field: :max_keys) + .register_column(:common_prefixes, field: :common_prefixes, style: :simple) + .register_column(:encoding_types, field: :encoding_type) + .register_column(:key_counts, field: :key_count) + .register_column(:continuation_tokens, field: :continuation_token) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_s3_bucket_policy.rb b/libraries/aws_s3_bucket_policy.rb index 64f7576e2..f6a261708 100644 --- a/libraries/aws_s3_bucket_policy.rb +++ b/libraries/aws_s3_bucket_policy.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSS3BucketPolicy < AwsResourceBase - name 'aws_s3_bucket_policy' - desc 'Retrieves the policy of a specified S3 Bucket.' + name "aws_s3_bucket_policy" + desc "Retrieves the policy of a specified S3 Bucket." example " describe aws_s3_bucket_policy(bucket: 'BUCKET_NAME') do @@ -17,7 +17,7 @@ def initialize(opts = {}) @display_name = opts[:bucket] catch_aws_errors do resp = @aws.storage_client.get_bucket_policy({ bucket: opts[:bucket] }) - @parsed_json = JSON.parse(resp.policy.read)['Statement'] + @parsed_json = JSON.parse(resp.policy.read)["Statement"] create_resource_methods(@parsed_json[0]) end end diff --git a/libraries/aws_s3_buckets.rb b/libraries/aws_s3_buckets.rb index 087b7322f..fcd1e8f3f 100644 --- a/libraries/aws_s3_buckets.rb +++ b/libraries/aws_s3_buckets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsS3Buckets < AwsResourceBase - name 'aws_s3_buckets' - desc 'Verifies settings for AWS S3 Buckets in bulk.' + name "aws_s3_buckets" + desc "Verifies settings for AWS S3 Buckets in bulk." example " describe aws_s3_bucket do its('bucket_names') { should eq ['my_bucket'] } @@ -12,9 +12,9 @@ class AwsS3Buckets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:bucket_names, field: :bucket_name) - .register_column(:tags, field: :tags, lazy: ->(r, c, t) { r[:tags] = fetch_tags_from(r, c, t) }) - .install_filter_methods_on_resource(self, :table) + .register_column(:bucket_names, field: :bucket_name) + .register_column(:tags, field: :tags, lazy: ->(r, c, t) { r[:tags] = fetch_tags_from(r, c, t) }) + .install_filter_methods_on_resource(self, :table) # helps to lazy load tags def self.fetch_tags_from(row, _condition, table) diff --git a/libraries/aws_sdb_domains.rb b/libraries/aws_sdb_domains.rb index 3fa6267b6..32abc5e8c 100644 --- a/libraries/aws_sdb_domains.rb +++ b/libraries/aws_sdb_domains.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSDBDomains < AwsResourceBase - name 'aws_sdb_domains' - desc 'Verifies settings for SDB Domain in bulk.' + name "aws_sdb_domains" + desc "Verifies settings for SDB Domain in bulk." example " describe aws_sdb_domains do @@ -19,8 +19,8 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:domain_names, field: :domain_names, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:domain_names, field: :domain_names, style: :simple) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_secretsmanager_secret.rb b/libraries/aws_secretsmanager_secret.rb index 8394f9eba..058d58a33 100644 --- a/libraries/aws_secretsmanager_secret.rb +++ b/libraries/aws_secretsmanager_secret.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSecretsManagerSecret < AwsResourceBase - name 'aws_secretsmanager_secret' - desc 'Retrieves the details of a secret.' + name "aws_secretsmanager_secret" + desc "Retrieves the details of a secret." example " describe aws_secretsmanager_secret(secret_id: 'Secret-Id') do diff --git a/libraries/aws_secretsmanager_secrets.rb b/libraries/aws_secretsmanager_secrets.rb index dbf87e7b6..f7c92662c 100644 --- a/libraries/aws_secretsmanager_secrets.rb +++ b/libraries/aws_secretsmanager_secrets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSecretsManagerSecrets < AwsResourceBase - name 'aws_secretsmanager_secrets' - desc 'Lists all of the secrets that are stored by Secrets Manager in the AWS account.' + name "aws_secretsmanager_secrets" + desc "Lists all of the secrets that are stored by Secrets Manager in the AWS account." example " describe aws_secretsmanager_secrets do @@ -13,23 +13,23 @@ class AWSSecretsManagerSecrets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:names, field: :name) - .register_column(:descriptions, field: :description) - .register_column(:kms_key_ids, field: :kms_key_id) - .register_column(:rotation_enableds, field: :rotation_enabled) - .register_column(:rotation_lambda_arns, field: :rotation_lambda_arn) - .register_column(:rotation_rules, field: :rotation_rules) - .register_column(:last_rotated_dates, field: :last_rotated_date) - .register_column(:last_changed_dates, field: :last_changed_date) - .register_column(:last_accessed_dates, field: :last_accessed_date) - .register_column(:deleted_dates, field: :deleted_date) - .register_column(:tags, field: :tags) - .register_column(:secret_versions_to_stages, field: :secret_versions_to_stages) - .register_column(:owning_services, field: :owning_service) - .register_column(:created_dates, field: :created_date) - .register_column(:primary_regions, field: :primary_region) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:names, field: :name) + .register_column(:descriptions, field: :description) + .register_column(:kms_key_ids, field: :kms_key_id) + .register_column(:rotation_enableds, field: :rotation_enabled) + .register_column(:rotation_lambda_arns, field: :rotation_lambda_arn) + .register_column(:rotation_rules, field: :rotation_rules) + .register_column(:last_rotated_dates, field: :last_rotated_date) + .register_column(:last_changed_dates, field: :last_changed_date) + .register_column(:last_accessed_dates, field: :last_accessed_date) + .register_column(:deleted_dates, field: :deleted_date) + .register_column(:tags, field: :tags) + .register_column(:secret_versions_to_stages, field: :secret_versions_to_stages) + .register_column(:owning_services, field: :owning_service) + .register_column(:created_dates, field: :created_date) + .register_column(:primary_regions, field: :primary_region) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_security_group.rb b/libraries/aws_security_group.rb index c9cb1bac6..28f3c610d 100644 --- a/libraries/aws_security_group.rb +++ b/libraries/aws_security_group.rb @@ -1,10 +1,10 @@ -require 'set' -require 'ipaddr' -require 'aws_backend' +require "set" +require "ipaddr" +require "aws_backend" class AwsSecurityGroup < AwsResourceBase - name 'aws_security_group' - desc 'Verifies settings for an individual AWS Security Group.' + name "aws_security_group" + desc "Verifies settings for an individual AWS Security Group." example " describe aws_security_group('sg-12345678') do it { should exist } @@ -24,14 +24,14 @@ def initialize(opts = {}) filter = [] if opts.key?(:vpc_id) raise ArgumentError, "#{@__resource_name__}: VPC ID must be in the format 'vpc-' followed by 8 or 17 hexadecimal characters." if opts[:vpc_id] !~ /^vpc\-[0-9a-f]{8}|(^vpc\-[0-9a-f]{17})$/ - filter += [{ name: 'vpc-id', values: [opts[:vpc_id]] }] + filter += [{ name: "vpc-id", values: [opts[:vpc_id]] }] end if opts.key?(:group_id) raise ArgumentError, "#{@__resource_name__}: security group ID must be in the format 'sg-' followed by 8 or 17 hexadecimal characters." if opts[:group_id] !~ /^sg\-[0-9a-f]{8}|(^sg\-[0-9a-f]{17})$/ - filter += [{ name: 'group-id', values: [opts[:group_id]] }] + filter += [{ name: "group-id", values: [opts[:group_id]] }] end - filter += [{ name: 'group-name', values: [opts[:group_name]] }] if opts.key?(:group_name) + filter += [{ name: "group-name", values: [opts[:group_name]] }] if opts.key?(:group_name) end if opts.key?(:resource_data) @@ -47,7 +47,7 @@ def initialize(opts = {}) if resp.security_groups.empty? @inbound_rules = [] @outbound_rules = [] - @group_id = 'empty response' + @group_id = "empty response" return end @security_group = resp.security_groups[0] @@ -97,7 +97,7 @@ def resource_id end def to_s - sg = '' + sg = "" sg += "ID: #{@group_id} " if @group_id sg += "Name: #{@group_name} " if @group_name sg += "VPC ID: #{@vpc_id} " if @vpc_id @@ -159,7 +159,7 @@ def allow__check_criteria(raw_criteria) # Any leftovers are unwelcome unless raw_criteria.empty? - raise ArgumentError, "Unrecognized security group rule 'allow' criteria '#{raw_criteria.keys.join(',')}'. Expected criteria: #{allowed_criteria.join(', ')}" + raise ArgumentError, "Unrecognized security group rule 'allow' criteria '#{raw_criteria.keys.join(",")}'. Expected criteria: #{allowed_criteria.join(", ")}" end recognized_criteria @@ -223,7 +223,7 @@ def allow__match_protocol(rule, criteria) return true unless criteria.key?(:protocol) prot = criteria[:protocol] # We provide a "fluency alias" for -1 (any). - prot = '-1' if prot == 'any' or prot.casecmp?('all') + prot = "-1" if prot == "any" or prot.casecmp?("all") rule[:ip_protocol] == prot end diff --git a/libraries/aws_security_groups.rb b/libraries/aws_security_groups.rb index 186ae4c38..61dff86f4 100644 --- a/libraries/aws_security_groups.rb +++ b/libraries/aws_security_groups.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSecurityGroups < AwsCollectionResourceBase - name 'aws_security_groups' - desc 'Verifies settings for AWS Security Groups in bulk.' + name "aws_security_groups" + desc "Verifies settings for AWS Security Groups in bulk." example " # Verify that you have security groups defined describe aws_security_groups do diff --git a/libraries/aws_securityhub_hub.rb b/libraries/aws_securityhub_hub.rb index 0817115b0..eae438fe5 100644 --- a/libraries/aws_securityhub_hub.rb +++ b/libraries/aws_securityhub_hub.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSecurityHubHub < AwsResourceBase - name 'aws_securityhub_hub' - desc 'Gets information about the Security Hub.' + name "aws_securityhub_hub" + desc "Gets information about the Security Hub." example " describe aws_securityhub_hub(hub_arn: 'HUB_ARN') do diff --git a/libraries/aws_servicecatalog_cloud_formation_product.rb b/libraries/aws_servicecatalog_cloud_formation_product.rb index edd516bc6..f45d659cd 100644 --- a/libraries/aws_servicecatalog_cloud_formation_product.rb +++ b/libraries/aws_servicecatalog_cloud_formation_product.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSServiceCatalogCloudFormationProduct < AwsResourceBase - name 'aws_servicecatalog_cloud_formation_product' - desc 'Gets information about the specified product.' + name "aws_servicecatalog_cloud_formation_product" + desc "Gets information about the specified product." example " describe aws_servicecatalog_cloud_formation_product(name: 'product_name') do diff --git a/libraries/aws_servicecatalog_launch_role_constraint.rb b/libraries/aws_servicecatalog_launch_role_constraint.rb index a39d9a315..4265b6afc 100644 --- a/libraries/aws_servicecatalog_launch_role_constraint.rb +++ b/libraries/aws_servicecatalog_launch_role_constraint.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSServiceCatalogLaunchRoleConstraint < AwsResourceBase - name 'aws_servicecatalog_launch_role_constraint' - desc 'Gets information about the specified constraint.' + name "aws_servicecatalog_launch_role_constraint" + desc "Gets information about the specified constraint." example " describe aws_servicecatalog_launch_role_constraint(id: 'Id') do @@ -24,7 +24,7 @@ def initialize(opts = {}) end def resource_id - @res? @display_name : '' + @res? @display_name : "" end def exists? diff --git a/libraries/aws_servicecatalog_launch_role_constraints.rb b/libraries/aws_servicecatalog_launch_role_constraints.rb index b9b7c7efe..01db4f60e 100644 --- a/libraries/aws_servicecatalog_launch_role_constraints.rb +++ b/libraries/aws_servicecatalog_launch_role_constraints.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSServiceCatalogLaunchRoleConstraints < AwsResourceBase - name 'aws_servicecatalog_launch_role_constraints' - desc 'Lists the constraints for the specified portfolio and product.' + name "aws_servicecatalog_launch_role_constraints" + desc "Lists the constraints for the specified portfolio and product." example " describe aws_servicecatalog_launch_role_constraints(portfolio_id: 'portfolio_id') do @@ -13,13 +13,13 @@ class AWSServiceCatalogLaunchRoleConstraints < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:constraint_ids, field: :constraint_id) - .register_column(:types, field: :type) - .register_column(:descriptions, field: :description) - .register_column(:owners, field: :owner) - .register_column(:product_ids, field: :product_id) - .register_column(:portfolio_ids, field: :portfolio_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:constraint_ids, field: :constraint_id) + .register_column(:types, field: :type) + .register_column(:descriptions, field: :description) + .register_column(:owners, field: :owner) + .register_column(:product_ids, field: :product_id) + .register_column(:portfolio_ids, field: :portfolio_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_servicecatalog_portfolio_principal_association.rb b/libraries/aws_servicecatalog_portfolio_principal_association.rb index b19a2604a..fbeb1142c 100644 --- a/libraries/aws_servicecatalog_portfolio_principal_association.rb +++ b/libraries/aws_servicecatalog_portfolio_principal_association.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSServiceCatalogPortfolioPrincipalAssociation < AwsResourceBase - name 'aws_servicecatalog_portfolio_principal_association' - desc 'Lists all principal ARNs associated with the specified portfolio.' + name "aws_servicecatalog_portfolio_principal_association" + desc "Lists all principal ARNs associated with the specified portfolio." example " describe aws_servicecatalog_portfolio_principal_association(portfolio_id: 'test1') do diff --git a/libraries/aws_servicecatalog_portfolio_principal_associations.rb b/libraries/aws_servicecatalog_portfolio_principal_associations.rb index 97ab57c09..f9b422269 100644 --- a/libraries/aws_servicecatalog_portfolio_principal_associations.rb +++ b/libraries/aws_servicecatalog_portfolio_principal_associations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSServiceCatalogPortfolioPrincipalAssociations < AwsResourceBase - name 'aws_servicecatalog_portfolio_principal_associations' - desc 'Lists all principal ARNs associated with the specified portfolio.' + name "aws_servicecatalog_portfolio_principal_associations" + desc "Lists all principal ARNs associated with the specified portfolio." example " describe aws_servicecatalog_portfolio_principal_associations(portfolio_id: 'test1') do @@ -13,9 +13,9 @@ class AWSServiceCatalogPortfolioPrincipalAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:principal_arns, field: :principal_arn) - .register_column(:principal_types, field: :principal_type) - .install_filter_methods_on_resource(self, :table) + .register_column(:principal_arns, field: :principal_arn) + .register_column(:principal_types, field: :principal_type) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_servicecatalog_portfolio_product_association.rb b/libraries/aws_servicecatalog_portfolio_product_association.rb index 457746cd2..83bb90197 100644 --- a/libraries/aws_servicecatalog_portfolio_product_association.rb +++ b/libraries/aws_servicecatalog_portfolio_product_association.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSServiceCatalogPortfolioProductAssociation < AwsResourceBase - name 'aws_servicecatalog_portfolio_product_association' - desc 'Describe a portfolio that the specified product is associated with.' + name "aws_servicecatalog_portfolio_product_association" + desc "Describe a portfolio that the specified product is associated with." example " describe aws_servicecatalog_portfolio_product_association(product_id: 'test1') do diff --git a/libraries/aws_servicecatalog_portfolio_product_associations.rb b/libraries/aws_servicecatalog_portfolio_product_associations.rb index 1d346861f..d56a957d8 100644 --- a/libraries/aws_servicecatalog_portfolio_product_associations.rb +++ b/libraries/aws_servicecatalog_portfolio_product_associations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSServiceCatalogPortfolioProductAssociations < AwsResourceBase - name 'aws_servicecatalog_portfolio_product_associations' - desc 'Lists all portfolios that the specified product is associated with.' + name "aws_servicecatalog_portfolio_product_associations" + desc "Lists all portfolios that the specified product is associated with." example " describe aws_servicecatalog_portfolio_product_associations(product_id: 'test1') do @@ -13,13 +13,13 @@ class AWSServiceCatalogPortfolioProductAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:arns, field: :arn) - .register_column(:display_names, field: :display_name) - .register_column(:descriptions, field: :description) - .register_column(:created_times, field: :created_time) - .register_column(:provider_names, field: :provider_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:arns, field: :arn) + .register_column(:display_names, field: :display_name) + .register_column(:descriptions, field: :description) + .register_column(:created_times, field: :created_time) + .register_column(:provider_names, field: :provider_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ses_receipt_rule.rb b/libraries/aws_ses_receipt_rule.rb index 00f6411ab..b6d5c5e8b 100644 --- a/libraries/aws_ses_receipt_rule.rb +++ b/libraries/aws_ses_receipt_rule.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSESReceiptRule < AwsResourceBase - name 'aws_ses_receipt_rule' - desc 'Returns the details of the specified receipt rule.' + name "aws_ses_receipt_rule" + desc "Returns the details of the specified receipt rule." example " describe aws_ses_receipt_rule(rule_set_name: 'RULE_SET_NAME', rule_name: 'RULE_NAME') do diff --git a/libraries/aws_ses_receipt_rule_set.rb b/libraries/aws_ses_receipt_rule_set.rb index 58e11e85a..791d405de 100644 --- a/libraries/aws_ses_receipt_rule_set.rb +++ b/libraries/aws_ses_receipt_rule_set.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSESReceiptRuleSet < AwsResourceBase - name 'aws_ses_receipt_rule_set' - desc 'Returns the details of the specified receipt rule set.' + name "aws_ses_receipt_rule_set" + desc "Returns the details of the specified receipt rule set." example " describe aws_ses_receipt_rule_set(rule_set_name: 'RULE_SET_NAME') do diff --git a/libraries/aws_ses_receipt_rule_sets.rb b/libraries/aws_ses_receipt_rule_sets.rb index a73fa2848..d0d98b856 100644 --- a/libraries/aws_ses_receipt_rule_sets.rb +++ b/libraries/aws_ses_receipt_rule_sets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSESReceiptRuleSets < AwsResourceBase - name 'aws_ses_receipt_rule_sets' - desc 'Lists the receipt rule sets that exist under your AWS account in the current AWS Region.' + name "aws_ses_receipt_rule_sets" + desc "Lists the receipt rule sets that exist under your AWS account in the current AWS Region." example " describe aws_ses_receipt_rule_sets do @@ -13,9 +13,9 @@ class AWSSESReceiptRuleSets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:created_timestamps, field: :created_timestamp) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:created_timestamps, field: :created_timestamp) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ses_template.rb b/libraries/aws_ses_template.rb index e43ec894f..2ebfb9d82 100644 --- a/libraries/aws_ses_template.rb +++ b/libraries/aws_ses_template.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSESTemplate < AwsResourceBase - name 'aws_ses_template' - desc 'Displays the template object (which includes the Subject line, HTML part and text part) for the template you specify.' + name "aws_ses_template" + desc "Displays the template object (which includes the Subject line, HTML part and text part) for the template you specify." example " describe aws_ses_template(template_name: 'TEMPLATE_NAME') do diff --git a/libraries/aws_ses_templates.rb b/libraries/aws_ses_templates.rb index b6f6febc3..c527c02bd 100644 --- a/libraries/aws_ses_templates.rb +++ b/libraries/aws_ses_templates.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSESTemplates < AwsResourceBase - name 'aws_ses_templates' - desc 'Lists the email templates present in your Amazon SES account in the current AWS Region.' + name "aws_ses_templates" + desc "Lists the email templates present in your Amazon SES account in the current AWS Region." example " describe aws_ses_templates do @@ -13,9 +13,9 @@ class AWSSESTemplates < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:names, field: :name) - .register_column(:created_timestamps, field: :created_timestamp) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:created_timestamps, field: :created_timestamp) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_shield_subscription.rb b/libraries/aws_shield_subscription.rb index f31817bfb..d9fd465c2 100644 --- a/libraries/aws_shield_subscription.rb +++ b/libraries/aws_shield_subscription.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsShieldSubscription < AwsResourceBase - name 'aws_shield_subscription' - desc 'Verifies settings for a Shield Subscription.' + name "aws_shield_subscription" + desc "Verifies settings for a Shield Subscription." example " describe aws_shield_subscription do it { should exist } diff --git a/libraries/aws_signer_profile_permissions.rb b/libraries/aws_signer_profile_permissions.rb index 0911ac5b5..5a72f9333 100644 --- a/libraries/aws_signer_profile_permissions.rb +++ b/libraries/aws_signer_profile_permissions.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSignerProfilePermissions < AwsResourceBase - name 'aws_signer_profile_permissions' - desc 'Lists the cross-account permissions associated with a signing profile.' + name "aws_signer_profile_permissions" + desc "Lists the cross-account permissions associated with a signing profile." example " describe aws_signer_profile_permissions(profile_name: 'PROFILE_NAME') do @@ -13,11 +13,11 @@ class AWSSignerProfilePermissions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:actions, field: :action) - .register_column(:principals, field: :principal) - .register_column(:statement_ids, field: :statement_id) - .register_column(:profile_versions, field: :profile_version) - .install_filter_methods_on_resource(self, :table) + .register_column(:actions, field: :action) + .register_column(:principals, field: :principal) + .register_column(:statement_ids, field: :statement_id) + .register_column(:profile_versions, field: :profile_version) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_signer_signing_profile.rb b/libraries/aws_signer_signing_profile.rb index 62aed3f3e..485e2436a 100644 --- a/libraries/aws_signer_signing_profile.rb +++ b/libraries/aws_signer_signing_profile.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSignerSigningProfile < AwsResourceBase - name 'aws_signer_signing_profile' - desc 'Returns information on a specific signing profile.' + name "aws_signer_signing_profile" + desc "Returns information on a specific signing profile." example " describe aws_signer_signing_profile(profile_name: 'PROFILE_NAME') do diff --git a/libraries/aws_signer_signing_profiles.rb b/libraries/aws_signer_signing_profiles.rb index beb30ee9c..9646c5b85 100644 --- a/libraries/aws_signer_signing_profiles.rb +++ b/libraries/aws_signer_signing_profiles.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSignerSigningProfiles < AwsResourceBase - name 'aws_signer_signing_profiles' - desc 'Returns information on a specific signing profile.' + name "aws_signer_signing_profiles" + desc "Returns information on a specific signing profile." example " describe aws_signer_signing_profiles do @@ -13,18 +13,18 @@ class AWSSignerSigningProfiles < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:profile_names, field: :profile_name) - .register_column(:profile_versions, field: :profile_version) - .register_column(:profile_version_arns, field: :profile_version_arn) - .register_column(:signing_materials, field: :signing_material) - .register_column(:signature_validity_periods, field: :signature_validity_period) - .register_column(:platform_ids, field: :platform_id) - .register_column(:platform_display_names, field: :platform_display_name) - .register_column(:signing_parameters, field: :signing_parameters) - .register_column(:statuses, field: :status) - .register_column(:arns, field: :arn) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:profile_names, field: :profile_name) + .register_column(:profile_versions, field: :profile_version) + .register_column(:profile_version_arns, field: :profile_version_arn) + .register_column(:signing_materials, field: :signing_material) + .register_column(:signature_validity_periods, field: :signature_validity_period) + .register_column(:platform_ids, field: :platform_id) + .register_column(:platform_display_names, field: :platform_display_name) + .register_column(:signing_parameters, field: :signing_parameters) + .register_column(:statuses, field: :status) + .register_column(:arns, field: :arn) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_sns_subscription.rb b/libraries/aws_sns_subscription.rb index e545e78a5..d0646f36d 100644 --- a/libraries/aws_sns_subscription.rb +++ b/libraries/aws_sns_subscription.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSnsSubscription < AwsResourceBase - name 'aws_sns_subscription' - desc 'Verifies settings for a SNS Subscription.' + name "aws_sns_subscription" + desc "Verifies settings for a SNS Subscription." example " describe aws_sns_subscription('arn:aws:sns:us-east-1::test-topic-01:b214aff5-a2c7-438f-a753-8494493f2ff6') do it { should_not have_raw_message_delivery } @@ -30,12 +30,12 @@ def initialize(opts = {}) catch_aws_errors do begin aws_response = @aws.sns_client.get_subscription_attributes(subscription_arn: opts[:subscription_arn]).attributes.to_h - @owner = aws_response['Owner'] - @topic_arn = aws_response['TopicArn'] - @endpoint = aws_response['Endpoint'] - @protocol = aws_response['Protocol'] - @raw_message_delivery = aws_response['RawMessageDelivery'].eql?('true') - @confirmation_was_authenticated = aws_response['ConfirmationWasAuthenticated'].eql?('true') + @owner = aws_response["Owner"] + @topic_arn = aws_response["TopicArn"] + @endpoint = aws_response["Endpoint"] + @protocol = aws_response["Protocol"] + @raw_message_delivery = aws_response["RawMessageDelivery"].eql?("true") + @confirmation_was_authenticated = aws_response["ConfirmationWasAuthenticated"].eql?("true") rescue Aws::SNS::Errors::NotFound return end diff --git a/libraries/aws_sns_subscriptions.rb b/libraries/aws_sns_subscriptions.rb index 07421c2e8..d5f8634e3 100644 --- a/libraries/aws_sns_subscriptions.rb +++ b/libraries/aws_sns_subscriptions.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSNSSubscriptions < AwsResourceBase - name 'aws_sns_subscriptions' - desc 'Verifies setting for a SNS Subscriptions.' + name "aws_sns_subscriptions" + desc "Verifies setting for a SNS Subscriptions." example " describe aws_sns_subscriptions do @@ -13,12 +13,12 @@ class AWSSNSSubscriptions < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:subscription_arns, field: :subscription_arn) - .register_column(:owners, field: :owner) - .register_column(:protocols, field: :protocol) - .register_column(:endpoints, field: :endpoint) - .register_column(:topic_arns, field: :topic_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:subscription_arns, field: :subscription_arn) + .register_column(:owners, field: :owner) + .register_column(:protocols, field: :protocol) + .register_column(:endpoints, field: :endpoint) + .register_column(:topic_arns, field: :topic_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_sns_topic.rb b/libraries/aws_sns_topic.rb index 849f50d9f..17b59ea8a 100644 --- a/libraries/aws_sns_topic.rb +++ b/libraries/aws_sns_topic.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSnsTopic < AwsResourceBase - name 'aws_sns_topic' - desc 'Verifies settings for an SNS Topic.' + name "aws_sns_topic" + desc "Verifies settings for an SNS Topic." example " describe aws_sns_topic('arn:aws:sns:us-east-1:123456789012:some-topic') do it { should exist } @@ -22,8 +22,8 @@ def initialize(opts = {}) catch_aws_errors do begin resp = @aws.sns_client.get_topic_attributes(topic_arn: @arn).attributes.to_h - @confirmed_subscription_count = resp['SubscriptionsConfirmed'].to_i - @kms_master_key_id = resp['KmsMasterKeyId'] + @confirmed_subscription_count = resp["SubscriptionsConfirmed"].to_i + @kms_master_key_id = resp["KmsMasterKeyId"] create_resource_methods(resp) rescue Aws::SNS::Errors::NotFound return diff --git a/libraries/aws_sns_topics.rb b/libraries/aws_sns_topics.rb index 18af7d7cb..06dc16d00 100644 --- a/libraries/aws_sns_topics.rb +++ b/libraries/aws_sns_topics.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSnsTopics < AwsResourceBase - name 'aws_sns_topics' - desc 'Verifies settings for SNS Topics in bulk.' + name "aws_sns_topics" + desc "Verifies settings for SNS Topics in bulk." example " describe aws_sns_topics do its('topic_arns') { should include 'arn:aws:sns:us-west-2:012345678901:aws-sns-topic-auzoitotenajpdiftuiorkmrf' } @@ -11,8 +11,8 @@ class AwsSnsTopics < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:topic_arns, field: :topic_arn) - .install_filter_methods_on_resource(self, :table) + .register_column(:topic_arns, field: :topic_arn) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_sqs_queue.rb b/libraries/aws_sqs_queue.rb index a612c5494..8470fab65 100644 --- a/libraries/aws_sqs_queue.rb +++ b/libraries/aws_sqs_queue.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSqsQueue < AwsResourceBase - name 'aws_sqs_queue' - desc 'Verifies settings for an SQS Queue.' + name "aws_sqs_queue" + desc "Verifies settings for an SQS Queue." example " describe aws_sqs_queue('queue-name') do it { should exist } @@ -20,21 +20,21 @@ def initialize(opts = {}) super(opts) validate_parameters(required: [:queue_url]) catch_aws_errors do - resp = @aws.sqs_client.get_queue_attributes(queue_url: opts[:queue_url], attribute_names: ['All']).attributes - @arn = resp['QueueArn'] - @visibility_timeout = resp['VisibilityTimeout'].to_i - @maximum_message_size = resp['MaximumMessageSize'].to_i - @message_retention_period = resp['MessageRetentionPeriod'].to_i - @delay_seconds = resp['DelaySeconds'].to_i - @receive_message_wait_timeout_seconds = resp['ReceiveMessageWaitTimeoutSeconds'].to_i - @content_based_deduplication = resp['ContentBasedDeduplication'].nil? ? false: true - @is_fifo_queue = resp['FifoQueue'].nil? ? false: true - @redrive_policy = resp['RedrivePolicy'] - @kms_master_key_id = resp['KmsMasterKeyId'] - @kms_data_key_reuse_period_seconds = resp['KmsDataKeyReusePeriodSeconds'] - @sqs_managed_enabled = resp['SqsManagedSseEnabled'] - @sqs_managed = resp['SqsManagedSseEnabled'].nil? ? false: true - @policy = resp['Policy'] + resp = @aws.sqs_client.get_queue_attributes(queue_url: opts[:queue_url], attribute_names: ["All"]).attributes + @arn = resp["QueueArn"] + @visibility_timeout = resp["VisibilityTimeout"].to_i + @maximum_message_size = resp["MaximumMessageSize"].to_i + @message_retention_period = resp["MessageRetentionPeriod"].to_i + @delay_seconds = resp["DelaySeconds"].to_i + @receive_message_wait_timeout_seconds = resp["ReceiveMessageWaitTimeoutSeconds"].to_i + @content_based_deduplication = resp["ContentBasedDeduplication"].nil? ? false: true + @is_fifo_queue = resp["FifoQueue"].nil? ? false: true + @redrive_policy = resp["RedrivePolicy"] + @kms_master_key_id = resp["KmsMasterKeyId"] + @kms_data_key_reuse_period_seconds = resp["KmsDataKeyReusePeriodSeconds"] + @sqs_managed_enabled = resp["SqsManagedSseEnabled"] + @sqs_managed = resp["SqsManagedSseEnabled"].nil? ? false: true + @policy = resp["Policy"] create_resource_methods(resp.to_h) end end @@ -52,10 +52,10 @@ def to_s end def policy_statement_principal_all_permissions_enabled? - @policy_statement_principal_all_permissions_enabled = @policy_statement_principal.include? '*' + @policy_statement_principal_all_permissions_enabled = @policy_statement_principal.include? "*" end def policy_statement_action_all_permissions_enabled? - @policy_statement_action_all_permissions_enabled = @policy_statement_action.include? '*' + @policy_statement_action_all_permissions_enabled = @policy_statement_action.include? "*" end end diff --git a/libraries/aws_sqs_queues.rb b/libraries/aws_sqs_queues.rb index 54409733c..79c88ec86 100644 --- a/libraries/aws_sqs_queues.rb +++ b/libraries/aws_sqs_queues.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSqsQueues < AwsResourceBase - name 'aws_sqs_queues' - desc 'Verifies settings for a collection AWS SQS Queues.' + name "aws_sqs_queues" + desc "Verifies settings for a collection AWS SQS Queues." example " describe aws_sqs_queues do it { should exist } @@ -12,16 +12,16 @@ class AwsSqsQueues < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:queue_urls, field: :queue_url) - .register_column(:is_fifo_queues, field: :is_fifo_queue) - .register_column(:visibility_timeouts, field: :visibility_timeout) - .register_column(:maximum_message_sizes, field: :maximum_message_size) - .register_column(:message_retention_periods, field: :message_retention_period) - .register_column(:delay_seconds, field: :delay_seconds) - .register_column(:receive_message_wait_timeout_seconds, field: :receive_message_wait_timeout_seconds) - .register_column(:content_based_deduplications, field: :content_based_deduplication) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:queue_urls, field: :queue_url) + .register_column(:is_fifo_queues, field: :is_fifo_queue) + .register_column(:visibility_timeouts, field: :visibility_timeout) + .register_column(:maximum_message_sizes, field: :maximum_message_size) + .register_column(:message_retention_periods, field: :message_retention_period) + .register_column(:delay_seconds, field: :delay_seconds) + .register_column(:receive_message_wait_timeout_seconds, field: :receive_message_wait_timeout_seconds) + .register_column(:content_based_deduplications, field: :content_based_deduplication) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -35,16 +35,16 @@ def fetch_data response = @aws.sqs_client.list_queues return [] if !response || response.empty? response.queue_urls.each do |url| - queue_attributes = @aws.sqs_client.get_queue_attributes(queue_url: url, attribute_names: ['All']).attributes - queue_rows += [{ arn: queue_attributes['QueueArn'], + queue_attributes = @aws.sqs_client.get_queue_attributes(queue_url: url, attribute_names: ["All"]).attributes + queue_rows += [{ arn: queue_attributes["QueueArn"], queue_url: url, - attachment_count: queue_attributes['VisibilityTimeout'].to_i, - default_version_id: queue_attributes['MaximumMessageSize'].to_i, - policy_name: queue_attributes['MessageRetentionPeriod'].to_i, - policy_id: queue_attributes['DelaySeconds'].to_i, - attached_groups: queue_attributes['ReceiveMessageWaitTimeoutSeconds'].to_i, - attached_roles: queue_attributes['ContentBasedDeduplication'].nil? ? false: true, - attached_users: queue_attributes['FifoQueue'].nil? ? false: true }] + attachment_count: queue_attributes["VisibilityTimeout"].to_i, + default_version_id: queue_attributes["MaximumMessageSize"].to_i, + policy_name: queue_attributes["MessageRetentionPeriod"].to_i, + policy_id: queue_attributes["DelaySeconds"].to_i, + attached_groups: queue_attributes["ReceiveMessageWaitTimeoutSeconds"].to_i, + attached_roles: queue_attributes["ContentBasedDeduplication"].nil? ? false: true, + attached_users: queue_attributes["FifoQueue"].nil? ? false: true }] end end @table = queue_rows diff --git a/libraries/aws_ssm_activation.rb b/libraries/aws_ssm_activation.rb index e9e1f4826..b6acb9c0f 100644 --- a/libraries/aws_ssm_activation.rb +++ b/libraries/aws_ssm_activation.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSsmActivation < AwsResourceBase - name 'aws_ssm_activation' - desc 'Verifies settings for a SSM Activation.' + name "aws_ssm_activation" + desc "Verifies settings for a SSM Activation." example " describe aws_ssm_activation(activation_id: 'activation-id') do @@ -17,7 +17,7 @@ def initialize(opts = {}) @display_name = opts[:activation_id] catch_aws_errors do - filter = { filter_key: 'ActivationIds', filter_values: [opts[:activation_id]] } + filter = { filter_key: "ActivationIds", filter_values: [opts[:activation_id]] } resp = @aws.ssm_client.describe_activations({ filters: [filter] }) if resp.activation_list.first.nil? empty_response_warn diff --git a/libraries/aws_ssm_activations.rb b/libraries/aws_ssm_activations.rb index 0f4c0fbfb..2f2a6b591 100644 --- a/libraries/aws_ssm_activations.rb +++ b/libraries/aws_ssm_activations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSsmActivations < AwsResourceBase - name 'aws_ssm_activations' - desc 'Verifies settings for a SSM Activation in bulk.' + name "aws_ssm_activations" + desc "Verifies settings for a SSM Activation in bulk." example " describe aws_ssm_activations do it { should exist } @@ -12,17 +12,17 @@ class AwsSsmActivations < AwsResourceBase attr_reader :table, :api_response FilterTable.create - .register_column(:activation_ids, field: :activation_id) - .register_column(:descriptions, field: :description) - .register_column(:default_instance_names, field: :default_instance_name) - .register_column(:iam_roles, field: :iam_role) - .register_column(:registration_limits, field: :registration_limit) - .register_column(:registrations_count, field: :registrations_count) - .register_column(:expiration_dates, field: :expiration_date) - .register_column(:expired, field: :expired) - .register_column(:created_dates, field: :created_date) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:activation_ids, field: :activation_id) + .register_column(:descriptions, field: :description) + .register_column(:default_instance_names, field: :default_instance_name) + .register_column(:iam_roles, field: :iam_role) + .register_column(:registration_limits, field: :registration_limit) + .register_column(:registrations_count, field: :registrations_count) + .register_column(:expiration_dates, field: :expiration_date) + .register_column(:expired, field: :expired) + .register_column(:created_dates, field: :created_date) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_association.rb b/libraries/aws_ssm_association.rb index cc961fa3e..0b52ccf29 100644 --- a/libraries/aws_ssm_association.rb +++ b/libraries/aws_ssm_association.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSsmAssociation < AwsResourceBase - name 'aws_ssm_association' - desc 'Verifies settings for a SSM Association.' + name "aws_ssm_association" + desc "Verifies settings for a SSM Association." example " describe aws_ssm_association(association_id: 'association-id') do diff --git a/libraries/aws_ssm_associations.rb b/libraries/aws_ssm_associations.rb index 23b7a0257..15f5cce6a 100644 --- a/libraries/aws_ssm_associations.rb +++ b/libraries/aws_ssm_associations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSsmAssociations < AwsResourceBase - name 'aws_ssm_associations' - desc 'Verifies settings for a SSM Association in bulk.' + name "aws_ssm_associations" + desc "Verifies settings for a SSM Association in bulk." example " describe aws_ssm_associations do it { should exist } @@ -12,17 +12,17 @@ class AwsSsmAssociations < AwsResourceBase attr_reader :table, :api_response FilterTable.create - .register_column(:names, field: :name) - .register_column(:instance_ids, field: :instance_id) - .register_column(:association_ids, field: :association_id) - .register_column(:association_versions, field: :association_version) - .register_column(:document_versions, field: :document_version) - .register_column(:targets, field: :targets) - .register_column(:last_execution_dates, field: :last_execution_date) - .register_column(:overviews, field: :overview) - .register_column(:schedule_expressions, field: :schedule_expression) - .register_column(:association_names, field: :association_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:instance_ids, field: :instance_id) + .register_column(:association_ids, field: :association_id) + .register_column(:association_versions, field: :association_version) + .register_column(:document_versions, field: :document_version) + .register_column(:targets, field: :targets) + .register_column(:last_execution_dates, field: :last_execution_date) + .register_column(:overviews, field: :overview) + .register_column(:schedule_expressions, field: :schedule_expression) + .register_column(:association_names, field: :association_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_document.rb b/libraries/aws_ssm_document.rb index af13d2ca0..44dadb5ca 100644 --- a/libraries/aws_ssm_document.rb +++ b/libraries/aws_ssm_document.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSsmDocument < AwsResourceBase - name 'aws_ssm_document' - desc 'Verifies settings for a SSM Document.' + name "aws_ssm_document" + desc "Verifies settings for a SSM Document." example " describe aws_ssm_document(name: 'document-name') do diff --git a/libraries/aws_ssm_documents.rb b/libraries/aws_ssm_documents.rb index 65477633b..7b6440d6e 100644 --- a/libraries/aws_ssm_documents.rb +++ b/libraries/aws_ssm_documents.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSsmDocuments < AwsResourceBase - name 'aws_ssm_documents' - desc 'Verifies settings for a SSM Document in bulk.' + name "aws_ssm_documents" + desc "Verifies settings for a SSM Document in bulk." example " describe aws_ssm_documents do it { should exist } @@ -12,16 +12,16 @@ class AwsSsmDocuments < AwsResourceBase attr_reader :table, :api_response FilterTable.create - .register_column(:names, field: :name) - .register_column(:owners, field: :owner) - .register_column(:platform_types, field: :platform_types) - .register_column(:document_versions, field: :document_version) - .register_column(:document_types, field: :document_type) - .register_column(:schema_versions, field: :schema_version) - .register_column(:document_formats, field: :document_format) - .register_column(:target_types, field: :target_type) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:owners, field: :owner) + .register_column(:platform_types, field: :platform_types) + .register_column(:document_versions, field: :document_version) + .register_column(:document_types, field: :document_type) + .register_column(:schema_versions, field: :schema_version) + .register_column(:document_formats, field: :document_format) + .register_column(:target_types, field: :target_type) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_maintenance_window.rb b/libraries/aws_ssm_maintenance_window.rb index 8eb6d4e3a..f0ffc6f44 100644 --- a/libraries/aws_ssm_maintenance_window.rb +++ b/libraries/aws_ssm_maintenance_window.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSESMaintenanceWindow < AwsResourceBase - name 'aws_ssm_maintenance_window' - desc 'Retrieves a maintenance window.' + name "aws_ssm_maintenance_window" + desc "Retrieves a maintenance window." example " describe aws_ssm_maintenance_window(window_id: 'WINDOW_ID') do diff --git a/libraries/aws_ssm_maintenance_window_target.rb b/libraries/aws_ssm_maintenance_window_target.rb index 628224e97..bdfc9092c 100644 --- a/libraries/aws_ssm_maintenance_window_target.rb +++ b/libraries/aws_ssm_maintenance_window_target.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSESMaintenanceWindowTarget < AwsResourceBase - name 'aws_ssm_maintenance_window_target' - desc 'Retrieves a target in the maintenance window.' + name "aws_ssm_maintenance_window_target" + desc "Retrieves a target in the maintenance window." example " describe aws_ssm_maintenance_window_target(window_id: 'WINDOW_ID', window_target_id: 'WINDOW_TARGET_ID') do @@ -17,7 +17,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: window_target_id must be provided" unless opts[:window_target_id] && !opts[:window_target_id].empty? filter = [ { - key: 'WindowTargetId', + key: "WindowTargetId", values: [opts[:window_target_id]], }, ] diff --git a/libraries/aws_ssm_maintenance_window_targets.rb b/libraries/aws_ssm_maintenance_window_targets.rb index 1cfd2d3b9..7e0e74f23 100644 --- a/libraries/aws_ssm_maintenance_window_targets.rb +++ b/libraries/aws_ssm_maintenance_window_targets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSESMaintenanceWindowTargets < AwsResourceBase - name 'aws_ssm_maintenance_window_targets' - desc 'Lists the targets registered with the maintenance window.' + name "aws_ssm_maintenance_window_targets" + desc "Lists the targets registered with the maintenance window." example " describe aws_ssm_maintenance_window_targets(window_id: 'WINDOW_ID') do @@ -13,14 +13,14 @@ class AWSSESMaintenanceWindowTargets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:window_ids, field: :window_id) - .register_column(:window_target_ids, field: :window_target_id) - .register_column(:resource_types, field: :resource_type) - .register_column(:targets, field: :targets) - .register_column(:owner_informations, field: :owner_information) - .register_column(:names, field: :name) - .register_column(:descriptions, field: :description) - .install_filter_methods_on_resource(self, :table) + .register_column(:window_ids, field: :window_id) + .register_column(:window_target_ids, field: :window_target_id) + .register_column(:resource_types, field: :resource_type) + .register_column(:targets, field: :targets) + .register_column(:owner_informations, field: :owner_information) + .register_column(:names, field: :name) + .register_column(:descriptions, field: :description) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_maintenance_window_task.rb b/libraries/aws_ssm_maintenance_window_task.rb index 95f0d4489..7cde5ac01 100644 --- a/libraries/aws_ssm_maintenance_window_task.rb +++ b/libraries/aws_ssm_maintenance_window_task.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSESMaintenanceWindowTask < AwsResourceBase - name 'aws_ssm_maintenance_window_task' - desc 'Retrieves a task in the maintenance window.' + name "aws_ssm_maintenance_window_task" + desc "Retrieves a task in the maintenance window." example " describe aws_ssm_maintenance_window_task(window_id: 'WINDOW_ID', window_task_id: 'WINDOW_TASK_ID') do @@ -17,7 +17,7 @@ def initialize(opts = {}) raise ArgumentError, "#{@__resource_name__}: window_task_id must be provided" unless opts[:window_task_id] && !opts[:window_task_id].empty? filter = [ { - key: 'WindowTaskId', + key: "WindowTaskId", values: [opts[:window_task_id]], }, ] diff --git a/libraries/aws_ssm_maintenance_window_tasks.rb b/libraries/aws_ssm_maintenance_window_tasks.rb index 0fdb91748..61e8f49f0 100644 --- a/libraries/aws_ssm_maintenance_window_tasks.rb +++ b/libraries/aws_ssm_maintenance_window_tasks.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSESMaintenanceWindowTasks < AwsResourceBase - name 'aws_ssm_maintenance_window_tasks' - desc 'Retrieves a task in the maintenance window.' + name "aws_ssm_maintenance_window_tasks" + desc "Retrieves a task in the maintenance window." example " describe aws_ssm_maintenance_window_tasks(window_id: 'WINDOW_ID') do @@ -13,21 +13,21 @@ class AWSSESMaintenanceWindowTasks < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:window_ids, field: :window_id) - .register_column(:window_task_ids, field: :window_task_id) - .register_column(:task_arns, field: :task_arn) - .register_column(:types, field: :type) - .register_column(:targets, field: :targets) - .register_column(:task_parameters, field: :task_parameters) - .register_column(:priorities, field: :priority) - .register_column(:logging_infos, field: :logging_info) - .register_column(:service_role_arns, field: :service_role_arn) - .register_column(:max_concurrencies, field: :max_concurrency) - .register_column(:max_errors, field: :max_errors) - .register_column(:names, field: :name) - .register_column(:descriptions, field: :description) - .register_column(:cutoff_behaviors, field: :cutoff_behavior) - .install_filter_methods_on_resource(self, :table) + .register_column(:window_ids, field: :window_id) + .register_column(:window_task_ids, field: :window_task_id) + .register_column(:task_arns, field: :task_arn) + .register_column(:types, field: :type) + .register_column(:targets, field: :targets) + .register_column(:task_parameters, field: :task_parameters) + .register_column(:priorities, field: :priority) + .register_column(:logging_infos, field: :logging_info) + .register_column(:service_role_arns, field: :service_role_arn) + .register_column(:max_concurrencies, field: :max_concurrency) + .register_column(:max_errors, field: :max_errors) + .register_column(:names, field: :name) + .register_column(:descriptions, field: :description) + .register_column(:cutoff_behaviors, field: :cutoff_behavior) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_maintenance_windows.rb b/libraries/aws_ssm_maintenance_windows.rb index 8e8832a64..c25f0dca5 100644 --- a/libraries/aws_ssm_maintenance_windows.rb +++ b/libraries/aws_ssm_maintenance_windows.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSESMaintenanceWindows < AwsResourceBase - name 'aws_ssm_maintenance_windows' - desc 'Retrieves the maintenance windows in an Amazon Web Services account.' + name "aws_ssm_maintenance_windows" + desc "Retrieves the maintenance windows in an Amazon Web Services account." example " describe aws_ssm_maintenance_windows do @@ -13,19 +13,19 @@ class AWSSESMaintenanceWindows < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:window_ids, field: :window_id) - .register_column(:names, field: :name) - .register_column(:descriptions, field: :description) - .register_column(:enabled, field: :enabled) - .register_column(:durations, field: :duration) - .register_column(:cutoffs, field: :cutoff) - .register_column(:schedules, field: :schedule) - .register_column(:schedule_timezones, field: :schedule_timezone) - .register_column(:schedule_offsets, field: :schedule_offset) - .register_column(:end_dates, field: :end_date) - .register_column(:start_dates, field: :start_date) - .register_column(:next_execution_times, field: :next_execution_time) - .install_filter_methods_on_resource(self, :table) + .register_column(:window_ids, field: :window_id) + .register_column(:names, field: :name) + .register_column(:descriptions, field: :description) + .register_column(:enabled, field: :enabled) + .register_column(:durations, field: :duration) + .register_column(:cutoffs, field: :cutoff) + .register_column(:schedules, field: :schedule) + .register_column(:schedule_timezones, field: :schedule_timezone) + .register_column(:schedule_offsets, field: :schedule_offset) + .register_column(:end_dates, field: :end_date) + .register_column(:start_dates, field: :start_date) + .register_column(:next_execution_times, field: :next_execution_time) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_parameter.rb b/libraries/aws_ssm_parameter.rb index 6343f9b0d..1bfa50045 100644 --- a/libraries/aws_ssm_parameter.rb +++ b/libraries/aws_ssm_parameter.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSsmParameter < AwsResourceBase - name 'aws_ssm_parameter' - desc 'Verifies settings for a SSM Parameter.' + name "aws_ssm_parameter" + desc "Verifies settings for a SSM Parameter." example " describe aws_ssm_parameter(name: 'parameter-name') do diff --git a/libraries/aws_ssm_parameters.rb b/libraries/aws_ssm_parameters.rb index 601809560..707b812a6 100644 --- a/libraries/aws_ssm_parameters.rb +++ b/libraries/aws_ssm_parameters.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSsmParameters < AwsResourceBase - name 'aws_ssm_parameters' - desc 'Verifies settings for a SSM Parameter in bulk.' + name "aws_ssm_parameters" + desc "Verifies settings for a SSM Parameter in bulk." example " describe aws_ssm_parameters do it { should exist } @@ -12,15 +12,15 @@ class AwsSsmParameters < AwsResourceBase attr_reader :table, :api_response FilterTable.create - .register_column(:names, field: :name) - .register_column(:types, field: :type) - .register_column(:key_ids, field: :key_id) - .register_column(:last_modified_dates, field: :last_modified_date) - .register_column(:last_modified_users, field: :last_modified_user) - .register_column(:descriptions, field: :description) - .register_column(:versions, field: :version) - .register_column(:tiers, field: :tier) - .install_filter_methods_on_resource(self, :table) + .register_column(:names, field: :name) + .register_column(:types, field: :type) + .register_column(:key_ids, field: :key_id) + .register_column(:last_modified_dates, field: :last_modified_date) + .register_column(:last_modified_users, field: :last_modified_user) + .register_column(:descriptions, field: :description) + .register_column(:versions, field: :version) + .register_column(:tiers, field: :tier) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_patch_baseline.rb b/libraries/aws_ssm_patch_baseline.rb index 63a705621..d6b931600 100644 --- a/libraries/aws_ssm_patch_baseline.rb +++ b/libraries/aws_ssm_patch_baseline.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSESPatchBaseline < AwsResourceBase - name 'aws_ssm_patch_baseline' - desc 'Retrieves information about a patch baseline.' + name "aws_ssm_patch_baseline" + desc "Retrieves information about a patch baseline." example " describe aws_ssm_patch_baseline(baseline_id: 'BASELINE_ID') do diff --git a/libraries/aws_ssm_patch_baselines.rb b/libraries/aws_ssm_patch_baselines.rb index e63e18da8..d8b842af3 100644 --- a/libraries/aws_ssm_patch_baselines.rb +++ b/libraries/aws_ssm_patch_baselines.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSESPatchBaselines < AwsResourceBase - name 'aws_ssm_patch_baselines' - desc 'Lists the patch baselines in your Amazon Web Services account.' + name "aws_ssm_patch_baselines" + desc "Lists the patch baselines in your Amazon Web Services account." example " describe aws_ssm_patch_baselines do @@ -17,12 +17,12 @@ class AWSSESPatchBaselines < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:baseline_ids, field: :baseline_id) - .register_column(:baseline_names, field: :baseline_name) - .register_column(:operating_systems, field: :operating_system) - .register_column(:baseline_descriptions, field: :baseline_description) - .register_column(:default_baselines, field: :default_baseline) - .install_filter_methods_on_resource(self, :table) + .register_column(:baseline_ids, field: :baseline_id) + .register_column(:baseline_names, field: :baseline_name) + .register_column(:operating_systems, field: :operating_system) + .register_column(:baseline_descriptions, field: :baseline_description) + .register_column(:default_baselines, field: :default_baseline) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_ssm_resource_compliance_summaries.rb b/libraries/aws_ssm_resource_compliance_summaries.rb index 63565986d..6ec71e279 100644 --- a/libraries/aws_ssm_resource_compliance_summaries.rb +++ b/libraries/aws_ssm_resource_compliance_summaries.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSsmResourceComplianceSummaries < AwsResourceBase - name 'aws_ssm_resource_compliance_summaries' - desc 'Verifies settings for a SSM Resource Compliance Summary in bulk.' + name "aws_ssm_resource_compliance_summaries" + desc "Verifies settings for a SSM Resource Compliance Summary in bulk." example " describe aws_ssm_resource_compliance_summaries do it { should exist } @@ -12,15 +12,15 @@ class AwsSsmResourceComplianceSummaries < AwsResourceBase attr_reader :table, :api_response FilterTable.create - .register_column(:compliance_types, field: :compliance_type) - .register_column(:resource_types, field: :resource_type) - .register_column(:resource_ids, field: :resource_id) - .register_column(:status, field: :status) - .register_column(:overall_severity, field: :overall_severity) - .register_column(:execution_summaries, field: :execution_summary) - .register_column(:compliant_summaries, field: :compliant_summary) - .register_column(:non_compliant_summaries, field: :non_compliant_summary) - .install_filter_methods_on_resource(self, :table) + .register_column(:compliance_types, field: :compliance_type) + .register_column(:resource_types, field: :resource_type) + .register_column(:resource_ids, field: :resource_id) + .register_column(:status, field: :status) + .register_column(:overall_severity, field: :overall_severity) + .register_column(:execution_summaries, field: :execution_summary) + .register_column(:compliant_summaries, field: :compliant_summary) + .register_column(:non_compliant_summaries, field: :non_compliant_summary) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -34,8 +34,8 @@ def fetch_data if opts[:compliance_type] || opts[:overall_severity] filter_array = [] - filter_array << { key: 'ComplianceType', values: [opts[:compliance_type]] } if opts[:compliance_type] - filter_array << { key: 'OverallSeverity', values: [opts[:overall_severity]] } if opts[:overall_severity] + filter_array << { key: "ComplianceType", values: [opts[:compliance_type]] } if opts[:compliance_type] + filter_array << { key: "OverallSeverity", values: [opts[:overall_severity]] } if opts[:overall_severity] filter_options = { filters: filter_array } end diff --git a/libraries/aws_ssm_resource_compliance_summary.rb b/libraries/aws_ssm_resource_compliance_summary.rb index 293fcc1f3..0e3d6e758 100644 --- a/libraries/aws_ssm_resource_compliance_summary.rb +++ b/libraries/aws_ssm_resource_compliance_summary.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSsmResourceComplianceSummary < AwsResourceBase - name 'aws_ssm_resource_compliance_summary' - desc 'Verifies settings for a SSM Resource Compliance Summary.' + name "aws_ssm_resource_compliance_summary" + desc "Verifies settings for a SSM Resource Compliance Summary." example " describe aws_ssm_resource_compliance_summary(resource_id: 'resource-id') do @@ -16,10 +16,10 @@ def initialize(opts = {}) validate_parameters(required: [:resource_id], allow: %i(compliance_type overall_severity status)) @display_name = opts[:resource_id] - filter_params = [{ key: 'InstanceId', values: [opts[:resource_id]] }] - filter_params << { key: 'ComplianceType', values: [opts[:compliance_type]] } if opts[:compliance_type] - filter_params << { key: 'OverallSeverity', values: [opts[:overall_severity]] } if opts[:overall_severity] - filter_params << { key: 'Status', values: [opts[:status]] } if opts[:status] + filter_params = [{ key: "InstanceId", values: [opts[:resource_id]] }] + filter_params << { key: "ComplianceType", values: [opts[:compliance_type]] } if opts[:compliance_type] + filter_params << { key: "OverallSeverity", values: [opts[:overall_severity]] } if opts[:overall_severity] + filter_params << { key: "Status", values: [opts[:status]] } if opts[:status] filter = { filters: filter_params } diff --git a/libraries/aws_ssm_resource_data_syncs.rb b/libraries/aws_ssm_resource_data_syncs.rb index b5f5fb955..051aa7f70 100644 --- a/libraries/aws_ssm_resource_data_syncs.rb +++ b/libraries/aws_ssm_resource_data_syncs.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSESResourceDataSyncs < AwsResourceBase - name 'aws_ssm_resource_data_syncs' - desc 'Lists your resource data sync configurations. Includes information about the last time a sync attempted to start, the last sync status, and the last time a sync successfully completed.' + name "aws_ssm_resource_data_syncs" + desc "Lists your resource data sync configurations. Includes information about the last time a sync attempted to start, the last sync status, and the last time a sync successfully completed." example " describe aws_ssm_resource_data_syncs do @@ -13,17 +13,17 @@ class AWSSESResourceDataSyncs < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:sync_names, field: :sync_name) - .register_column(:sync_types, field: :sync_type) - .register_column(:sync_sources, field: :sync_source) - .register_column(:s3_destinations, field: :s3_destination) - .register_column(:last_sync_times, field: :last_sync_time) - .register_column(:last_successful_sync_times, field: :last_successful_sync_time) - .register_column(:sync_last_modified_times, field: :sync_last_modified_time) - .register_column(:last_statuses, field: :last_status) - .register_column(:sync_created_times, field: :sync_created_time) - .register_column(:last_sync_status_messages, field: :last_sync_status_message) - .install_filter_methods_on_resource(self, :table) + .register_column(:sync_names, field: :sync_name) + .register_column(:sync_types, field: :sync_type) + .register_column(:sync_sources, field: :sync_source) + .register_column(:s3_destinations, field: :s3_destination) + .register_column(:last_sync_times, field: :last_sync_time) + .register_column(:last_successful_sync_times, field: :last_successful_sync_time) + .register_column(:sync_last_modified_times, field: :sync_last_modified_time) + .register_column(:last_statuses, field: :last_status) + .register_column(:sync_created_times, field: :sync_created_time) + .register_column(:last_sync_status_messages, field: :last_sync_status_message) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_stepfunctions_activities.rb b/libraries/aws_stepfunctions_activities.rb index 0fbec8fb1..acb85f7cc 100644 --- a/libraries/aws_stepfunctions_activities.rb +++ b/libraries/aws_stepfunctions_activities.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSStepFunctionsActivities < AwsResourceBase - name 'aws_stepfunctions_activities' - desc 'Retrieves a task in the maintenance window.' + name "aws_stepfunctions_activities" + desc "Retrieves a task in the maintenance window." example " describe aws_stepfunctions_activities do @@ -13,10 +13,10 @@ class AWSStepFunctionsActivities < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:activity_arns, field: :activity_arn) - .register_column(:names, field: :name) - .register_column(:creation_dates, field: :creation_date) - .install_filter_methods_on_resource(self, :table) + .register_column(:activity_arns, field: :activity_arn) + .register_column(:names, field: :name) + .register_column(:creation_dates, field: :creation_date) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_stepfunctions_activity.rb b/libraries/aws_stepfunctions_activity.rb index c6f8f6af2..bb7a17352 100644 --- a/libraries/aws_stepfunctions_activity.rb +++ b/libraries/aws_stepfunctions_activity.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSStepFunctionsActivity < AwsResourceBase - name 'aws_stepfunctions_activity' - desc 'Describes an activity.' + name "aws_stepfunctions_activity" + desc "Describes an activity." example " describe aws_stepfunctions_activity(activity_arn: 'ACTIVITY_ARN') do diff --git a/libraries/aws_stepfunctions_state_machine.rb b/libraries/aws_stepfunctions_state_machine.rb index 31e86a094..b7451fd77 100644 --- a/libraries/aws_stepfunctions_state_machine.rb +++ b/libraries/aws_stepfunctions_state_machine.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSStepFunctionsStateMachine < AwsResourceBase - name 'aws_stepfunctions_state_machine' - desc 'Describes a state machine.' + name "aws_stepfunctions_state_machine" + desc "Describes a state machine." example " describe aws_stepfunctions_state_machine(state_machine_arn: 'state_machine_arn_value') do diff --git a/libraries/aws_stepfunctions_state_machines.rb b/libraries/aws_stepfunctions_state_machines.rb index 736135a16..89cd90698 100644 --- a/libraries/aws_stepfunctions_state_machines.rb +++ b/libraries/aws_stepfunctions_state_machines.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSStepFunctionsStateMachines < AwsResourceBase - name 'aws_stepfunctions_state_machines' - desc 'Lists the existing state machines.' + name "aws_stepfunctions_state_machines" + desc "Lists the existing state machines." example " describe aws_stepfnctions_state_machines do @@ -13,11 +13,11 @@ class AWSStepFunctionsStateMachines < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:state_machine_arns, field: :state_machine_arn) - .register_column(:names, field: :name) - .register_column(:types, field: :type) - .register_column(:creation_dates, field: :creation_date) - .install_filter_methods_on_resource(self, :table) + .register_column(:state_machine_arns, field: :state_machine_arn) + .register_column(:names, field: :name) + .register_column(:types, field: :type) + .register_column(:creation_dates, field: :creation_date) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_sts_caller_identity.rb b/libraries/aws_sts_caller_identity.rb index e381c74b0..b99738c5f 100644 --- a/libraries/aws_sts_caller_identity.rb +++ b/libraries/aws_sts_caller_identity.rb @@ -1,6 +1,6 @@ class AwsStsCallerIdentity < AwsResourceBase - name 'aws_sts_caller_identity' - desc 'Verifies settings for an AWS STS Caller Identity.' + name "aws_sts_caller_identity" + desc "Verifies settings for an AWS STS Caller Identity." example " describe aws_sts_caller_identity do its('arn') { should match 'arn:aws:iam::.*:user/service-account-inspec' } @@ -27,7 +27,7 @@ def resource_id end def govcloud? - fetch_arn_components[:partition] == 'aws-us-gov' + fetch_arn_components[:partition] == "aws-us-gov" end def exists? @@ -35,12 +35,12 @@ def exists? end def to_s - 'AWS Security Token Service Caller Identity' + "AWS Security Token Service Caller Identity" end private def fetch_arn_components - Hash[%i(arn partition service region account_id resource).zip(arn.split(':'))] + Hash[%i(arn partition service region account_id resource).zip(arn.split(":"))] end end diff --git a/libraries/aws_subnet.rb b/libraries/aws_subnet.rb index d2e3f5d5b..bf0edc90b 100644 --- a/libraries/aws_subnet.rb +++ b/libraries/aws_subnet.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSubnet < AwsResourceBase - name 'aws_subnet' - desc 'Verifies settings for an AWS VPC Subnet.' + name "aws_subnet" + desc "Verifies settings for an AWS VPC Subnet." example " describe aws_subnet(subnet_id: 'subnet-12345678') do @@ -21,7 +21,7 @@ def initialize(opts = {}) end @display_name = opts[:subnet_id] - filter = { name: 'subnet-id', values: [opts[:subnet_id]] } + filter = { name: "subnet-id", values: [opts[:subnet_id]] } catch_aws_errors do resp = @aws.compute_client.describe_subnets({ filters: [filter] }) @subnet = resp.subnets[0].to_h @@ -30,7 +30,7 @@ def initialize(opts = {}) end def available? - @subnet[:state]=='available' + @subnet[:state]=="available" end def exists? diff --git a/libraries/aws_subnets.rb b/libraries/aws_subnets.rb index cce0de437..45ad44625 100644 --- a/libraries/aws_subnets.rb +++ b/libraries/aws_subnets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsSubnets < AwsResourceBase - name 'aws_subnets' - desc 'Verifies settings for an AWS VPC Subnets in bulk.' + name "aws_subnets" + desc "Verifies settings for an AWS VPC Subnets in bulk." example " describe aws_subnets do @@ -19,14 +19,14 @@ class AwsSubnets < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:availability_zone, field: :availability_zone) - .register_column(:cidr_blocks, field: :cidr_block) - .register_column(:map_public_ip_on_launch, field: :map_public_ip_on_launch) - .register_column(:states, field: :state) - .register_column(:subnet_ids, field: :subnet_id) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:availability_zone, field: :availability_zone) + .register_column(:cidr_blocks, field: :cidr_block) + .register_column(:map_public_ip_on_launch, field: :map_public_ip_on_launch) + .register_column(:states, field: :state) + .register_column(:subnet_ids, field: :subnet_id) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_synthetics_canaries.rb b/libraries/aws_synthetics_canaries.rb index 9cf9f21ed..fc4f99ff9 100644 --- a/libraries/aws_synthetics_canaries.rb +++ b/libraries/aws_synthetics_canaries.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSyntheticsCanaries < AwsResourceBase - name 'aws_synthetics_canaries' - desc 'Lists the canaries.' + name "aws_synthetics_canaries" + desc "Lists the canaries." example " describe aws_synthetics_canaries do @@ -13,24 +13,24 @@ class AWSSyntheticsCanaries < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:ids, field: :id) - .register_column(:names, field: :name) - .register_column(:codes, field: :code) - .register_column(:execution_role_arns, field: :execution_role_arn) - .register_column(:schedules, field: :schedule) - .register_column(:run_configs, field: :run_config) - .register_column(:success_retention_period_in_days, field: :success_retention_period_in_days) - .register_column(:failure_retention_period_in_days, field: :failure_retention_period_in_days) - .register_column(:statuses, field: :status) - .register_column(:timelines, field: :timeline) - .register_column(:artifact_s3_locations, field: :artifact_s3_location) - .register_column(:engine_arns, field: :engine_arn) - .register_column(:runtime_versions, field: :runtime_version) - .register_column(:vpc_configs, field: :vpc_config) - .register_column(:visual_references, field: :visual_reference) - .register_column(:tags, field: :tags) - .register_column(:artifact_configs, field: :artifact_config) - .install_filter_methods_on_resource(self, :table) + .register_column(:ids, field: :id) + .register_column(:names, field: :name) + .register_column(:codes, field: :code) + .register_column(:execution_role_arns, field: :execution_role_arn) + .register_column(:schedules, field: :schedule) + .register_column(:run_configs, field: :run_config) + .register_column(:success_retention_period_in_days, field: :success_retention_period_in_days) + .register_column(:failure_retention_period_in_days, field: :failure_retention_period_in_days) + .register_column(:statuses, field: :status) + .register_column(:timelines, field: :timeline) + .register_column(:artifact_s3_locations, field: :artifact_s3_location) + .register_column(:engine_arns, field: :engine_arn) + .register_column(:runtime_versions, field: :runtime_version) + .register_column(:vpc_configs, field: :vpc_config) + .register_column(:visual_references, field: :visual_reference) + .register_column(:tags, field: :tags) + .register_column(:artifact_configs, field: :artifact_config) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_synthetics_canary.rb b/libraries/aws_synthetics_canary.rb index c33a2243b..0b8e442bd 100644 --- a/libraries/aws_synthetics_canary.rb +++ b/libraries/aws_synthetics_canary.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSSyntheticsCanary < AwsResourceBase - name 'aws_synthetics_canary' - desc 'Retrieves complete information about one canary.' + name "aws_synthetics_canary" + desc "Retrieves complete information about one canary." example " describe aws_synthetics_canary(name: 'CANARY_NAME') do diff --git a/libraries/aws_transfer_user.rb b/libraries/aws_transfer_user.rb index e2436a597..01678d7d0 100644 --- a/libraries/aws_transfer_user.rb +++ b/libraries/aws_transfer_user.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSTransferUser < AwsResourceBase - name 'aws_transfer_user' - desc 'Describes the user assigned to the specific file transfer protocol-enabled server, as identified by its ServerId property.' + name "aws_transfer_user" + desc "Describes the user assigned to the specific file transfer protocol-enabled server, as identified by its ServerId property." example " describe aws_transfer_user(server_id: 'test', user_name: 'test') do it { should exist } diff --git a/libraries/aws_transfer_users.rb b/libraries/aws_transfer_users.rb index c4d046fbf..9465b77b2 100644 --- a/libraries/aws_transfer_users.rb +++ b/libraries/aws_transfer_users.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSTransferUsers < AwsResourceBase - name 'aws_transfer_users' - desc 'Lists the users for a file transfer protocol-enabled server that you specify by passing the ServerId parameter.' + name "aws_transfer_users" + desc "Lists the users for a file transfer protocol-enabled server that you specify by passing the ServerId parameter." example " describe aws_transfer_users(server_id: 's-0123456789') do @@ -13,13 +13,13 @@ class AWSTransferUsers < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:arns, field: :arn) - .register_column(:home_directories, field: :home_directory) - .register_column(:home_directory_types, field: :home_directory_type) - .register_column(:roles, field: :role) - .register_column(:ssh_public_key_count, field: :ssh_public_key_count) - .register_column(:user_names, field: :user_name) - .install_filter_methods_on_resource(self, :table) + .register_column(:arns, field: :arn) + .register_column(:home_directories, field: :home_directory) + .register_column(:home_directory_types, field: :home_directory_type) + .register_column(:roles, field: :role) + .register_column(:ssh_public_key_count, field: :ssh_public_key_count) + .register_column(:user_names, field: :user_name) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_transit_gateway.rb b/libraries/aws_transit_gateway.rb index db5a41c05..64eea6e5e 100644 --- a/libraries/aws_transit_gateway.rb +++ b/libraries/aws_transit_gateway.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsTransitGateway < AwsResourceBase - name 'aws_transit_gateway' - desc 'Verifies settings for an AWS Transit Gateway.' + name "aws_transit_gateway" + desc "Verifies settings for an AWS Transit Gateway." example " describe aws_transit_gateway('TRANSIT_GATEWAY_ID') do diff --git a/libraries/aws_transit_gateway_connect.rb b/libraries/aws_transit_gateway_connect.rb index f275e87aa..3e5db2ec8 100644 --- a/libraries/aws_transit_gateway_connect.rb +++ b/libraries/aws_transit_gateway_connect.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSTransitGatewayConnect < AwsResourceBase - name 'aws_transit_gateway_connect' - desc 'Describes one or more Connect attachments.' + name "aws_transit_gateway_connect" + desc "Describes one or more Connect attachments." example " describe aws_transit_gateway_connect(transit_gateway_attachment_id: 'TRANSIT_GATEWAY_CONNECT_ATTACHMENT_ID') do diff --git a/libraries/aws_transit_gateway_connects.rb b/libraries/aws_transit_gateway_connects.rb index 35efa01a4..e5cc84e4b 100644 --- a/libraries/aws_transit_gateway_connects.rb +++ b/libraries/aws_transit_gateway_connects.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSTransitGatewayConnects < AwsResourceBase - name 'aws_transit_gateway_connects' - desc 'Describes one or more Connect attachments.' + name "aws_transit_gateway_connects" + desc "Describes one or more Connect attachments." example " describe aws_transit_gateway_connects do @@ -17,15 +17,15 @@ class AWSTransitGatewayConnects < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) - .register_column(:transport_transit_gateway_attachment_ids, field: :transport_transit_gateway_attachment_id) - .register_column(:transit_gateway_ids, field: :transit_gateway_id) - .register_column(:states, field: :state) - .register_column(:creation_times, field: :creation_time) - .register_column(:options, field: :options) - .register_column(:creation_times, field: :creation_time) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) + .register_column(:transport_transit_gateway_attachment_ids, field: :transport_transit_gateway_attachment_id) + .register_column(:transit_gateway_ids, field: :transit_gateway_id) + .register_column(:states, field: :state) + .register_column(:creation_times, field: :creation_time) + .register_column(:options, field: :options) + .register_column(:creation_times, field: :creation_time) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_transit_gateway_multicast_domain.rb b/libraries/aws_transit_gateway_multicast_domain.rb index b5e8cb67e..1ef0bc3e1 100644 --- a/libraries/aws_transit_gateway_multicast_domain.rb +++ b/libraries/aws_transit_gateway_multicast_domain.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSTransitGatewayMulticastDomain < AwsResourceBase - name 'aws_transit_gateway_multicast_domain' - desc 'Describes one or more transit gateway multicast domains.' + name "aws_transit_gateway_multicast_domain" + desc "Describes one or more transit gateway multicast domains." example " describe aws_transit_gateway_multicast_domain(transit_gateway_multicast_domain_id: 'Domain ID') do diff --git a/libraries/aws_transit_gateway_multicast_domain_association.rb b/libraries/aws_transit_gateway_multicast_domain_association.rb index 4e761bbaf..189c787b9 100644 --- a/libraries/aws_transit_gateway_multicast_domain_association.rb +++ b/libraries/aws_transit_gateway_multicast_domain_association.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSTransitGatewayMulticastDomainAssociation < AwsResourceBase - name 'aws_transit_gateway_multicast_domain_association' - desc 'Gets information about the associations for the transit gateway multicast domain.' + name "aws_transit_gateway_multicast_domain_association" + desc "Gets information about the associations for the transit gateway multicast domain." example " describe aws_transit_gateway_multicast_domain_association(transit_gateway_multicast_domain_id: 'Domain ID') do diff --git a/libraries/aws_transit_gateway_multicast_domain_associations.rb b/libraries/aws_transit_gateway_multicast_domain_associations.rb index 2dc891cae..8b0f06682 100644 --- a/libraries/aws_transit_gateway_multicast_domain_associations.rb +++ b/libraries/aws_transit_gateway_multicast_domain_associations.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSTransitGatewayMulticastDomainAssociations < AwsResourceBase - name 'aws_transit_gateway_multicast_domain_associations' - desc 'Gets information about the associations for the transit gateway multicast domain.' + name "aws_transit_gateway_multicast_domain_associations" + desc "Gets information about the associations for the transit gateway multicast domain." example " describe aws_transit_gateway_multicast_domain_associations(transit_gateway_multicast_domain_id: 'id') do @@ -17,12 +17,12 @@ class AWSTransitGatewayMulticastDomainAssociations < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) - .register_column(:resource_ids, field: :resource_id) - .register_column(:resource_types, field: :resource_type) - .register_column(:resource_owner_ids, field: :resource_owner_id) - .register_column(:subnets, field: :subnet) - .install_filter_methods_on_resource(self, :table) + .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) + .register_column(:resource_ids, field: :resource_id) + .register_column(:resource_types, field: :resource_type) + .register_column(:resource_owner_ids, field: :resource_owner_id) + .register_column(:subnets, field: :subnet) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_transit_gateway_multicast_domains.rb b/libraries/aws_transit_gateway_multicast_domains.rb index 238aeb98f..8ec01312b 100644 --- a/libraries/aws_transit_gateway_multicast_domains.rb +++ b/libraries/aws_transit_gateway_multicast_domains.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSTransitGatewayMulticastDomains < AwsResourceBase - name 'aws_transit_gateway_multicast_domains' - desc 'Describes one or more transit gateway multicast domains.' + name "aws_transit_gateway_multicast_domains" + desc "Describes one or more transit gateway multicast domains." example " describe aws_transit_gateway_multicast_domains do @@ -17,15 +17,15 @@ class AWSTransitGatewayMulticastDomains < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:transit_gateway_multicast_domain_ids, field: :transit_gateway_multicast_domain_id) - .register_column(:transit_gateway_ids, field: :transit_gateway_id) - .register_column(:transit_gateway_multicast_domain_arns, field: :transit_gateway_multicast_domain_arn) - .register_column(:owner_ids, field: :owner_id) - .register_column(:options, field: :options) - .register_column(:states, field: :state) - .register_column(:creation_time, field: :creation_time) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:transit_gateway_multicast_domain_ids, field: :transit_gateway_multicast_domain_id) + .register_column(:transit_gateway_ids, field: :transit_gateway_id) + .register_column(:transit_gateway_multicast_domain_arns, field: :transit_gateway_multicast_domain_arn) + .register_column(:owner_ids, field: :owner_id) + .register_column(:options, field: :options) + .register_column(:states, field: :state) + .register_column(:creation_time, field: :creation_time) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_transit_gateway_multicast_group_member.rb b/libraries/aws_transit_gateway_multicast_group_member.rb index 0475cc187..c9f688e2c 100644 --- a/libraries/aws_transit_gateway_multicast_group_member.rb +++ b/libraries/aws_transit_gateway_multicast_group_member.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSTransitGatewayMulticastGroupMember < AwsResourceBase - name 'aws_transit_gateway_multicast_group_member' - desc 'Searches one or more transit gateway multicast groups and returns the group membership information.' + name "aws_transit_gateway_multicast_group_member" + desc "Searches one or more transit gateway multicast groups and returns the group membership information." example " describe aws_transit_gateway_multicast_group_member(transit_gateway_multicast_domain_id: 'test') do diff --git a/libraries/aws_transit_gateway_multicast_group_members.rb b/libraries/aws_transit_gateway_multicast_group_members.rb index cd43f5a2d..44ebfa068 100644 --- a/libraries/aws_transit_gateway_multicast_group_members.rb +++ b/libraries/aws_transit_gateway_multicast_group_members.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSTransitGatewayMulticastGroupMembers < AwsResourceBase - name 'aws_transit_gateway_multicast_group_members' - desc 'Searches one or more transit gateway multicast groups and returns the group membership information.' + name "aws_transit_gateway_multicast_group_members" + desc "Searches one or more transit gateway multicast groups and returns the group membership information." example " describe aws_transit_gateway_multicast_group_members(transit_gateway_multicast_domain_id: 'tgw-mcast-domain-1234567890') do @@ -17,18 +17,18 @@ class AWSTransitGatewayMulticastGroupMembers < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:group_ip_addresses, field: :group_ip_address) - .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) - .register_column(:subnet_ids, field: :subnet_id) - .register_column(:resource_ids, field: :resource_id) - .register_column(:resource_types, field: :resource_type) - .register_column(:resource_owner_ids, field: :resource_owner_id) - .register_column(:network_interface_ids, field: :network_interface_id) - .register_column(:group_members, field: :group_member) - .register_column(:group_sources, field: :group_source) - .register_column(:member_types, field: :member_type) - .register_column(:source_types, field: :source_type) - .install_filter_methods_on_resource(self, :table) + .register_column(:group_ip_addresses, field: :group_ip_address) + .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) + .register_column(:subnet_ids, field: :subnet_id) + .register_column(:resource_ids, field: :resource_id) + .register_column(:resource_types, field: :resource_type) + .register_column(:resource_owner_ids, field: :resource_owner_id) + .register_column(:network_interface_ids, field: :network_interface_id) + .register_column(:group_members, field: :group_member) + .register_column(:group_sources, field: :group_source) + .register_column(:member_types, field: :member_type) + .register_column(:source_types, field: :source_type) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_transit_gateway_multicast_group_source.rb b/libraries/aws_transit_gateway_multicast_group_source.rb index c2734648e..4a72f68e9 100644 --- a/libraries/aws_transit_gateway_multicast_group_source.rb +++ b/libraries/aws_transit_gateway_multicast_group_source.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSTransitGatewayMulticastGroupSource < AwsResourceBase - name 'aws_transit_gateway_multicast_group_source' - desc 'Searches one or more transit gateway multicast groups and returns the group membership information.' + name "aws_transit_gateway_multicast_group_source" + desc "Searches one or more transit gateway multicast groups and returns the group membership information." example " describe aws_transit_gateway_multicast_group_source(transit_gateway_multicast_domain_id: 'test') do diff --git a/libraries/aws_transit_gateway_multicast_group_sources.rb b/libraries/aws_transit_gateway_multicast_group_sources.rb index d9f6f867b..458c88f49 100644 --- a/libraries/aws_transit_gateway_multicast_group_sources.rb +++ b/libraries/aws_transit_gateway_multicast_group_sources.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSTransitGatewayMulticastGroupSources < AwsResourceBase - name 'aws_transit_gateway_multicast_group_sources' - desc 'Describes one or more transit gateway multicast domains.' + name "aws_transit_gateway_multicast_group_sources" + desc "Describes one or more transit gateway multicast domains." example " describe aws_transit_gateway_multicast_group_sources(transit_gateway_multicast_domain_id: 'tgw-mcast-domain-1234567890') do @@ -17,18 +17,18 @@ class AWSTransitGatewayMulticastGroupSources < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:group_ip_addresses, field: :group_ip_address) - .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) - .register_column(:subnet_ids, field: :subnet_id) - .register_column(:resource_ids, field: :resource_id) - .register_column(:resource_types, field: :resource_type) - .register_column(:resource_owner_ids, field: :resource_owner_id) - .register_column(:network_interface_ids, field: :network_interface_id) - .register_column(:group_members, field: :group_member) - .register_column(:group_sources, field: :group_source) - .register_column(:member_types, field: :member_type) - .register_column(:source_types, field: :source_type) - .install_filter_methods_on_resource(self, :table) + .register_column(:group_ip_addresses, field: :group_ip_address) + .register_column(:transit_gateway_attachment_ids, field: :transit_gateway_attachment_id) + .register_column(:subnet_ids, field: :subnet_id) + .register_column(:resource_ids, field: :resource_id) + .register_column(:resource_types, field: :resource_type) + .register_column(:resource_owner_ids, field: :resource_owner_id) + .register_column(:network_interface_ids, field: :network_interface_id) + .register_column(:group_members, field: :group_member) + .register_column(:group_sources, field: :group_source) + .register_column(:member_types, field: :member_type) + .register_column(:source_types, field: :source_type) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_transit_gateway_route.rb b/libraries/aws_transit_gateway_route.rb index c1e075455..2696f1c98 100644 --- a/libraries/aws_transit_gateway_route.rb +++ b/libraries/aws_transit_gateway_route.rb @@ -1,11 +1,11 @@ -require 'aws_backend' +require "aws_backend" class AwsTransitGatewayRoute < AwsResourceBase STATES = %w{active blackhole}.freeze TYPES = %w{static propagated}.freeze ATTACHMENT_RESOURCE_TYPES = %w{vpc vpn direct-connect-gateway connect peering tgw-peering}.freeze - name 'aws_transit_gateway_route' - desc 'Verifies settings for an AWS Transit Gateway.' + name "aws_transit_gateway_route" + desc "Verifies settings for an AWS Transit Gateway." example " describe aws_transit_gateway_route(transit_gateway_route_table_id: 'tgw-rtb-08acd74550c99e589', cidr_block: '0.0.0.0/16') do @@ -28,7 +28,7 @@ class AwsTransitGatewayRoute < AwsResourceBase end ATTACHMENT_RESOURCE_TYPES.each do |resource_type| - resource_type_name = resource_type.gsub('-', '_') + resource_type_name = resource_type.gsub("-", "_") method_name = "#{resource_type_name}_attachment?" define_method method_name do attachment_resource_type == resource_type @@ -49,7 +49,7 @@ def exists? end def resource_id - @response ? @display_name : '' + @response ? @display_name : "" end def to_s @@ -73,7 +73,7 @@ def fetch_response transit_gateway_route_table_id: @opts[:transit_gateway_route_table_id], filters: [ { - name: 'route-search.exact-match', + name: "route-search.exact-match", values: [@opts[:cidr_block]], }, ], @@ -84,7 +84,7 @@ def fetch_response end def route - raise StandardError, 'More than One Route is available' if @response.additional_routes_available + raise StandardError, "More than One Route is available" if @response.additional_routes_available @response.routes.first end diff --git a/libraries/aws_transit_gateway_routes.rb b/libraries/aws_transit_gateway_routes.rb index 3ab24fd3e..026b049ed 100644 --- a/libraries/aws_transit_gateway_routes.rb +++ b/libraries/aws_transit_gateway_routes.rb @@ -1,10 +1,10 @@ -require 'aws_backend' +require "aws_backend" class AwsTransitGatewayRoutes < AwsResourceBase TYPES = %w{static propagated}.freeze SUPPORTED_FILTER_PARAMS = %i(exact_match longest_prefix_match subnet_of_match supernet_of_match).freeze - name 'aws_transit_gateway_routes' - desc 'Verifies settings for list of AWS Transit Gateways.' + name "aws_transit_gateway_routes" + desc "Verifies settings for list of AWS Transit Gateways." example " describe aws_transit_gateway_routes(transit_gateway_route_table_id: 'tgw-rtb-08acd74550c99e589') do @@ -19,19 +19,19 @@ class AwsTransitGatewayRoutes < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:cidr_blocks, field: :cidr_block) - .register_column(:prefix_list_ids, field: :prefix_list_id) - .register_column(:types, field: :type, style: :simple) - .register_column(:states, field: :state, style: :simple) - .register_column(:static, field: :static, style: :simple) - .register_column(:propagated, field: :propagated, style: :simple) - .register_column(:active, field: :active, style: :simple) - .register_column(:blackhole, field: :blackhole, style: :simple) - .register_column(:attachment_ids, field: :attachment_id, style: :simple) - .register_column(:attachment_resource_ids, field: :attachment_resource_id, style: :simple) - .register_column(:attachment_resource_types, field: :attachment_resource_type, style: :simple) - .register_column(:attached_vpc_ids, field: :attached_vpc_id, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:cidr_blocks, field: :cidr_block) + .register_column(:prefix_list_ids, field: :prefix_list_id) + .register_column(:types, field: :type, style: :simple) + .register_column(:states, field: :state, style: :simple) + .register_column(:static, field: :static, style: :simple) + .register_column(:propagated, field: :propagated, style: :simple) + .register_column(:active, field: :active, style: :simple) + .register_column(:blackhole, field: :blackhole, style: :simple) + .register_column(:attachment_ids, field: :attachment_id, style: :simple) + .register_column(:attachment_resource_ids, field: :attachment_resource_id, style: :simple) + .register_column(:attachment_resource_types, field: :attachment_resource_type, style: :simple) + .register_column(:attached_vpc_ids, field: :attached_vpc_id, style: :simple) + .install_filter_methods_on_resource(self, :table) def initialize(opts) super @@ -78,15 +78,15 @@ def populate_filter_table @table = routes.map do |route| row = route.to_h row[:cidr_block] = row.delete(:destination_cidr_block) - row[:static] = (row[:type] == 'static') - row[:propagated] = (row[:type] == 'propagated') - row[:active] = (row[:state] == 'active') - row[:blackhole] = (row[:state] == 'blackhole') + row[:static] = (row[:type] == "static") + row[:propagated] = (row[:type] == "propagated") + row[:active] = (row[:state] == "active") + row[:blackhole] = (row[:state] == "blackhole") tgw = transit_gw_attachment_for(route) row[:attachment_id] = tgw&.transit_gateway_attachment_id row[:attachment_resource_type] = tgw&.resource_type row[:attachment_resource_id] = tgw&.resource_id - row[:attached_vpc_id] = (row[:attachment_resource_type] == 'vpc' && row[:attachment_resource_id]) + row[:attached_vpc_id] = (row[:attachment_resource_type] == "vpc" && row[:attachment_resource_id]) row.delete(:transit_gateway_attachments) row end @@ -99,7 +99,7 @@ def transit_gw_attachment_for(route) end def format_route_search_for(param) - format('route-search.%s', param.to_s.gsub('_', '-')) + format("route-search.%s", param.to_s.gsub("_", "-")) end def build_filters_from_params @@ -111,7 +111,7 @@ def build_filters_from_params def default_filters [ - name: 'type', + name: "type", values: TYPES, ] end diff --git a/libraries/aws_vpc.rb b/libraries/aws_vpc.rb index 9cdb97484..69765c3c0 100644 --- a/libraries/aws_vpc.rb +++ b/libraries/aws_vpc.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsVpc < AwsResourceBase - name 'aws_vpc' - desc 'Verifies settings for an AWS VPC.' + name "aws_vpc" + desc "Verifies settings for an AWS VPC." example " describe aws_vpc(vpc_id: 'vpc-12345678') do @@ -20,12 +20,12 @@ def initialize(opts = {}) validate_parameters(allow: [:vpc_id]) if opts[:vpc_id].nil? - @display_name = 'default' - filter = { name: 'isDefault', values: ['true'] } + @display_name = "default" + filter = { name: "isDefault", values: ["true"] } else @display_name = opts[:vpc_id] raise ArgumentError, "#{@__resource_name__}: VPC ID must be in the format 'vpc-' followed by 8 or 17 hexadecimal characters." if opts[:vpc_id] !~ /^vpc\-([0-9a-f]{8})|(^vpc\-[0-9a-f]{17})$/ - filter = { name: 'vpc-id', values: [opts[:vpc_id]] } + filter = { name: "vpc-id", values: [opts[:vpc_id]] } end catch_aws_errors do @@ -61,7 +61,7 @@ def exists? end def resource_id - @response ? @display_name : '' + @response ? @display_name : "" end def has_cidr_block_associated?(cidr_block) @@ -105,13 +105,13 @@ def has_ipv6_cidr_block_disassociated?(ipv6_cidr_block) end def has_network_border_group_value?(ipv6_cidr_block:, network_border_group:) - raise ArgumentError, 'parameters `ipv6_cidr_block` and `network_border_group` should be present' unless ipv6_cidr_block && network_border_group + raise ArgumentError, "parameters `ipv6_cidr_block` and `network_border_group` should be present" unless ipv6_cidr_block && network_border_group ipv6_cidr_block_associations.any? { |assoc| assoc.ipv_6_cidr_block == ipv6_cidr_block && assoc.network_border_group == network_border_group } end def has_ipv6_pool_value?(ipv6_cidr_block:, ipv6_pool:) - raise ArgumentError, 'parameters `ipv6_cidr_block` and `ipv6_pool` should be present' unless ipv6_cidr_block && ipv6_pool + raise ArgumentError, "parameters `ipv6_cidr_block` and `ipv6_pool` should be present" unless ipv6_cidr_block && ipv6_pool ipv6_cidr_block_associations.any? { |assoc| assoc.ipv_6_cidr_block == ipv6_cidr_block && assoc.ipv_6_pool == ipv6_pool } end diff --git a/libraries/aws_vpc_endpoint.rb b/libraries/aws_vpc_endpoint.rb index cea24d5c3..e26d34a27 100644 --- a/libraries/aws_vpc_endpoint.rb +++ b/libraries/aws_vpc_endpoint.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsVpce < AwsResourceBase - name 'aws_vpc_endpoint' - desc 'Verifies settings for an AWS VPC Endpoint.' + name "aws_vpc_endpoint" + desc "Verifies settings for an AWS VPC Endpoint." example " describe aws_vpc_endpoint(vpc_endpoint_id: 'vpce-12345678123456789') do @@ -20,7 +20,7 @@ def initialize(opts = {}) end @display_name = opts[:vpc_endpoint_id] - filter = { name: 'vpc-endpoint-id', values: [opts[:vpc_endpoint_id]] } + filter = { name: "vpc-endpoint-id", values: [opts[:vpc_endpoint_id]] } catch_aws_errors do resp = @aws.compute_client.describe_vpc_endpoints({ filters: [filter] }) @vpce = resp.vpc_endpoints[0].to_h @@ -34,7 +34,7 @@ def exists? def available? return false unless exists? - @vpce[:state] == 'available' + @vpce[:state] == "available" end def private_dns_enabled? @@ -43,12 +43,12 @@ def private_dns_enabled? def interface? return false unless exists? - @vpce[:vpc_endpoint_type] == 'Interface' + @vpce[:vpc_endpoint_type] == "Interface" end def gateway? return false unless exists? - @vpce[:vpc_endpoint_type] == 'Gateway' + @vpce[:vpc_endpoint_type] == "Gateway" end def resource_id diff --git a/libraries/aws_vpc_endpoint_connection_notification.rb b/libraries/aws_vpc_endpoint_connection_notification.rb index e4c2b026d..24b81ff67 100644 --- a/libraries/aws_vpc_endpoint_connection_notification.rb +++ b/libraries/aws_vpc_endpoint_connection_notification.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsVpcEndpointConnectionNotification < AwsResourceBase - name 'aws_vpc_endpoint_connection_notification' - desc 'Verifies settings for an AWS VPC Endpoint Notification.' + name "aws_vpc_endpoint_connection_notification" + desc "Verifies settings for an AWS VPC Endpoint Notification." example " describe aws_vpc_endpoint_connection_notification(connection-notification-id: 'vpce-12345678123456789') do @@ -37,7 +37,7 @@ def exists? end def connection_notification_state_enabled? - @vpcen[:connection_notification_state]=='Enabled' + @vpcen[:connection_notification_state]=="Enabled" end def resource_id diff --git a/libraries/aws_vpc_endpoint_connection_notifications.rb b/libraries/aws_vpc_endpoint_connection_notifications.rb index c34e8eb0e..d73b456a2 100644 --- a/libraries/aws_vpc_endpoint_connection_notifications.rb +++ b/libraries/aws_vpc_endpoint_connection_notifications.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsVpcEndpointConnectionNotifications < AwsResourceBase - name 'aws_vpc_endpoint_connection_notifications' - desc 'Verifies settings for all the AWS VPC Endpoint Notifications.' + name "aws_vpc_endpoint_connection_notifications" + desc "Verifies settings for all the AWS VPC Endpoint Notifications." example " describe aws_vpc_endpoint_connection_notifications do @@ -14,14 +14,14 @@ class AwsVpcEndpointConnectionNotifications < AwsResourceBase # FilterTable setup FilterTable.create - .register_column(:connection_notification_ids, field: :connection_notification_id) - .register_column(:service_ids, field: :service_id) - .register_column(:connection_notification_types, field: :connection_notification_type) - .register_column(:connection_notification_arns, field: :connection_notification_arn) - .register_column(:connection_events, field: :connection_events) - .register_column(:connection_notification_state, field: :connection_notification_state) - .register_column(:vpc_endpoint_id, field: :vpc_endpoint_id) - .install_filter_methods_on_resource(self, :table) + .register_column(:connection_notification_ids, field: :connection_notification_id) + .register_column(:service_ids, field: :service_id) + .register_column(:connection_notification_types, field: :connection_notification_type) + .register_column(:connection_notification_arns, field: :connection_notification_arn) + .register_column(:connection_events, field: :connection_events) + .register_column(:connection_notification_state, field: :connection_notification_state) + .register_column(:vpc_endpoint_id, field: :vpc_endpoint_id) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_vpc_endpoint_service.rb b/libraries/aws_vpc_endpoint_service.rb index 446260bdf..622e13a2f 100644 --- a/libraries/aws_vpc_endpoint_service.rb +++ b/libraries/aws_vpc_endpoint_service.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsVPCEndpointService < AwsResourceBase - name 'aws_vpc_endpoint_service' - desc 'Verifies settings for an AWS VPC End Point Service.' + name "aws_vpc_endpoint_service" + desc "Verifies settings for an AWS VPC End Point Service." example " describe aws_vpc_endpoint_service(service_name: 'aws.sagemaker.us-east-2.notebook') do @@ -90,7 +90,7 @@ def service_type end def service_detail - raise StandardError, 'More than One Route is available' if @response.next_token + raise StandardError, "More than One Route is available" if @response.next_token @response.service_details.first end diff --git a/libraries/aws_vpc_endpoint_service_permission.rb b/libraries/aws_vpc_endpoint_service_permission.rb index 627825c7f..fd0c2dba0 100644 --- a/libraries/aws_vpc_endpoint_service_permission.rb +++ b/libraries/aws_vpc_endpoint_service_permission.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsVPCEndpointServicePermission < AwsResourceBase - name 'aws_vpc_endpoint_service_permission' - desc 'Describes the principal (service consumers) that are permitted to discover your VPC endpoint service.' + name "aws_vpc_endpoint_service_permission" + desc "Describes the principal (service consumers) that are permitted to discover your VPC endpoint service." example " describe aws_vpc_endpoint_service_permission(service_id: 'vpce-svc-04deb776dc2b8e67f', principal: 'arn:aws:iam::112758395563:user/chef-server') do it { should exist } @@ -23,7 +23,7 @@ def initialize(opts) validate_parameters(required: %i(service_id principal)) filters = { filters: [ - name: 'principal', + name: "principal", values: [opts[:principal]], ], } @@ -37,7 +37,7 @@ def exists? end def resource_id - "#{@opts ? @opts[:service_id] : ''}_#{@opts ? @opts[:principal] : ''}" + "#{@opts ? @opts[:service_id] : ""}_#{@opts ? @opts[:principal] : ""}" end def to_s diff --git a/libraries/aws_vpc_endpoint_service_permissions.rb b/libraries/aws_vpc_endpoint_service_permissions.rb index 81b65a357..3cf98776d 100644 --- a/libraries/aws_vpc_endpoint_service_permissions.rb +++ b/libraries/aws_vpc_endpoint_service_permissions.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsVPCEndpointServicePermissions < AwsResourceBase - name 'aws_vpc_endpoint_service_permissions' - desc 'Describes the principals (service consumers) that are permitted to discover your VPC endpoint service.' + name "aws_vpc_endpoint_service_permissions" + desc "Describes the principals (service consumers) that are permitted to discover your VPC endpoint service." example " describe aws_vpc_endpoint_service_permissions(service_id: 'vpce-svc-04deb776dc2b8e67f') do it { should exist } @@ -12,9 +12,9 @@ class AwsVPCEndpointServicePermissions < AwsResourceBase attr_reader :table, :params FilterTable.create - .register_column(:principal_types, field: :principal_type, style: :simple) - .register_column(:principals, field: :principal) - .install_filter_methods_on_resource(self, :table) + .register_column(:principal_types, field: :principal_type, style: :simple) + .register_column(:principals, field: :principal) + .install_filter_methods_on_resource(self, :table) def initialize(opts) super diff --git a/libraries/aws_vpc_endpoint_services.rb b/libraries/aws_vpc_endpoint_services.rb index 8f9757858..d9ebe869b 100644 --- a/libraries/aws_vpc_endpoint_services.rb +++ b/libraries/aws_vpc_endpoint_services.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsVPCEndpointServices < AwsResourceBase - name 'aws_vpc_endpoint_services' - desc 'Verifies settings for a collection of AWS VPC End Point Services.' + name "aws_vpc_endpoint_services" + desc "Verifies settings for a collection of AWS VPC End Point Services." example " describe aws_vpc_endpoint_services do @@ -13,19 +13,19 @@ class AwsVPCEndpointServices < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:service_names, field: :service_name) - .register_column(:service_ids, field: :service_id) - .register_column(:service_types, field: :service_type) - .register_column(:availability_zones, field: :availability_zones, style: :simple) - .register_column(:owners, field: :owner) - .register_column(:base_endpoint_dns_names, field: :base_endpoint_dns_names, style: :simple) - .register_column(:private_dns_names, field: :private_dns_name) - .register_column(:vpc_endpoint_policy_supported, field: :vpc_endpoint_policy_supported) - .register_column(:acceptance_required, field: :acceptance_required) - .register_column(:manages_vpc_endpoints, field: :manages_vpc_endpoints) - .register_column(:tags, field: :tags) - .register_column(:private_dns_name_verification_states, field: :private_dns_name_verification_state) - .install_filter_methods_on_resource(self, :table) + .register_column(:service_names, field: :service_name) + .register_column(:service_ids, field: :service_id) + .register_column(:service_types, field: :service_type) + .register_column(:availability_zones, field: :availability_zones, style: :simple) + .register_column(:owners, field: :owner) + .register_column(:base_endpoint_dns_names, field: :base_endpoint_dns_names, style: :simple) + .register_column(:private_dns_names, field: :private_dns_name) + .register_column(:vpc_endpoint_policy_supported, field: :vpc_endpoint_policy_supported) + .register_column(:acceptance_required, field: :acceptance_required) + .register_column(:manages_vpc_endpoints, field: :manages_vpc_endpoints) + .register_column(:tags, field: :tags) + .register_column(:private_dns_name_verification_states, field: :private_dns_name_verification_state) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_vpc_endpoints.rb b/libraries/aws_vpc_endpoints.rb index d53a6b3ee..db70a2bdd 100644 --- a/libraries/aws_vpc_endpoints.rb +++ b/libraries/aws_vpc_endpoints.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsVpces < AwsResourceBase - name 'aws_vpc_endpoints' - desc 'Verifies settings for an AWS VPC Endpoints in bulk.' + name "aws_vpc_endpoints" + desc "Verifies settings for an AWS VPC Endpoints in bulk." example " describe aws_vpc_endpoints do @@ -13,16 +13,16 @@ class AwsVpces < AwsResourceBase # FilterTable setup FilterTable.create - .register_column(:vpc_endpoint_ids, field: :vpc_endpoint_id) - .register_column(:vpc_endpoint_types, field: :vpc_endpoint_type) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:service_names, field: :service_name) - .register_column(:states, field: :state) - .register_column(:route_table_ids, field: :route_table_ids) - .register_column(:subnet_ids, field: :subnet_ids) - .register_column(:private_dns_enabled, field: :private_dns_enabled) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:vpc_endpoint_ids, field: :vpc_endpoint_id) + .register_column(:vpc_endpoint_types, field: :vpc_endpoint_type) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:service_names, field: :service_name) + .register_column(:states, field: :state) + .register_column(:route_table_ids, field: :route_table_ids) + .register_column(:subnet_ids, field: :subnet_ids) + .register_column(:private_dns_enabled, field: :private_dns_enabled) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_vpcs.rb b/libraries/aws_vpcs.rb index 916681e99..e5f7a2de5 100644 --- a/libraries/aws_vpcs.rb +++ b/libraries/aws_vpcs.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsVpcs < AwsResourceBase - name 'aws_vpcs' - desc 'Verifies settings for an AWS VPCs in bulk.' + name "aws_vpcs" + desc "Verifies settings for an AWS VPCs in bulk." example " describe aws_vpcs do @@ -13,23 +13,23 @@ class AwsVpcs < AwsResourceBase # FilterTable setup FilterTable.create - .register_column(:cidr_blocks, field: :cidr_block, style: :simple) - .register_column(:vpc_ids, field: :vpc_id) - .register_column(:states, field: :state, style: :simple) - .register_column(:dhcp_options_ids, field: :dhcp_options_id) - .register_column(:instance_tenancies, field: :instance_tenancy, style: :simple) - .register_column(:is_default, field: :is_default, style: :simple) - .register_column(:defaults, field: :defaults, style: :simple) - .register_column(:tags, field: :tags) - .register_column(:cidr_block_association_ids, field: :cidr_block_association_ids, style: :simple) - .register_column(:associated_cidr_blocks, field: :associated_cidr_blocks, style: :simple) - .register_column(:cidr_block_states, field: :cidr_block_states, style: :simple) - .register_column(:ipv6_cidr_block_association_ids, field: :ipv6_cidr_block_association_ids, style: :simple) - .register_column(:ipv6_cidr_blocks, field: :ipv6_cidr_blocks, style: :simple) - .register_column(:ipv6_cidr_block_states, field: :ipv6_cidr_block_states, style: :simple) - .register_column(:ipv6_network_border_groups, field: :ipv6_network_border_groups, style: :simple) - .register_column(:ipv6_pools, field: :ipv6_pools, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:cidr_blocks, field: :cidr_block, style: :simple) + .register_column(:vpc_ids, field: :vpc_id) + .register_column(:states, field: :state, style: :simple) + .register_column(:dhcp_options_ids, field: :dhcp_options_id) + .register_column(:instance_tenancies, field: :instance_tenancy, style: :simple) + .register_column(:is_default, field: :is_default, style: :simple) + .register_column(:defaults, field: :defaults, style: :simple) + .register_column(:tags, field: :tags) + .register_column(:cidr_block_association_ids, field: :cidr_block_association_ids, style: :simple) + .register_column(:associated_cidr_blocks, field: :associated_cidr_blocks, style: :simple) + .register_column(:cidr_block_states, field: :cidr_block_states, style: :simple) + .register_column(:ipv6_cidr_block_association_ids, field: :ipv6_cidr_block_association_ids, style: :simple) + .register_column(:ipv6_cidr_blocks, field: :ipv6_cidr_blocks, style: :simple) + .register_column(:ipv6_cidr_block_states, field: :ipv6_cidr_block_states, style: :simple) + .register_column(:ipv6_network_border_groups, field: :ipv6_network_border_groups, style: :simple) + .register_column(:ipv6_pools, field: :ipv6_pools, style: :simple) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) @@ -69,16 +69,16 @@ def flat_hash_for(vpc) hash[:tags] = map_tags(vpc.tags) cidr_block_associations = vpc.cidr_block_association_set - hash[:cidr_block_association_ids] = map_attributes_from(cidr_block_associations, 'association_id') - hash[:associated_cidr_blocks] = map_attributes_from(cidr_block_associations, 'cidr_block') - hash[:cidr_block_states] = map_attributes_from(cidr_block_associations, 'cidr_block_state&.state') + hash[:cidr_block_association_ids] = map_attributes_from(cidr_block_associations, "association_id") + hash[:associated_cidr_blocks] = map_attributes_from(cidr_block_associations, "cidr_block") + hash[:cidr_block_states] = map_attributes_from(cidr_block_associations, "cidr_block_state&.state") ipv6_cidr_block_associations = vpc.ipv_6_cidr_block_association_set - hash[:ipv6_cidr_block_association_ids] = map_attributes_from(ipv6_cidr_block_associations, 'association_id') - hash[:ipv6_cidr_blocks] = map_attributes_from(ipv6_cidr_block_associations, 'ipv_6_cidr_block') - hash[:ipv6_cidr_block_states] = map_attributes_from(ipv6_cidr_block_associations, 'ipv_6_cidr_block_state&.state') - hash[:ipv6_network_border_groups] = map_attributes_from(ipv6_cidr_block_associations, 'network_border_group') - hash[:ipv6_pools] = map_attributes_from(ipv6_cidr_block_associations, 'ipv_6_pool') + hash[:ipv6_cidr_block_association_ids] = map_attributes_from(ipv6_cidr_block_associations, "association_id") + hash[:ipv6_cidr_blocks] = map_attributes_from(ipv6_cidr_block_associations, "ipv_6_cidr_block") + hash[:ipv6_cidr_block_states] = map_attributes_from(ipv6_cidr_block_associations, "ipv_6_cidr_block_state&.state") + hash[:ipv6_network_border_groups] = map_attributes_from(ipv6_cidr_block_associations, "network_border_group") + hash[:ipv6_pools] = map_attributes_from(ipv6_cidr_block_associations, "ipv_6_pool") end end diff --git a/libraries/aws_vpn_connection.rb b/libraries/aws_vpn_connection.rb index 3d648cc2c..9ecf80225 100644 --- a/libraries/aws_vpn_connection.rb +++ b/libraries/aws_vpn_connection.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsVPNConnection < AwsResourceBase - name 'aws_vpn_connection' - desc 'Verifies settings for a single AWS VPN Connection.' + name "aws_vpn_connection" + desc "Verifies settings for a single AWS VPN Connection." example <<-EXAMPLE describe aws_vpn_connection(vpn_connection_id: 'vpn-1234567890') do it { should exist } @@ -50,6 +50,6 @@ def query_with(params) end def validate_identifier - raise ArgumentError, 'parameter `vpn_connection_id` cannot be blank' if @opts[:vpn_connection_id].blank? + raise ArgumentError, "parameter `vpn_connection_id` cannot be blank" if @opts[:vpn_connection_id].blank? end end diff --git a/libraries/aws_vpn_connections.rb b/libraries/aws_vpn_connections.rb index cdb676693..bdcc3a964 100644 --- a/libraries/aws_vpn_connections.rb +++ b/libraries/aws_vpn_connections.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsVpnConnections < AwsResourceBase - name 'aws_vpn_connections' - desc 'Verifies settings for an AWS VPN connections in bulk' + name "aws_vpn_connections" + desc "Verifies settings for an AWS VPN connections in bulk" example " describe aws_vpn_connections do @@ -13,14 +13,14 @@ class AwsVpnConnections < AwsResourceBase # FilterTable setup FilterTable.create - .register_column(:vpn_connection_ids, field: :vpn_connection_id) - .register_column(:vpn_gateway_ids, field: :vpn_gateway_id) - .register_column(:outside_ip_addresses, field: :outside_ip_address) - .register_column(:tunnel_inside_cidrs, field: :tunnel_inside_cidr) - .register_column(:states, field: :state) - .register_column(:types, field: :type) - .register_column(:tags, field: :tags) - .install_filter_methods_on_resource(self, :table) + .register_column(:vpn_connection_ids, field: :vpn_connection_id) + .register_column(:vpn_gateway_ids, field: :vpn_gateway_id) + .register_column(:outside_ip_addresses, field: :outside_ip_address) + .register_column(:tunnel_inside_cidrs, field: :tunnel_inside_cidr) + .register_column(:states, field: :state) + .register_column(:types, field: :type) + .register_column(:tags, field: :tags) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super(opts) diff --git a/libraries/aws_vpn_gateway.rb b/libraries/aws_vpn_gateway.rb index 72b2c086b..079ac2cc6 100644 --- a/libraries/aws_vpn_gateway.rb +++ b/libraries/aws_vpn_gateway.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsVPNGateway < AwsResourceBase - name 'aws_vpn_gateway' - desc 'Verifies settings for a single AWS VPN Gateway.' + name "aws_vpn_gateway" + desc "Verifies settings for a single AWS VPN Gateway." example " describe aws_vpn_gateway(vpn_gateway_id: 'vgw-014aef8a0689b8f43') do @@ -39,7 +39,7 @@ def vpc_id def attached? return false if attachments.nil? || attachments.empty? - attachments.first.state == 'attached' + attachments.first.state == "attached" end def detached? @@ -47,7 +47,7 @@ def detached? end def resource_id - @opts ? @opts[:vpn_gateway_id] : '' + @opts ? @opts[:vpn_gateway_id] : "" end private @@ -73,7 +73,7 @@ def attachments end def validate_identifier - raise ArgumentError, 'parameter `vpn_gateway_id` cannot be blank' if @opts[:vpn_gateway_id].nil? || @opts[:vpn_gateway_id].empty? - raise ArgumentError, 'parameter `vpn_gateway_id` should start with `vgw-` followed by alpha numeric characters' if @opts[:vpn_gateway_id] !~ /^vgw-[a-z0-9]+$/ + raise ArgumentError, "parameter `vpn_gateway_id` cannot be blank" if @opts[:vpn_gateway_id].nil? || @opts[:vpn_gateway_id].empty? + raise ArgumentError, "parameter `vpn_gateway_id` should start with `vgw-` followed by alpha numeric characters" if @opts[:vpn_gateway_id] !~ /^vgw-[a-z0-9]+$/ end end diff --git a/libraries/aws_vpn_gateways.rb b/libraries/aws_vpn_gateways.rb index 3fd6f49a3..f9e7804be 100644 --- a/libraries/aws_vpn_gateways.rb +++ b/libraries/aws_vpn_gateways.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AwsVPNGateways < AwsResourceBase - name 'aws_vpn_gateways' - desc 'Verifies settings for AWS VPN Gateways.' + name "aws_vpn_gateways" + desc "Verifies settings for AWS VPN Gateways." example " describe aws_vpn_gateways do @@ -13,14 +13,14 @@ class AwsVPNGateways < AwsResourceBase attr_reader :table FilterTable.create - .register_column(:availability_zones, field: :availability_zone, style: :simple) - .register_column(:states, field: :state) - .register_column(:types, field: :type) - .register_column(:vpn_gateway_ids, field: :vpn_gateway_id) - .register_column(:amazon_side_asns, field: :amazon_side_asn) - .register_column(:tags, field: :tags) - .register_column(:vpc_attachments, field: :vpc_attachments) - .install_filter_methods_on_resource(self, :table) + .register_column(:availability_zones, field: :availability_zone, style: :simple) + .register_column(:states, field: :state) + .register_column(:types, field: :type) + .register_column(:vpn_gateway_ids, field: :vpn_gateway_id) + .register_column(:amazon_side_asns, field: :amazon_side_asn) + .register_column(:tags, field: :tags) + .register_column(:vpc_attachments, field: :vpc_attachments) + .install_filter_methods_on_resource(self, :table) def initialize(opts = {}) super diff --git a/libraries/aws_waf_byte_match_set.rb b/libraries/aws_waf_byte_match_set.rb index df7c8a34c..02e6aa51d 100644 --- a/libraries/aws_waf_byte_match_set.rb +++ b/libraries/aws_waf_byte_match_set.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSWAFByteMatchSet < AwsResourceBase - name 'aws_waf_byte_match_set' - desc 'Describes one WAF byte set.' + name "aws_waf_byte_match_set" + desc "Describes one WAF byte set." example " describe aws_waf_byte_match_set(byte_match_set_id: 'BYTE_MATCH_SET_ID') do diff --git a/libraries/aws_waf_byte_match_sets.rb b/libraries/aws_waf_byte_match_sets.rb index 05ab4e74b..cd908ce31 100644 --- a/libraries/aws_waf_byte_match_sets.rb +++ b/libraries/aws_waf_byte_match_sets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSWAFByteMatchSets < AwsResourceBase - name 'aws_waf_byte_match_sets' - desc 'Verifies settings for all the WAF rules.' + name "aws_waf_byte_match_sets" + desc "Verifies settings for all the WAF rules." example " describe aws_waf_byte_match_sets do @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:byte_match_set_ids, field: :byte_match_set_id, style: :simple) - .register_column(:names, field: :name, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:byte_match_set_ids, field: :byte_match_set_id, style: :simple) + .register_column(:names, field: :name, style: :simple) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_waf_ip_set.rb b/libraries/aws_waf_ip_set.rb index 3ad2bf11f..9235dcd81 100644 --- a/libraries/aws_waf_ip_set.rb +++ b/libraries/aws_waf_ip_set.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSWAFIPSet < AwsResourceBase - name 'aws_waf_ip_set' - desc 'Describes one WAF IP set.' + name "aws_waf_ip_set" + desc "Describes one WAF IP set." example " describe aws_waf_ip_set(ip_set_id: 'IP_SET_ID') do diff --git a/libraries/aws_waf_ip_sets.rb b/libraries/aws_waf_ip_sets.rb index c0eb70ad2..e314e32a5 100644 --- a/libraries/aws_waf_ip_sets.rb +++ b/libraries/aws_waf_ip_sets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSWAFIPSets < AwsResourceBase - name 'aws_waf_ip_sets' - desc 'Verifies settings for all the IP sets.' + name "aws_waf_ip_sets" + desc "Verifies settings for all the IP sets." example " describe aws_waf_ip_sets do @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:ip_set_ids, field: :ip_set_id, style: :simple) - .register_column(:names, field: :name, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:ip_set_ids, field: :ip_set_id, style: :simple) + .register_column(:names, field: :name, style: :simple) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_waf_rule.rb b/libraries/aws_waf_rule.rb index aae044361..cef07fa77 100644 --- a/libraries/aws_waf_rule.rb +++ b/libraries/aws_waf_rule.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSWAFRule < AwsResourceBase - name 'aws_waf_rule' - desc 'Describes one WAF rule.' + name "aws_waf_rule" + desc "Describes one WAF rule." example " describe aws_waf_rule(rule_id: 'RULE_ID') do diff --git a/libraries/aws_waf_rules.rb b/libraries/aws_waf_rules.rb index 7bda9c93c..74b7f0267 100644 --- a/libraries/aws_waf_rules.rb +++ b/libraries/aws_waf_rules.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSWAFRules < AwsResourceBase - name 'aws_waf_rules' - desc 'Verifies settings for all the WAF rules.' + name "aws_waf_rules" + desc "Verifies settings for all the WAF rules." example " describe aws_waf_rules do @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:rule_ids, field: :rule_id) - .register_column(:names, field: :name) - .install_filter_methods_on_resource(self, :table) + .register_column(:rule_ids, field: :rule_id) + .register_column(:names, field: :name) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_waf_size_constraint_set.rb b/libraries/aws_waf_size_constraint_set.rb index c621eaf00..7848dd90c 100644 --- a/libraries/aws_waf_size_constraint_set.rb +++ b/libraries/aws_waf_size_constraint_set.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSWAFSizeConstraintSet < AwsResourceBase - name 'aws_waf_size_constraint_set' - desc 'Describes one WAF size constraint set.' + name "aws_waf_size_constraint_set" + desc "Describes one WAF size constraint set." example " describe aws_waf_size_constraint_set(size_constraint_set_id: 'SIZE_CONSTRAINT_SET_ID') do diff --git a/libraries/aws_waf_size_constraint_sets.rb b/libraries/aws_waf_size_constraint_sets.rb index cce3bcab1..cf8bf1e72 100644 --- a/libraries/aws_waf_size_constraint_sets.rb +++ b/libraries/aws_waf_size_constraint_sets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSWAFSizeConstraintSets < AwsResourceBase - name 'aws_waf_size_constraint_sets' - desc 'Describes all the WAF size constraint sets.' + name "aws_waf_size_constraint_sets" + desc "Describes all the WAF size constraint sets." example " describe aws_waf_size_constraint_set do @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:size_constraint_set_ids, field: :size_constraint_set_id, style: :simple) - .register_column(:names, field: :name, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:size_constraint_set_ids, field: :size_constraint_set_id, style: :simple) + .register_column(:names, field: :name, style: :simple) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_waf_sql_injection_match_set.rb b/libraries/aws_waf_sql_injection_match_set.rb index b320ac633..219d83547 100644 --- a/libraries/aws_waf_sql_injection_match_set.rb +++ b/libraries/aws_waf_sql_injection_match_set.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSWAFSQLInjectionMatchSet < AwsResourceBase - name 'aws_waf_sql_injection_match_set' - desc 'Describes one WAF SQL Injection match set.' + name "aws_waf_sql_injection_match_set" + desc "Describes one WAF SQL Injection match set." example " describe aws_waf_sql_injection_match_set(sql_injection_match_set_id: 'SQL_INJECTION_MATCH_SET_ID') do diff --git a/libraries/aws_waf_sql_injection_match_sets.rb b/libraries/aws_waf_sql_injection_match_sets.rb index 259b10b74..16938c939 100644 --- a/libraries/aws_waf_sql_injection_match_sets.rb +++ b/libraries/aws_waf_sql_injection_match_sets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSWAFSQLInjectionMatchSets < AwsResourceBase - name 'aws_waf_sql_injection_match_sets' - desc 'Verifies settings for all the WAF SQL Injection match set.' + name "aws_waf_sql_injection_match_sets" + desc "Verifies settings for all the WAF SQL Injection match set." example " describe aws_waf_sql_injection_match_sets do @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:sql_injection_match_set_ids, field: :sql_injection_match_set_id, style: :simple) - .register_column(:names, field: :name, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:sql_injection_match_set_ids, field: :sql_injection_match_set_id, style: :simple) + .register_column(:names, field: :name, style: :simple) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_waf_web_acl.rb b/libraries/aws_waf_web_acl.rb index e8a6185b6..c84af3ddd 100644 --- a/libraries/aws_waf_web_acl.rb +++ b/libraries/aws_waf_web_acl.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSWAFWebACL < AwsResourceBase - name 'aws_waf_web_acl' - desc 'Describes one WAF Web ACL.' + name "aws_waf_web_acl" + desc "Describes one WAF Web ACL." example " describe aws_waf_web_acl(web_acl_id: 'WEB_ACL_ID') do diff --git a/libraries/aws_waf_web_acls.rb b/libraries/aws_waf_web_acls.rb index 02c97e383..f9d372c08 100644 --- a/libraries/aws_waf_web_acls.rb +++ b/libraries/aws_waf_web_acls.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSWAFWebACLS < AwsResourceBase - name 'aws_waf_web_acls' - desc 'Verifies settings for all the Web ACLs.' + name "aws_waf_web_acls" + desc "Verifies settings for all the Web ACLs." example " describe aws_waf_web_acls do @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:web_acl_ids, field: :web_acl_id, style: :simple) - .register_column(:names, field: :name, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:web_acl_ids, field: :web_acl_id, style: :simple) + .register_column(:names, field: :name, style: :simple) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do diff --git a/libraries/aws_waf_xss_match_set.rb b/libraries/aws_waf_xss_match_set.rb index 99d79aacf..6a4d77c13 100644 --- a/libraries/aws_waf_xss_match_set.rb +++ b/libraries/aws_waf_xss_match_set.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSWAFXSSMatchSet < AwsResourceBase - name 'aws_waf_xss_match_set' - desc 'Describes one WAF XSS match set.' + name "aws_waf_xss_match_set" + desc "Describes one WAF XSS match set." example " describe aws_waf_xss_match_set(xss_match_set_id: 'XSS_MATCH_SET_ID') do diff --git a/libraries/aws_waf_xss_match_sets.rb b/libraries/aws_waf_xss_match_sets.rb index 71fb8ccfd..cb5c18428 100644 --- a/libraries/aws_waf_xss_match_sets.rb +++ b/libraries/aws_waf_xss_match_sets.rb @@ -1,8 +1,8 @@ -require 'aws_backend' +require "aws_backend" class AWSWAFXSSMatchSets < AwsResourceBase - name 'aws_waf_xss_match_sets' - desc 'Verifies settings for all the WAF XSS Match Set.' + name "aws_waf_xss_match_sets" + desc "Verifies settings for all the WAF XSS Match Set." example " describe aws_waf_xss_match_sets do @@ -19,9 +19,9 @@ def initialize(opts = {}) end FilterTable.create - .register_column(:xss_match_set_ids, field: :xss_match_set_id, style: :simple) - .register_column(:names, field: :name, style: :simple) - .install_filter_methods_on_resource(self, :table) + .register_column(:xss_match_set_ids, field: :xss_match_set_id, style: :simple) + .register_column(:names, field: :name, style: :simple) + .install_filter_methods_on_resource(self, :table) def fetch_data catch_aws_errors do From d0bfefa8def57e95ca16c15630313349e4d38764 Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Mon, 13 Nov 2023 11:28:44 -0500 Subject: [PATCH 14/15] Merge from upstream fix * removed unneeded if clause in init method given fix Signed-off-by: Aaron Lippold --- libraries/aws_backend.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/aws_backend.rb b/libraries/aws_backend.rb index 02c43e145..b4471656d 100644 --- a/libraries/aws_backend.rb +++ b/libraries/aws_backend.rb @@ -369,7 +369,7 @@ def initialize(opts) client_args[:client_args][:retry_backoff] = "lambda { |c| sleep(#{opts[:aws_retry_backoff]}) }" if opts[:aws_retry_backoff] # this catches the stub_data true option for unit testing - and others that could be useful for consumers client_args[:client_args].update(opts[:client_args]) if opts[:client_args] - @resource_data = opts[:resource_data].presence&.to_h if opts[:resource_data] + @resource_data = opts[:resource_data].presence&.to_h end @aws = AwsConnection.new(client_args) # N.B. if/when we migrate AwsConnection to train, can update above and inject args via: From e4b35ba7e0fb4752afe0bae166a5394b8875316e Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Tue, 14 Nov 2023 08:58:55 -0500 Subject: [PATCH 15/15] step 1: fixing autocorrect Signed-off-by: Aaron Lippold --- libraries/aws_amplify_app.rb | 8 +- libraries/aws_amplify_branch.rb | 15 +++- libraries/aws_api_gateway_deployment.rb | 21 +++-- .../aws_api_gateway_documentation_part.rb | 21 +++-- .../aws_api_gateway_documentation_version.rb | 21 +++-- libraries/aws_api_gateway_domain_name.rb | 16 ++-- libraries/aws_api_gateway_method.rb | 31 +++++-- libraries/aws_api_gateway_model.rb | 19 +++-- libraries/aws_api_gateway_response.rb | 21 +++-- libraries/aws_api_gateway_restapi.rb | 13 +-- libraries/aws_api_gateway_stage.rb | 19 +++-- libraries/aws_api_gateway_usage_plan.rb | 16 ++-- libraries/aws_api_gateway_usage_plan_key.rb | 20 +++-- libraries/aws_api_gateway_v2_api.rb | 10 ++- libraries/aws_api_gateway_v2_api_mapping.rb | 24 ++++-- libraries/aws_api_gateway_v2_authorizer.rb | 20 +++-- libraries/aws_api_gateway_v2_deployment.rb | 20 +++-- libraries/aws_api_gateway_v2_domain_name.rb | 16 ++-- libraries/aws_api_gateway_v2_integration.rb | 20 +++-- ...aws_api_gateway_v2_integration_response.rb | 37 +++++++-- libraries/aws_api_gateway_v2_model.rb | 19 +++-- libraries/aws_api_gateway_v2_route.rb | 19 +++-- libraries/aws_api_gateway_vpc_link.rb | 13 +-- libraries/aws_apigateway_api_key.rb | 10 ++- libraries/aws_apigateway_authorizer.rb | 23 ++++-- libraries/aws_apigateway_base_path_mapping.rb | 17 ++-- .../aws_apigateway_client_certificate.rb | 14 +++- ...application_autoscaling_scalable_target.rb | 14 +++- ..._application_autoscaling_scaling_policy.rb | 14 +++- libraries/aws_athena_work_group.rb | 9 ++- libraries/aws_autoscaling_scaling_policy.rb | 13 ++- libraries/aws_batch_compute_environment.rb | 13 ++- libraries/aws_batch_job_definition.rb | 10 ++- libraries/aws_batch_job_queue.rb | 12 ++- libraries/aws_cloud_formation_stack_set.rb | 12 ++- libraries/aws_cloudformation_template.rb | 14 ++-- libraries/aws_cloudfront_cache_policy.rb | 10 ++- libraries/aws_cloudfront_key_group.rb | 6 +- .../aws_cloudfront_origin_access_identity.rb | 13 ++- .../aws_cloudfront_origin_request_policy.rb | 6 +- libraries/aws_cloudfront_public_key.rb | 10 ++- .../aws_cloudfront_realtime_log_config.rb | 11 ++- .../aws_cloudfront_streaming_distribution.rb | 11 ++- libraries/aws_cloudtrail_trail.rb | 43 +++++++--- libraries/aws_cloudwatch_anomaly_detector.rb | 15 ++-- libraries/aws_cloudwatch_composite_alarm.rb | 13 ++- libraries/aws_cloudwatch_dashboard.rb | 12 ++- libraries/aws_cloudwatch_metric_stream.rb | 12 ++- libraries/aws_cloudwatchlogs_destinantion.rb | 11 ++- libraries/aws_cloudwatchlogs_log_stream.rb | 23 ++++-- .../aws_cloudwatchlogs_subscription_filter.rb | 22 +++-- libraries/aws_cognito_identity_pool.rb | 12 ++- libraries/aws_cognito_userpool.rb | 12 ++- libraries/aws_cognito_userpool_client.rb | 9 ++- libraries/aws_dms_endpoint.rb | 12 ++- libraries/aws_dms_replication_instance.rb | 13 +-- libraries/aws_dms_replication_subnet_group.rb | 29 ++++--- libraries/aws_ebs_volume.rb | 12 ++- libraries/aws_ec2_capacity_reservation.rb | 16 +++- libraries/aws_ec2_carrier_gateway.rb | 12 ++- .../aws_ec2_client_vpn_authorization_rule.rb | 25 ++++-- libraries/aws_ec2_client_vpn_endpoint.rb | 13 ++- libraries/aws_ec2_client_vpn_route.rb | 26 ++++-- ...2_client_vpn_target_network_association.rb | 30 ++++--- libraries/aws_ec2_customer_gateway.rb | 12 ++- .../aws_ec2_egress_only_internet_gateway.rb | 17 +++- libraries/aws_ec2_eip.rb | 11 ++- libraries/aws_ec2_eip_association.rb | 16 ++-- libraries/aws_ec2_fleet.rb | 9 ++- libraries/aws_ec2_host.rb | 4 +- libraries/aws_ec2_instance.rb | 51 +++++++++--- libraries/aws_ec2_internet_gateway.rb | 12 ++- .../aws_ec2_network_insights_analysis.rb | 15 +++- libraries/aws_ec2_network_insights_path.rb | 13 ++- libraries/aws_ec2_network_interface.rb | 12 ++- libraries/aws_ec2_placement_group.rb | 12 ++- libraries/aws_ec2_prefix_list.rb | 12 ++- libraries/aws_ec2_spot_fleet.rb | 12 ++- libraries/aws_ec2_traffic_mirror_filter.rb | 29 +++++-- .../aws_ec2_transit_gateway_attachment.rb | 21 ++++- .../aws_ec2_transit_gateway_route_table.rb | 23 +++++- ...transit_gateway_route_table_association.rb | 13 ++- ...transit_gateway_route_table_propagation.rb | 32 ++++++-- libraries/aws_ec2_volume_attachment.rb | 9 ++- libraries/aws_ec2_vpc_peering_connection.rb | 13 ++- .../aws_ec2_vpn_gateway_route_propagation.rb | 7 +- libraries/aws_ecr_image.rb | 52 +++++++----- libraries/aws_ecr_repository.rb | 26 ++++-- libraries/aws_ecrpublic_repository.rb | 28 ++++--- libraries/aws_ecs_service.rb | 15 +++- libraries/aws_ecs_task_definition.rb | 81 +++++++++++++++---- libraries/aws_efs_mount_target.rb | 12 ++- .../aws_elasticloadbalancingv2_listener.rb | 12 ++- ...ticloadbalancingv2_listener_certificate.rb | 12 ++- ...ws_elasticloadbalancingv2_listener_rule.rb | 9 ++- ...aws_elasticloadbalancingv2_target_group.rb | 12 ++- libraries/aws_elasticsearchservice_domain.rb | 13 ++- libraries/aws_eventbridge_rule.rb | 6 +- libraries/aws_glue_crawler.rb | 4 +- libraries/aws_glue_database.rb | 6 +- libraries/aws_iam_access_key.rb | 38 ++++----- libraries/aws_iam_instance_profile.rb | 12 ++- ...iam_service_linked_role_deletion_status.rb | 14 +++- libraries/aws_iam_ssh_public_key.rb | 28 +++++-- libraries/aws_internet_gateway.rb | 37 +++++---- libraries/aws_lambda_alias.rb | 22 +++-- libraries/aws_lambda_code_signing_config.rb | 13 ++- libraries/aws_lambda_event_invoke_config.rb | 14 +++- libraries/aws_lambda_event_source_mapping.rb | 6 +- .../aws_lambda_layer_version_permission.rb | 21 +++-- libraries/aws_lambda_version.rb | 16 +++- libraries/aws_logs_metric_filter.rb | 11 ++- libraries/aws_mq_broker.rb | 8 +- libraries/aws_mq_configuration.rb | 16 ++-- libraries/aws_network_firewall_firewall.rb | 12 ++- .../aws_network_firewall_firewall_policy.rb | 12 ++- ..._network_firewall_logging_configuration.rb | 18 +++-- libraries/aws_network_firewall_rule_group.rb | 14 +++- ...rk_manager_customer_gateway_association.rb | 24 ++++-- libraries/aws_network_manager_device.rb | 18 +++-- .../aws_network_manager_global_network.rb | 14 +++- libraries/aws_ram_resource_share.rb | 26 ++++-- libraries/aws_rds_db_cluster_snapshot.rb | 14 ++-- libraries/aws_rds_db_proxy.rb | 14 +++- libraries/aws_rds_db_proxy_endpoint.rb | 23 ++++-- libraries/aws_rds_db_security_group.rb | 15 +++- libraries/aws_rds_event_subscription.rb | 16 ++-- libraries/aws_rds_global_cluster.rb | 15 +++- .../aws_redshift_cluster_parameter_group.rb | 12 ++- libraries/aws_route53_record_set.rb | 24 ++++-- .../aws_route53resolver_resolver_endpoint.rb | 16 ++-- .../aws_route53resolver_resolver_rule.rb | 16 ++-- ...ute53resolver_resolver_rule_association.rb | 15 +++- libraries/aws_s3_access_point.rb | 17 ++-- libraries/aws_secretsmanager_secret.rb | 13 ++- libraries/aws_securityhub_hub.rb | 6 +- ..._servicecatalog_cloud_formation_product.rb | 14 +++- ...catalog_portfolio_principal_association.rb | 12 ++- ...cecatalog_portfolio_product_association.rb | 9 ++- libraries/aws_ses_receipt_rule.rb | 18 +++-- libraries/aws_ses_receipt_rule_set.rb | 14 +++- libraries/aws_ses_template.rb | 12 ++- libraries/aws_signer_signing_profile.rb | 14 +++- libraries/aws_ssm_maintenance_window.rb | 13 +-- .../aws_ssm_maintenance_window_target.rb | 25 +++--- libraries/aws_ssm_maintenance_window_task.rb | 25 +++--- libraries/aws_ssm_patch_baseline.rb | 28 +++++-- libraries/aws_stepfunctions_activity.rb | 14 +++- libraries/aws_stepfunctions_state_machine.rb | 14 +++- libraries/aws_synthetics_canary.rb | 6 +- libraries/aws_transfer_user.rb | 17 ++-- libraries/aws_transit_gateway_connect.rb | 23 +++++- .../aws_transit_gateway_multicast_domain.rb | 29 +++++-- ...it_gateway_multicast_domain_association.rb | 28 +++++-- ..._transit_gateway_multicast_group_member.rb | 22 ++++- ..._transit_gateway_multicast_group_source.rb | 22 ++++- libraries/aws_waf_byte_match_set.rb | 14 +++- libraries/aws_waf_ip_set.rb | 8 +- libraries/aws_waf_rule.rb | 8 +- libraries/aws_waf_size_constraint_set.rb | 15 +++- libraries/aws_waf_sql_injection_match_set.rb | 15 +++- libraries/aws_waf_web_acl.rb | 8 +- libraries/aws_waf_xss_match_set.rb | 14 +++- 163 files changed, 1970 insertions(+), 777 deletions(-) diff --git a/libraries/aws_amplify_app.rb b/libraries/aws_amplify_app.rb index 8ffd115f4..103446e77 100644 --- a/libraries/aws_amplify_app.rb +++ b/libraries/aws_amplify_app.rb @@ -14,7 +14,9 @@ def initialize(opts = {}) super(opts) validate_parameters(required: [:app_id]) - raise ArgumentError, "#{@__resource_name__}: app_id must be provided" unless opts[:app_id] && !opts[:app_id].empty? + unless opts[:app_id] && !opts[:app_id].empty? + raise ArgumentError, "#{@__resource_name__}: app_id must be provided" + end @display_name = opts[:app_id] resp = @aws.amplify_client.get_app({ app_id: opts[:app_id] }) @apps = resp.app.to_h @@ -22,12 +24,12 @@ def initialize(opts = {}) end def app_id - return unless exists? + return nil unless exists? @apps[:app_id] end def resource_id - @apps? @apps[:app_id] : @display_name + @apps ? @apps[:app_id] : @display_name end def exists? diff --git a/libraries/aws_amplify_branch.rb b/libraries/aws_amplify_branch.rb index d9906dc7f..dbb565517 100644 --- a/libraries/aws_amplify_branch.rb +++ b/libraries/aws_amplify_branch.rb @@ -13,16 +13,23 @@ def initialize(opts = {}) opts = { app_id: opts } if opts.is_a?(String) opts = { branch_name: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(app_id branch_name)) - raise ArgumentError, "#{@__resource_name__}: app_id and branch_name must be provided" unless opts[:app_id] && !opts[:app_id].empty? && opts[:branch_name] && !opts[:branch_name].empty? + validate_parameters(required: %i[app_id branch_name]) + unless opts[:app_id] && !opts[:app_id].empty? && opts[:branch_name] && + !opts[:branch_name].empty? + raise ArgumentError, + "#{@__resource_name__}: app_id and branch_name must be provided" + end @display_name = opts[:branch_name] - resp = @aws.amplify_client.get_branch({ app_id: opts[:app_id], branch_name: opts[:branch_name] }) + resp = + @aws.amplify_client.get_branch( + { app_id: opts[:app_id], branch_name: opts[:branch_name] } + ) @apps = resp.branch.to_h create_resource_methods(@apps) end def branch_name - return unless exists? + return nil unless exists? @apps[:branch_name] end diff --git a/libraries/aws_api_gateway_deployment.rb b/libraries/aws_api_gateway_deployment.rb index 69a69bcb7..f7e1d645d 100644 --- a/libraries/aws_api_gateway_deployment.rb +++ b/libraries/aws_api_gateway_deployment.rb @@ -11,19 +11,30 @@ class AWSApiGatewayDeployment < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(rest_api_id deployment_id)) - raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" unless opts[:rest_api_id] && !opts[:rest_api_id].empty? - raise ArgumentError, "#{@__resource_name__}: deployment_id must be provided" unless opts[:deployment_id] && !opts[:deployment_id].empty? + validate_parameters(required: %i[rest_api_id deployment_id]) + unless opts[:rest_api_id] && !opts[:rest_api_id].empty? + raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" + end + unless opts[:deployment_id] && !opts[:deployment_id].empty? + raise ArgumentError, + "#{@__resource_name__}: deployment_id must be provided" + end @display_name = opts[:rest_api_id] catch_aws_errors do - resp = @aws.apigateway_client.get_deployment({ rest_api_id: opts[:rest_api_id], deployment_id: opts[:deployment_id] }) + resp = + @aws.apigateway_client.get_deployment( + { + rest_api_id: opts[:rest_api_id], + deployment_id: opts[:deployment_id] + } + ) @res = resp.to_h create_resource_methods(@res) end end def rest_api_id - return unless exists? + return nil unless exists? @res[:rest_api_id] end diff --git a/libraries/aws_api_gateway_documentation_part.rb b/libraries/aws_api_gateway_documentation_part.rb index aef2309a2..8825f9bb6 100644 --- a/libraries/aws_api_gateway_documentation_part.rb +++ b/libraries/aws_api_gateway_documentation_part.rb @@ -11,12 +11,23 @@ class AWSApiGatewayDocumentationPart < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(rest_api_id documentation_part_id)) - raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" unless opts[:rest_api_id] && !opts[:rest_api_id].empty? - raise ArgumentError, "#{@__resource_name__}: documentation_part_id must be provided" unless opts[:documentation_part_id] && !opts[:documentation_part_id].empty? + validate_parameters(required: %i[rest_api_id documentation_part_id]) + unless opts[:rest_api_id] && !opts[:rest_api_id].empty? + raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" + end + unless opts[:documentation_part_id] && !opts[:documentation_part_id].empty? + raise ArgumentError, + "#{@__resource_name__}: documentation_part_id must be provided" + end @display_name = opts[:documentation_part_id] catch_aws_errors do - resp = @aws.apigateway_client.get_documentation_part({ rest_api_id: opts[:rest_api_id], documentation_part_id: opts[:documentation_part_id] }) + resp = + @aws.apigateway_client.get_documentation_part( + { + rest_api_id: opts[:rest_api_id], + documentation_part_id: opts[:documentation_part_id] + } + ) @res = resp.to_h create_resource_methods(@res) end @@ -27,7 +38,7 @@ def exists? end def documentation_part_id - return unless exists? + return nil unless exists? @res[:documentation_part_id] end diff --git a/libraries/aws_api_gateway_documentation_version.rb b/libraries/aws_api_gateway_documentation_version.rb index ed8309cad..c2485be20 100644 --- a/libraries/aws_api_gateway_documentation_version.rb +++ b/libraries/aws_api_gateway_documentation_version.rb @@ -11,12 +11,23 @@ class AWSApiGatewayDocumentationVersion < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(rest_api_id documentation_version)) - raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" unless opts[:rest_api_id] && !opts[:rest_api_id].empty? - raise ArgumentError, "#{@__resource_name__}: documentation_version must be provided" unless opts[:documentation_version] && !opts[:documentation_version].empty? + validate_parameters(required: %i[rest_api_id documentation_version]) + unless opts[:rest_api_id] && !opts[:rest_api_id].empty? + raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" + end + unless opts[:documentation_version] && !opts[:documentation_version].empty? + raise ArgumentError, + "#{@__resource_name__}: documentation_version must be provided" + end @display_name = opts[:documentation_version] catch_aws_errors do - resp = @aws.apigateway_client.get_documentation_version({ rest_api_id: opts[:rest_api_id], documentation_version: opts[:documentation_version] }) + resp = + @aws.apigateway_client.get_documentation_version( + { + rest_api_id: opts[:rest_api_id], + documentation_version: opts[:documentation_version] + } + ) @res = resp.to_h create_resource_methods(@res) end @@ -31,7 +42,7 @@ def resource_id end def documentation_version - return unless exists? + return nil unless exists? @res[:documentation_version] end diff --git a/libraries/aws_api_gateway_domain_name.rb b/libraries/aws_api_gateway_domain_name.rb index e0fbd8c19..bba526ce6 100644 --- a/libraries/aws_api_gateway_domain_name.rb +++ b/libraries/aws_api_gateway_domain_name.rb @@ -12,18 +12,24 @@ class AWSApiGatewayDomainName < AwsResourceBase def initialize(opts = {}) opts = { domain_name: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(domain_name)) - raise ArgumentError, "#{@__resource_name__}: domain_name must be provided!" if opts[:domain_name].blank? + validate_parameters(required: %i[domain_name]) + if opts[:domain_name].blank? + raise ArgumentError, + "#{@__resource_name__}: domain_name must be provided!" + end @display_name = opts[:domain_name] catch_aws_errors do - resp = @aws.apigateway_client.get_domain_name({ domain_name: opts[:domain_name] }) + resp = + @aws.apigateway_client.get_domain_name( + { domain_name: opts[:domain_name] } + ) @res = resp.to_h create_resource_methods(@res) end end def resource_id - @res? "#{@res[:domain_name]}_#{@res[:certificate_arn]}" : "" + @res ? "#{@res[:domain_name]}_#{@res[:certificate_arn]}" : "" end def exists? @@ -31,7 +37,7 @@ def exists? end def domain_name - return unless exists? + return nil unless exists? @res[:domain_name] end diff --git a/libraries/aws_api_gateway_method.rb b/libraries/aws_api_gateway_method.rb index 918fcd8b6..997a639ca 100644 --- a/libraries/aws_api_gateway_method.rb +++ b/libraries/aws_api_gateway_method.rb @@ -10,22 +10,39 @@ class AWSApiGatewayMethod < AwsResourceBase EXAMPLE def initialize(opts = {}) - opts = { rest_api_id: opts, resource_id: opts, http_method: opts } if opts.is_a?(String) + opts = { + rest_api_id: opts, + resource_id: opts, + http_method: opts + } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(rest_api_id resource_id http_method)) - raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" unless opts[:rest_api_id] && !opts[:rest_api_id].empty? - raise ArgumentError, "#{@__resource_name__}: resource_id must be provided" unless opts[:resource_id] && !opts[:resource_id].empty? - raise ArgumentError, "#{@__resource_name__}: http_method must be provided" unless opts[:http_method] && !opts[:http_method].empty? + validate_parameters(required: %i[rest_api_id resource_id http_method]) + unless opts[:rest_api_id] && !opts[:rest_api_id].empty? + raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" + end + unless opts[:resource_id] && !opts[:resource_id].empty? + raise ArgumentError, "#{@__resource_name__}: resource_id must be provided" + end + unless opts[:http_method] && !opts[:http_method].empty? + raise ArgumentError, "#{@__resource_name__}: http_method must be provided" + end @rest_api_id = opts[:rest_api_id] catch_aws_errors do - resp = @aws.apigateway_client.get_method({ rest_api_id: opts[:rest_api_id], resource_id: opts[:resource_id], http_method: opts[:http_method] }) + resp = + @aws.apigateway_client.get_method( + { + rest_api_id: opts[:rest_api_id], + resource_id: opts[:resource_id], + http_method: opts[:http_method] + } + ) @res = resp.to_h create_resource_methods(@res) end end def rest_api_id - return unless exists? + return nil unless exists? @res[:rest_api_id] end diff --git a/libraries/aws_api_gateway_model.rb b/libraries/aws_api_gateway_model.rb index 27133c996..10747b15c 100644 --- a/libraries/aws_api_gateway_model.rb +++ b/libraries/aws_api_gateway_model.rb @@ -11,12 +11,19 @@ class AWSApiGatewayModel < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(rest_api_id model_name)) - raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" unless opts[:rest_api_id] && !opts[:rest_api_id].empty? - raise ArgumentError, "#{@__resource_name__}: model_name must be provided" unless opts[:model_name] && !opts[:model_name].empty? + validate_parameters(required: %i[rest_api_id model_name]) + unless opts[:rest_api_id] && !opts[:rest_api_id].empty? + raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" + end + unless opts[:model_name] && !opts[:model_name].empty? + raise ArgumentError, "#{@__resource_name__}: model_name must be provided" + end @display_name = opts[:model_name] catch_aws_errors do - resp = @aws.apigateway_client.get_model({ rest_api_id: opts[:rest_api_id], model_name: opts[:model_name] }) + resp = + @aws.apigateway_client.get_model( + { rest_api_id: opts[:rest_api_id], model_name: opts[:model_name] } + ) @res = resp.to_h create_resource_methods(@res) end @@ -27,12 +34,12 @@ def exists? end def model_name - return unless exists? + return nil unless exists? @res[:model_name] end def resource_id - @res? @res[:id] : @display_name + @res ? @res[:id] : @display_name end def to_s diff --git a/libraries/aws_api_gateway_response.rb b/libraries/aws_api_gateway_response.rb index bfaaa60bb..70e838559 100644 --- a/libraries/aws_api_gateway_response.rb +++ b/libraries/aws_api_gateway_response.rb @@ -11,19 +11,30 @@ class AWSApiGatewayResponse < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(rest_api_id response_type)) - raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" unless opts[:rest_api_id] && !opts[:rest_api_id].empty? - raise ArgumentError, "#{@__resource_name__}: response_type must be provided" unless opts[:response_type] && !opts[:response_type].empty? + validate_parameters(required: %i[rest_api_id response_type]) + unless opts[:rest_api_id] && !opts[:rest_api_id].empty? + raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" + end + unless opts[:response_type] && !opts[:response_type].empty? + raise ArgumentError, + "#{@__resource_name__}: response_type must be provided" + end @display_name = opts[:response_type] catch_aws_errors do - resp = @aws.apigateway_client.get_gateway_response({ rest_api_id: opts[:rest_api_id], response_type: opts[:response_type] }) + resp = + @aws.apigateway_client.get_gateway_response( + { + rest_api_id: opts[:rest_api_id], + response_type: opts[:response_type] + } + ) @res = resp.to_h create_resource_methods(@res) end end def response_type - return unless exists? + return nil unless exists? @res[:response_type] end diff --git a/libraries/aws_api_gateway_restapi.rb b/libraries/aws_api_gateway_restapi.rb index e81d27db5..43a0509bf 100644 --- a/libraries/aws_api_gateway_restapi.rb +++ b/libraries/aws_api_gateway_restapi.rb @@ -12,23 +12,26 @@ class AWSApiGatewayRestApi < AwsResourceBase def initialize(opts = {}) opts = { rest_api_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(rest_api_id)) - raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" unless opts[:rest_api_id] && !opts[:rest_api_id].empty? + validate_parameters(required: %i[rest_api_id]) + unless opts[:rest_api_id] && !opts[:rest_api_id].empty? + raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" + end @display_name = opts[:rest_api_id] catch_aws_errors do - resp = @aws.apigateway_client.get_rest_api({ rest_api_id: opts[:rest_api_id] }) + resp = + @aws.apigateway_client.get_rest_api({ rest_api_id: opts[:rest_api_id] }) @res = resp.to_h create_resource_methods(@res) end end def rest_api_id - return unless exists? + return nil unless exists? @res[:rest_api_id] end def resource_id - @res? @res[:id]:@display_name + @res ? @res[:id] : @display_name end def exists? diff --git a/libraries/aws_api_gateway_stage.rb b/libraries/aws_api_gateway_stage.rb index 9161dba1a..87b99fe5f 100644 --- a/libraries/aws_api_gateway_stage.rb +++ b/libraries/aws_api_gateway_stage.rb @@ -11,24 +11,31 @@ class AWSApiGatewayStage < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(rest_api_id stage_name)) - raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" unless opts[:rest_api_id] && !opts[:rest_api_id].empty? - raise ArgumentError, "#{@__resource_name__}: stage_name must be provided" unless opts[:stage_name] && !opts[:stage_name].empty? + validate_parameters(required: %i[rest_api_id stage_name]) + unless opts[:rest_api_id] && !opts[:rest_api_id].empty? + raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" + end + unless opts[:stage_name] && !opts[:stage_name].empty? + raise ArgumentError, "#{@__resource_name__}: stage_name must be provided" + end @display_name = opts[:stage_name] catch_aws_errors do - resp = @aws.apigateway_client.get_stage({ rest_api_id: opts[:rest_api_id], stage_name: opts[:stage_name] }) + resp = + @aws.apigateway_client.get_stage( + { rest_api_id: opts[:rest_api_id], stage_name: opts[:stage_name] } + ) @res = resp.to_h create_resource_methods(@res) end end def stage_name - return unless exists? + return nil unless exists? @res[:stage_name] end def resource_id - @res? @res[:stage_name] : @display_name + @res ? @res[:stage_name] : @display_name end def exists? diff --git a/libraries/aws_api_gateway_usage_plan.rb b/libraries/aws_api_gateway_usage_plan.rb index 7af92a329..c5eb11ede 100644 --- a/libraries/aws_api_gateway_usage_plan.rb +++ b/libraries/aws_api_gateway_usage_plan.rb @@ -11,11 +11,17 @@ class AWSApiGatewayUsagePlan < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(usage_plan_id)) - raise ArgumentError, "#{@__resource_name__}: usage_plan_id must be provided" if opts[:usage_plan_id].blank? + validate_parameters(required: %i[usage_plan_id]) + if opts[:usage_plan_id].blank? + raise ArgumentError, + "#{@__resource_name__}: usage_plan_id must be provided" + end @display_name = opts[:usage_plan_id] catch_aws_errors do - resp = @aws.apigateway_client.get_usage_plan({ usage_plan_id: opts[:usage_plan_id] }) + resp = + @aws.apigateway_client.get_usage_plan( + { usage_plan_id: opts[:usage_plan_id] } + ) @res = resp.to_h @usage_plan_id = @res[:id] create_resource_methods(@res) @@ -23,7 +29,7 @@ def initialize(opts = {}) end def resource_id - @res? @usage_plan_id: @display_name + @res ? @usage_plan_id : @display_name end def exists? @@ -31,7 +37,7 @@ def exists? end def usage_plan_id - return unless exists? + return nil unless exists? @res[:id] end diff --git a/libraries/aws_api_gateway_usage_plan_key.rb b/libraries/aws_api_gateway_usage_plan_key.rb index 686e2f954..fad6f228a 100644 --- a/libraries/aws_api_gateway_usage_plan_key.rb +++ b/libraries/aws_api_gateway_usage_plan_key.rb @@ -12,13 +12,21 @@ class AWSApiGatewayUsagePlanKey < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(usage_plan_id key_id)) - raise ArgumentError, "#{@__resource_name__}: usage_plan_id must be provided" if opts[:usage_plan_id].blank? - raise ArgumentError, "#{@__resource_name__}: key_id must be provided" if opts[:key_id].blank? + validate_parameters(required: %i[usage_plan_id key_id]) + if opts[:usage_plan_id].blank? + raise ArgumentError, + "#{@__resource_name__}: usage_plan_id must be provided" + end + if opts[:key_id].blank? + raise ArgumentError, "#{@__resource_name__}: key_id must be provided" + end @display_name = opts[:key_id] @usage_plan_id = opts[:usage_plan_id] catch_aws_errors do - resp = @aws.apigateway_client.get_usage_plan_key({ usage_plan_id: opts[:usage_plan_id], key_id: opts[:key_id] }) + resp = + @aws.apigateway_client.get_usage_plan_key( + { usage_plan_id: opts[:usage_plan_id], key_id: opts[:key_id] } + ) @res = resp.to_h @usage_plan_key_id = @res[:id] @usage_plan_key_name = @res[:name] @@ -27,7 +35,7 @@ def initialize(opts = {}) end def resource_id - "#{@res? @usage_plan_key_id: @display_name}_#{@res? @usage_plan_key_name: ""}" + "#{@res ? @usage_plan_key_id : @display_name}_#{@res ? @usage_plan_key_name : ""}" end def exists? @@ -35,7 +43,7 @@ def exists? end def key_id - return unless exists? + return nil unless exists? @res[:id] end diff --git a/libraries/aws_api_gateway_v2_api.rb b/libraries/aws_api_gateway_v2_api.rb index 76bf28887..34d4248be 100644 --- a/libraries/aws_api_gateway_v2_api.rb +++ b/libraries/aws_api_gateway_v2_api.rb @@ -12,8 +12,10 @@ class AwsApiGatewayV2Api < AwsResourceBase def initialize(opts = {}) opts = { api_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(api_id)) - raise ArgumentError, "#{@__resource_name__}: api_id must be provided!" if opts[:api_id].blank? + validate_parameters(required: %i[api_id]) + if opts[:api_id].blank? + raise ArgumentError, "#{@__resource_name__}: api_id must be provided!" + end @display_name = opts[:api_id] catch_aws_errors do resp = @aws.apigatewayv2_client.get_api({ api_id: opts[:api_id] }) @@ -23,7 +25,7 @@ def initialize(opts = {}) end def api_id - return unless exists? + return nil unless exists? @res[:api_id] end @@ -32,7 +34,7 @@ def exists? end def resource_id - @res? @res[:api_endpoint] : @display_name + @res ? @res[:api_endpoint] : @display_name end def to_s diff --git a/libraries/aws_api_gateway_v2_api_mapping.rb b/libraries/aws_api_gateway_v2_api_mapping.rb index a63d7db7d..d875d4897 100644 --- a/libraries/aws_api_gateway_v2_api_mapping.rb +++ b/libraries/aws_api_gateway_v2_api_mapping.rb @@ -12,19 +12,31 @@ class AwsApiGatewayV2ApiMapping < AwsResourceBase def initialize(opts = {}) opts = { api_mapping_id: opts, domain_name: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(api_mapping_id domain_name)) - raise ArgumentError, "#{@__resource_name__}: api_mapping_id must be provided!" if opts[:api_mapping_id].blank? - raise ArgumentError, "#{@__resource_name__}: domain_name must be provided!" if opts[:domain_name].blank? + validate_parameters(required: %i[api_mapping_id domain_name]) + if opts[:api_mapping_id].blank? + raise ArgumentError, + "#{@__resource_name__}: api_mapping_id must be provided!" + end + if opts[:domain_name].blank? + raise ArgumentError, + "#{@__resource_name__}: domain_name must be provided!" + end @display_name = opts[:api_mapping_id] catch_aws_errors do - resp = @aws.apigatewayv2_client.get_api_mapping({ api_mapping_id: opts[:api_mapping_id], domain_name: opts[:domain_name] }) + resp = + @aws.apigatewayv2_client.get_api_mapping( + { + api_mapping_id: opts[:api_mapping_id], + domain_name: opts[:domain_name] + } + ) @res = resp.to_h create_resource_methods(@res) end end def api_mapping_id - return unless exists? + return nil unless exists? @res[:api_mapping_id] end @@ -33,7 +45,7 @@ def exists? end def resource_id - @res? @res[:api_mapping_id]: @display_name + @res ? @res[:api_mapping_id] : @display_name end def to_s diff --git a/libraries/aws_api_gateway_v2_authorizer.rb b/libraries/aws_api_gateway_v2_authorizer.rb index 53e492d4d..597741551 100644 --- a/libraries/aws_api_gateway_v2_authorizer.rb +++ b/libraries/aws_api_gateway_v2_authorizer.rb @@ -14,19 +14,27 @@ class AwsApiGatewayV2Authorizer < AwsResourceBase def initialize(opts = {}) opts = { api_id: opts, authorizer_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(api_id authorizer_id)) - raise ArgumentError, "#{@__resource_name__}: api_id must be provided!" if opts[:api_id].blank? - raise ArgumentError, "#{@__resource_name__}: authorizer_id must be provided!" if opts[:authorizer_id].blank? + validate_parameters(required: %i[api_id authorizer_id]) + if opts[:api_id].blank? + raise ArgumentError, "#{@__resource_name__}: api_id must be provided!" + end + if opts[:authorizer_id].blank? + raise ArgumentError, + "#{@__resource_name__}: authorizer_id must be provided!" + end @display_name = opts[:authorizer_id] catch_aws_errors do - resp = @aws.apigatewayv2_client.get_authorizer({ api_id: opts[:api_id], authorizer_id: opts[:authorizer_id] }) + resp = + @aws.apigatewayv2_client.get_authorizer( + { api_id: opts[:api_id], authorizer_id: opts[:authorizer_id] } + ) @res = resp.to_h create_resource_methods(@res) end end def authorizer_id - return unless exists? + return nil unless exists? @res[:authorizer_id] end @@ -35,7 +43,7 @@ def exists? end def resource_id - @res? @res[:authorizer_id] : @display_name + @res ? @res[:authorizer_id] : @display_name end def to_s diff --git a/libraries/aws_api_gateway_v2_deployment.rb b/libraries/aws_api_gateway_v2_deployment.rb index 9b1efc852..408a8b6db 100644 --- a/libraries/aws_api_gateway_v2_deployment.rb +++ b/libraries/aws_api_gateway_v2_deployment.rb @@ -15,19 +15,27 @@ class AwsApiGatewayV2Deployment < AwsResourceBase def initialize(opts = {}) opts = { api_id: opts, deployment_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(api_id deployment_id)) - raise ArgumentError, "#{@__resource_name__}: api_id must be provided!" if opts[:api_id].blank? - raise ArgumentError, "#{@__resource_name__}: deployment_id must be provided!" if opts[:deployment_id].blank? + validate_parameters(required: %i[api_id deployment_id]) + if opts[:api_id].blank? + raise ArgumentError, "#{@__resource_name__}: api_id must be provided!" + end + if opts[:deployment_id].blank? + raise ArgumentError, + "#{@__resource_name__}: deployment_id must be provided!" + end @display_name = opts[:deployment_id] catch_aws_errors do - resp = @aws.apigatewayv2_client.get_deployment({ api_id: opts[:api_id], deployment_id: opts[:deployment_id] }) + resp = + @aws.apigatewayv2_client.get_deployment( + { api_id: opts[:api_id], deployment_id: opts[:deployment_id] } + ) @res = resp.to_h create_resource_methods(@res) end end def deployment_id - return unless exists? + return nil unless exists? @res[:deployment_id] end @@ -36,7 +44,7 @@ def exists? end def resource_id - @res? @res[:deployment_id]: @display_name + @res ? @res[:deployment_id] : @display_name end def to_s diff --git a/libraries/aws_api_gateway_v2_domain_name.rb b/libraries/aws_api_gateway_v2_domain_name.rb index b7213b803..6a96fba70 100644 --- a/libraries/aws_api_gateway_v2_domain_name.rb +++ b/libraries/aws_api_gateway_v2_domain_name.rb @@ -12,18 +12,24 @@ class AwsApiGatewayV2DomainName < AwsResourceBase def initialize(opts = {}) opts = { domain_name: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(domain_name)) - raise ArgumentError, "#{@__resource_name__}: domain_name must be provided!" if opts[:domain_name].blank? + validate_parameters(required: %i[domain_name]) + if opts[:domain_name].blank? + raise ArgumentError, + "#{@__resource_name__}: domain_name must be provided!" + end @display_name = opts[:domain_name] catch_aws_errors do - resp = @aws.apigatewayv2_client.get_domain_name({ domain_name: opts[:domain_name] }) + resp = + @aws.apigatewayv2_client.get_domain_name( + { domain_name: opts[:domain_name] } + ) @res = resp.to_h create_resource_methods(@res) end end def domain_name - return unless exists? + return nil unless exists? @res[:domain_name] end @@ -32,7 +38,7 @@ def exists? end def resource_id - @res? @res[:domain_name]: @display_name + @res ? @res[:domain_name] : @display_name end def to_s diff --git a/libraries/aws_api_gateway_v2_integration.rb b/libraries/aws_api_gateway_v2_integration.rb index faa2d4fad..550cb86bc 100644 --- a/libraries/aws_api_gateway_v2_integration.rb +++ b/libraries/aws_api_gateway_v2_integration.rb @@ -15,19 +15,27 @@ class AwsApiGatewayV2Integration < AwsResourceBase def initialize(opts = {}) opts = { api_id: opts, integration_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(api_id integration_id)) - raise ArgumentError, "#{@__resource_name__}: api_id must be provided!" if opts[:api_id].blank? - raise ArgumentError, "#{@__resource_name__}: integration_id must be provided!" if opts[:integration_id].blank? + validate_parameters(required: %i[api_id integration_id]) + if opts[:api_id].blank? + raise ArgumentError, "#{@__resource_name__}: api_id must be provided!" + end + if opts[:integration_id].blank? + raise ArgumentError, + "#{@__resource_name__}: integration_id must be provided!" + end @display_name = opts[:integration_id] catch_aws_errors do - resp = @aws.apigatewayv2_client.get_integration({ api_id: opts[:api_id], integration_id: opts[:integration_id] }) + resp = + @aws.apigatewayv2_client.get_integration( + { api_id: opts[:api_id], integration_id: opts[:integration_id] } + ) @res = resp.to_h create_resource_methods(@res) end end def integration_id - return unless exists? + return nil unless exists? @res[:integration_id] end @@ -36,7 +44,7 @@ def exists? end def resource_id - @res? @res[:integration_id]: @display_name + @res ? @res[:integration_id] : @display_name end def to_s diff --git a/libraries/aws_api_gateway_v2_integration_response.rb b/libraries/aws_api_gateway_v2_integration_response.rb index 238530817..a45442f4b 100644 --- a/libraries/aws_api_gateway_v2_integration_response.rb +++ b/libraries/aws_api_gateway_v2_integration_response.rb @@ -10,22 +10,43 @@ class AwsApiGatewayV2IntegrationResponse < AwsResourceBase EXAMPLE def initialize(opts = {}) - opts = { api_id: opts, integration_id: opts, integration_response_id: opts } if opts.is_a?(String) + opts = { + api_id: opts, + integration_id: opts, + integration_response_id: opts + } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(api_id integration_id integration_response_id)) - raise ArgumentError, "#{@__resource_name__}: api_id must be provided!" if opts[:api_id].blank? - raise ArgumentError, "#{@__resource_name__}: integration_id must be provided!" if opts[:integration_id].blank? - raise ArgumentError, "#{@__resource_name__}: integration_response_id must be provided!" if opts[:integration_response_id].blank? + validate_parameters( + required: %i[api_id integration_id integration_response_id] + ) + if opts[:api_id].blank? + raise ArgumentError, "#{@__resource_name__}: api_id must be provided!" + end + if opts[:integration_id].blank? + raise ArgumentError, + "#{@__resource_name__}: integration_id must be provided!" + end + if opts[:integration_response_id].blank? + raise ArgumentError, + "#{@__resource_name__}: integration_response_id must be provided!" + end @display_name = opts[:integration_response_id] catch_aws_errors do - resp = @aws.apigatewayv2_client.get_integration_response({ api_id: opts[:api_id], integration_id: opts[:integration_id], integration_response_id: opts[:integration_response_id] }) + resp = + @aws.apigatewayv2_client.get_integration_response( + { + api_id: opts[:api_id], + integration_id: opts[:integration_id], + integration_response_id: opts[:integration_response_id] + } + ) @res = resp.to_h create_resource_methods(@res) end end def integration_response_id - return unless exists? + return nil unless exists? @res[:integration_response_id] end @@ -34,7 +55,7 @@ def exists? end def resource_id - @res? @res[:integration_response_id]: @display_name + @res ? @res[:integration_response_id] : @display_name end def to_s diff --git a/libraries/aws_api_gateway_v2_model.rb b/libraries/aws_api_gateway_v2_model.rb index 079009288..5ad645f5e 100644 --- a/libraries/aws_api_gateway_v2_model.rb +++ b/libraries/aws_api_gateway_v2_model.rb @@ -14,19 +14,26 @@ class AwsApiGatewayV2Model < AwsResourceBase def initialize(opts = {}) opts = { api_id: opts, model_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(api_id model_id)) - raise ArgumentError, "#{@__resource_name__}: api_id must be provided!" if opts[:api_id].blank? - raise ArgumentError, "#{@__resource_name__}: model_id must be provided!" if opts[:model_id].blank? + validate_parameters(required: %i[api_id model_id]) + if opts[:api_id].blank? + raise ArgumentError, "#{@__resource_name__}: api_id must be provided!" + end + if opts[:model_id].blank? + raise ArgumentError, "#{@__resource_name__}: model_id must be provided!" + end @display_name = opts[:model_id] catch_aws_errors do - resp = @aws.apigatewayv2_client.get_model({ api_id: opts[:api_id], model_id: opts[:model_id] }) + resp = + @aws.apigatewayv2_client.get_model( + { api_id: opts[:api_id], model_id: opts[:model_id] } + ) @res = resp.to_h create_resource_methods(@res) end end def model_id - return unless exists? + return nil unless exists? @res[:model_id] end @@ -35,7 +42,7 @@ def exists? end def resource_id - @res? @res[:model_id]: @display_name + @res ? @res[:model_id] : @display_name end def to_s diff --git a/libraries/aws_api_gateway_v2_route.rb b/libraries/aws_api_gateway_v2_route.rb index 3e1028c47..c9bccbfa2 100644 --- a/libraries/aws_api_gateway_v2_route.rb +++ b/libraries/aws_api_gateway_v2_route.rb @@ -12,19 +12,26 @@ class AwsApiGatewayV2Route < AwsResourceBase def initialize(opts = {}) opts = { api_id: opts, route_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(api_id route_id)) - raise ArgumentError, "#{@__resource_name__}: api_id must be provided!" if opts[:api_id].blank? - raise ArgumentError, "#{@__resource_name__}: route_id must be provided!" if opts[:route_id].blank? + validate_parameters(required: %i[api_id route_id]) + if opts[:api_id].blank? + raise ArgumentError, "#{@__resource_name__}: api_id must be provided!" + end + if opts[:route_id].blank? + raise ArgumentError, "#{@__resource_name__}: route_id must be provided!" + end @display_name = opts[:route_id] catch_aws_errors do - resp = @aws.apigatewayv2_client.get_route({ api_id: opts[:api_id], route_id: opts[:route_id] }) + resp = + @aws.apigatewayv2_client.get_route( + { api_id: opts[:api_id], route_id: opts[:route_id] } + ) @res = resp.to_h create_resource_methods(@res) end end def route_id - return unless exists? + return nil unless exists? @res[:route_id] end @@ -33,7 +40,7 @@ def exists? end def resource_id - @res? @res[:route_id]: @display_name + @res ? @res[:route_id] : @display_name end def to_s diff --git a/libraries/aws_api_gateway_vpc_link.rb b/libraries/aws_api_gateway_vpc_link.rb index 2389280a2..2c7c1496a 100644 --- a/libraries/aws_api_gateway_vpc_link.rb +++ b/libraries/aws_api_gateway_vpc_link.rb @@ -12,18 +12,21 @@ class AWSApiGatewayVPCLink < AwsResourceBase def initialize(opts = {}) opts = { vpc_link_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(vpc_link_id)) - raise ArgumentError, "#{@__resource_name__}: vpc_link_id must be provided" if opts[:vpc_link_id].blank? + validate_parameters(required: %i[vpc_link_id]) + if opts[:vpc_link_id].blank? + raise ArgumentError, "#{@__resource_name__}: vpc_link_id must be provided" + end @display_name = opts[:vpc_link_id] catch_aws_errors do - resp = @aws.apigateway_client.get_vpc_link({ vpc_link_id: opts[:vpc_link_id] }) + resp = + @aws.apigateway_client.get_vpc_link({ vpc_link_id: opts[:vpc_link_id] }) @res = resp.to_h create_resource_methods(@res) end end def resource_id - @res? "#{@res[:id]}_#{@res[:name]}" : @display_name + @res ? "#{@res[:id]}_#{@res[:name]}" : @display_name end def exists? @@ -31,7 +34,7 @@ def exists? end def vpc_link_id - return unless exists? + return nil unless exists? @res[:id] end diff --git a/libraries/aws_apigateway_api_key.rb b/libraries/aws_apigateway_api_key.rb index 017b771d2..133340918 100644 --- a/libraries/aws_apigateway_api_key.rb +++ b/libraries/aws_apigateway_api_key.rb @@ -12,8 +12,10 @@ class AWSApiGatewayAPIKey < AwsResourceBase def initialize(opts = {}) opts = { api_key: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(api_key)) - raise ArgumentError, "#{@__resource_name__}: api_key must be provided" unless opts[:api_key] && !opts[:api_key].empty? + validate_parameters(required: %i[api_key]) + unless opts[:api_key] && !opts[:api_key].empty? + raise ArgumentError, "#{@__resource_name__}: api_key must be provided" + end @display_name = opts[:api_key] catch_aws_errors do resp = @aws.apigateway_client.get_api_key({ api_key: opts[:api_key] }) @@ -23,7 +25,7 @@ def initialize(opts = {}) end def api_key - return unless exists? + return nil unless exists? @res[:api_key] end @@ -32,7 +34,7 @@ def exists? end def resource_id - @res? @res[:id] : @display_name + @res ? @res[:id] : @display_name end def to_s diff --git a/libraries/aws_apigateway_authorizer.rb b/libraries/aws_apigateway_authorizer.rb index 39f3f3466..d9f7c1078 100644 --- a/libraries/aws_apigateway_authorizer.rb +++ b/libraries/aws_apigateway_authorizer.rb @@ -13,24 +13,35 @@ def initialize(opts = {}) opts = { api_id: opts } if opts.is_a?(String) opts = { authorizer_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(rest_api_id authorizer_id)) - raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" unless opts[:rest_api_id] && !opts[:rest_api_id].empty? - raise ArgumentError, "#{@__resource_name__}: authorizer_id must be provided" unless opts[:authorizer_id] && !opts[:authorizer_id].empty? + validate_parameters(required: %i[rest_api_id authorizer_id]) + unless opts[:rest_api_id] && !opts[:rest_api_id].empty? + raise ArgumentError, "#{@__resource_name__}: rest_api_id must be provided" + end + unless opts[:authorizer_id] && !opts[:authorizer_id].empty? + raise ArgumentError, + "#{@__resource_name__}: authorizer_id must be provided" + end @display_name = opts[:authorizer_id] catch_aws_errors do - resp = @aws.apigateway_client.get_authorizer({ rest_api_id: opts[:rest_api_id], authorizer_id: opts[:authorizer_id] }) + resp = + @aws.apigateway_client.get_authorizer( + { + rest_api_id: opts[:rest_api_id], + authorizer_id: opts[:authorizer_id] + } + ) @res = resp.to_h create_resource_methods(@res) end end def authorizer_id - return unless exists? + return nil unless exists? @res[:authorizer_id] end def resource_id - @res? @res[:id] : @display_name + @res ? @res[:id] : @display_name end def exists? diff --git a/libraries/aws_apigateway_base_path_mapping.rb b/libraries/aws_apigateway_base_path_mapping.rb index e1fb57f81..5ff535067 100644 --- a/libraries/aws_apigateway_base_path_mapping.rb +++ b/libraries/aws_apigateway_base_path_mapping.rb @@ -13,19 +13,26 @@ def initialize(opts = {}) opts = { domain_name: opts } if opts.is_a?(String) opts = { base_path: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(domain_name base_path)) - raise ArgumentError, "#{@__resource_name__}: domain_name must be provided" unless opts[:domain_name] && !opts[:domain_name].empty? - raise ArgumentError, "#{@__resource_name__}: base_path must be provided" unless opts[:base_path] && !opts[:base_path].empty? + validate_parameters(required: %i[domain_name base_path]) + unless opts[:domain_name] && !opts[:domain_name].empty? + raise ArgumentError, "#{@__resource_name__}: domain_name must be provided" + end + unless opts[:base_path] && !opts[:base_path].empty? + raise ArgumentError, "#{@__resource_name__}: base_path must be provided" + end @display_name = opts[:base_path] catch_aws_errors do - resp = @aws.apigateway_client.get_base_path_mapping({ domain_name: opts[:domain_name], base_path: opts[:base_path] }) + resp = + @aws.apigateway_client.get_base_path_mapping( + { domain_name: opts[:domain_name], base_path: opts[:base_path] } + ) @res = resp.to_h create_resource_methods(@res) end end def base_path - return unless exists? + return nil unless exists? @res[:base_path] end diff --git a/libraries/aws_apigateway_client_certificate.rb b/libraries/aws_apigateway_client_certificate.rb index 03779dc16..686886148 100644 --- a/libraries/aws_apigateway_client_certificate.rb +++ b/libraries/aws_apigateway_client_certificate.rb @@ -12,11 +12,17 @@ class AWSApiGatewayClientCertificate < AwsResourceBase def initialize(opts = {}) opts = { client_certificate_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(client_certificate_id)) - raise ArgumentError, "#{@__resource_name__}: client_certificate_id must be provided" unless opts[:client_certificate_id] && !opts[:client_certificate_id].empty? + validate_parameters(required: %i[client_certificate_id]) + unless opts[:client_certificate_id] && !opts[:client_certificate_id].empty? + raise ArgumentError, + "#{@__resource_name__}: client_certificate_id must be provided" + end @display_name = opts[:client_certificate_id] catch_aws_errors do - resp = @aws.apigateway_client.get_client_certificate({ client_certificate_id: opts[:client_certificate_id] }) + resp = + @aws.apigateway_client.get_client_certificate( + { client_certificate_id: opts[:client_certificate_id] } + ) @res = resp.to_h create_resource_methods(@res) end @@ -28,7 +34,7 @@ def client_certificate_id end def resource_id - @res? @res[:client_certificate_id] : @display_name + @res ? @res[:client_certificate_id] : @display_name end def exists? diff --git a/libraries/aws_application_autoscaling_scalable_target.rb b/libraries/aws_application_autoscaling_scalable_target.rb index 459d612e9..f0755d1d8 100644 --- a/libraries/aws_application_autoscaling_scalable_target.rb +++ b/libraries/aws_application_autoscaling_scalable_target.rb @@ -13,22 +13,28 @@ def initialize(opts = {}) opts = { service_namespace: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:service_namespace]) - raise ArgumentError, "#{@__resource_name__}: service_namespace must be provided" unless opts[:service_namespace] && !opts[:service_namespace].empty? + unless opts[:service_namespace] && !opts[:service_namespace].empty? + raise ArgumentError, + "#{@__resource_name__}: service_namespace must be provided" + end @display_name = opts[:service_namespace] catch_aws_errors do - resp = @aws.applicationautoscaling_client.describe_scalable_targets({ service_namespace: opts[:service_namespace] }) + resp = + @aws.applicationautoscaling_client.describe_scalable_targets( + { service_namespace: opts[:service_namespace] } + ) @scalable_targets = resp.scalable_targets[0].to_h create_resource_methods(@scalable_targets) end end def service_namespace - return unless exists? + return nil unless exists? @scalable_targets[:service_namespace] end def resource_id - @scalable_targets? @scalable_targets[:resource_id]: "" + @scalable_targets ? @scalable_targets[:resource_id] : "" end def exists? diff --git a/libraries/aws_application_autoscaling_scaling_policy.rb b/libraries/aws_application_autoscaling_scaling_policy.rb index ed7fcd245..c194e5094 100644 --- a/libraries/aws_application_autoscaling_scaling_policy.rb +++ b/libraries/aws_application_autoscaling_scaling_policy.rb @@ -14,22 +14,28 @@ def initialize(opts = {}) super(opts) validate_parameters(required: [:service_namespace]) - raise ArgumentError, "#{@__resource_name__}: service_namespace must be provided" unless opts[:service_namespace] && !opts[:service_namespace].empty? + unless opts[:service_namespace] && !opts[:service_namespace].empty? + raise ArgumentError, + "#{@__resource_name__}: service_namespace must be provided" + end @display_name = opts[:service_namespace] catch_aws_errors do - resp = @aws.applicationautoscaling_client.describe_scaling_policies({ service_namespace: opts[:service_namespace] }) + resp = + @aws.applicationautoscaling_client.describe_scaling_policies( + { service_namespace: opts[:service_namespace] } + ) @scaling_policies = resp.scaling_policies[0].to_h create_resource_methods(@scaling_policies) end end def service_namespace - return unless exists? + return nil unless exists? @scaling_policies[:service_namespace] end def resource_id - @scaling_policies ? @scaling_policies[:resource_id]: "" + @scaling_policies ? @scaling_policies[:resource_id] : "" end def exists? diff --git a/libraries/aws_athena_work_group.rb b/libraries/aws_athena_work_group.rb index 9b9bb5b50..3e3ba96bd 100644 --- a/libraries/aws_athena_work_group.rb +++ b/libraries/aws_athena_work_group.rb @@ -14,17 +14,20 @@ def initialize(opts = {}) super(opts) validate_parameters(required: [:work_group]) - raise ArgumentError, "#{@__resource_name__}: work_group must be provided" unless opts[:work_group] && !opts[:work_group].empty? + unless opts[:work_group] && !opts[:work_group].empty? + raise ArgumentError, "#{@__resource_name__}: work_group must be provided" + end @display_name = opts[:work_group] catch_aws_errors do - resp = @aws.athena_client.get_work_group({ work_group: opts[:work_group] }) + resp = + @aws.athena_client.get_work_group({ work_group: opts[:work_group] }) @work_group = resp.work_group.to_h create_resource_methods(@work_group) end end def work_group - return unless exists? + return nil unless exists? @work_group[:work_group] end diff --git a/libraries/aws_autoscaling_scaling_policy.rb b/libraries/aws_autoscaling_scaling_policy.rb index 02f8cd3f3..b2142e14e 100644 --- a/libraries/aws_autoscaling_scaling_policy.rb +++ b/libraries/aws_autoscaling_scaling_policy.rb @@ -15,17 +15,24 @@ def initialize(opts = {}) super(opts) validate_parameters(required: [:auto_scaling_group_name]) - raise ArgumentError, "#{@__resource_name__}: auto_scaling_group_name must be provided" unless opts[:auto_scaling_group_name] && !opts[:auto_scaling_group_name].empty? + unless opts[:auto_scaling_group_name] && + !opts[:auto_scaling_group_name].empty? + raise ArgumentError, + "#{@__resource_name__}: auto_scaling_group_name must be provided" + end @display_name = opts[:auto_scaling_group_name] catch_aws_errors do - resp = @aws.autoscaling_client.describe_policies({ auto_scaling_group_name: opts[:auto_scaling_group_name] }) + resp = + @aws.autoscaling_client.describe_policies( + { auto_scaling_group_name: opts[:auto_scaling_group_name] } + ) @scaling_policies = resp.scaling_policies[0].to_h create_resource_methods(@scaling_policies) end end def auto_scaling_group_name - return unless exists? + return nil unless exists? @scaling_policies[:auto_scaling_group_name] end diff --git a/libraries/aws_batch_compute_environment.rb b/libraries/aws_batch_compute_environment.rb index a9da53894..d85f787c1 100644 --- a/libraries/aws_batch_compute_environment.rb +++ b/libraries/aws_batch_compute_environment.rb @@ -14,17 +14,24 @@ def initialize(opts = {}) super(opts) validate_parameters(required: [:compute_environment_name]) - raise ArgumentError, "#{@__resource_name__}: compute_environment_name must be provided" unless opts[:compute_environment_name] && !opts[:compute_environment_name].empty? + unless opts[:compute_environment_name] && + !opts[:compute_environment_name].empty? + raise ArgumentError, + "#{@__resource_name__}: compute_environment_name must be provided" + end @display_name = opts[:compute_environment_name] catch_aws_errors do - resp = @aws.batch_client.describe_compute_environments({ compute_environments: [opts[:compute_environment_name]] }) + resp = + @aws.batch_client.describe_compute_environments( + { compute_environments: [opts[:compute_environment_name]] } + ) @compute_environments = resp.compute_environments[0].to_h create_resource_methods(@compute_environments) end end def compute_environment_name - return unless exists? + return nil unless exists? @compute_environments[:compute_environment_name] end diff --git a/libraries/aws_batch_job_definition.rb b/libraries/aws_batch_job_definition.rb index 93f1c80fa..b250851cc 100644 --- a/libraries/aws_batch_job_definition.rb +++ b/libraries/aws_batch_job_definition.rb @@ -14,9 +14,15 @@ def initialize(opts = {}) super(opts) validate_parameters(required: [:job_definition_name]) - raise ArgumentError, "#{@__resource_name__}: job_definition_name must be provided" unless opts[:job_definition_name] && !opts[:job_definition_name].empty? + unless opts[:job_definition_name] && !opts[:job_definition_name].empty? + raise ArgumentError, + "#{@__resource_name__}: job_definition_name must be provided" + end @display_name = opts[:job_definition_name] - resp = @aws.batch_client.describe_job_definitions({ job_definition_name: opts[:job_definition_name] }) + resp = + @aws.batch_client.describe_job_definitions( + { job_definition_name: opts[:job_definition_name] } + ) @job_definitions = resp.job_definitions[0].to_h create_resource_methods(@job_definitions) end diff --git a/libraries/aws_batch_job_queue.rb b/libraries/aws_batch_job_queue.rb index 0c33f8014..23dddc07e 100644 --- a/libraries/aws_batch_job_queue.rb +++ b/libraries/aws_batch_job_queue.rb @@ -14,17 +14,23 @@ def initialize(opts = {}) super(opts) validate_parameters(required: [:job_queue_name]) - raise ArgumentError, "#{@__resource_name__}: job_queue_name must be provided" unless opts[:job_queue_name] && !opts[:job_queue_name].empty? + unless opts[:job_queue_name] && !opts[:job_queue_name].empty? + raise ArgumentError, + "#{@__resource_name__}: job_queue_name must be provided" + end @display_name = opts[:job_queue_name] catch_aws_errors do - resp = @aws.batch_client.describe_job_queues({ job_queues: [opts[:job_queue_name]] }) + resp = + @aws.batch_client.describe_job_queues( + { job_queues: [opts[:job_queue_name]] } + ) @job_queues = resp.job_queues[0].to_h create_resource_methods(@job_queues) end end def job_queue_name - return unless exists? + return nil unless exists? @job_queues[:job_queue_name] end diff --git a/libraries/aws_cloud_formation_stack_set.rb b/libraries/aws_cloud_formation_stack_set.rb index dc38961eb..f9469c00b 100644 --- a/libraries/aws_cloud_formation_stack_set.rb +++ b/libraries/aws_cloud_formation_stack_set.rb @@ -13,9 +13,15 @@ def initialize(opts = {}) opts = { stack_set_name: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:stack_set_name]) - raise ArgumentError, "#{@__resource_name__}: stack_set_name must be provided" unless opts[:stack_set_name] && !opts[:stack_set_name].empty? + unless opts[:stack_set_name] && !opts[:stack_set_name].empty? + raise ArgumentError, + "#{@__resource_name__}: stack_set_name must be provided" + end @display_name = opts[:stack_set_name] - resp = @aws.cloudformation_client.describe_stack_set({ stack_set_name: opts[:stack_set_name] }) + resp = + @aws.cloudformation_client.describe_stack_set( + { stack_set_name: opts[:stack_set_name] } + ) @resp = resp.stack_set.to_h @stack_set_id = @resp[:stack_set_id] create_resource_methods(@resp) @@ -26,7 +32,7 @@ def resource_id end def stack_set_name - return unless exists? + return nil unless exists? @resp[:stack_set_name] end diff --git a/libraries/aws_cloudformation_template.rb b/libraries/aws_cloudformation_template.rb index 86cf6a48c..522cc8c4f 100644 --- a/libraries/aws_cloudformation_template.rb +++ b/libraries/aws_cloudformation_template.rb @@ -23,10 +23,13 @@ class AWSCloudFormationTemplate < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(require_any_of: %i(stack_name stack_set_name template_url template_body)) + validate_parameters( + require_any_of: %i[stack_name stack_set_name template_url template_body] + ) @stack_name = opts[:stack_name] @template_url = opts[:template_url] - @query_params = opts.slice(:stack_name, :stack_set_name, :template_url, :template_body) + @query_params = + opts.slice(:stack_name, :stack_set_name, :template_url, :template_body) @query_stack_name = opts.slice(:stack_name) catch_aws_errors do resp = @aws.cloudformation_client.get_template_summary(@query_params) @@ -40,14 +43,15 @@ def resource_id end def template_body - return unless exists? + return nil unless exists? catch_aws_errors do - @template_body ||= @aws.cloudformation_client.get_template(@query_stack_name) + @template_body ||= + @aws.cloudformation_client.get_template(@query_stack_name) end end def stack_name - return unless exists? + return nil unless exists? @res[:stack_name] end diff --git a/libraries/aws_cloudfront_cache_policy.rb b/libraries/aws_cloudfront_cache_policy.rb index 79498bdc8..6251e7d18 100644 --- a/libraries/aws_cloudfront_cache_policy.rb +++ b/libraries/aws_cloudfront_cache_policy.rb @@ -12,8 +12,10 @@ class AWSCloudFrontCachePolicy < AwsResourceBase def initialize(opts = {}) opts = { id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(id)) - raise ArgumentError, "#{@__resource_name__}: id must be provided" unless opts[:id] && !opts[:id].empty? + validate_parameters(required: %i[id]) + unless opts[:id] && !opts[:id].empty? + raise ArgumentError, "#{@__resource_name__}: id must be provided" + end @display_name = opts[:id] catch_aws_errors do resp = @aws.cloudfront_client.get_cache_policy({ id: opts[:id] }) @@ -23,11 +25,11 @@ def initialize(opts = {}) end def resource_id - @res? @res[:id]: @display_name + @res ? @res[:id] : @display_name end def id - return unless exists? + return nil unless exists? @res[:id] end diff --git a/libraries/aws_cloudfront_key_group.rb b/libraries/aws_cloudfront_key_group.rb index 8460e0368..7d471b9ab 100644 --- a/libraries/aws_cloudfront_key_group.rb +++ b/libraries/aws_cloudfront_key_group.rb @@ -13,7 +13,9 @@ def initialize(opts = {}) opts = { id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:id]) - raise ArgumentError, "#{@__resource_name__}: id must be provided" unless opts[:id] && !opts[:id].empty? + unless opts[:id] && !opts[:id].empty? + raise ArgumentError, "#{@__resource_name__}: id must be provided" + end @display_name = opts[:id] catch_aws_errors do resp = @aws.cloudfront_client.get_key_group({ id: opts[:id] }) @@ -23,7 +25,7 @@ def initialize(opts = {}) end def resource_id - @resp? @resp[:id]: @display_name + @resp ? @resp[:id] : @display_name end def id diff --git a/libraries/aws_cloudfront_origin_access_identity.rb b/libraries/aws_cloudfront_origin_access_identity.rb index 9a1583733..c61ff1235 100644 --- a/libraries/aws_cloudfront_origin_access_identity.rb +++ b/libraries/aws_cloudfront_origin_access_identity.rb @@ -12,18 +12,23 @@ class AWSCloudFrontOriginAccessIdentity < AwsResourceBase def initialize(opts = {}) opts = { id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(id)) - raise ArgumentError, "#{@__resource_name__}: id must be provided" unless opts[:id] && !opts[:id].empty? + validate_parameters(required: %i[id]) + unless opts[:id] && !opts[:id].empty? + raise ArgumentError, "#{@__resource_name__}: id must be provided" + end @display_name = opts[:id] catch_aws_errors do - resp = @aws.cloudfront_client.get_cloud_front_origin_access_identity({ id: opts[:id] }) + resp = + @aws.cloudfront_client.get_cloud_front_origin_access_identity( + { id: opts[:id] } + ) @res = resp.cloud_front_origin_access_identity.to_h create_resource_methods(@res) end end def resource_id - @res? @res[:id]: @display_name + @res ? @res[:id] : @display_name end def id diff --git a/libraries/aws_cloudfront_origin_request_policy.rb b/libraries/aws_cloudfront_origin_request_policy.rb index 4e7292543..3c4644f6a 100644 --- a/libraries/aws_cloudfront_origin_request_policy.rb +++ b/libraries/aws_cloudfront_origin_request_policy.rb @@ -13,7 +13,9 @@ def initialize(opts = {}) opts = { id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:id]) - raise ArgumentError, "#{@__resource_name__}: id must be provided" unless opts[:id] && !opts[:id].empty? + unless opts[:id] && !opts[:id].empty? + raise ArgumentError, "#{@__resource_name__}: id must be provided" + end @display_name = opts[:id] resp = @aws.cloudfront_client.get_origin_request_policy({ id: opts[:id] }) @origin_request_policy = resp.origin_request_policy.to_h @@ -26,7 +28,7 @@ def resource_id end def id - return unless exists? + return nil unless exists? @origin_request_policy_id end diff --git a/libraries/aws_cloudfront_public_key.rb b/libraries/aws_cloudfront_public_key.rb index 7255d9b8f..50ab40bd6 100644 --- a/libraries/aws_cloudfront_public_key.rb +++ b/libraries/aws_cloudfront_public_key.rb @@ -12,8 +12,10 @@ class AWSCloudFrontPublicKey < AwsResourceBase def initialize(opts = {}) opts = { id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(id)) - raise ArgumentError, "#{@__resource_name__}: id must be provided" unless opts[:id] && !opts[:id].empty? + validate_parameters(required: %i[id]) + unless opts[:id] && !opts[:id].empty? + raise ArgumentError, "#{@__resource_name__}: id must be provided" + end @display_name = opts[:id] catch_aws_errors do resp = @aws.cloudfront_client.get_public_key({ id: opts[:id] }) @@ -23,11 +25,11 @@ def initialize(opts = {}) end def resource_id - @res? @res[:id]: @display_name + @res ? @res[:id] : @display_name end def id - return unless exists? + return nil unless exists? @res[:id] end diff --git a/libraries/aws_cloudfront_realtime_log_config.rb b/libraries/aws_cloudfront_realtime_log_config.rb index 42eb72689..b43c61a8f 100644 --- a/libraries/aws_cloudfront_realtime_log_config.rb +++ b/libraries/aws_cloudfront_realtime_log_config.rb @@ -12,11 +12,14 @@ class AwsCloudFrontRealtimeLogConfig < AwsResourceBase def initialize(opts = {}) opts = { name: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(name)) - raise ArgumentError, "#{@__resource_name__}: name must be provided" unless opts[:name] && !opts[:name].empty? + validate_parameters(required: %i[name]) + unless opts[:name] && !opts[:name].empty? + raise ArgumentError, "#{@__resource_name__}: name must be provided" + end @display_name = opts[:name] catch_aws_errors do - resp = @aws.cloudfront_client.get_realtime_log_config({ name: opts[:name] }) + resp = + @aws.cloudfront_client.get_realtime_log_config({ name: opts[:name] }) @res = resp.realtime_log_config.to_h @arn = @res[:arn] create_resource_methods(@res) @@ -24,7 +27,7 @@ def initialize(opts = {}) end def name - return unless exists? + return nil unless exists? @res[:name] end diff --git a/libraries/aws_cloudfront_streaming_distribution.rb b/libraries/aws_cloudfront_streaming_distribution.rb index b2fd6eb35..a83c29ffe 100644 --- a/libraries/aws_cloudfront_streaming_distribution.rb +++ b/libraries/aws_cloudfront_streaming_distribution.rb @@ -12,11 +12,14 @@ class AWSCloudFrontStreamingDistribution < AwsResourceBase def initialize(opts = {}) opts = { id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(id)) - raise ArgumentError, "#{@__resource_name__}: id must be provided" unless opts[:id] && !opts[:id].empty? + validate_parameters(required: %i[id]) + unless opts[:id] && !opts[:id].empty? + raise ArgumentError, "#{@__resource_name__}: id must be provided" + end @display_name = opts[:id] catch_aws_errors do - resp = @aws.cloudfront_client.get_streaming_distribution({ id: opts[:id] }) + resp = + @aws.cloudfront_client.get_streaming_distribution({ id: opts[:id] }) @res = resp.streaming_distribution.to_h @arn = @res[:arn] create_resource_methods(@res) @@ -28,7 +31,7 @@ def resource_id end def id - return unless exists? + return nil unless exists? @res[:id] end diff --git a/libraries/aws_cloudtrail_trail.rb b/libraries/aws_cloudtrail_trail.rb index dfe079373..e387eca13 100644 --- a/libraries/aws_cloudtrail_trail.rb +++ b/libraries/aws_cloudtrail_trail.rb @@ -9,9 +9,17 @@ class AwsCloudTrailTrail < AwsResourceBase end EXAMPLE - attr_reader :cloud_watch_logs_log_group_arn, :cloud_watch_logs_role_arn, :home_region, :trail_name, - :kms_key_id, :s3_bucket_name, :s3_key_prefix, :trail_arn, :is_multi_region_trail, - :log_file_validation_enabled, :is_organization_trail + attr_reader :cloud_watch_logs_log_group_arn, + :cloud_watch_logs_role_arn, + :home_region, + :trail_name, + :kms_key_id, + :s3_bucket_name, + :s3_key_prefix, + :trail_arn, + :is_multi_region_trail, + :log_file_validation_enabled, + :is_organization_trail alias multi_region_trail? is_multi_region_trail alias log_file_validation_enabled? log_file_validation_enabled @@ -25,7 +33,10 @@ def initialize(opts = {}) @trail_name = opts[:trail_name] catch_aws_errors do - resp = @aws.cloudtrail_client.describe_trails({ trail_name_list: [@trail_name] }) + resp = + @aws.cloudtrail_client.describe_trails( + { trail_name_list: [@trail_name] } + ) @trail = resp.trail_list[0].to_h @trail_arn = @trail[:trail_arn] @kms_key_id = @trail[:kms_key_id] @@ -48,8 +59,14 @@ def delivered_logs_days_ago return unless exists? catch_aws_errors do begin - trail_status = @aws.cloudtrail_client.get_trail_status({ name: @trail_name }).to_h - ((Time.now - trail_status[:latest_cloud_watch_logs_delivery_time]) / (24 * 60 * 60)).to_i unless trail_status[:latest_cloud_watch_logs_delivery_time].nil? + trail_status = + @aws.cloudtrail_client.get_trail_status({ name: @trail_name }).to_h + unless trail_status[:latest_cloud_watch_logs_delivery_time].nil? + ( + (Time.now - trail_status[:latest_cloud_watch_logs_delivery_time]) / + (24 * 60 * 60) + ).to_i + end rescue Aws::CloudTrail::Errors::TrailNotFoundException nil end @@ -59,7 +76,9 @@ def delivered_logs_days_ago def logging? catch_aws_errors do begin - @aws.cloudtrail_client.get_trail_status({ name: @trail_name }).to_h[:is_logging] + @aws.cloudtrail_client.get_trail_status({ name: @trail_name }).to_h[ + :is_logging + ] rescue Aws::CloudTrail::Errors::TrailNotFoundException nil end @@ -74,16 +93,20 @@ def get_log_group_for_multi_region_active_mgmt_rw_all return unless exists? return unless @cloud_watch_logs_log_group_arn return if @cloud_watch_logs_log_group_arn.split(":").count < 6 - return @cloud_watch_logs_log_group_arn.split(":")[6] if has_event_selector_mgmt_events_rw_type_all? && logging? + if has_event_selector_mgmt_events_rw_type_all? && logging? + return @cloud_watch_logs_log_group_arn.split(":")[6] + end end def has_event_selector_mgmt_events_rw_type_all? return unless exists? event_selector_found = false begin - event_selectors = @aws.cloudtrail_client.get_event_selectors(trail_name: @trail_name) + event_selectors = + @aws.cloudtrail_client.get_event_selectors(trail_name: @trail_name) event_selectors.event_selectors.each do |es| - event_selector_found = true if es.read_write_type == "All" && es.include_management_events == true + event_selector_found = true if es.read_write_type == "All" && + es.include_management_events == true end rescue Aws::CloudTrail::Errors::TrailNotFoundException event_selector_found diff --git a/libraries/aws_cloudwatch_anomaly_detector.rb b/libraries/aws_cloudwatch_anomaly_detector.rb index e5312fe9c..4a2e3f3fd 100644 --- a/libraries/aws_cloudwatch_anomaly_detector.rb +++ b/libraries/aws_cloudwatch_anomaly_detector.rb @@ -12,22 +12,27 @@ class AwsCloudwatchAnomalyDetector < AwsResourceBase def initialize(opts = {}) opts = { metric_name: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(metric_name)) - raise ArgumentError, "#{@__resource_name__}: metric_name must be provided" unless opts[:metric_name] && !opts[:metric_name].empty? + validate_parameters(required: %i[metric_name]) + unless opts[:metric_name] && !opts[:metric_name].empty? + raise ArgumentError, "#{@__resource_name__}: metric_name must be provided" + end @display_name = opts[:metric_name] catch_aws_errors do - resp = @aws.cloudwatch_client.describe_anomaly_detectors({ metric_name: opts[:metric_name] }) + resp = + @aws.cloudwatch_client.describe_anomaly_detectors( + { metric_name: opts[:metric_name] } + ) @res = resp.anomaly_detectors[0].to_h create_resource_methods(@res) end end def resource_id - "#{@res? @res[:metric_name]: ""}_#{@res? @res[:namespace]: ""}" + "#{@res ? @res[:metric_name] : ""}_#{@res ? @res[:namespace] : ""}" end def metric_name - return unless exists? + return nil unless exists? @res[:metric_name] end diff --git a/libraries/aws_cloudwatch_composite_alarm.rb b/libraries/aws_cloudwatch_composite_alarm.rb index 7e8b28995..44459feb0 100644 --- a/libraries/aws_cloudwatch_composite_alarm.rb +++ b/libraries/aws_cloudwatch_composite_alarm.rb @@ -12,11 +12,16 @@ class AwsCloudwatchCompositeAlarm < AwsResourceBase def initialize(opts = {}) opts = { alarm_name: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(alarm_name)) - raise ArgumentError, "#{@__resource_name__}: alarm_name must be provided" unless opts[:alarm_name] && !opts[:alarm_name].empty? + validate_parameters(required: %i[alarm_name]) + unless opts[:alarm_name] && !opts[:alarm_name].empty? + raise ArgumentError, "#{@__resource_name__}: alarm_name must be provided" + end @display_name = opts[:alarm_name] catch_aws_errors do - resp = @aws.cloudwatch_client.describe_alarms({ alarm_names: [opts[:alarm_name]], alarm_types: ["CompositeAlarm"] }) + resp = + @aws.cloudwatch_client.describe_alarms( + { alarm_names: [opts[:alarm_name]], alarm_types: ["CompositeAlarm"] } + ) @res = resp.composite_alarms[0].to_h @alarm_arn = @res[:alarm_arn] create_resource_methods(@res) @@ -28,7 +33,7 @@ def resource_id end def alarm_name - return unless exists? + return nil unless exists? @res[:alarm_name] end diff --git a/libraries/aws_cloudwatch_dashboard.rb b/libraries/aws_cloudwatch_dashboard.rb index b94f52d6d..a184d8634 100644 --- a/libraries/aws_cloudwatch_dashboard.rb +++ b/libraries/aws_cloudwatch_dashboard.rb @@ -13,10 +13,16 @@ def initialize(opts = {}) opts = { dashboard_name: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:dashboard_name]) - raise ArgumentError, "#{@__resource_name__}: dashboard_name must be provided" unless opts[:dashboard_name] && !opts[:dashboard_name].empty? + unless opts[:dashboard_name] && !opts[:dashboard_name].empty? + raise ArgumentError, + "#{@__resource_name__}: dashboard_name must be provided" + end @display_name = opts[:dashboard_name] catch_aws_errors do - resp = @aws.cloudwatch_client.get_dashboard({ dashboard_name: opts[:dashboard_name] }) + resp = + @aws.cloudwatch_client.get_dashboard( + { dashboard_name: opts[:dashboard_name] } + ) @dashboard = resp.to_h @dashboard_arn = @dashboard[:dashboard_arn] create_resource_methods(@dashboard) @@ -28,7 +34,7 @@ def resource_id end def dashboard_name - return unless exists? + return nil unless exists? @dashboard[:dashboard_name] end diff --git a/libraries/aws_cloudwatch_metric_stream.rb b/libraries/aws_cloudwatch_metric_stream.rb index 4c54d9f58..ec18ef3ff 100644 --- a/libraries/aws_cloudwatch_metric_stream.rb +++ b/libraries/aws_cloudwatch_metric_stream.rb @@ -13,10 +13,16 @@ def initialize(opts = {}) opts = { metric_stream_name: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:metric_stream_name]) - raise ArgumentError, "#{@__resource_name__}: metric_stream_name must be provided" unless opts[:metric_stream_name] && !opts[:metric_stream_name].empty? + unless opts[:metric_stream_name] && !opts[:metric_stream_name].empty? + raise ArgumentError, + "#{@__resource_name__}: metric_stream_name must be provided" + end @display_name = opts[:metric_stream_name] catch_aws_errors do - resp = @aws.cloudwatch_client.get_metric_stream({ name: opts[:metric_stream_name] }) + resp = + @aws.cloudwatch_client.get_metric_stream( + { name: opts[:metric_stream_name] } + ) @stream = resp.to_h @stream_name = @stream[:name] @stream_arn = @stream[:arn] @@ -29,7 +35,7 @@ def resource_id end def metric_stream_name - return unless exists? + return nil unless exists? @stream[:name] end diff --git a/libraries/aws_cloudwatchlogs_destinantion.rb b/libraries/aws_cloudwatchlogs_destinantion.rb index af41eaa22..5e1583e8e 100644 --- a/libraries/aws_cloudwatchlogs_destinantion.rb +++ b/libraries/aws_cloudwatchlogs_destinantion.rb @@ -13,10 +13,17 @@ def initialize(opts = {}) opts = { destination_name_prefix: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:destination_name_prefix]) - raise ArgumentError, "#{@__resource_name__}: destination_name_prefix must be provided" unless opts[:destination_name_prefix] && !opts[:destination_name_prefix].empty? + unless opts[:destination_name_prefix] && + !opts[:destination_name_prefix].empty? + raise ArgumentError, + "#{@__resource_name__}: destination_name_prefix must be provided" + end @display_name = opts[:destination_name_prefix] catch_aws_errors do - resp = @aws.cloudwatchlogs_client.describe_destinations({ destination_name_prefix: opts[:destination_name_prefix] }) + resp = + @aws.cloudwatchlogs_client.describe_destinations( + { destination_name_prefix: opts[:destination_name_prefix] } + ) @destinations = resp.destinations[0].to_h @destination_name = @destinations[:destination_name] @destination_arn = @destinations[:arn] diff --git a/libraries/aws_cloudwatchlogs_log_stream.rb b/libraries/aws_cloudwatchlogs_log_stream.rb index 59a4fb56f..6b53b8938 100644 --- a/libraries/aws_cloudwatchlogs_log_stream.rb +++ b/libraries/aws_cloudwatchlogs_log_stream.rb @@ -12,12 +12,25 @@ class AWSCloudWatchLogsLogStream < AwsResourceBase def initialize(opts = {}) opts = { log_stream_name_prefix: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(log_stream_name_prefix log_group_name)) - raise ArgumentError, "#{@__resource_name__}: log_stream_name_prefix must be provided." unless opts[:log_stream_name_prefix] && !opts[:log_stream_name_prefix].empty? - raise ArgumentError, "#{@__resource_name__}: log_group_name must be provided." unless opts[:log_group_name] && !opts[:log_group_name].empty? + validate_parameters(required: %i[log_stream_name_prefix log_group_name]) + unless opts[:log_stream_name_prefix] && + !opts[:log_stream_name_prefix].empty? + raise ArgumentError, + "#{@__resource_name__}: log_stream_name_prefix must be provided." + end + unless opts[:log_group_name] && !opts[:log_group_name].empty? + raise ArgumentError, + "#{@__resource_name__}: log_group_name must be provided." + end @display_name = opts[:log_stream_name_prefix] catch_aws_errors do - resp = @aws.cloudwatchlogs_client.describe_log_streams({ log_stream_name_prefix: opts[:log_stream_name_prefix], log_group_name: opts[:log_group_name] }) + resp = + @aws.cloudwatchlogs_client.describe_log_streams( + { + log_stream_name_prefix: opts[:log_stream_name_prefix], + log_group_name: opts[:log_group_name] + } + ) @log_streams = resp.log_streams[0].to_h @log_stream_name = @log_streams[:log_stream_name] @log_stream_arn = @log_streams[:arn] @@ -30,7 +43,7 @@ def resource_id end def log_stream_name_prefix - return unless exists? + return nil unless exists? @log_streams[:log_stream_name_prefix] end diff --git a/libraries/aws_cloudwatchlogs_subscription_filter.rb b/libraries/aws_cloudwatchlogs_subscription_filter.rb index 975afcd49..4ff7e4041 100644 --- a/libraries/aws_cloudwatchlogs_subscription_filter.rb +++ b/libraries/aws_cloudwatchlogs_subscription_filter.rb @@ -12,12 +12,24 @@ class AWSCloudWatchLogsSubscriptionFilter < AwsResourceBase def initialize(opts = {}) opts = { filter_name_prefix: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(log_group_name filter_name_prefix)) - raise ArgumentError, "#{@__resource_name__}: log_group_name must be provided" unless opts[:log_group_name] && !opts[:log_group_name].empty? - raise ArgumentError, "#{@__resource_name__}: filter_name_prefix must be provided" unless opts[:filter_name_prefix] && !opts[:filter_name_prefix].empty? + validate_parameters(required: %i[log_group_name filter_name_prefix]) + unless opts[:log_group_name] && !opts[:log_group_name].empty? + raise ArgumentError, + "#{@__resource_name__}: log_group_name must be provided" + end + unless opts[:filter_name_prefix] && !opts[:filter_name_prefix].empty? + raise ArgumentError, + "#{@__resource_name__}: filter_name_prefix must be provided" + end @display_name = opts[:filter_name_prefix] catch_aws_errors do - resp = @aws.cloudwatchlogs_client.describe_subscription_filters({ log_group_name: opts[:log_group_name], filter_name_prefix: opts[:filter_name_prefix] }) + resp = + @aws.cloudwatchlogs_client.describe_subscription_filters( + { + log_group_name: opts[:log_group_name], + filter_name_prefix: opts[:filter_name_prefix] + } + ) @filter = resp.subscription_filters[0].to_h @filter_name = @filter[:filter_name] @filter_log_group_name = @filter[:log_group_name] @@ -31,7 +43,7 @@ def resource_id end def filter_name_prefix - return unless exists? + return nil unless exists? @filter[:filter_name_prefix] end diff --git a/libraries/aws_cognito_identity_pool.rb b/libraries/aws_cognito_identity_pool.rb index c1ab07f71..3a1498af4 100644 --- a/libraries/aws_cognito_identity_pool.rb +++ b/libraries/aws_cognito_identity_pool.rb @@ -13,17 +13,23 @@ def initialize(opts = {}) opts = { identity_pool_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:identity_pool_id]) - raise ArgumentError, "#{@__resource_name__}: identity_pool_id must be provided" unless opts[:identity_pool_id] && !opts[:identity_pool_id].empty? + unless opts[:identity_pool_id] && !opts[:identity_pool_id].empty? + raise ArgumentError, + "#{@__resource_name__}: identity_pool_id must be provided" + end @display_name = opts[:identity_pool_id] catch_aws_errors do - resp = @aws.cognitoidentity_client.describe_identity_pool({ identity_pool_id: opts[:identity_pool_id] }) + resp = + @aws.cognitoidentity_client.describe_identity_pool( + { identity_pool_id: opts[:identity_pool_id] } + ) @res = resp.to_h create_resource_methods(@res) end end def identity_pool_id - return unless exists? + return nil unless exists? @res[:identity_pool_id] end diff --git a/libraries/aws_cognito_userpool.rb b/libraries/aws_cognito_userpool.rb index 6338a8f63..523272b58 100644 --- a/libraries/aws_cognito_userpool.rb +++ b/libraries/aws_cognito_userpool.rb @@ -14,17 +14,23 @@ def initialize(opts = {}) super(opts) validate_parameters(required: [:user_pool_id]) - raise ArgumentError, "#{@__resource_name__}: user_pool_id must be provided" unless opts[:user_pool_id] && !opts[:user_pool_id].empty? + unless opts[:user_pool_id] && !opts[:user_pool_id].empty? + raise ArgumentError, + "#{@__resource_name__}: user_pool_id must be provided" + end @display_name = opts[:user_pool_id] catch_aws_errors do - resp = @aws.cognitoidentityprovider_client.describe_user_pool({ user_pool_id: opts[:user_pool_id] }) + resp = + @aws.cognitoidentityprovider_client.describe_user_pool( + { user_pool_id: opts[:user_pool_id] } + ) @user_pool = resp.user_pool.to_h create_resource_methods(@user_pool) end end def job_queue_name - return unless exists? + return nil unless exists? @user_pool[:job_queue_name] end diff --git a/libraries/aws_cognito_userpool_client.rb b/libraries/aws_cognito_userpool_client.rb index 5d2d907c5..9e089469d 100644 --- a/libraries/aws_cognito_userpool_client.rb +++ b/libraries/aws_cognito_userpool_client.rb @@ -12,16 +12,19 @@ class AWSCognitoUserPoolClient < AwsResourceBase def initialize(opts = {}) opts = { user_pool_id: opts, client_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(user_pool_id client_id)) + validate_parameters(required: %i[user_pool_id client_id]) catch_aws_errors do - resp = @aws.cognitoidentityprovider_client.describe_user_pool_client({ user_pool_id: opts[:user_pool_id], client_id: opts[:client_id] }) + resp = + @aws.cognitoidentityprovider_client.describe_user_pool_client( + { user_pool_id: opts[:user_pool_id], client_id: opts[:client_id] } + ) @user_pool_client = resp.user_pool_client.to_h create_resource_methods(@user_pool_client) end end def id - return unless exists? + return nil unless exists? @user_pool_client[:user_pool_id, :client_id] end diff --git a/libraries/aws_dms_endpoint.rb b/libraries/aws_dms_endpoint.rb index 7126198ef..ddfc6f58d 100644 --- a/libraries/aws_dms_endpoint.rb +++ b/libraries/aws_dms_endpoint.rb @@ -15,11 +15,17 @@ def initialize(opts = {}) super(opts) validate_parameters(required: [:endpoint_arn]) - raise ArgumentError, "#{@__resource_name__}: endpoint_arn must be provided" unless opts[:endpoint_arn] && !opts[:endpoint_arn].empty? + unless opts[:endpoint_arn] && !opts[:endpoint_arn].empty? + raise ArgumentError, + "#{@__resource_name__}: endpoint_arn must be provided" + end @display_name = opts[:endpoint_arn] filter = { name: "endpoint-arn", values: [opts[:endpoint_arn]] } catch_aws_errors do - resp = @aws.dmsmigrationservice_client.describe_endpoints({ filters: [filter] }) + resp = + @aws.dmsmigrationservice_client.describe_endpoints( + { filters: [filter] } + ) @endpoints = resp.endpoints[0].to_h create_resource_methods(@endpoints) end @@ -30,7 +36,7 @@ def resource_id end def endpoint_arn - return unless exists? + return nil unless exists? @endpoints[:endpoint_arn] end diff --git a/libraries/aws_dms_replication_instance.rb b/libraries/aws_dms_replication_instance.rb index 9da08ff43..2be424ba3 100644 --- a/libraries/aws_dms_replication_instance.rb +++ b/libraries/aws_dms_replication_instance.rb @@ -13,22 +13,25 @@ def initialize(opts = {}) super(opts) validate_parameters catch_aws_errors do - resp = @aws.dmsmigrationservice_client.describe_orderable_replication_instances - @orderable_replication_instances = resp.orderable_replication_instances[0].to_h + resp = + @aws.dmsmigrationservice_client.describe_orderable_replication_instances + @orderable_replication_instances = + resp.orderable_replication_instances[0].to_h create_resource_methods(@orderable_replication_instances) end end def resource_id - "#{@orderable_replication_instances? @orderable_replication_instances[:replication_instance_class]: ""}_#{@orderable_replication_instances? @orderable_replication_instances[:engine_version]: ""}" + "#{@orderable_replication_instances ? @orderable_replication_instances[:replication_instance_class] : ""}_#{@orderable_replication_instances ? @orderable_replication_instances[:engine_version] : ""}" end def replication_instance_class - return unless exists? + return nil unless exists? @orderable_replication_instances[:replication_instance_class] end def exists? - !@orderable_replication_instances.nil? && !@orderable_replication_instances.empty? + !@orderable_replication_instances.nil? && + !@orderable_replication_instances.empty? end end diff --git a/libraries/aws_dms_replication_subnet_group.rb b/libraries/aws_dms_replication_subnet_group.rb index c8337ce4c..77a596ec2 100644 --- a/libraries/aws_dms_replication_subnet_group.rb +++ b/libraries/aws_dms_replication_subnet_group.rb @@ -13,19 +13,24 @@ def initialize(opts = {}) opts = { replication_subnet_group_identifier: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:replication_subnet_group_identifier]) - raise ArgumentError, "#{@__resource_name__}: replication_subnet_group_identifier must be provided" unless opts[:replication_subnet_group_identifier] && !opts[:replication_subnet_group_identifier].empty? + unless opts[:replication_subnet_group_identifier] && + !opts[:replication_subnet_group_identifier].empty? + raise ArgumentError, + "#{@__resource_name__}: replication_subnet_group_identifier must be provided" + end @display_name = opts[:replication_subnet_group_identifier] catch_aws_errors do - resp = @aws.dmsmigrationservice_client.describe_replication_subnet_groups( - { - filters: [ - { - name: "replication-subnet-group-id", - values: [opts[:replication_subnet_group_identifier]], - }, - ], - }, - ) + resp = + @aws.dmsmigrationservice_client.describe_replication_subnet_groups( + { + filters: [ + { + name: "replication-subnet-group-id", + values: [opts[:replication_subnet_group_identifier]] + } + ] + } + ) @replication_subnet_groups = resp.replication_subnet_groups[0].to_h create_resource_methods(@replication_subnet_groups) end @@ -36,7 +41,7 @@ def resource_id end def replication_subnet_group_identifier - return unless exists? + return nil unless exists? @replication_subnet_groups[:replication_subnet_group_identifier] end diff --git a/libraries/aws_ebs_volume.rb b/libraries/aws_ebs_volume.rb index cea84b9da..87741258a 100644 --- a/libraries/aws_ebs_volume.rb +++ b/libraries/aws_ebs_volume.rb @@ -18,10 +18,13 @@ class AwsEbsVolume < AwsResourceBase def initialize(opts = {}) opts = { volume_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(require_any_of: %i(volume_id name)) + validate_parameters(require_any_of: %i[volume_id name]) if opts[:volume_id] && !opts[:volume_id].empty? - raise ArgumentError, "#{@__resource_name__}: must be in the format 'vol- followed by 8 or 17 hexadecimal characters." if opts[:volume_id] !~ /^vol\-([0-9a-f]{8})|(^vol\-[0-9a-f]{17})$/ + if opts[:volume_id] !~ /^vol\-([0-9a-f]{8})|(^vol\-[0-9a-f]{17})$/ + raise ArgumentError, + "#{@__resource_name__}: must be in the format 'vol- followed by 8 or 17 hexadecimal characters." + end @display_name = opts[:volume_id] volume_arguments = { volume_ids: [opts[:volume_id]] } elsif opts[:name] && !opts[:name].empty? @@ -29,7 +32,8 @@ def initialize(opts = {}) filter = { name: "tag:Name", values: [opts[:name]] } volume_arguments = { filters: [filter] } else - raise ArgumentError, "#{@__resource_name__}: `volume_id` or `name` must be provided" + raise ArgumentError, + "#{@__resource_name__}: `volume_id` or `name` must be provided" end catch_aws_errors do @@ -48,7 +52,7 @@ def tags end def id - return unless exists? + return nil unless exists? @volume[:volume_id] end diff --git a/libraries/aws_ec2_capacity_reservation.rb b/libraries/aws_ec2_capacity_reservation.rb index 862a99dd5..d8b43d9d6 100644 --- a/libraries/aws_ec2_capacity_reservation.rb +++ b/libraries/aws_ec2_capacity_reservation.rb @@ -13,18 +13,26 @@ def initialize(opts = {}) opts = { capacity_reservation_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:capacity_reservation_id]) - raise ArgumentError, "#{@__resource_name__}: capacity_reservation_id must be provided" unless opts[:capacity_reservation_id] && !opts[:capacity_reservation_id].empty? + unless opts[:capacity_reservation_id] && + !opts[:capacity_reservation_id].empty? + raise ArgumentError, + "#{@__resource_name__}: capacity_reservation_id must be provided" + end @display_name = opts[:capacity_reservation_id] catch_aws_errors do - resp = @aws.compute_client.describe_capacity_reservations({ capacity_reservation_ids: [opts[:capacity_reservation_id]] }) + resp = + @aws.compute_client.describe_capacity_reservations( + { capacity_reservation_ids: [opts[:capacity_reservation_id]] } + ) @resp = resp.capacity_reservations[0].to_h - @capacity_reservation_id = resp.capacity_reservations[0].capacity_reservation_id + @capacity_reservation_id = + resp.capacity_reservations[0].capacity_reservation_id create_resource_methods(@resp) end end def capacity_reservation_id - return unless exists? + return nil unless exists? @resp[:capacity_reservation_id] end diff --git a/libraries/aws_ec2_carrier_gateway.rb b/libraries/aws_ec2_carrier_gateway.rb index fde5c8716..88c973f5b 100644 --- a/libraries/aws_ec2_carrier_gateway.rb +++ b/libraries/aws_ec2_carrier_gateway.rb @@ -13,10 +13,16 @@ def initialize(opts = {}) opts = { carrier_gateway_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:carrier_gateway_id]) - raise ArgumentError, "#{@__resource_name__}: carrier_gateway_id must be provided" unless opts[:carrier_gateway_id] && !opts[:carrier_gateway_id].empty? + unless opts[:carrier_gateway_id] && !opts[:carrier_gateway_id].empty? + raise ArgumentError, + "#{@__resource_name__}: carrier_gateway_id must be provided" + end @display_name = opts[:carrier_gateway_id] catch_aws_errors do - resp = @aws.compute_client.describe_carrier_gateways({ carrier_gateway_ids: [opts[:carrier_gateway_id]] }) + resp = + @aws.compute_client.describe_carrier_gateways( + { carrier_gateway_ids: [opts[:carrier_gateway_id]] } + ) @resp = resp.carrier_gateways[0].to_h @carrier_gateway_id = resp.carrier_gateways[0].carrier_gateway_id create_resource_methods(@resp) @@ -24,7 +30,7 @@ def initialize(opts = {}) end def carrier_gateway_id - return unless exists? + return nil unless exists? @resp[:carrier_gateway_id] end diff --git a/libraries/aws_ec2_client_vpn_authorization_rule.rb b/libraries/aws_ec2_client_vpn_authorization_rule.rb index 056349862..c3999fc39 100644 --- a/libraries/aws_ec2_client_vpn_authorization_rule.rb +++ b/libraries/aws_ec2_client_vpn_authorization_rule.rb @@ -12,21 +12,32 @@ class AWSEC2ClientVPNAuthorizationRule < AwsResourceBase def initialize(opts = {}) opts = { client_vpn_endpoint_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(client_vpn_endpoint_id group_id)) - raise ArgumentError, "#{@__resource_name__}: client_vpn_endpoint_id must be provided" unless opts[:client_vpn_endpoint_id] && !opts[:client_vpn_endpoint_id].empty? - raise ArgumentError, "#{@__resource_name__}: group_id must be provided" unless opts[:group_id] && !opts[:group_id].empty? + validate_parameters(required: %i[client_vpn_endpoint_id group_id]) + unless opts[:client_vpn_endpoint_id] && + !opts[:client_vpn_endpoint_id].empty? + raise ArgumentError, + "#{@__resource_name__}: client_vpn_endpoint_id must be provided" + end + unless opts[:group_id] && !opts[:group_id].empty? + raise ArgumentError, "#{@__resource_name__}: group_id must be provided" + end @display_name = opts[:client_vpn_endpoint_id] - filter = [{ name: "group-id", - values: [opts[:group_id]] }] + filter = [{ name: "group-id", values: [opts[:group_id]] }] catch_aws_errors do - resp = @aws.compute_client.describe_client_vpn_authorization_rules({ client_vpn_endpoint_id: opts[:client_vpn_endpoint_id], filters: filter }) + resp = + @aws.compute_client.describe_client_vpn_authorization_rules( + { + client_vpn_endpoint_id: opts[:client_vpn_endpoint_id], + filters: filter + } + ) @res = resp.authorization_rules[0].to_h create_resource_methods(@res) end end def client_vpn_endpoint_id - return unless exists? + return nil unless exists? @res[:client_vpn_endpoint_id] end diff --git a/libraries/aws_ec2_client_vpn_endpoint.rb b/libraries/aws_ec2_client_vpn_endpoint.rb index 9bc9dbf1c..feb45492f 100644 --- a/libraries/aws_ec2_client_vpn_endpoint.rb +++ b/libraries/aws_ec2_client_vpn_endpoint.rb @@ -13,17 +13,24 @@ def initialize(opts = {}) opts = { client_vpn_endpoint_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:client_vpn_endpoint_id]) - raise ArgumentError, "#{@__resource_name__}: client_vpn_endpoint_id must be provided" unless opts[:client_vpn_endpoint_id] && !opts[:client_vpn_endpoint_id].empty? + unless opts[:client_vpn_endpoint_id] && + !opts[:client_vpn_endpoint_id].empty? + raise ArgumentError, + "#{@__resource_name__}: client_vpn_endpoint_id must be provided" + end @display_name = opts[:client_vpn_endpoint_id] catch_aws_errors do - resp = @aws.compute_client.describe_client_vpn_endpoints({ client_vpn_endpoint_ids: [opts[:client_vpn_endpoint_id]] }) + resp = + @aws.compute_client.describe_client_vpn_endpoints( + { client_vpn_endpoint_ids: [opts[:client_vpn_endpoint_id]] } + ) @res = resp.client_vpn_endpoints[0].to_h create_resource_methods(@res) end end def client_vpn_endpoint_id - return unless exists? + return nil unless exists? @res[:client_vpn_endpoint_id] end diff --git a/libraries/aws_ec2_client_vpn_route.rb b/libraries/aws_ec2_client_vpn_route.rb index 686b3cfcb..09cb0d958 100644 --- a/libraries/aws_ec2_client_vpn_route.rb +++ b/libraries/aws_ec2_client_vpn_route.rb @@ -12,21 +12,33 @@ class AWSEC2ClientVPNRoute < AwsResourceBase def initialize(opts = {}) opts = { client_vpn_endpoint_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(client_vpn_endpoint_id target_subnet)) - raise ArgumentError, "#{@__resource_name__}: client_vpn_endpoint_id must be provided" unless opts[:client_vpn_endpoint_id] && !opts[:client_vpn_endpoint_id].empty? - raise ArgumentError, "#{@__resource_name__}: target_subnet must be provided" unless opts[:target_subnet] && !opts[:target_subnet].empty? + validate_parameters(required: %i[client_vpn_endpoint_id target_subnet]) + unless opts[:client_vpn_endpoint_id] && + !opts[:client_vpn_endpoint_id].empty? + raise ArgumentError, + "#{@__resource_name__}: client_vpn_endpoint_id must be provided" + end + unless opts[:target_subnet] && !opts[:target_subnet].empty? + raise ArgumentError, + "#{@__resource_name__}: target_subnet must be provided" + end @display_name = opts[:client_vpn_endpoint_id] - filter = [{ name: "target-subnet", - values: [opts[:target_subnet]] }] + filter = [{ name: "target-subnet", values: [opts[:target_subnet]] }] catch_aws_errors do - resp = @aws.compute_client.describe_client_vpn_routes({ client_vpn_endpoint_id: opts[:client_vpn_endpoint_id], filters: filter }) + resp = + @aws.compute_client.describe_client_vpn_routes( + { + client_vpn_endpoint_id: opts[:client_vpn_endpoint_id], + filters: filter + } + ) @res = resp.routes[0].to_h create_resource_methods(@res) end end def client_vpn_endpoint_id - return unless exists? + return nil unless exists? @res[:client_vpn_endpoint_id] end diff --git a/libraries/aws_ec2_client_vpn_target_network_association.rb b/libraries/aws_ec2_client_vpn_target_network_association.rb index 526126e20..c5c53fe2a 100644 --- a/libraries/aws_ec2_client_vpn_target_network_association.rb +++ b/libraries/aws_ec2_client_vpn_target_network_association.rb @@ -12,25 +12,33 @@ class AWSEC2ClientVPNTargetNetworkAssociation < AwsResourceBase def initialize(opts = {}) opts = { client_vpn_endpoint_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(client_vpn_endpoint_id association_id)) - raise ArgumentError, "#{@__resource_name__}: client_vpn_endpoint_id must be provided" unless opts[:client_vpn_endpoint_id] && !opts[:client_vpn_endpoint_id].empty? - raise ArgumentError, "#{@__resource_name__}: association_id must be provided" unless opts[:association_id] && !opts[:association_id].empty? + validate_parameters(required: %i[client_vpn_endpoint_id association_id]) + unless opts[:client_vpn_endpoint_id] && + !opts[:client_vpn_endpoint_id].empty? + raise ArgumentError, + "#{@__resource_name__}: client_vpn_endpoint_id must be provided" + end + unless opts[:association_id] && !opts[:association_id].empty? + raise ArgumentError, + "#{@__resource_name__}: association_id must be provided" + end @display_name = opts[:client_vpn_endpoint_id] - filter = [ - { - name: "association-id", - values: [opts[:association_id]], - }, - ] + filter = [{ name: "association-id", values: [opts[:association_id]] }] catch_aws_errors do - resp = @aws.compute_client.describe_client_vpn_target_networks({ client_vpn_endpoint_id: opts[:client_vpn_endpoint_id], filters: filter }) + resp = + @aws.compute_client.describe_client_vpn_target_networks( + { + client_vpn_endpoint_id: opts[:client_vpn_endpoint_id], + filters: filter + } + ) @res = resp.client_vpn_target_networks[0].to_h create_resource_methods(@res) end end def association_id - return unless exists? + return nil unless exists? @res[:association_id] end diff --git a/libraries/aws_ec2_customer_gateway.rb b/libraries/aws_ec2_customer_gateway.rb index 8ee158fc9..1ae8b33cf 100644 --- a/libraries/aws_ec2_customer_gateway.rb +++ b/libraries/aws_ec2_customer_gateway.rb @@ -13,17 +13,23 @@ def initialize(opts = {}) opts = { customer_gateway_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:customer_gateway_id]) - raise ArgumentError, "#{@__resource_name__}: customer_gateway_id must be provided" unless opts[:customer_gateway_id] && !opts[:customer_gateway_id].empty? + unless opts[:customer_gateway_id] && !opts[:customer_gateway_id].empty? + raise ArgumentError, + "#{@__resource_name__}: customer_gateway_id must be provided" + end @display_name = opts[:customer_gateway_id] catch_aws_errors do - resp = @aws.compute_client.describe_customer_gateways({ customer_gateway_ids: [opts[:customer_gateway_id]] }) + resp = + @aws.compute_client.describe_customer_gateways( + { customer_gateway_ids: [opts[:customer_gateway_id]] } + ) @resp = resp.customer_gateways[0].to_h create_resource_methods(@resp) end end def customer_gateway_id - return unless exists? + return nil unless exists? @resp[:customer_gateway_id] end diff --git a/libraries/aws_ec2_egress_only_internet_gateway.rb b/libraries/aws_ec2_egress_only_internet_gateway.rb index 9a9e6b388..cec32fe0f 100644 --- a/libraries/aws_ec2_egress_only_internet_gateway.rb +++ b/libraries/aws_ec2_egress_only_internet_gateway.rb @@ -14,17 +14,28 @@ def initialize(opts = {}) opts = { egress_only_internet_gateway_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:egress_only_internet_gateway_id]) - raise ArgumentError, "#{@__resource_name__}: egress_only_internet_gateway_id must be provided" unless opts[:egress_only_internet_gateway_id] && !opts[:egress_only_internet_gateway_id].empty? + unless opts[:egress_only_internet_gateway_id] && + !opts[:egress_only_internet_gateway_id].empty? + raise ArgumentError, + "#{@__resource_name__}: egress_only_internet_gateway_id must be provided" + end @display_name = opts[:egress_only_internet_gateway_id] catch_aws_errors do - resp = @aws.compute_client.describe_egress_only_internet_gateways({ egress_only_internet_gateway_ids: [opts[:egress_only_internet_gateway_id]] }) + resp = + @aws.compute_client.describe_egress_only_internet_gateways( + { + egress_only_internet_gateway_ids: [ + opts[:egress_only_internet_gateway_id] + ] + } + ) @resp = resp.egress_only_internet_gateways[0].to_h create_resource_methods(@resp) end end def egress_only_internet_gateway_id - return unless exists? + return nil unless exists? @resp[:egress_only_internet_gateway_id] end diff --git a/libraries/aws_ec2_eip.rb b/libraries/aws_ec2_eip.rb index 8fa40ffaa..b1d422d06 100644 --- a/libraries/aws_ec2_eip.rb +++ b/libraries/aws_ec2_eip.rb @@ -19,17 +19,22 @@ def initialize(opts = {}) super(opts) validate_parameters(required: [:public_ip]) - raise ArgumentError, "#{@__resource_name__}: public_ip must be provided" unless opts[:public_ip] && !opts[:public_ip].empty? + unless opts[:public_ip] && !opts[:public_ip].empty? + raise ArgumentError, "#{@__resource_name__}: public_ip must be provided" + end @display_name = opts[:public_ip] catch_aws_errors do - resp = @aws.compute_client.describe_addresses({ public_ips: [opts[:public_ip]] }) + resp = + @aws.compute_client.describe_addresses( + { public_ips: [opts[:public_ip]] } + ) @addresses = resp.addresses[0].to_h create_resource_methods(@addresses) end end def public_ip - return unless exists? + return nil unless exists? @addresses[:public_ip] end diff --git a/libraries/aws_ec2_eip_association.rb b/libraries/aws_ec2_eip_association.rb index de5864a7b..e966fc38b 100644 --- a/libraries/aws_ec2_eip_association.rb +++ b/libraries/aws_ec2_eip_association.rb @@ -13,14 +13,12 @@ class AWSEC2EIPAssociation < AwsResourceBase def initialize(opts = {}) opts = { association_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(association_id)) - raise ArgumentError, "#{@__resource_name__}: association_id must be provided" unless opts[:association_id] && !opts[:association_id].empty? - filter = [ - { - name: "association-id", - values: [opts[:association_id]], - }, - ] + validate_parameters(required: %i[association_id]) + unless opts[:association_id] && !opts[:association_id].empty? + raise ArgumentError, + "#{@__resource_name__}: association_id must be provided" + end + filter = [{ name: "association-id", values: [opts[:association_id]] }] @display_name = opts[:association_id] catch_aws_errors do resp = @aws.compute_client.describe_addresses({ filters: filter }) @@ -30,7 +28,7 @@ def initialize(opts = {}) end def association_id - return unless exists? + return nil unless exists? @resp[:association_id] end diff --git a/libraries/aws_ec2_fleet.rb b/libraries/aws_ec2_fleet.rb index 80a52261b..a75455e53 100644 --- a/libraries/aws_ec2_fleet.rb +++ b/libraries/aws_ec2_fleet.rb @@ -14,17 +14,20 @@ def initialize(opts = {}) opts = { fleet_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:fleet_id]) - raise ArgumentError, "#{@__resource_name__}: fleet_id must be provided" unless opts[:fleet_id] && !opts[:fleet_id].empty? + unless opts[:fleet_id] && !opts[:fleet_id].empty? + raise ArgumentError, "#{@__resource_name__}: fleet_id must be provided" + end @display_name = opts[:fleet_id] catch_aws_errors do - resp = @aws.compute_client.describe_fleets({ fleet_ids: [opts[:fleet_id]] }) + resp = + @aws.compute_client.describe_fleets({ fleet_ids: [opts[:fleet_id]] }) @resp = resp.fleets[0].to_h create_resource_methods(@resp) end end def fleet_id - return unless exists? + return nil unless exists? @resp[:fleet_id] end diff --git a/libraries/aws_ec2_host.rb b/libraries/aws_ec2_host.rb index db1856cce..834ab39da 100644 --- a/libraries/aws_ec2_host.rb +++ b/libraries/aws_ec2_host.rb @@ -14,7 +14,9 @@ def initialize(opts = {}) opts = { host_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:host_id]) - raise ArgumentError, "#{@__resource_name__}: host_id must be provided" unless opts[:host_id] && !opts[:host_id].empty? + unless opts[:host_id] && !opts[:host_id].empty? + raise ArgumentError, "#{@__resource_name__}: host_id must be provided" + end @display_name = opts[:host_id] catch_aws_errors do resp = @aws.compute_client.describe_hosts({ host_ids: [opts[:host_id]] }) diff --git a/libraries/aws_ec2_instance.rb b/libraries/aws_ec2_instance.rb index da7491ccd..afa038dd5 100644 --- a/libraries/aws_ec2_instance.rb +++ b/libraries/aws_ec2_instance.rb @@ -19,28 +19,35 @@ class AwsEc2Instance < AwsResourceBase def initialize(opts = {}) opts = { instance_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(require_any_of: %i(instance_id name)) + validate_parameters(require_any_of: %i[instance_id name]) if opts[:instance_id] && !opts[:instance_id].empty? # Use instance_id, if provided - if !opts[:instance_id].is_a?(String) || opts[:instance_id] !~ /(^i-[0-9a-f]{8})|(^i-[0-9a-f]{17})$/ - raise ArgumentError, "#{@__resource_name__}: `instance_id` must be a string in the format of 'i-' followed by 8 or 17 hexadecimal characters." + if !opts[:instance_id].is_a?(String) || + opts[:instance_id] !~ /(^i-[0-9a-f]{8})|(^i-[0-9a-f]{17})$/ + raise ArgumentError, + "#{@__resource_name__}: `instance_id` must be a string in the format of 'i-' followed by 8 or 17 hexadecimal characters." end @display_name = opts[:instance_id] instance_arguments = { instance_ids: [opts[:instance_id]] } elsif opts[:name] && !opts[:name].empty? # Otherwise use name, if provided @display_name = opts[:name] - instance_arguments = { filters: [{ name: "tag:Name", values: [opts[:name]] }] } + instance_arguments = { + filters: [{ name: "tag:Name", values: [opts[:name]] }] + } else - raise ArgumentError, "#{@__resource_name__}: either instance_id or name must be provided." + raise ArgumentError, + "#{@__resource_name__}: either instance_id or name must be provided." end catch_aws_errors do resp = @aws.compute_client.describe_instances(instance_arguments) - if resp.reservations.first.nil? || resp.reservations.first.instances.first.nil? + if resp.reservations.first.nil? || + resp.reservations.first.instances.first.nil? empty_response_warn return end - if resp.reservations.count > 1 || resp.reservations.first.instances.count > 1 + if resp.reservations.count > 1 || + resp.reservations.first.instances.count > 1 resource_fail return else @@ -57,7 +64,9 @@ def state end def security_groups - @instance[:security_groups].map { |sg| { id: sg[:group_id], name: sg[:group_name] } } + @instance[:security_groups].map do |sg| + { id: sg[:group_id], name: sg[:group_name] } + end end def tags @@ -86,7 +95,9 @@ def availability_zone def ebs_volumes return unless @instance[:block_device_mappings] return if @instance[:block_device_mappings].count == 0 - @instance[:block_device_mappings].map { |vol| { id: vol[:ebs][:volume_id], name: vol[:device_name] } } + @instance[:block_device_mappings].map do |vol| + { id: vol[:ebs][:volume_id], name: vol[:device_name] } + end end def network_interface_ids @@ -96,12 +107,18 @@ def network_interface_ids end def has_roles? - return false unless @instance[:iam_instance_profile] && @instance[:iam_instance_profile][:arn] + unless @instance[:iam_instance_profile] && + @instance[:iam_instance_profile][:arn] + return false + end instance_profile = @instance[:iam_instance_profile][:arn].split("/").last @returned_roles = nil # Check if there is a role created at the attached profile catch_aws_errors do - resp = @aws.iam_client.get_instance_profile({ instance_profile_name: instance_profile }) + resp = + @aws.iam_client.get_instance_profile( + { instance_profile_name: instance_profile } + ) @returned_roles = resp.instance_profile.roles end @returned_roles && !@returned_roles.empty? @@ -117,7 +134,15 @@ def role end # Generate a matcher for each state - %w{pending running shutting-down terminated stopping stopped unknown}.each do |state_name| + %w[ + pending + running + shutting-down + terminated + stopping + stopped + unknown + ].each do |state_name| define_method "#{state_name.tr("-", "_")}?" do state == state_name end @@ -132,7 +157,7 @@ def to_s end def tags_hash - return unless exists? + return nil unless exists? map_tags(tags) end end diff --git a/libraries/aws_ec2_internet_gateway.rb b/libraries/aws_ec2_internet_gateway.rb index d9ccbe02a..876b6b544 100644 --- a/libraries/aws_ec2_internet_gateway.rb +++ b/libraries/aws_ec2_internet_gateway.rb @@ -14,17 +14,23 @@ def initialize(opts = {}) opts = { internet_gateway_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:internet_gateway_id]) - raise ArgumentError, "#{@__resource_name__}: internet_gateway_id must be provided" unless opts[:internet_gateway_id] && !opts[:internet_gateway_id].empty? + unless opts[:internet_gateway_id] && !opts[:internet_gateway_id].empty? + raise ArgumentError, + "#{@__resource_name__}: internet_gateway_id must be provided" + end @display_name = opts[:internet_gateway_id] catch_aws_errors do - resp = @aws.compute_client.describe_internet_gateways({ internet_gateway_ids: [opts[:internet_gateway_id]] }) + resp = + @aws.compute_client.describe_internet_gateways( + { internet_gateway_ids: [opts[:internet_gateway_id]] } + ) @res = resp.internet_gateways[0].to_h create_resource_methods(@res) end end def internet_gateway_id - return unless exists? + return nil unless exists? @res[:internet_gateway_id] end diff --git a/libraries/aws_ec2_network_insights_analysis.rb b/libraries/aws_ec2_network_insights_analysis.rb index e8e2a5f38..071b9f49f 100644 --- a/libraries/aws_ec2_network_insights_analysis.rb +++ b/libraries/aws_ec2_network_insights_analysis.rb @@ -14,17 +14,26 @@ def initialize(opts = {}) opts = { network_insights_analysis_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:network_insights_analysis_id]) - raise ArgumentError, "#{@__resource_name__}: network_insights_analysis_id must be provided" unless opts[:network_insights_analysis_id] && !opts[:network_insights_analysis_id].empty? + unless opts[:network_insights_analysis_id] && + !opts[:network_insights_analysis_id].empty? + raise ArgumentError, + "#{@__resource_name__}: network_insights_analysis_id must be provided" + end @display_name = opts[:network_insights_analysis_id] catch_aws_errors do - resp = @aws.compute_client.describe_network_insights_analyses({ network_insights_analysis_ids: [opts[:network_insights_analysis_id]] }) + resp = + @aws.compute_client.describe_network_insights_analyses( + { + network_insights_analysis_ids: [opts[:network_insights_analysis_id]] + } + ) @res = resp.network_insights_analyses[0].to_h create_resource_methods(@res) end end def network_insights_analysis_id - return unless exists? + return nil unless exists? @res[:network_insights_analysis_id] end diff --git a/libraries/aws_ec2_network_insights_path.rb b/libraries/aws_ec2_network_insights_path.rb index 8a7db60bd..e55bd9567 100644 --- a/libraries/aws_ec2_network_insights_path.rb +++ b/libraries/aws_ec2_network_insights_path.rb @@ -14,17 +14,24 @@ def initialize(opts = {}) opts = { network_insights_path_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:network_insights_path_id]) - raise ArgumentError, "#{@__resource_name__}: network_insights_path_id must be provided" unless opts[:network_insights_path_id] && !opts[:network_insights_path_id].empty? + unless opts[:network_insights_path_id] && + !opts[:network_insights_path_id].empty? + raise ArgumentError, + "#{@__resource_name__}: network_insights_path_id must be provided" + end @display_name = opts[:network_insights_path_id] catch_aws_errors do - resp = @aws.compute_client.describe_network_insights_paths({ network_insights_path_ids: [opts[:network_insights_path_id]] }) + resp = + @aws.compute_client.describe_network_insights_paths( + { network_insights_path_ids: [opts[:network_insights_path_id]] } + ) @res = resp.network_insights_paths[0].to_h create_resource_methods(@res) end end def network_insights_path_id - return unless exists? + return nil unless exists? @res[:network_insights_path_id] end diff --git a/libraries/aws_ec2_network_interface.rb b/libraries/aws_ec2_network_interface.rb index 5dbad8b96..77bba95ab 100644 --- a/libraries/aws_ec2_network_interface.rb +++ b/libraries/aws_ec2_network_interface.rb @@ -14,17 +14,23 @@ def initialize(opts = {}) opts = { network_interface_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:network_interface_id]) - raise ArgumentError, "#{@__resource_name__}: network_interface_id must be provided" unless opts[:network_interface_id] && !opts[:network_interface_id].empty? + unless opts[:network_interface_id] && !opts[:network_interface_id].empty? + raise ArgumentError, + "#{@__resource_name__}: network_interface_id must be provided" + end @display_name = opts[:network_interface_id] catch_aws_errors do - resp = @aws.compute_client.describe_network_interfaces({ network_interface_ids: [opts[:network_interface_id]] }) + resp = + @aws.compute_client.describe_network_interfaces( + { network_interface_ids: [opts[:network_interface_id]] } + ) @res = resp.network_interfaces[0].to_h create_resource_methods(@res) end end def network_interface_id - return unless exists? + return nil unless exists? @res[:network_interface_id] end diff --git a/libraries/aws_ec2_placement_group.rb b/libraries/aws_ec2_placement_group.rb index a70e1a627..e65ab17f4 100644 --- a/libraries/aws_ec2_placement_group.rb +++ b/libraries/aws_ec2_placement_group.rb @@ -14,10 +14,16 @@ def initialize(opts = {}) opts = { placement_group_name: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:placement_group_name]) - raise ArgumentError, "#{@__resource_name__}: placement_group_name must be provided" unless opts[:placement_group_name] && !opts[:placement_group_name].empty? + unless opts[:placement_group_name] && !opts[:placement_group_name].empty? + raise ArgumentError, + "#{@__resource_name__}: placement_group_name must be provided" + end @display_name = opts[:placement_group_name] catch_aws_errors do - resp = @aws.compute_client.describe_placement_groups({ group_names: [opts[:placement_group_name]] }) + resp = + @aws.compute_client.describe_placement_groups( + { group_names: [opts[:placement_group_name]] } + ) @resp = resp.placement_groups[0].to_h @placement_group_name = resp.placement_groups[0].group_name create_resource_methods(@resp) @@ -25,7 +31,7 @@ def initialize(opts = {}) end def placement_group_name - return unless exists? + return nil unless exists? @resp[:group_name] end diff --git a/libraries/aws_ec2_prefix_list.rb b/libraries/aws_ec2_prefix_list.rb index c5e0d0b46..095d77b37 100644 --- a/libraries/aws_ec2_prefix_list.rb +++ b/libraries/aws_ec2_prefix_list.rb @@ -14,17 +14,23 @@ def initialize(opts = {}) opts = { prefix_list_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:prefix_list_id]) - raise ArgumentError, "#{@__resource_name__}: prefix_list_id must be provided" unless opts[:prefix_list_id] && !opts[:prefix_list_id].empty? + unless opts[:prefix_list_id] && !opts[:prefix_list_id].empty? + raise ArgumentError, + "#{@__resource_name__}: prefix_list_id must be provided" + end @display_name = opts[:prefix_list_id] catch_aws_errors do - resp = @aws.compute_client.describe_managed_prefix_lists({ prefix_list_ids: [opts[:prefix_list_id]] }) + resp = + @aws.compute_client.describe_managed_prefix_lists( + { prefix_list_ids: [opts[:prefix_list_id]] } + ) @res = resp.prefix_lists[0].to_h create_resource_methods(@res) end end def prefix_list_id - return unless exists? + return nil unless exists? @res[:prefix_list_id] end diff --git a/libraries/aws_ec2_spot_fleet.rb b/libraries/aws_ec2_spot_fleet.rb index 37d9e4d11..97ab3ff0c 100644 --- a/libraries/aws_ec2_spot_fleet.rb +++ b/libraries/aws_ec2_spot_fleet.rb @@ -14,17 +14,23 @@ def initialize(opts = {}) opts = { spot_fleet_request_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:spot_fleet_request_id]) - raise ArgumentError, "#{@__resource_name__}: spot_fleet_request_id must be provided" unless opts[:spot_fleet_request_id] && !opts[:spot_fleet_request_id].empty? + unless opts[:spot_fleet_request_id] && !opts[:spot_fleet_request_id].empty? + raise ArgumentError, + "#{@__resource_name__}: spot_fleet_request_id must be provided" + end @display_name = opts[:spot_fleet_request_id] catch_aws_errors do - resp = @aws.compute_client.describe_spot_fleet_requests({ spot_fleet_request_ids: [opts[:spot_fleet_request_id]] }) + resp = + @aws.compute_client.describe_spot_fleet_requests( + { spot_fleet_request_ids: [opts[:spot_fleet_request_id]] } + ) @res = resp.spot_fleet_request_configs[0].to_h create_resource_methods(@res) end end def spot_fleet_request_id - return unless exists? + return nil unless exists? @res[:spot_fleet_request_id] end diff --git a/libraries/aws_ec2_traffic_mirror_filter.rb b/libraries/aws_ec2_traffic_mirror_filter.rb index d5c8d0ab1..75006f62c 100644 --- a/libraries/aws_ec2_traffic_mirror_filter.rb +++ b/libraries/aws_ec2_traffic_mirror_filter.rb @@ -13,23 +13,32 @@ class AWSEc2TrafficMirrorFilter < AwsResourceBase def initialize(opts = {}) opts = { traffic_mirror_filter_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(traffic_mirror_filter_id)) - if opts[:traffic_mirror_filter_id] && !opts[:traffic_mirror_filter_id].empty? # Use instance_id, if provided - if !opts[:traffic_mirror_filter_id].is_a?(String) || opts[:traffic_mirror_filter_id] !~ /(^tmf-[0-9a-f]{8})|(^tmf-[0-9a-f]{17})$/ - raise ArgumentError, "#{@__resource_name__}: `traffic_mirror_filter_id` must be a string in the format of 'tfm-' followed by 8 or 17 hexadecimal characters." + validate_parameters(required: %i[traffic_mirror_filter_id]) + if opts[:traffic_mirror_filter_id] && + !opts[:traffic_mirror_filter_id].empty? # Use instance_id, if provided + if !opts[:traffic_mirror_filter_id].is_a?(String) || + opts[:traffic_mirror_filter_id] !~ + /(^tmf-[0-9a-f]{8})|(^tmf-[0-9a-f]{17})$/ + raise ArgumentError, + "#{@__resource_name__}: `traffic_mirror_filter_id` must be a string in the format of 'tfm-' followed by 8 or 17 hexadecimal characters." end @display_name = opts[:traffic_mirror_filter_id] - traffic_mirror_filters_arguments = { traffic_mirror_filter_ids: [opts[:traffic_mirror_filter_id]] } + traffic_mirror_filters_arguments = { + traffic_mirror_filter_ids: [opts[:traffic_mirror_filter_id]] + } end catch_aws_errors do - resp = @aws.compute_client.describe_traffic_mirror_filters(traffic_mirror_filters_arguments) + resp = + @aws.compute_client.describe_traffic_mirror_filters( + traffic_mirror_filters_arguments + ) @traffic_mirror_filters = resp.traffic_mirror_filters[0].to_h create_resource_methods(@traffic_mirror_filters) end end def traffic_mirror_filter_id - return unless exists? + return nil unless exists? @traffic_mirror_filters[:traffic_mirror_filter_id] end @@ -38,7 +47,11 @@ def exists? end def resource_id - @traffic_mirror_filters ? @traffic_mirror_filters[:traffic_mirror_filter_id] : @display_name + if @traffic_mirror_filters + @traffic_mirror_filters[:traffic_mirror_filter_id] + else + @display_name + end end def to_s diff --git a/libraries/aws_ec2_transit_gateway_attachment.rb b/libraries/aws_ec2_transit_gateway_attachment.rb index a0f322b0b..00a0dd678 100644 --- a/libraries/aws_ec2_transit_gateway_attachment.rb +++ b/libraries/aws_ec2_transit_gateway_attachment.rb @@ -14,17 +14,32 @@ def initialize(opts = {}) opts = { transit_gateway_attachment_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:transit_gateway_attachment_id]) - raise ArgumentError, "#{@__resource_name__}: transit_gateway_attachment_id must be provided" unless opts[:transit_gateway_attachment_id] && !opts[:transit_gateway_attachment_id].empty? + unless opts[:transit_gateway_attachment_id] && + !opts[:transit_gateway_attachment_id].empty? + raise ArgumentError, + "#{@__resource_name__}: transit_gateway_attachment_id must be provided" + end @display_name = opts[:transit_gateway_attachment_id] catch_aws_errors do - resp = @aws.compute_client.describe_transit_gateway_attachments({ transit_gateway_attachment_ids: [opts[:transit_gateway_attachment_id]] }) + resp = + @aws.compute_client.describe_transit_gateway_attachments( + { + transit_gateway_attachment_ids: [ + opts[:transit_gateway_attachment_id] + ] + } + ) @transit_gateway_attachments = resp.transit_gateway_attachments[0].to_h create_resource_methods(@transit_gateway_attachments) end end def resource_id - @transit_gateway_attachments ? @transit_gateway_attachments[:transit_gateway_attachment_id] : @display_name + if @transit_gateway_attachments + @transit_gateway_attachments[:transit_gateway_attachment_id] + else + @display_name + end end def transit_gateway_attachment_id diff --git a/libraries/aws_ec2_transit_gateway_route_table.rb b/libraries/aws_ec2_transit_gateway_route_table.rb index 179456b3c..fbb0cdab9 100644 --- a/libraries/aws_ec2_transit_gateway_route_table.rb +++ b/libraries/aws_ec2_transit_gateway_route_table.rb @@ -14,17 +14,28 @@ def initialize(opts = {}) opts = { transit_gateway_route_table_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:transit_gateway_route_table_id]) - raise ArgumentError, "#{@__resource_name__}: transit_gateway_route_table_id must be provided" unless opts[:transit_gateway_route_table_id] && !opts[:transit_gateway_route_table_id].empty? + unless opts[:transit_gateway_route_table_id] && + !opts[:transit_gateway_route_table_id].empty? + raise ArgumentError, + "#{@__resource_name__}: transit_gateway_route_table_id must be provided" + end @display_name = opts[:transit_gateway_route_table_id] catch_aws_errors do - resp = @aws.compute_client.describe_transit_gateway_route_tables({ transit_gateway_route_table_ids: [opts[:transit_gateway_route_table_id]] }) + resp = + @aws.compute_client.describe_transit_gateway_route_tables( + { + transit_gateway_route_table_ids: [ + opts[:transit_gateway_route_table_id] + ] + } + ) @transit_gateway_route_tables = resp.transit_gateway_route_tables[0].to_h create_resource_methods(@transit_gateway_route_tables) end end def transit_gateway_route_table_id - return unless exists? + return nil unless exists? @transit_gateway_route_tables[:transit_gateway_route_table_id] end @@ -33,7 +44,11 @@ def exists? end def resource_id - @transit_gateway_route_tables ? @transit_gateway_route_tables[:transit_gateway_route_table_id] : @display_name + if @transit_gateway_route_tables + @transit_gateway_route_tables[:transit_gateway_route_table_id] + else + @display_name + end end def to_s diff --git a/libraries/aws_ec2_transit_gateway_route_table_association.rb b/libraries/aws_ec2_transit_gateway_route_table_association.rb index 76144faef..59070d9f3 100644 --- a/libraries/aws_ec2_transit_gateway_route_table_association.rb +++ b/libraries/aws_ec2_transit_gateway_route_table_association.rb @@ -16,10 +16,17 @@ def initialize(opts = {}) opts = { transit_gateway_route_table_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:transit_gateway_route_table_id]) - raise ArgumentError, "#{@__resource_name__}: transit_gateway_route_table_id must be provided" unless opts[:transit_gateway_route_table_id] && !opts[:transit_gateway_route_table_id].empty? + unless opts[:transit_gateway_route_table_id] && + !opts[:transit_gateway_route_table_id].empty? + raise ArgumentError, + "#{@__resource_name__}: transit_gateway_route_table_id must be provided" + end @display_name = opts[:transit_gateway_route_table_id] catch_aws_errors do - resp = aws.compute_client.get_transit_gateway_route_table_associations({ transit_gateway_route_table_id: @display_name }) + resp = + aws.compute_client.get_transit_gateway_route_table_associations( + { transit_gateway_route_table_id: @display_name } + ) @association = resp.associations[0].to_h create_resource_methods(@association) end @@ -30,7 +37,7 @@ def resource_id end def transit_gateway_route_table_id - return unless exists? + return nil unless exists? @association[:transit_gateway_route_table_id] end diff --git a/libraries/aws_ec2_transit_gateway_route_table_propagation.rb b/libraries/aws_ec2_transit_gateway_route_table_propagation.rb index e41937f87..f430bbb33 100644 --- a/libraries/aws_ec2_transit_gateway_route_table_propagation.rb +++ b/libraries/aws_ec2_transit_gateway_route_table_propagation.rb @@ -15,19 +15,35 @@ class AWSEc2TransitGatewayRouteTablePropagation < AwsResourceBase def initialize(opts = {}) opts = { transit_gateway_route_table_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(transit_gateway_route_table_id transit_gateway_attachment_id)) - raise ArgumentError, "#{@__resource_name__}: transit_gateway_route_table_id must be provided" unless opts[:transit_gateway_route_table_id] && !opts[:transit_gateway_route_table_id].empty? - raise ArgumentError, "#{@__resource_name__}: transit_gateway_attachment_id must be provided" unless opts[:transit_gateway_attachment_id] && !opts[:transit_gateway_attachment_id].empty? + validate_parameters( + required: %i[transit_gateway_route_table_id transit_gateway_attachment_id] + ) + unless opts[:transit_gateway_route_table_id] && + !opts[:transit_gateway_route_table_id].empty? + raise ArgumentError, + "#{@__resource_name__}: transit_gateway_route_table_id must be provided" + end + unless opts[:transit_gateway_attachment_id] && + !opts[:transit_gateway_attachment_id].empty? + raise ArgumentError, + "#{@__resource_name__}: transit_gateway_attachment_id must be provided" + end @display_name = opts[:transit_gateway_attachment_id] filter = [ { name: "transit-gateway-attachment-id", - values: [opts[:transit_gateway_attachment_id]], - }, + values: [opts[:transit_gateway_attachment_id]] + } ] catch_aws_errors do - resp = @aws.compute_client.get_transit_gateway_route_table_propagations({ transit_gateway_route_table_id: opts[:transit_gateway_route_table_id], - filters: filter }) + resp = + @aws.compute_client.get_transit_gateway_route_table_propagations( + { + transit_gateway_route_table_id: + opts[:transit_gateway_route_table_id], + filters: filter + } + ) @resp = resp.transit_gateway_route_table_propagations[0].to_h create_resource_methods(@resp) end @@ -38,7 +54,7 @@ def resource_id end def transit_gateway_attachment_id - return unless exists? + return nil unless exists? @resp[:transit_gateway_attachment_id] end diff --git a/libraries/aws_ec2_volume_attachment.rb b/libraries/aws_ec2_volume_attachment.rb index 71fb2dd62..d18dfe245 100644 --- a/libraries/aws_ec2_volume_attachment.rb +++ b/libraries/aws_ec2_volume_attachment.rb @@ -14,17 +14,20 @@ def initialize(opts = {}) opts = { volume_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:volume_id]) - raise ArgumentError, "#{@__resource_name__}: volume_id must be provided" unless opts[:volume_id] && !opts[:volume_id].empty? + unless opts[:volume_id] && !opts[:volume_id].empty? + raise ArgumentError, "#{@__resource_name__}: volume_id must be provided" + end @display_name = opts[:volume_id] catch_aws_errors do - resp = @aws.compute_client.describe_volumes({ volume_ids: [opts[:volume_id]] }) + resp = + @aws.compute_client.describe_volumes({ volume_ids: [opts[:volume_id]] }) @res = resp.volumes[0].attachments[0].to_h create_resource_methods(@res) end end def volume_id - return unless exists? + return nil unless exists? @res[:volume_id] end diff --git a/libraries/aws_ec2_vpc_peering_connection.rb b/libraries/aws_ec2_vpc_peering_connection.rb index d9491e918..38eafc4d7 100644 --- a/libraries/aws_ec2_vpc_peering_connection.rb +++ b/libraries/aws_ec2_vpc_peering_connection.rb @@ -14,17 +14,24 @@ def initialize(opts = {}) opts = { vpc_peering_connection_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:vpc_peering_connection_id]) - raise ArgumentError, "#{@__resource_name__}: vpc_peering_connection_id must be provided" unless opts[:vpc_peering_connection_id] && !opts[:vpc_peering_connection_id].empty? + unless opts[:vpc_peering_connection_id] && + !opts[:vpc_peering_connection_id].empty? + raise ArgumentError, + "#{@__resource_name__}: vpc_peering_connection_id must be provided" + end @display_name = opts[:vpc_peering_connection_id] catch_aws_errors do - resp = @aws.compute_client.describe_vpc_peering_connections({ vpc_peering_connection_ids: [opts[:vpc_peering_connection_id]] }) + resp = + @aws.compute_client.describe_vpc_peering_connections( + { vpc_peering_connection_ids: [opts[:vpc_peering_connection_id]] } + ) @res = resp.vpc_peering_connections[0].to_h create_resource_methods(@res) end end def vpc_peering_connection_id - return unless exists? + return nil unless exists? @res[:vpc_peering_connection_id] end diff --git a/libraries/aws_ec2_vpn_gateway_route_propagation.rb b/libraries/aws_ec2_vpn_gateway_route_propagation.rb index deb5a5e99..2a37dbb6d 100644 --- a/libraries/aws_ec2_vpn_gateway_route_propagation.rb +++ b/libraries/aws_ec2_vpn_gateway_route_propagation.rb @@ -18,7 +18,10 @@ def initialize(opts = {}) opts = { route_table_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:route_table_id]) - raise ArgumentError, "#{@__resource_name__}: route_table_id must be provided" unless opts[:route_table_id] && !opts[:route_table_id].empty? + unless opts[:route_table_id] && !opts[:route_table_id].empty? + raise ArgumentError, + "#{@__resource_name__}: route_table_id must be provided" + end @display_name = opts[:route_table_id] @route_arguments = { route_table_ids: [opts[:route_table_id]] } catch_aws_errors do @@ -29,7 +32,7 @@ def initialize(opts = {}) end def id - return unless exists? + return nil unless exists? @route_tables[:route_table_id] end diff --git a/libraries/aws_ecr_image.rb b/libraries/aws_ecr_image.rb index 33aa55dad..d1c619e91 100644 --- a/libraries/aws_ecr_image.rb +++ b/libraries/aws_ecr_image.rb @@ -16,34 +16,50 @@ class AwsEcrImage < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(repository_name), require_any_of: %i(image_tag image_digest), allow: %i(registry_id)) + validate_parameters( + required: %i[repository_name], + require_any_of: %i[image_tag image_digest], + allow: %i[registry_id] + ) @display_name = opts.values.join(" ") # Validate repository_name. - pattern = %r{(?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._\-][a-z0-9]+)*} + pattern = + %r{(?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._\-][a-z0-9]+)*} matched_str = opts[:repository_name].match(pattern) - unless (opts[:repository_name] == matched_str[0]) && (matched_str.length == 1) && opts[:repository_name].length.between?(2, 256) - raise ArgumentError, "#{@__resource_name__}: `repository_name` is not in a valid format. " \ - "Please check the docs for more info "\ - "https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html" \ + unless (opts[:repository_name] == matched_str[0]) && + (matched_str.length == 1) && + opts[:repository_name].length.between?(2, 256) + raise ArgumentError, + "#{@__resource_name__}: `repository_name` is not in a valid format. " \ + "Please check the docs for more info " \ + "https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html" end # Validate image identifiers: # https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_ImageIdentifier.html - raise ArgumentError, "#{@__resource_name__}: `image_tag` must be maximum 300 characters long." if opts[:image_tag] && !opts[:image_tag].length.between?(1, 300) + if opts[:image_tag] && !opts[:image_tag].length.between?(1, 300) + raise ArgumentError, + "#{@__resource_name__}: `image_tag` must be maximum 300 characters long." + end - raise ArgumentError, "#{@__resource_name__}: `image_digest` must be a sha256 digest, e.g. 'sha256:aa..00'" if opts[:image_digest] && !/[a-zA-Z0-9\-_+.]+:[a-fA-F0-9]+/.match?(opts[:image_digest]) + if opts[:image_digest] && + !/[a-zA-Z0-9\-_+.]+:[a-fA-F0-9]+/.match?(opts[:image_digest]) + raise ArgumentError, + "#{@__resource_name__}: `image_digest` must be a sha256 digest, e.g. 'sha256:aa..00'" + end query_params = { repository_name: opts[:repository_name], - image_ids: [ - opts.select { |k, _v| k.to_s.start_with?("image") }, - ], + image_ids: [opts.select { |k, _v| k.to_s.start_with?("image") }] } # Validate registry_id. (Optional. If not provided, AWS account ID will be used by the AWS API.) if opts.key?(:registry_id) - raise ArgumentError, "#{@__resource_name__}: `registry_id` should be a string of 12 digits." unless /^[0-9]{12}$/.match?(opts[:registry_id]) + unless /^[0-9]{12}$/.match?(opts[:registry_id]) + raise ArgumentError, + "#{@__resource_name__}: `registry_id` should be a string of 12 digits." + end query_params[:registry_id] = opts[:registry_id] end @@ -60,7 +76,7 @@ def exists? def vulnerabilities # Create an array of vulnerabilities identified in the image after a scan - @vulns. - return unless exists? + return nil unless exists? # Do not try to create if vulnerability data exists. return @vulns unless @vulns.nil? # Use describe_image_scan_findings method: @@ -68,7 +84,7 @@ def vulnerabilities query_params = { repository_name: @opts[:repository_name], image_id: @opts.select { |k, _v| k.to_s.start_with?("image") }, - max_results: 1000, + max_results: 1000 } @scan_findings = [] loop do @@ -83,9 +99,7 @@ def vulnerabilities end # Convert AWS struct format to hash. @vulns = [] - @scan_findings.each do |vuln| - @vulns << vuln.to_h - end + @scan_findings.each { |vuln| @vulns << vuln.to_h } # Extract :attributes returned in scan_findings: # :attributes=>[{:key=>"package_version", :value=>"1.1.18-r3"}, # {:key=>"package_name", :value=>"musl"}, @@ -98,9 +112,7 @@ def vulnerabilities # :CVSS2_VECTOR=>"AV:N/AC:L/Au:N/C:P/I:P/A:P" # :CVSS2_SCORE=>"7.5" @vulns.each do |vuln| - vuln[:attributes].each do |attr| - vuln[attr[:key].to_sym] = attr[:value] - end + vuln[:attributes].each { |attr| vuln[attr[:key].to_sym] = attr[:value] } # Delete original :attributes item. vuln.delete(:attributes) end diff --git a/libraries/aws_ecr_repository.rb b/libraries/aws_ecr_repository.rb index d1309a73d..b3680ab2c 100644 --- a/libraries/aws_ecr_repository.rb +++ b/libraries/aws_ecr_repository.rb @@ -17,15 +17,19 @@ def initialize(opts = {}) opts = {} unless opts.is_a?(Hash) super(opts) - validate_parameters(required: %i(repository_name), allow: %i(registry_id)) + validate_parameters(required: %i[repository_name], allow: %i[registry_id]) # Validate repository_name. - pattern = %r{(?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._\-][a-z0-9]+)*} + pattern = + %r{(?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._\-][a-z0-9]+)*} matched_str = opts[:repository_name].match(pattern) - unless (opts[:repository_name] == matched_str[0]) && (matched_str.length == 1) && opts[:repository_name].length.between?(2, 256) - raise ArgumentError, "#{@__resource_name__}: `repository_name` is not in a valid format. " \ - "Please check the docs for more info "\ - "https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html" \ + unless (opts[:repository_name] == matched_str[0]) && + (matched_str.length == 1) && + opts[:repository_name].length.between?(2, 256) + raise ArgumentError, + "#{@__resource_name__}: `repository_name` is not in a valid format. " \ + "Please check the docs for more info " \ + "https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html" end @display_name = opts[:repository_name] @@ -33,7 +37,10 @@ def initialize(opts = {}) query_params[:repository_names] = [opts[:repository_name]] # Validate registry_id. (Optional. If not provided, AWS account ID will be used by the AWS API.) if opts.key?(:registry_id) - raise ArgumentError, "#{@__resource_name__}: `registry_id` should be a string of 12 digits." unless /^[0-9]{12}$/.match?(opts[:registry_id]) + unless /^[0-9]{12}$/.match?(opts[:registry_id]) + raise ArgumentError, + "#{@__resource_name__}: `registry_id` should be a string of 12 digits." + end query_params[:registry_id] = opts[:registry_id] end @@ -59,7 +66,10 @@ def resource_id def tags return unless exists? catch_aws_errors do - @resp_tags = @aws.ecr_client.list_tags_for_resource(resource_arn: @ecr_repo[:repository_arn]) + @resp_tags = + @aws.ecr_client.list_tags_for_resource( + resource_arn: @ecr_repo[:repository_arn] + ) end map_tags(@resp_tags.tags) end diff --git a/libraries/aws_ecrpublic_repository.rb b/libraries/aws_ecrpublic_repository.rb index 34804a14c..e6aa413b6 100644 --- a/libraries/aws_ecrpublic_repository.rb +++ b/libraries/aws_ecrpublic_repository.rb @@ -17,15 +17,19 @@ def initialize(opts = {}) opts = {} unless opts.is_a?(Hash) super(opts) - validate_parameters(required: %i(repository_name), allow: %i(registry_id)) + validate_parameters(required: %i[repository_name], allow: %i[registry_id]) # Validate repository_name. - pattern = %r{(?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._\-][a-z0-9]+)*} + pattern = + %r{(?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._\-][a-z0-9]+)*} matched_str = opts[:repository_name].match(pattern) - unless (opts[:repository_name] == matched_str[0]) && (matched_str.length == 1) && opts[:repository_name].length.between?(2, 256) - raise ArgumentError, "#{@__resource_name__}: `repository_name` is not in a valid format. " \ - "Please check the docs for more info "\ - "https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html" \ + unless (opts[:repository_name] == matched_str[0]) && + (matched_str.length == 1) && + opts[:repository_name].length.between?(2, 256) + raise ArgumentError, + "#{@__resource_name__}: `repository_name` is not in a valid format. " \ + "Please check the docs for more info " \ + "https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeRepositories.html" end @display_name = opts[:repository_name] @@ -33,7 +37,10 @@ def initialize(opts = {}) query_params[:repository_names] = [opts[:repository_name]] # Validate registry_id. (Optional. If not provided, AWS account ID will be used by the AWS API.) if opts.key?(:registry_id) - raise ArgumentError, "#{@__resource_name__}: `registry_id` should be a string of 12 digits." unless /^[0-9]{12}$/.match?(opts[:registry_id]) + unless /^[0-9]{12}$/.match?(opts[:registry_id]) + raise ArgumentError, + "#{@__resource_name__}: `registry_id` should be a string of 12 digits." + end query_params[:registry_id] = opts[:registry_id] end @@ -58,9 +65,12 @@ def to_s end def tags - return unless exists? + return nil unless exists? catch_aws_errors do - @resp_tags = @aws.ecrpublic_client.list_tags_for_resource(resource_arn: @ecr_repo[:repository_arn]) + @resp_tags = + @aws.ecrpublic_client.list_tags_for_resource( + resource_arn: @ecr_repo[:repository_arn] + ) end map_tags(@resp_tags.tags) end diff --git a/libraries/aws_ecs_service.rb b/libraries/aws_ecs_service.rb index b223ec298..e98b24287 100644 --- a/libraries/aws_ecs_service.rb +++ b/libraries/aws_ecs_service.rb @@ -12,12 +12,19 @@ class AWSECSService < AwsResourceBase def initialize(opts = {}) opts = { services: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(service), require_any_of: %i(cluster)) - raise ArgumentError, "#{@__resource_name__}: services must be provided" unless opts[:service] && !opts[:service].empty? - raise ArgumentError, "#{@__resource_name__}: cluster must be provided" unless opts[:cluster] && !opts[:cluster].empty? + validate_parameters(required: %i[service], require_any_of: %i[cluster]) + unless opts[:service] && !opts[:service].empty? + raise ArgumentError, "#{@__resource_name__}: services must be provided" + end + unless opts[:cluster] && !opts[:cluster].empty? + raise ArgumentError, "#{@__resource_name__}: cluster must be provided" + end @display_name = opts[:service] catch_aws_errors do - resp = @aws.ecs_client.describe_services({ cluster: opts[:cluster], services: [opts[:service]] }) + resp = + @aws.ecs_client.describe_services( + { cluster: opts[:cluster], services: [opts[:service]] } + ) @services = resp.services[0].to_h create_resource_methods(@services) end diff --git a/libraries/aws_ecs_task_definition.rb b/libraries/aws_ecs_task_definition.rb index 74c03fc30..073cdaf3d 100644 --- a/libraries/aws_ecs_task_definition.rb +++ b/libraries/aws_ecs_task_definition.rb @@ -14,10 +14,16 @@ def initialize(opts = {}) opts = { task_definition: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:task_definition]) - raise ArgumentError, "#{@__resource_name__}: task_definition must be provided" unless opts[:task_definition] && !opts[:task_definition].empty? + unless opts[:task_definition] && !opts[:task_definition].empty? + raise ArgumentError, + "#{@__resource_name__}: task_definition must be provided" + end @display_name = opts[:task_definition] catch_aws_errors do - resp = @aws.ecs_client.describe_task_definition({ task_definition: opts[:task_definition] }) + resp = + @aws.ecs_client.describe_task_definition( + { task_definition: opts[:task_definition] } + ) @task_definition = resp.task_definition.to_h create_resource_methods(@task_definition) end @@ -45,7 +51,9 @@ def container_definitions_repository_credentials end def container_definitions_repository_credentials_credentials_parameters - container_definitions.map(&:repository_credentials).map(&:credentials_parameter) + container_definitions.map(&:repository_credentials).map( + &:credentials_parameter + ) end def container_definitions_cpus @@ -161,15 +169,24 @@ def container_definitions_linux_parameters_capabilities_devices end def container_definitions_linux_parameters_capabilities_devices_host_paths - container_definitions.map(&:linux_parameters).map(&:devices).map(&:host_path) + container_definitions + .map(&:linux_parameters) + .map(&:devices) + .map(&:host_path) end def container_definitions_linux_parameters_capabilities_devices_container_paths - container_definitions.map(&:linux_parameters).map(&:devices).map(&:container_path) + container_definitions + .map(&:linux_parameters) + .map(&:devices) + .map(&:container_path) end def container_definitions_linux_parameters_capabilities_devices_permissions - container_definitions.map(&:linux_parameters).map(&:devices).map(&:permissions) + container_definitions + .map(&:linux_parameters) + .map(&:devices) + .map(&:permissions) end def container_definitions_linux_parameters_init_process_enabled @@ -185,7 +202,10 @@ def container_definitions_linux_parameters_tmpfs end def container_definitions_linux_parameters_tmpfs_container_paths - container_definitions.map(&:linux_parameters).map(&:tmpfs).map(&:container_path) + container_definitions + .map(&:linux_parameters) + .map(&:tmpfs) + .map(&:container_path) end def container_definitions_linux_parameters_tmpfs_sizes @@ -193,7 +213,10 @@ def container_definitions_linux_parameters_tmpfs_sizes end def container_definitions_linux_parameters_tmpfs_mount_options - container_definitions.map(&:linux_parameters).map(&:tmpfs).map(&:mount_options) + container_definitions + .map(&:linux_parameters) + .map(&:tmpfs) + .map(&:mount_options) end def container_definitions_linux_parameters_max_swaps @@ -329,11 +352,17 @@ def container_definitions_log_configurations_secret_options end def container_definitions_log_configurations_secret_options_names - container_definitions.map(&:log_configuration).map(&:secret_options).map(&:name) + container_definitions + .map(&:log_configuration) + .map(&:secret_options) + .map(&:name) end def container_definitions_log_configurations_secret_value_froms - container_definitions.map(&:log_configuration).map(&:secret_options).map(&:value_from) + container_definitions + .map(&:log_configuration) + .map(&:secret_options) + .map(&:value_from) end def container_definitions_health_checks @@ -457,11 +486,17 @@ def volumes_efs_volume_configuration_authorization_configs end def volumes_efs_volume_configuration_authorization_config_access_point_ids - volumes.map(&:efs_volume_configurations).map(&:authorization_config).map(&:access_point_id) + volumes + .map(&:efs_volume_configurations) + .map(&:authorization_config) + .map(&:access_point_id) end def volumes_efs_volume_configuration_authorization_config_iams - volumes.map(&:efs_volume_configurations).map(&:authorization_config).map(&:iam) + volumes + .map(&:efs_volume_configurations) + .map(&:authorization_config) + .map(&:iam) end def volumes_fsx_windows_file_server_volume_configurations @@ -469,23 +504,35 @@ def volumes_fsx_windows_file_server_volume_configurations end def volumes_fsx_windows_file_server_volume_configurations_file_system_ids - volumes.map(&:fsx_windows_file_server_volume_configuration).map(&:file_system_id) + volumes.map(&:fsx_windows_file_server_volume_configuration).map( + &:file_system_id + ) end def volumes_fsx_windows_file_server_volume_configurations_root_directories - volumes.map(&:fsx_windows_file_server_volume_configuration).map(&:root_directory) + volumes.map(&:fsx_windows_file_server_volume_configuration).map( + &:root_directory + ) end def volumes_fsx_windows_file_server_volume_configurations_authorization_configs - volumes.map(&:fsx_windows_file_server_volume_configuration).map(&:authorization_config) + volumes.map(&:fsx_windows_file_server_volume_configuration).map( + &:authorization_config + ) end def volumes_fsx_windows_file_server_volume_configurations_authorization_configs_credentials_parameters - volumes.map(&:fsx_windows_file_server_volume_configuration).map(&:authorization_config).map(&:credentials_parameter) + volumes + .map(&:fsx_windows_file_server_volume_configuration) + .map(&:authorization_config) + .map(&:credentials_parameter) end def volumes_fsx_windows_file_server_volume_configurations_authorization_configs_domains - volumes.map(&:fsx_windows_file_server_volume_configuration).map(&:authorization_config).map(&:domain) + volumes + .map(&:fsx_windows_file_server_volume_configuration) + .map(&:authorization_config) + .map(&:domain) end def requires_attributes_names diff --git a/libraries/aws_efs_mount_target.rb b/libraries/aws_efs_mount_target.rb index 946d28257..2731097e9 100644 --- a/libraries/aws_efs_mount_target.rb +++ b/libraries/aws_efs_mount_target.rb @@ -13,17 +13,23 @@ def initialize(opts = {}) opts = { mount_target_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:mount_target_id]) - raise ArgumentError, "#{@__resource_name__}: mount_target_id must be provided" unless opts[:mount_target_id] && !opts[:mount_target_id].empty? + unless opts[:mount_target_id] && !opts[:mount_target_id].empty? + raise ArgumentError, + "#{@__resource_name__}: mount_target_id must be provided" + end @display_name = opts[:mount_target_id] catch_aws_errors do - resp = @aws.efs_client.describe_mount_targets({ mount_target_id: opts[:mount_target_id] }) + resp = + @aws.efs_client.describe_mount_targets( + { mount_target_id: opts[:mount_target_id] } + ) @mount_targets = resp.mount_targets[0].to_h create_resource_methods(@mount_targets) end end def mount_target_id - return unless exists? + return nil unless exists? @mount_targets[:mount_target_id] end diff --git a/libraries/aws_elasticloadbalancingv2_listener.rb b/libraries/aws_elasticloadbalancingv2_listener.rb index a4b8ee0b5..d7bba469f 100644 --- a/libraries/aws_elasticloadbalancingv2_listener.rb +++ b/libraries/aws_elasticloadbalancingv2_listener.rb @@ -13,17 +13,23 @@ def initialize(opts = {}) opts = { listener_arn: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:listener_arn]) - raise ArgumentError, "#{@__resource_name__}: listener_arn must be provided" unless opts[:listener_arn] && !opts[:listener_arn].empty? + unless opts[:listener_arn] && !opts[:listener_arn].empty? + raise ArgumentError, + "#{@__resource_name__}: listener_arn must be provided" + end @display_name = opts[:listener_arn] catch_aws_errors do - resp = @aws.elb_client_v2.describe_listeners({ listener_arns: [opts[:listener_arn]] }) + resp = + @aws.elb_client_v2.describe_listeners( + { listener_arns: [opts[:listener_arn]] } + ) @listeners = resp.listeners[0].to_h create_resource_methods(@listeners) end end def listener_arn - return unless exists? + return nil unless exists? @listeners[:listener_arns] end diff --git a/libraries/aws_elasticloadbalancingv2_listener_certificate.rb b/libraries/aws_elasticloadbalancingv2_listener_certificate.rb index aad8297b5..5fd0fca9d 100644 --- a/libraries/aws_elasticloadbalancingv2_listener_certificate.rb +++ b/libraries/aws_elasticloadbalancingv2_listener_certificate.rb @@ -13,17 +13,23 @@ def initialize(opts = {}) opts = { listener_arn: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:listener_arn]) - raise ArgumentError, "#{@__resource_name__}: listener_arn must be provided" unless opts[:listener_arn] && !opts[:listener_arn].empty? + unless opts[:listener_arn] && !opts[:listener_arn].empty? + raise ArgumentError, + "#{@__resource_name__}: listener_arn must be provided" + end @display_name = opts[:listener_arn] catch_aws_errors do - resp = @aws.elb_client_v2.describe_listener_certificates({ listener_arn: opts[:listener_arn] }) + resp = + @aws.elb_client_v2.describe_listener_certificates( + { listener_arn: opts[:listener_arn] } + ) @listeners = resp.certificates[0].to_h create_resource_methods(@listeners) end end def listener_arn - return unless exists? + return nil unless exists? @listeners[:listener_arn] end diff --git a/libraries/aws_elasticloadbalancingv2_listener_rule.rb b/libraries/aws_elasticloadbalancingv2_listener_rule.rb index a03f807e6..9e144428c 100644 --- a/libraries/aws_elasticloadbalancingv2_listener_rule.rb +++ b/libraries/aws_elasticloadbalancingv2_listener_rule.rb @@ -13,17 +13,20 @@ def initialize(opts = {}) opts = { rule_arns: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:rule_arns]) - raise ArgumentError, "#{@__resource_name__}: rule_arns must be provided" unless opts[:rule_arns] && !opts[:rule_arns].empty? + unless opts[:rule_arns] && !opts[:rule_arns].empty? + raise ArgumentError, "#{@__resource_name__}: rule_arns must be provided" + end @display_name = opts[:rule_arns] catch_aws_errors do - resp = @aws.elb_client_v2.describe_rules({ rule_arns: [opts[:rule_arns]] }) + resp = + @aws.elb_client_v2.describe_rules({ rule_arns: [opts[:rule_arns]] }) @listeners = resp.rules[0].to_h create_resource_methods(@listeners) end end def listener_arns - return unless exists? + return nil unless exists? @listeners[:listener_arns] end diff --git a/libraries/aws_elasticloadbalancingv2_target_group.rb b/libraries/aws_elasticloadbalancingv2_target_group.rb index 5455ebb40..df0055855 100644 --- a/libraries/aws_elasticloadbalancingv2_target_group.rb +++ b/libraries/aws_elasticloadbalancingv2_target_group.rb @@ -13,17 +13,23 @@ def initialize(opts = {}) opts = { target_group_arn: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:target_group_arn]) - raise ArgumentError, "#{@__resource_name__}: target_group_arns must be provided" unless opts[:target_group_arn] && !opts[:target_group_arn].empty? + unless opts[:target_group_arn] && !opts[:target_group_arn].empty? + raise ArgumentError, + "#{@__resource_name__}: target_group_arns must be provided" + end @display_name = opts[:target_group_arn] catch_aws_errors do - resp = @aws.elb_client_v2.describe_target_groups({ target_group_arns: [opts[:target_group_arn]] }) + resp = + @aws.elb_client_v2.describe_target_groups( + { target_group_arns: [opts[:target_group_arn]] } + ) @target_groups = resp.target_groups[0].to_h create_resource_methods(@target_groups) end end def target_group_arn - return unless exists? + return nil unless exists? @target_groups[:target_group_arn] end diff --git a/libraries/aws_elasticsearchservice_domain.rb b/libraries/aws_elasticsearchservice_domain.rb index 428a2f140..fe70c7ca2 100644 --- a/libraries/aws_elasticsearchservice_domain.rb +++ b/libraries/aws_elasticsearchservice_domain.rb @@ -14,22 +14,27 @@ def initialize(opts = {}) opts = { domain_name: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:domain_name]) - raise ArgumentError, "#{@__resource_name__}: domain_name must be provided" unless opts[:domain_name] && !opts[:domain_name].empty? + unless opts[:domain_name] && !opts[:domain_name].empty? + raise ArgumentError, "#{@__resource_name__}: domain_name must be provided" + end @display_name = opts[:domain_name] catch_aws_errors do - resp = @aws.elasticsearch_service_client.describe_elasticsearch_domain({ domain_name: opts[:domain_name] }) + resp = + @aws.elasticsearch_service_client.describe_elasticsearch_domain( + { domain_name: opts[:domain_name] } + ) @domain_status = resp.domain_status.to_h create_resource_methods(@domain_status) end end def domain_name - return unless exists? + return nil unless exists? @domain_status[:domain_name] end def resource_id - @domain_status? @domain_status[:domain_id]: "" + @domain_status ? @domain_status[:domain_id] : "" end def exists? diff --git a/libraries/aws_eventbridge_rule.rb b/libraries/aws_eventbridge_rule.rb index 7b778a5c0..5487604a3 100644 --- a/libraries/aws_eventbridge_rule.rb +++ b/libraries/aws_eventbridge_rule.rb @@ -14,7 +14,9 @@ def initialize(opts = {}) opts = { name: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:name]) - raise ArgumentError, "#{@__resource_name__}: name must be provided" unless opts[:name] && !opts[:name].empty? + unless opts[:name] && !opts[:name].empty? + raise ArgumentError, "#{@__resource_name__}: name must be provided" + end @display_name = opts[:name] catch_aws_errors do resp = @aws.eventbridge_client.describe_rule({ name: opts[:name] }) @@ -24,7 +26,7 @@ def initialize(opts = {}) end def name - return unless exists? + return nil unless exists? @res[:name] end diff --git a/libraries/aws_glue_crawler.rb b/libraries/aws_glue_crawler.rb index c26d4bd0f..1e4641f53 100644 --- a/libraries/aws_glue_crawler.rb +++ b/libraries/aws_glue_crawler.rb @@ -14,7 +14,9 @@ def initialize(opts = {}) opts = { name: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:name]) - raise ArgumentError, "#{@__resource_name__}: name must be provided" unless opts[:name] && !opts[:name].empty? + unless opts[:name] && !opts[:name].empty? + raise ArgumentError, "#{@__resource_name__}: name must be provided" + end @display_name = opts[:name] catch_aws_errors do resp = @aws.glue_client.get_crawler({ name: opts[:name] }) diff --git a/libraries/aws_glue_database.rb b/libraries/aws_glue_database.rb index 316a8a879..0e8bb2ed4 100644 --- a/libraries/aws_glue_database.rb +++ b/libraries/aws_glue_database.rb @@ -14,7 +14,9 @@ def initialize(opts = {}) opts = { name: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:name]) - raise ArgumentError, "#{@__resource_name__}: name must be provided" unless opts[:name] && !opts[:name].empty? + unless opts[:name] && !opts[:name].empty? + raise ArgumentError, "#{@__resource_name__}: name must be provided" + end @display_name = opts[:name] catch_aws_errors do resp = @aws.glue_client.get_database({ name: opts[:name] }) @@ -24,7 +26,7 @@ def initialize(opts = {}) end def name - return unless exists? + return nil unless exists? @res[:name] end diff --git a/libraries/aws_iam_access_key.rb b/libraries/aws_iam_access_key.rb index 279847cdb..4b22e4ec5 100644 --- a/libraries/aws_iam_access_key.rb +++ b/libraries/aws_iam_access_key.rb @@ -29,12 +29,14 @@ def initialize(opts = {}) opts[:access_key_id] = opts.delete(:id) end - if opts[:access_key_id] && !/^AKIA[0-9A-Z]{16}$/.match?(opts[:access_key_id]) - raise ArgumentError, "#{@__resource_name__}: Incorrect format for provided Access Key ID" + if opts[:access_key_id] && + !/^AKIA[0-9A-Z]{16}$/.match?(opts[:access_key_id]) + raise ArgumentError, + "#{@__resource_name__}: Incorrect format for provided Access Key ID" end super(opts) - validate_parameters(require_any_of: %i(access_key_id username)) + validate_parameters(require_any_of: %i[access_key_id username]) @username = opts[:username] @access_key_id = opts[:access_key_id] @@ -47,13 +49,10 @@ def initialize(opts = {}) # Get all keys for the provided user. If no user provided, use current principal. # If an `access_key_id` has been provided, get only that key. - access_keys = resp.access_key_metadata.select do |key| - if access_key_id - key.access_key_id == access_key_id - else - true + access_keys = + resp.access_key_metadata.select do |key| + access_key_id ? key.access_key_id == access_key_id : true end - end return if access_keys.empty? if access_keys.count > 1 @@ -62,9 +61,9 @@ def initialize(opts = {}) end @access_key_id = access_keys[0].access_key_id - @username = access_keys[0].user_name - @create_date = access_keys[0].create_date - @status = access_keys[0].status + @username = access_keys[0].user_name + @create_date = access_keys[0].create_date + @status = access_keys[0].status end end @@ -73,7 +72,7 @@ def resource_id end def active? - return unless exists? + return nil unless exists? status == "Active" end @@ -86,12 +85,15 @@ def to_s end def last_used_date - return unless exists? - return @last_used_date if defined? @last_used_date + return nil unless exists? + return @last_used_date if defined?(@last_used_date) catch_aws_errors do - @last_used_date = @aws.iam_client.get_access_key_last_used({ access_key_id: @access_key_id }) - .access_key_last_used - .last_used_date + @last_used_date = + @aws + .iam_client + .get_access_key_last_used({ access_key_id: @access_key_id }) + .access_key_last_used + .last_used_date end end end diff --git a/libraries/aws_iam_instance_profile.rb b/libraries/aws_iam_instance_profile.rb index 33f40fa14..845d62524 100644 --- a/libraries/aws_iam_instance_profile.rb +++ b/libraries/aws_iam_instance_profile.rb @@ -14,10 +14,16 @@ def initialize(opts = {}) opts = { instance_profile_name: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:instance_profile_name]) - raise ArgumentError, "#{@__resource_name__}: instance_profile_name must be provided" unless opts[:instance_profile_name] && !opts[:instance_profile_name].empty? + unless opts[:instance_profile_name] && !opts[:instance_profile_name].empty? + raise ArgumentError, + "#{@__resource_name__}: instance_profile_name must be provided" + end @display_name = opts[:instance_profile_name] catch_aws_errors do - resp = @aws.iam_client.get_instance_profile({ instance_profile_name: opts[:instance_profile_name] }) + resp = + @aws.iam_client.get_instance_profile( + { instance_profile_name: opts[:instance_profile_name] } + ) @res = resp.instance_profile.to_h @arn = @res[:arn] create_resource_methods(@res) @@ -29,7 +35,7 @@ def resource_id end def instance_profile_name - return unless exists? + return nil unless exists? @res[:instance_profile_name] end diff --git a/libraries/aws_iam_service_linked_role_deletion_status.rb b/libraries/aws_iam_service_linked_role_deletion_status.rb index ea1af627a..6656f01d8 100644 --- a/libraries/aws_iam_service_linked_role_deletion_status.rb +++ b/libraries/aws_iam_service_linked_role_deletion_status.rb @@ -14,22 +14,28 @@ def initialize(opts = {}) opts = { deletion_task_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:deletion_task_id]) - raise ArgumentError, "#{@__resource_name__}: deletion_task_id must be provided" unless opts[:deletion_task_id] && !opts[:deletion_task_id].empty? + unless opts[:deletion_task_id] && !opts[:deletion_task_id].empty? + raise ArgumentError, + "#{@__resource_name__}: deletion_task_id must be provided" + end @display_name = opts[:deletion_task_id] catch_aws_errors do - resp = @aws.iam_client.get_service_linked_role_deletion_status({ deletion_task_id: opts[:deletion_task_id] }) + resp = + @aws.iam_client.get_service_linked_role_deletion_status( + { deletion_task_id: opts[:deletion_task_id] } + ) @res = resp.to_h create_resource_methods(@res) end end def status - return unless exists? + return nil unless exists? @res[:status] end def resource_id - @res? @display_name: "" + @res ? @display_name : "" end def exists? diff --git a/libraries/aws_iam_ssh_public_key.rb b/libraries/aws_iam_ssh_public_key.rb index db6990cba..1ebece862 100644 --- a/libraries/aws_iam_ssh_public_key.rb +++ b/libraries/aws_iam_ssh_public_key.rb @@ -16,13 +16,27 @@ class AWSIAMSSHPublicKey < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(user_name ssh_public_key_id encoding)) - raise ArgumentError, "#{@__resource_name__}: user_name must be provided" unless opts[:user_name] && !opts[:user_name].empty? - raise ArgumentError, "#{@__resource_name__}: ssh_public_key_id must be provided" unless opts[:ssh_public_key_id] && !opts[:ssh_public_key_id].empty? - raise ArgumentError, "#{@__resource_name__}: encoding must be provided" unless opts[:encoding] && !opts[:encoding].empty? + validate_parameters(required: %i[user_name ssh_public_key_id encoding]) + unless opts[:user_name] && !opts[:user_name].empty? + raise ArgumentError, "#{@__resource_name__}: user_name must be provided" + end + unless opts[:ssh_public_key_id] && !opts[:ssh_public_key_id].empty? + raise ArgumentError, + "#{@__resource_name__}: ssh_public_key_id must be provided" + end + unless opts[:encoding] && !opts[:encoding].empty? + raise ArgumentError, "#{@__resource_name__}: encoding must be provided" + end @display_name = opts[:ssh_public_key_id] catch_aws_errors do - resp = @aws.iam_client.get_ssh_public_key({ user_name: opts[:user_name], ssh_public_key_id: opts[:ssh_public_key_id], encoding: opts[:encoding] }) + resp = + @aws.iam_client.get_ssh_public_key( + { + user_name: opts[:user_name], + ssh_public_key_id: opts[:ssh_public_key_id], + encoding: opts[:encoding] + } + ) @res = resp.ssh_public_key.to_h @user_name = @res[:user_name] @ssh_public_key_id = @res[:ssh_public_key_id] @@ -35,12 +49,12 @@ def resource_id end def ssh_public_key_id - return unless exists? + return nil unless exists? @res[:ssh_public_key_id] end def ssh_key_age_valid - return unless exists? + return nil unless exists? result = (Time.now - @res[:upload_date]).to_i / (24 * 60 * 60) return false if result > 730 true diff --git a/libraries/aws_internet_gateway.rb b/libraries/aws_internet_gateway.rb index 4c3305306..6a605eedb 100644 --- a/libraries/aws_internet_gateway.rb +++ b/libraries/aws_internet_gateway.rb @@ -16,27 +16,32 @@ class AwsInternetGateway < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(require_any_of: %i(id name)) + validate_parameters(require_any_of: %i[id name]) # Either id or name should be provided. if opts.key?(:id) && !opts.key?(:name) id = opts[:id] - format_error = "#{@__resource_name__}: `id` must be a string in the format of "\ - "'igw-' followed by 8 or 17 hexadecimal characters." + format_error = + "#{@__resource_name__}: `id` must be a string in the format of " \ + "'igw-' followed by 8 or 17 hexadecimal characters." pattern = /^igw-[0-9a-f]{8,17}$/ - raise ArgumentError, format_error unless id.match?(pattern) || id.length.between?(12, 21) + unless id.match?(pattern) || id.length.between?(12, 21) + raise ArgumentError, format_error + end query_params = { internet_gateway_ids: [id] } elsif opts.key?(:name) && !opts.key?(:id) name = opts[:name] - tag_error = "#{@__resource_name__}: `name` should be maximum 255 characters long and contain "\ - "letters, numbers, spaces and the following characters only: + - = . _ : / @" - raise ArgumentError, tag_error unless name.match?(%r{^[\w+\- =._:/@]{1,256}$}) && name.length.between?(1, 255) - query_params = { filters: [ - name: "tag:Name", - values: [name], - ] } + tag_error = + "#{@__resource_name__}: `name` should be maximum 255 characters long and contain " \ + "letters, numbers, spaces and the following characters only: + - = . _ : / @" + unless name.match?(%r{^[\w+\- =._:/@]{1,256}$}) && + name.length.between?(1, 255) + raise ArgumentError, tag_error + end + query_params = { filters: [name: "tag:Name", values: [name]] } else - raise ArgumentError, "#{@__resource_name__}: either `id` or `name` must be provided." + raise ArgumentError, + "#{@__resource_name__}: either `id` or `name` must be provided." end @display_name = opts.values.join(" ") @@ -52,9 +57,11 @@ def initialize(opts = {}) end # Fail resource, redirect users to plural resource if there are multiple resources with the same name tag. if gateways.length > 1 - fail_resource("#{@__resource_name__}: Multiple internet gateways were returned for the provided parameter:"\ - " `#{@display_name}`. If you wish to test multiple internet gateways, "\ - "please use the aws_internet_gateways resource.") + fail_resource( + "#{@__resource_name__}: Multiple internet gateways were returned for the provided parameter:" \ + " `#{@display_name}`. If you wish to test multiple internet gateways, " \ + "please use the aws_internet_gateways resource." + ) @failed_resource = true return end diff --git a/libraries/aws_lambda_alias.rb b/libraries/aws_lambda_alias.rb index de85e4c2c..be2a5aac2 100644 --- a/libraries/aws_lambda_alias.rb +++ b/libraries/aws_lambda_alias.rb @@ -12,19 +12,31 @@ class AWSLambdaAlias < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(function_name function_alias_name)) - raise ArgumentError, "#{@__resource_name__}: function_name must be provided" unless opts[:function_name] && !opts[:function_name].empty? - raise ArgumentError, "#{@__resource_name__}: function_alias_name must be provided" unless opts[:function_alias_name] && !opts[:function_alias_name].empty? + validate_parameters(required: %i[function_name function_alias_name]) + unless opts[:function_name] && !opts[:function_name].empty? + raise ArgumentError, + "#{@__resource_name__}: function_name must be provided" + end + unless opts[:function_alias_name] && !opts[:function_alias_name].empty? + raise ArgumentError, + "#{@__resource_name__}: function_alias_name must be provided" + end @display_name = opts[:function_alias_name] catch_aws_errors do - resp = @aws.lambda_client.get_alias({ function_name: opts[:function_name], name: opts[:function_alias_name] }) + resp = + @aws.lambda_client.get_alias( + { + function_name: opts[:function_name], + name: opts[:function_alias_name] + } + ) @res = resp.to_h create_resource_methods(@res) end end def function_alias_name - return unless exists? + return nil unless exists? @res[:function_alias_name] end diff --git a/libraries/aws_lambda_code_signing_config.rb b/libraries/aws_lambda_code_signing_config.rb index be7dac880..dd651cc0e 100644 --- a/libraries/aws_lambda_code_signing_config.rb +++ b/libraries/aws_lambda_code_signing_config.rb @@ -12,11 +12,18 @@ class AWSLambdaCodeSigningConfig < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(code_signing_config_arn)) - raise ArgumentError, "#{@__resource_name__}: code_signing_config_arn must be provided" unless opts[:code_signing_config_arn] && !opts[:code_signing_config_arn].empty? + validate_parameters(required: %i[code_signing_config_arn]) + unless opts[:code_signing_config_arn] && + !opts[:code_signing_config_arn].empty? + raise ArgumentError, + "#{@__resource_name__}: code_signing_config_arn must be provided" + end @display_name = opts[:code_signing_config_arn] catch_aws_errors do - resp = @aws.lambda_client.get_code_signing_config({ code_signing_config_arn: opts[:code_signing_config_arn] }) + resp = + @aws.lambda_client.get_code_signing_config( + { code_signing_config_arn: opts[:code_signing_config_arn] } + ) @res = resp.code_signing_config.to_h create_resource_methods(@res) end diff --git a/libraries/aws_lambda_event_invoke_config.rb b/libraries/aws_lambda_event_invoke_config.rb index b48f85399..0b6f810fc 100644 --- a/libraries/aws_lambda_event_invoke_config.rb +++ b/libraries/aws_lambda_event_invoke_config.rb @@ -13,18 +13,24 @@ class AWSLambdaEventInvokeConfig < AwsResourceBase def initialize(opts = {}) opts = { function_name: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(function_name)) - raise ArgumentError, "#{@__resource_name__}: function_name must be provided" unless opts[:function_name] && !opts[:function_name].empty? + validate_parameters(required: %i[function_name]) + unless opts[:function_name] && !opts[:function_name].empty? + raise ArgumentError, + "#{@__resource_name__}: function_name must be provided" + end @display_name = opts[:function_name] catch_aws_errors do - resp = @aws.lambda_client.get_function_event_invoke_config({ function_name: opts[:function_name] }) + resp = + @aws.lambda_client.get_function_event_invoke_config( + { function_name: opts[:function_name] } + ) @res = resp.to_h create_resource_methods(@res) end end def function_name - return unless exists? + return nil unless exists? @res[:function_name] end diff --git a/libraries/aws_lambda_event_source_mapping.rb b/libraries/aws_lambda_event_source_mapping.rb index 17b58a0c1..c504ae544 100644 --- a/libraries/aws_lambda_event_source_mapping.rb +++ b/libraries/aws_lambda_event_source_mapping.rb @@ -14,7 +14,9 @@ def initialize(opts = {}) opts = { uuid: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:uuid]) - raise ArgumentError, "#{@__resource_name__}: uuid must be provided" unless opts[:uuid] && !opts[:uuid].empty? + unless opts[:uuid] && !opts[:uuid].empty? + raise ArgumentError, "#{@__resource_name__}: uuid must be provided" + end @display_name = opts[:uuid] catch_aws_errors do resp = @aws.lambda_client.get_event_source_mapping({ uuid: opts[:uuid] }) @@ -24,7 +26,7 @@ def initialize(opts = {}) end def uuid - return unless exists? + return nil unless exists? @res[:uuid] end diff --git a/libraries/aws_lambda_layer_version_permission.rb b/libraries/aws_lambda_layer_version_permission.rb index 7b17791b3..d6132e13a 100644 --- a/libraries/aws_lambda_layer_version_permission.rb +++ b/libraries/aws_lambda_layer_version_permission.rb @@ -13,19 +13,30 @@ class AWSLambdaLayerVersionPermission < AwsResourceBase def initialize(opts = {}) opts = { layer_name: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(layer_name version_number)) - raise ArgumentError, "#{@__resource_name__}: layer_name must be provided" unless opts[:layer_name] && !opts[:layer_name].empty? - raise ArgumentError, "#{@__resource_name__}: version_number must be provided" unless opts[:version_number] + validate_parameters(required: %i[layer_name version_number]) + unless opts[:layer_name] && !opts[:layer_name].empty? + raise ArgumentError, "#{@__resource_name__}: layer_name must be provided" + end + unless opts[:version_number] + raise ArgumentError, + "#{@__resource_name__}: version_number must be provided" + end @display_name = opts[:layer_name] catch_aws_errors do - resp = @aws.lambda_client.get_layer_version_policy({ layer_name: opts[:layer_name], version_number: opts[:version_number] }) + resp = + @aws.lambda_client.get_layer_version_policy( + { + layer_name: opts[:layer_name], + version_number: opts[:version_number] + } + ) @res = resp.to_h create_resource_methods(@res) end end def layer_name - return unless exists? + return nil unless exists? @res[:layer_name] end diff --git a/libraries/aws_lambda_version.rb b/libraries/aws_lambda_version.rb index 5f7deeb71..aafbabd5a 100644 --- a/libraries/aws_lambda_version.rb +++ b/libraries/aws_lambda_version.rb @@ -12,18 +12,26 @@ class AWSLambdaVersion < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(layer_name version_number)) - raise ArgumentError, "#{@__resource_name__}: layer_name must be provided" unless opts[:layer_name] && !opts[:layer_name].empty? + validate_parameters(required: %i[layer_name version_number]) + unless opts[:layer_name] && !opts[:layer_name].empty? + raise ArgumentError, "#{@__resource_name__}: layer_name must be provided" + end @display_name = opts[:layer_name] catch_aws_errors do - resp = @aws.lambda_client.get_layer_version({ layer_name: opts[:layer_name], version_number: opts[:version_number] }) + resp = + @aws.lambda_client.get_layer_version( + { + layer_name: opts[:layer_name], + version_number: opts[:version_number] + } + ) @res = resp.to_h create_resource_methods(@res) end end def version_number - return unless exists? + return nil unless exists? @res[:version_number] end diff --git a/libraries/aws_logs_metric_filter.rb b/libraries/aws_logs_metric_filter.rb index a1896849a..0bb19d298 100644 --- a/libraries/aws_logs_metric_filter.rb +++ b/libraries/aws_logs_metric_filter.rb @@ -14,10 +14,15 @@ def initialize(opts = {}) opts = { filter_name: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:filter_name]) - raise ArgumentError, "#{@__resource_name__}: filter_name must be provided" unless opts[:filter_name] && !opts[:filter_name].empty? + unless opts[:filter_name] && !opts[:filter_name].empty? + raise ArgumentError, "#{@__resource_name__}: filter_name must be provided" + end @display_name = opts[:filter_name] catch_aws_errors do - resp = @aws.cloudwatchlogs_client.describe_metric_filters({ filter_name_prefix: opts[:filter_name] }) + resp = + @aws.cloudwatchlogs_client.describe_metric_filters( + { filter_name_prefix: opts[:filter_name] } + ) @metric_filters = resp.metric_filters[0].to_h @filter_name = @metric_filters[:filter_name] @log_group_name = @metric_filters[:log_group_name] @@ -30,7 +35,7 @@ def resource_id end def filter_name - return unless exists? + return nil unless exists? @metric_filters[:filter_name_prefix] end diff --git a/libraries/aws_mq_broker.rb b/libraries/aws_mq_broker.rb index 139ff6773..995d67352 100644 --- a/libraries/aws_mq_broker.rb +++ b/libraries/aws_mq_broker.rb @@ -14,7 +14,9 @@ def initialize(opts = {}) opts = { broker_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:broker_id]) - raise ArgumentError, "#{@__resource_name__}: broker_id must be provided" unless opts[:broker_id] && !opts[:broker_id].empty? + unless opts[:broker_id] && !opts[:broker_id].empty? + raise ArgumentError, "#{@__resource_name__}: broker_id must be provided" + end @display_name = opts[:broker_id] resp = @aws.mq_client.describe_broker({ broker_id: opts[:broker_id] }) @brokers = resp.to_h @@ -22,12 +24,12 @@ def initialize(opts = {}) end def broker_id - return unless exists? + return nil unless exists? @brokers[:broker_id] end def resource_id - @brokers? @brokers[:broker_id] : @display_name + @brokers ? @brokers[:broker_id] : @display_name end def exists? diff --git a/libraries/aws_mq_configuration.rb b/libraries/aws_mq_configuration.rb index e12315c65..d5a30286a 100644 --- a/libraries/aws_mq_configuration.rb +++ b/libraries/aws_mq_configuration.rb @@ -12,11 +12,17 @@ class AWSMQConfiguration < AwsResourceBase def initialize(opts = {}) opts = { configuration_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(configuration_id)) - raise ArgumentError, "#{@__resource_name__}: configuration_id must be provided" if opts[:configuration_id].blank? + validate_parameters(required: %i[configuration_id]) + if opts[:configuration_id].blank? + raise ArgumentError, + "#{@__resource_name__}: configuration_id must be provided" + end @display_name = opts[:configuration_id] catch_aws_errors do - resp = @aws.mq_client.describe_configuration({ configuration_id: opts[:configuration_id] }) + resp = + @aws.mq_client.describe_configuration( + { configuration_id: opts[:configuration_id] } + ) @configurations = resp.to_h @arn = @configurations[:arn] create_resource_methods(@configurations) @@ -24,7 +30,7 @@ def initialize(opts = {}) end def resource_id - return unless exists? + return nil unless exists? @arn || @display_name end @@ -34,7 +40,7 @@ def exists? end def configuration_id - return unless exists? + return nil unless exists? @configurations[:id] end diff --git a/libraries/aws_network_firewall_firewall.rb b/libraries/aws_network_firewall_firewall.rb index 7d58ecce8..b4ba5ae23 100644 --- a/libraries/aws_network_firewall_firewall.rb +++ b/libraries/aws_network_firewall_firewall.rb @@ -14,10 +14,16 @@ def initialize(opts = {}) opts = { firewall_name: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:firewall_name]) - raise ArgumentError, "#{@__resource_name__}: firewall_name must be provided" unless opts[:firewall_name] && !opts[:firewall_name].empty? + unless opts[:firewall_name] && !opts[:firewall_name].empty? + raise ArgumentError, + "#{@__resource_name__}: firewall_name must be provided" + end @display_name = opts[:firewall_name] catch_aws_errors do - resp = @aws.network_firewall_client.describe_firewall({ firewall_name: opts[:firewall_name] }) + resp = + @aws.network_firewall_client.describe_firewall( + { firewall_name: opts[:firewall_name] } + ) @res = resp.to_h @firewall_arn = @res[:firewall][:firewall_arn] create_resource_methods(@res) @@ -25,7 +31,7 @@ def initialize(opts = {}) end def firewall_name - return unless exists? + return nil unless exists? @res[:firewall_name] end diff --git a/libraries/aws_network_firewall_firewall_policy.rb b/libraries/aws_network_firewall_firewall_policy.rb index d199f1f82..354052cc2 100644 --- a/libraries/aws_network_firewall_firewall_policy.rb +++ b/libraries/aws_network_firewall_firewall_policy.rb @@ -14,10 +14,16 @@ def initialize(opts = {}) opts = { firewall_policy_name: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:firewall_policy_name]) - raise ArgumentError, "#{@__resource_name__}: firewall_policy_name must be provided" unless opts[:firewall_policy_name] && !opts[:firewall_policy_name].empty? + unless opts[:firewall_policy_name] && !opts[:firewall_policy_name].empty? + raise ArgumentError, + "#{@__resource_name__}: firewall_policy_name must be provided" + end @display_name = opts[:firewall_policy_name] catch_aws_errors do - resp = @aws.network_firewall_client.describe_firewall_policy({ firewall_policy_name: opts[:firewall_policy_name] }) + resp = + @aws.network_firewall_client.describe_firewall_policy( + { firewall_policy_name: opts[:firewall_policy_name] } + ) @res = resp.to_h @firewall_policy_arn = @res[:firewall_policy_arn] create_resource_methods(@res) @@ -25,7 +31,7 @@ def initialize(opts = {}) end def firewall_policy_name - return unless exists? + return nil unless exists? @res[:firewall_policy_name] end diff --git a/libraries/aws_network_firewall_logging_configuration.rb b/libraries/aws_network_firewall_logging_configuration.rb index b9d90fc76..3ee17c35c 100644 --- a/libraries/aws_network_firewall_logging_configuration.rb +++ b/libraries/aws_network_firewall_logging_configuration.rb @@ -14,22 +14,28 @@ def initialize(opts = {}) opts = { firewall_name: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:firewall_name]) - raise ArgumentError, "#{@__resource_name__}: firewall_name must be provided" unless opts[:firewall_name] && !opts[:firewall_name].empty? + unless opts[:firewall_name] && !opts[:firewall_name].empty? + raise ArgumentError, + "#{@__resource_name__}: firewall_name must be provided" + end @display_name = opts[:firewall_name] catch_aws_errors do - resp = @aws.network_firewall_client.describe_logging_configuration({ firewall_name: opts[:firewall_name] }) + resp = + @aws.network_firewall_client.describe_logging_configuration( + { firewall_name: opts[:firewall_name] } + ) @res = resp.to_h create_resource_methods(@res) end end def firewall_name - return unless exists? + return nil unless exists? @res[:firewall_name] end def resource_id - @res? @res[:firewall_arn]: "" + @res ? @res[:firewall_arn] : "" end def exists? @@ -45,7 +51,9 @@ def logging_configuration_log_destination_configs_log_type end def logging_configuration_log_destination_configs_log_destination_type - logging_configuration.map(&:log_destination_configs).map(&:log_destination_type) + logging_configuration.map(&:log_destination_configs).map( + &:log_destination_type + ) end def logging_configuration_log_destination_configs_log_destination diff --git a/libraries/aws_network_firewall_rule_group.rb b/libraries/aws_network_firewall_rule_group.rb index 673f56532..1b56f832b 100644 --- a/libraries/aws_network_firewall_rule_group.rb +++ b/libraries/aws_network_firewall_rule_group.rb @@ -14,22 +14,28 @@ def initialize(opts = {}) opts = { rule_group_arn: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:rule_group_arn]) - raise ArgumentError, "#{@__resource_name__}: rule_group_arn must be provided" unless opts[:rule_group_arn] && !opts[:rule_group_arn].empty? + unless opts[:rule_group_arn] && !opts[:rule_group_arn].empty? + raise ArgumentError, + "#{@__resource_name__}: rule_group_arn must be provided" + end @display_name = opts[:rule_group_arn] catch_aws_errors do - resp = @aws.network_firewall_client.describe_rule_group({ rule_group_arn: opts[:rule_group_arn] }) + resp = + @aws.network_firewall_client.describe_rule_group( + { rule_group_arn: opts[:rule_group_arn] } + ) @res = resp.to_h create_resource_methods(@res) end end def rule_group_arn - return unless exists? + return nil unless exists? @res[:rule_group_arn] end def resource_id - @res? @res[:rule_group_response][:rule_group_arn]: @display_name + @res ? @res[:rule_group_response][:rule_group_arn] : @display_name end def exists? diff --git a/libraries/aws_network_manager_customer_gateway_association.rb b/libraries/aws_network_manager_customer_gateway_association.rb index 2a89e284d..46b469cc0 100644 --- a/libraries/aws_network_manager_customer_gateway_association.rb +++ b/libraries/aws_network_manager_customer_gateway_association.rb @@ -14,24 +14,36 @@ def initialize(opts = {}) opts = { global_network_id: opts } if opts.is_a?(String) opts = { customer_gateway_arn: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(global_network_id customer_gateway_arn)) - raise ArgumentError, "#{@__resource_name__}: global_network_id must be provided" unless opts[:global_network_id] && !opts[:global_network_id].empty? - raise ArgumentError, "#{@__resource_name__}: customer_gateway_arn must be provided" unless opts[:customer_gateway_arn] && !opts[:customer_gateway_arn].empty? + validate_parameters(required: %i[global_network_id customer_gateway_arn]) + unless opts[:global_network_id] && !opts[:global_network_id].empty? + raise ArgumentError, + "#{@__resource_name__}: global_network_id must be provided" + end + unless opts[:customer_gateway_arn] && !opts[:customer_gateway_arn].empty? + raise ArgumentError, + "#{@__resource_name__}: customer_gateway_arn must be provided" + end @display_name = opts[:customer_gateway_arn] catch_aws_errors do - resp = @aws.network_manager_client.get_customer_gateway_associations({ global_network_id: opts[:global_network_id], customer_gateway_arns: [opts[:customer_gateway_arn]] }) + resp = + @aws.network_manager_client.get_customer_gateway_associations( + { + global_network_id: opts[:global_network_id], + customer_gateway_arns: [opts[:customer_gateway_arn]] + } + ) @res = resp.customer_gateway_associations[0].to_h create_resource_methods(@res) end end def customer_gateway_arn - return unless exists? + return nil unless exists? @res[:customer_gateway_arn] end def resource_id - @res? @res[:customer_gateway_arn]: @display_name + @res ? @res[:customer_gateway_arn] : @display_name end def exists? diff --git a/libraries/aws_network_manager_device.rb b/libraries/aws_network_manager_device.rb index f046f5520..863834be0 100644 --- a/libraries/aws_network_manager_device.rb +++ b/libraries/aws_network_manager_device.rb @@ -13,23 +13,31 @@ class AWSNetworkManagerDevice < AwsResourceBase def initialize(opts = {}) opts = { global_network_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(device_id global_network_id)) - raise ArgumentError, "#{@__resource_name__}: device_id must be provided" unless opts[:device_id] && !opts[:device_id].empty? + validate_parameters(required: %i[device_id global_network_id]) + unless opts[:device_id] && !opts[:device_id].empty? + raise ArgumentError, "#{@__resource_name__}: device_id must be provided" + end @display_name = opts[:device_id] catch_aws_errors do - resp = @aws.network_manager_client.get_devices({ device_ids: [opts[:device_id]], global_network_id: opts[:global_network_id] }) + resp = + @aws.network_manager_client.get_devices( + { + device_ids: [opts[:device_id]], + global_network_id: opts[:global_network_id] + } + ) @res = resp.devices[0].to_h create_resource_methods(@res) end end def device_id - return unless exists? + return nil unless exists? @res[:device_id] end def resource_id - @res? @res[:device_id]: @display_name + @res ? @res[:device_id] : @display_name end def exists? diff --git a/libraries/aws_network_manager_global_network.rb b/libraries/aws_network_manager_global_network.rb index 653fbef24..af796386a 100644 --- a/libraries/aws_network_manager_global_network.rb +++ b/libraries/aws_network_manager_global_network.rb @@ -14,22 +14,28 @@ def initialize(opts = {}) opts = { global_network_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:global_network_id]) - raise ArgumentError, "#{@__resource_name__}: global_network_id must be provided" unless opts[:global_network_id] && !opts[:global_network_id].empty? + unless opts[:global_network_id] && !opts[:global_network_id].empty? + raise ArgumentError, + "#{@__resource_name__}: global_network_id must be provided" + end @display_name = opts[:global_network_id] catch_aws_errors do - resp = @aws.network_manager_client.describe_global_networks({ global_network_ids: [opts[:global_network_id]] }) + resp = + @aws.network_manager_client.describe_global_networks( + { global_network_ids: [opts[:global_network_id]] } + ) @res = resp.global_networks[0].to_h create_resource_methods(@res) end end def global_network_id - return unless exists? + return nil unless exists? @res[:global_network_id] end def resource_id - @res? @res[:global_network_id]: @display_name + @res ? @res[:global_network_id] : @display_name end def exists? diff --git a/libraries/aws_ram_resource_share.rb b/libraries/aws_ram_resource_share.rb index 7d37e6d21..5ee9dae6a 100644 --- a/libraries/aws_ram_resource_share.rb +++ b/libraries/aws_ram_resource_share.rb @@ -11,21 +11,35 @@ class AWSRAMResourceShare < AwsResourceBase " def initialize(opts = {}) - opts = { resource_owner: opts, resource_share_arn: opts } if opts.is_a?(String) + opts = { resource_owner: opts, resource_share_arn: opts } if opts.is_a?( + String + ) super(opts) - validate_parameters(required: %i(resource_owner resource_share_arn)) - raise ArgumentError, "#{@__resource_name__}: resource_owner must be provided" unless opts[:resource_owner] && !opts[:resource_owner].empty? - raise ArgumentError, "#{@__resource_name__}: resource_share_arn must be provided" unless opts[:resource_share_arn] && !opts[:resource_share_arn].empty? + validate_parameters(required: %i[resource_owner resource_share_arn]) + unless opts[:resource_owner] && !opts[:resource_owner].empty? + raise ArgumentError, + "#{@__resource_name__}: resource_owner must be provided" + end + unless opts[:resource_share_arn] && !opts[:resource_share_arn].empty? + raise ArgumentError, + "#{@__resource_name__}: resource_share_arn must be provided" + end @display_name = opts[:resource_share_arn] catch_aws_errors do - resp = @aws.ram_client.get_resource_shares({ resource_owner: opts[:resource_owner], resource_share_arns: [opts[:resource_share_arn]] }) + resp = + @aws.ram_client.get_resource_shares( + { + resource_owner: opts[:resource_owner], + resource_share_arns: [opts[:resource_share_arn]] + } + ) @res = resp.resource_shares[0].to_h create_resource_methods(@res) end end def resource_share_arn - return unless exists? + return nil unless exists? @res[:resource_share_arn] end diff --git a/libraries/aws_rds_db_cluster_snapshot.rb b/libraries/aws_rds_db_cluster_snapshot.rb index c6f461be7..82a460ffa 100644 --- a/libraries/aws_rds_db_cluster_snapshot.rb +++ b/libraries/aws_rds_db_cluster_snapshot.rb @@ -13,14 +13,18 @@ class AWSRDSDBClusterSnapShot < AwsResourceBase def initialize(opts = {}) opts = { db_cluster_snapshot_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(db_cluster_snapshot_id)) - raise ArgumentError, "#{@__resource_name__}: db_cluster_snapshot_id must be provided" unless opts[:db_cluster_snapshot_id] && !opts[:db_cluster_snapshot_id].empty? + validate_parameters(required: %i[db_cluster_snapshot_id]) + unless opts[:db_cluster_snapshot_id] && + !opts[:db_cluster_snapshot_id].empty? + raise ArgumentError, + "#{@__resource_name__}: db_cluster_snapshot_id must be provided" + end @display_name = opts[:db_cluster_snapshot_id] filter = [ { name: "db-cluster-snapshot-id", - values: [opts[:db_cluster_snapshot_id]], - }, + values: [opts[:db_cluster_snapshot_id]] + } ] catch_aws_errors do resp = @aws.rds_client.describe_db_cluster_snapshots({ filters: filter }) @@ -31,7 +35,7 @@ def initialize(opts = {}) end def db_cluster_snapshot_id - return unless exists? + return nil unless exists? @res[:db_cluster_snapshot_id] end diff --git a/libraries/aws_rds_db_proxy.rb b/libraries/aws_rds_db_proxy.rb index bb174c736..e06432756 100644 --- a/libraries/aws_rds_db_proxy.rb +++ b/libraries/aws_rds_db_proxy.rb @@ -12,11 +12,17 @@ class AWSRDSProxy < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(db_proxy_name)) - raise ArgumentError, "#{@__resource_name__}: db_proxy_name must be provided" unless opts[:db_proxy_name] && !opts[:db_proxy_name].empty? + validate_parameters(required: %i[db_proxy_name]) + unless opts[:db_proxy_name] && !opts[:db_proxy_name].empty? + raise ArgumentError, + "#{@__resource_name__}: db_proxy_name must be provided" + end @display_name = opts[:db_proxy_name] catch_aws_errors do - resp = @aws.rds_client.describe_db_proxies({ db_proxy_name: opts[:db_proxy_name] }) + resp = + @aws.rds_client.describe_db_proxies( + { db_proxy_name: opts[:db_proxy_name] } + ) @res = resp.db_proxies[0].to_h @db_proxy_arn = @res[:db_proxy_arn] create_resource_methods(@res) @@ -24,7 +30,7 @@ def initialize(opts = {}) end def db_proxy_name - return unless exists? + return nil unless exists? @res[:db_proxy_name] end diff --git a/libraries/aws_rds_db_proxy_endpoint.rb b/libraries/aws_rds_db_proxy_endpoint.rb index fe9503bc1..dbe5b634c 100644 --- a/libraries/aws_rds_db_proxy_endpoint.rb +++ b/libraries/aws_rds_db_proxy_endpoint.rb @@ -12,12 +12,25 @@ class AWSRDSProxyEndpoint < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(db_proxy_name db_proxy_endpoint_name)) - raise ArgumentError, "#{@__resource_name__}: db_proxy_name must be provided" unless opts[:db_proxy_name] && !opts[:db_proxy_name].empty? - raise ArgumentError, "#{@__resource_name__}: db_proxy_endpoint_name must be provided" unless opts[:db_proxy_endpoint_name] && !opts[:db_proxy_endpoint_name].empty? + validate_parameters(required: %i[db_proxy_name db_proxy_endpoint_name]) + unless opts[:db_proxy_name] && !opts[:db_proxy_name].empty? + raise ArgumentError, + "#{@__resource_name__}: db_proxy_name must be provided" + end + unless opts[:db_proxy_endpoint_name] && + !opts[:db_proxy_endpoint_name].empty? + raise ArgumentError, + "#{@__resource_name__}: db_proxy_endpoint_name must be provided" + end @display_name = opts[:db_proxy_endpoint_name] catch_aws_errors do - resp = @aws.rds_client.describe_db_proxy_endpoints({ db_proxy_name: opts[:db_proxy_name], db_proxy_endpoint_name: opts[:db_proxy_endpoint_name] }) + resp = + @aws.rds_client.describe_db_proxy_endpoints( + { + db_proxy_name: opts[:db_proxy_name], + db_proxy_endpoint_name: opts[:db_proxy_endpoint_name] + } + ) @res = resp.db_proxy_endpoints[0].to_h @db_proxy_endpoint_arn = @res[:db_proxy_endpoint_arn] create_resource_methods(@res) @@ -29,7 +42,7 @@ def resource_id end def db_proxy_endpoint_name - return unless exists? + return nil unless exists? @res[:db_proxy_endpoint_name] end diff --git a/libraries/aws_rds_db_security_group.rb b/libraries/aws_rds_db_security_group.rb index 390acb878..d69c9ac48 100644 --- a/libraries/aws_rds_db_security_group.rb +++ b/libraries/aws_rds_db_security_group.rb @@ -12,11 +12,18 @@ class AWSRDSDBSecurityGroup < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(db_security_group_name)) - raise ArgumentError, "#{@__resource_name__}: db_security_group_name must be provided" unless opts[:db_security_group_name] && !opts[:db_security_group_name].empty? + validate_parameters(required: %i[db_security_group_name]) + unless opts[:db_security_group_name] && + !opts[:db_security_group_name].empty? + raise ArgumentError, + "#{@__resource_name__}: db_security_group_name must be provided" + end @display_name = opts[:db_security_group_name] catch_aws_errors do - resp = @aws.rds_client.describe_db_security_groups({ db_security_group_name: opts[:db_security_group_name] }) + resp = + @aws.rds_client.describe_db_security_groups( + { db_security_group_name: opts[:db_security_group_name] } + ) @res = resp.db_security_groups[0].to_h @db_security_group_arn = @res[:db_security_group_arn] create_resource_methods(@res) @@ -28,7 +35,7 @@ def resource_id end def db_security_group_name - return unless exists? + return nil unless exists? @res[:db_security_group_name] end diff --git a/libraries/aws_rds_event_subscription.rb b/libraries/aws_rds_event_subscription.rb index e5a8f354d..0b0beac3e 100644 --- a/libraries/aws_rds_event_subscription.rb +++ b/libraries/aws_rds_event_subscription.rb @@ -12,22 +12,28 @@ class AWSRDSEventSubscription < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(subscription_name)) - raise ArgumentError, "#{@__resource_name__}: subscription_name must be provided" unless opts[:subscription_name] && !opts[:subscription_name].empty? + validate_parameters(required: %i[subscription_name]) + unless opts[:subscription_name] && !opts[:subscription_name].empty? + raise ArgumentError, + "#{@__resource_name__}: subscription_name must be provided" + end @display_name = opts[:subscription_name] catch_aws_errors do - resp = @aws.rds_client.describe_event_subscriptions({ subscription_name: opts[:subscription_name] }) + resp = + @aws.rds_client.describe_event_subscriptions( + { subscription_name: opts[:subscription_name] } + ) @res = resp.event_subscriptions_list[0].to_h create_resource_methods(@res) end end def resource_id - "#{@res? @res[:customer_aws_id]: ""}_#{@res? @res[:cust_subscription_id]: ""}" + "#{@res ? @res[:customer_aws_id] : ""}_#{@res ? @res[:cust_subscription_id] : ""}" end def subscription_name - return unless exists? + return nil unless exists? @res[:subscription_name] end diff --git a/libraries/aws_rds_global_cluster.rb b/libraries/aws_rds_global_cluster.rb index dddbe35ba..aa64ca810 100644 --- a/libraries/aws_rds_global_cluster.rb +++ b/libraries/aws_rds_global_cluster.rb @@ -12,11 +12,18 @@ class AWSRDSGlobalCluster < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(global_cluster_identifier)) - raise ArgumentError, "#{@__resource_name__}: global_cluster_identifier must be provided" unless opts[:global_cluster_identifier] && !opts[:global_cluster_identifier].empty? + validate_parameters(required: %i[global_cluster_identifier]) + unless opts[:global_cluster_identifier] && + !opts[:global_cluster_identifier].empty? + raise ArgumentError, + "#{@__resource_name__}: global_cluster_identifier must be provided" + end @display_name = opts[:global_cluster_identifier] catch_aws_errors do - resp = @aws.rds_client.describe_global_clusters({ global_cluster_identifier: opts[:global_cluster_identifier] }) + resp = + @aws.rds_client.describe_global_clusters( + { global_cluster_identifier: opts[:global_cluster_identifier] } + ) @res = resp.global_clusters[0].to_h @global_cluster_resource_id = @res[:global_cluster_resource_id] create_resource_methods(@res) @@ -28,7 +35,7 @@ def resource_id end def global_cluster_identifier - return unless exists? + return nil unless exists? @res[:global_cluster_identifier] end diff --git a/libraries/aws_redshift_cluster_parameter_group.rb b/libraries/aws_redshift_cluster_parameter_group.rb index 160e4f875..24cfc5ff1 100644 --- a/libraries/aws_redshift_cluster_parameter_group.rb +++ b/libraries/aws_redshift_cluster_parameter_group.rb @@ -13,10 +13,16 @@ def initialize(opts = {}) opts = { parameter_group_name: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:parameter_group_name]) - raise ArgumentError, "#{@__resource_name__}: parameter_group_name must be provided" unless opts[:parameter_group_name] && !opts[:parameter_group_name].empty? + unless opts[:parameter_group_name] && !opts[:parameter_group_name].empty? + raise ArgumentError, + "#{@__resource_name__}: parameter_group_name must be provided" + end @display_name = opts[:parameter_group_name] catch_aws_errors do - resp = @aws.redshift_client.describe_cluster_parameter_groups({ parameter_group_name: opts[:parameter_group_name] }) + resp = + @aws.redshift_client.describe_cluster_parameter_groups( + { parameter_group_name: opts[:parameter_group_name] } + ) @parameter_groups = resp.parameter_groups[0].to_h @parameter_group_name = (@parameter_groups[:parameter_group_name]).to_s create_resource_methods(@parameter_groups) @@ -24,7 +30,7 @@ def initialize(opts = {}) end def parameter_group_name - return unless exists? + return nil unless exists? @parameter_groups[:parameter_group_name] end diff --git a/libraries/aws_route53_record_set.rb b/libraries/aws_route53_record_set.rb index cdb40a5b1..cc755e40d 100644 --- a/libraries/aws_route53_record_set.rb +++ b/libraries/aws_route53_record_set.rb @@ -12,25 +12,37 @@ class AWSRoute53RecordSet < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(hosted_zone_id start_record_name)) - raise ArgumentError, "#{@__resource_name__}: hosted_zone_id must be provided" unless opts[:hosted_zone_id] && !opts[:hosted_zone_id].empty? - raise ArgumentError, "#{@__resource_name__}: start_record_name must be provided" unless opts[:start_record_name] && !opts[:start_record_name].empty? + validate_parameters(required: %i[hosted_zone_id start_record_name]) + unless opts[:hosted_zone_id] && !opts[:hosted_zone_id].empty? + raise ArgumentError, + "#{@__resource_name__}: hosted_zone_id must be provided" + end + unless opts[:start_record_name] && !opts[:start_record_name].empty? + raise ArgumentError, + "#{@__resource_name__}: start_record_name must be provided" + end @hosted_zone_id = opts[:hosted_zone_id] @start_record_name = opts[:start_record_name] catch_aws_errors do - resp = @aws.route53_client.list_resource_record_sets({ hosted_zone_id: opts[:hosted_zone_id], start_record_name: opts[:name] }) + resp = + @aws.route53_client.list_resource_record_sets( + { + hosted_zone_id: opts[:hosted_zone_id], + start_record_name: opts[:name] + } + ) @res = resp.resource_record_sets[0].to_h create_resource_methods(@res) end end def hosted_zone_id - return unless exists? + return nil unless exists? @res[:alias_target][:hosted_zone_id] end def resource_id - "#{@res? @hosted_zone_id: ""}_#{@res? @start_record_name: ""}" + "#{@res ? @hosted_zone_id : ""}_#{@res ? @start_record_name : ""}" end def exists? diff --git a/libraries/aws_route53resolver_resolver_endpoint.rb b/libraries/aws_route53resolver_resolver_endpoint.rb index 1427331fd..7d1781275 100644 --- a/libraries/aws_route53resolver_resolver_endpoint.rb +++ b/libraries/aws_route53resolver_resolver_endpoint.rb @@ -13,23 +13,29 @@ class AWSRoute53ResolverResolverEndpoint < AwsResourceBase def initialize(opts = {}) opts = { resolver_endpoint_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(resolver_endpoint_id)) - raise ArgumentError, "#{@__resource_name__}: resolver_endpoint_id must be provided" unless opts[:resolver_endpoint_id] && !opts[:resolver_endpoint_id].empty? + validate_parameters(required: %i[resolver_endpoint_id]) + unless opts[:resolver_endpoint_id] && !opts[:resolver_endpoint_id].empty? + raise ArgumentError, + "#{@__resource_name__}: resolver_endpoint_id must be provided" + end @display_name = opts[:resolver_endpoint_id] catch_aws_errors do - resp = @aws.route53resolver_client.get_resolver_endpoint({ resolver_endpoint_id: opts[:resolver_endpoint_id] }) + resp = + @aws.route53resolver_client.get_resolver_endpoint( + { resolver_endpoint_id: opts[:resolver_endpoint_id] } + ) @res = resp.resolver_endpoint.to_h create_resource_methods(@res) end end def resolver_endpoint_id - return unless exists? + return nil unless exists? @res[:id] end def resource_id - @res? @res[:id]: @display_name + @res ? @res[:id] : @display_name end def exists? diff --git a/libraries/aws_route53resolver_resolver_rule.rb b/libraries/aws_route53resolver_resolver_rule.rb index ea6033950..644e9af39 100644 --- a/libraries/aws_route53resolver_resolver_rule.rb +++ b/libraries/aws_route53resolver_resolver_rule.rb @@ -13,23 +13,29 @@ class AWSRoute53ResolverResolverRule < AwsResourceBase def initialize(opts = {}) opts = { resolver_rule_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(resolver_rule_id)) - raise ArgumentError, "#{@__resource_name__}: resolver_rule_id must be provided" unless opts[:resolver_rule_id] && !opts[:resolver_rule_id].empty? + validate_parameters(required: %i[resolver_rule_id]) + unless opts[:resolver_rule_id] && !opts[:resolver_rule_id].empty? + raise ArgumentError, + "#{@__resource_name__}: resolver_rule_id must be provided" + end @display_name = opts[:resolver_rule_id] catch_aws_errors do - resp = @aws.route53resolver_client.get_resolver_rule({ resolver_rule_id: opts[:resolver_rule_id] }) + resp = + @aws.route53resolver_client.get_resolver_rule( + { resolver_rule_id: opts[:resolver_rule_id] } + ) @res = resp.resolver_rule.to_h create_resource_methods(@res) end end def resolver_rule_id - return unless exists? + return nil unless exists? @res[:id] end def resource_id - @res? @res[:id]: @display_name + @res ? @res[:id] : @display_name end def exists? diff --git a/libraries/aws_route53resolver_resolver_rule_association.rb b/libraries/aws_route53resolver_resolver_rule_association.rb index 4c7f2a5e7..f95e9409c 100644 --- a/libraries/aws_route53resolver_resolver_rule_association.rb +++ b/libraries/aws_route53resolver_resolver_rule_association.rb @@ -13,11 +13,18 @@ class AWSRoute53ResolverResolverRuleAssociation < AwsResourceBase def initialize(opts = {}) opts = { resolver_rule_association_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(resolver_rule_association_id)) - raise ArgumentError, "#{@__resource_name__}: resource_share_arn must be provided" unless opts[:resolver_rule_association_id] && !opts[:resolver_rule_association_id].empty? + validate_parameters(required: %i[resolver_rule_association_id]) + unless opts[:resolver_rule_association_id] && + !opts[:resolver_rule_association_id].empty? + raise ArgumentError, + "#{@__resource_name__}: resource_share_arn must be provided" + end @display_name = opts[:resolver_rule_association_id] catch_aws_errors do - resp = @aws.route53resolver_client.get_resolver_rule_association({ resolver_rule_association_id: opts[:resolver_rule_association_id] }) + resp = + @aws.route53resolver_client.get_resolver_rule_association( + { resolver_rule_association_id: opts[:resolver_rule_association_id] } + ) @res = resp.resolver_rule_association.to_h create_resource_methods(@res) end @@ -29,7 +36,7 @@ def resolver_rule_association_id end def resource_id - @res? @res[:id]: @display_name + @res ? @res[:id] : @display_name end def exists? diff --git a/libraries/aws_s3_access_point.rb b/libraries/aws_s3_access_point.rb index ac724f96a..257dc35c5 100644 --- a/libraries/aws_s3_access_point.rb +++ b/libraries/aws_s3_access_point.rb @@ -14,19 +14,26 @@ def initialize(opts = {}) opts = { bucket_name: opts } if opts.is_a?(String) opts = { metrics_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(bucket_name metrics_id)) - raise ArgumentError, "#{@__resource_name__}: bucket_name must be provided" unless opts[:bucket_name] && !opts[:bucket_name].empty? - raise ArgumentError, "#{@__resource_name__}: metrics_id must be provided" unless opts[:metrics_id] && !opts[:metrics_id].empty? + validate_parameters(required: %i[bucket_name metrics_id]) + unless opts[:bucket_name] && !opts[:bucket_name].empty? + raise ArgumentError, "#{@__resource_name__}: bucket_name must be provided" + end + unless opts[:metrics_id] && !opts[:metrics_id].empty? + raise ArgumentError, "#{@__resource_name__}: metrics_id must be provided" + end @display_name = opts[:metrics_id] catch_aws_errors do - resp = @aws.storage_client.get_bucket_metrics_configuration({ bucket: opts[:bucket_name], id: opts[:metrics_id] }) + resp = + @aws.storage_client.get_bucket_metrics_configuration( + { bucket: opts[:bucket_name], id: opts[:metrics_id] } + ) @resp = resp.metrics_configuration.to_h create_resource_methods(@resp) end end def metrics_id - return unless exists? + return nil unless exists? @resp[:id] end diff --git a/libraries/aws_secretsmanager_secret.rb b/libraries/aws_secretsmanager_secret.rb index 058d58a33..7556b54a5 100644 --- a/libraries/aws_secretsmanager_secret.rb +++ b/libraries/aws_secretsmanager_secret.rb @@ -13,11 +13,16 @@ class AWSSecretsManagerSecret < AwsResourceBase def initialize(opts = {}) opts = { secret_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(secret_id)) - raise ArgumentError, "#{@__resource_name__}: secret_id must be provided" unless opts[:secret_id] && !opts[:secret_id].empty? + validate_parameters(required: %i[secret_id]) + unless opts[:secret_id] && !opts[:secret_id].empty? + raise ArgumentError, "#{@__resource_name__}: secret_id must be provided" + end @display_name = opts[:secret_id] catch_aws_errors do - resp = @aws.secretsmanager_client.describe_secret({ secret_id: opts[:secret_id] }) + resp = + @aws.secretsmanager_client.describe_secret( + { secret_id: opts[:secret_id] } + ) @res = resp.to_h create_resource_methods(@res) end @@ -28,7 +33,7 @@ def resource_id end def secret_id - return unless exists? + return nil unless exists? @res[:secret_id] end diff --git a/libraries/aws_securityhub_hub.rb b/libraries/aws_securityhub_hub.rb index eae438fe5..d67da7045 100644 --- a/libraries/aws_securityhub_hub.rb +++ b/libraries/aws_securityhub_hub.rb @@ -14,7 +14,9 @@ def initialize(opts = {}) opts = { hub_arn: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:hub_arn]) - raise ArgumentError, "#{@__resource_hub_arn__}: hub_arn must be provided" unless opts[:hub_arn] && !opts[:hub_arn].empty? + unless opts[:hub_arn] && !opts[:hub_arn].empty? + raise ArgumentError, "#{@__resource_hub_arn__}: hub_arn must be provided" + end @display_name = opts[:hub_arn] catch_aws_errors do resp = @aws.securityhub_client.describe_hub({ hub_arn: opts[:hub_arn] }) @@ -29,7 +31,7 @@ def resource_id end def hub_arn - return unless exists? + return nil unless exists? @hub_arn end diff --git a/libraries/aws_servicecatalog_cloud_formation_product.rb b/libraries/aws_servicecatalog_cloud_formation_product.rb index f45d659cd..955b008c9 100644 --- a/libraries/aws_servicecatalog_cloud_formation_product.rb +++ b/libraries/aws_servicecatalog_cloud_formation_product.rb @@ -14,12 +14,18 @@ def initialize(opts = {}) opts = { name: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:name]) - raise ArgumentError, "#{@__resource_name__}: name must be provided" unless opts[:name] && !opts[:name].empty? + unless opts[:name] && !opts[:name].empty? + raise ArgumentError, "#{@__resource_name__}: name must be provided" + end @display_name = opts[:name] catch_aws_errors do - resp = @aws.servicecatalog_client.describe_product_as_admin({ name: opts[:name] }) + resp = + @aws.servicecatalog_client.describe_product_as_admin( + { name: opts[:name] } + ) @res = resp.to_h - @product_view_detail_product_view_summary_id = @res[:product_view_detail][:product_view_summary][:id] + @product_view_detail_product_view_summary_id = + @res[:product_view_detail][:product_view_summary][:id] create_resource_methods(@res) end end @@ -29,7 +35,7 @@ def resource_id end def name - return unless exists? + return nil unless exists? @res[:name] end diff --git a/libraries/aws_servicecatalog_portfolio_principal_association.rb b/libraries/aws_servicecatalog_portfolio_principal_association.rb index fbeb1142c..4c42e2b1a 100644 --- a/libraries/aws_servicecatalog_portfolio_principal_association.rb +++ b/libraries/aws_servicecatalog_portfolio_principal_association.rb @@ -14,10 +14,16 @@ def initialize(opts = {}) opts = { portfolio_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:portfolio_id]) - raise ArgumentError, "#{@__resource_name__}: portfolio_id must be provided" unless opts[:portfolio_id] && !opts[:portfolio_id].empty? + unless opts[:portfolio_id] && !opts[:portfolio_id].empty? + raise ArgumentError, + "#{@__resource_name__}: portfolio_id must be provided" + end @display_name = opts[:portfolio_id] catch_aws_errors do - resp = @aws.servicecatalog_client.list_principals_for_portfolio({ portfolio_id: opts[:portfolio_id] }) + resp = + @aws.servicecatalog_client.list_principals_for_portfolio( + { portfolio_id: opts[:portfolio_id] } + ) @res = resp.principals[0].to_h @principal_arn = @res[:principal_arn] create_resource_methods(@res) @@ -29,7 +35,7 @@ def resource_id end def portfolio_id - return unless exists? + return nil unless exists? @res[:portfolio_id] end diff --git a/libraries/aws_servicecatalog_portfolio_product_association.rb b/libraries/aws_servicecatalog_portfolio_product_association.rb index 83bb90197..edc58cbde 100644 --- a/libraries/aws_servicecatalog_portfolio_product_association.rb +++ b/libraries/aws_servicecatalog_portfolio_product_association.rb @@ -14,10 +14,15 @@ def initialize(opts = {}) opts = { product_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:product_id]) - raise ArgumentError, "#{@__resource_name__}: product_id must be provided" unless opts[:product_id] && !opts[:product_id].empty? + unless opts[:product_id] && !opts[:product_id].empty? + raise ArgumentError, "#{@__resource_name__}: product_id must be provided" + end @display_name = opts[:product_id] catch_aws_errors do - resp = @aws.servicecatalog_client.list_portfolios_for_product({ product_id: opts[:product_id] }) + resp = + @aws.servicecatalog_client.list_portfolios_for_product( + { product_id: opts[:product_id] } + ) @res = resp.portfolio_details[0].to_h @arn = @res[:arn] create_resource_methods(@res) diff --git a/libraries/aws_ses_receipt_rule.rb b/libraries/aws_ses_receipt_rule.rb index b6d5c5e8b..28a734919 100644 --- a/libraries/aws_ses_receipt_rule.rb +++ b/libraries/aws_ses_receipt_rule.rb @@ -12,19 +12,27 @@ class AWSSESReceiptRule < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(rule_set_name rule_name)) - raise ArgumentError, "#{@__resource_name__}: rule_set_name must be provided" unless opts[:rule_set_name] && !opts[:rule_set_name].empty? - raise ArgumentError, "#{@__resource_name__}: rule_name must be provided" unless opts[:rule_name] && !opts[:rule_name].empty? + validate_parameters(required: %i[rule_set_name rule_name]) + unless opts[:rule_set_name] && !opts[:rule_set_name].empty? + raise ArgumentError, + "#{@__resource_name__}: rule_set_name must be provided" + end + unless opts[:rule_name] && !opts[:rule_name].empty? + raise ArgumentError, "#{@__resource_name__}: rule_name must be provided" + end @display_name = opts[:rule_name] catch_aws_errors do - resp = @aws.ses_client.describe_receipt_rule({ rule_set_name: opts[:rule_set_name], rule_name: opts[:rule_name] }) + resp = + @aws.ses_client.describe_receipt_rule( + { rule_set_name: opts[:rule_set_name], rule_name: opts[:rule_name] } + ) @res = resp.rule.to_h create_resource_methods(@res) end end def rule_name - return unless exists? + return nil unless exists? @res[:rule_name] end diff --git a/libraries/aws_ses_receipt_rule_set.rb b/libraries/aws_ses_receipt_rule_set.rb index 791d405de..967967069 100644 --- a/libraries/aws_ses_receipt_rule_set.rb +++ b/libraries/aws_ses_receipt_rule_set.rb @@ -12,18 +12,24 @@ class AWSSESReceiptRuleSet < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(rule_set_name)) - raise ArgumentError, "#{@__resource_name__}: rule_set_name must be provided" unless opts[:rule_set_name] && !opts[:rule_set_name].empty? + validate_parameters(required: %i[rule_set_name]) + unless opts[:rule_set_name] && !opts[:rule_set_name].empty? + raise ArgumentError, + "#{@__resource_name__}: rule_set_name must be provided" + end @display_name = opts[:rule_set_name] catch_aws_errors do - resp = @aws.ses_client.describe_receipt_rule_set({ rule_set_name: opts[:rule_set_name] }) + resp = + @aws.ses_client.describe_receipt_rule_set( + { rule_set_name: opts[:rule_set_name] } + ) @res = resp.rules[0].to_h create_resource_methods(@res) end end def rule_set_name - return unless exists? + return nil unless exists? @res[:rule_set_name] end diff --git a/libraries/aws_ses_template.rb b/libraries/aws_ses_template.rb index 2ebfb9d82..973199c8b 100644 --- a/libraries/aws_ses_template.rb +++ b/libraries/aws_ses_template.rb @@ -12,18 +12,22 @@ class AWSSESTemplate < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(template_name)) - raise ArgumentError, "#{@__resource_name__}: template_name must be provided" unless opts[:template_name] && !opts[:template_name].empty? + validate_parameters(required: %i[template_name]) + unless opts[:template_name] && !opts[:template_name].empty? + raise ArgumentError, + "#{@__resource_name__}: template_name must be provided" + end @display_name = opts[:template_name] catch_aws_errors do - resp = @aws.ses_client.get_template({ template_name: opts[:template_name] }) + resp = + @aws.ses_client.get_template({ template_name: opts[:template_name] }) @res = resp.template.to_h create_resource_methods(@res) end end def template_name - return unless exists? + return nil unless exists? @res[:template_name] end diff --git a/libraries/aws_signer_signing_profile.rb b/libraries/aws_signer_signing_profile.rb index 485e2436a..d166bbce7 100644 --- a/libraries/aws_signer_signing_profile.rb +++ b/libraries/aws_signer_signing_profile.rb @@ -13,18 +13,24 @@ class AWSSignerSigningProfile < AwsResourceBase def initialize(opts = {}) opts = { profile_name: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(profile_name)) - raise ArgumentError, "#{@__resource_name__}: profile_name must be provided" unless opts[:profile_name] && !opts[:profile_name].empty? + validate_parameters(required: %i[profile_name]) + unless opts[:profile_name] && !opts[:profile_name].empty? + raise ArgumentError, + "#{@__resource_name__}: profile_name must be provided" + end @display_name = opts[:profile_name] catch_aws_errors do - resp = @aws.signer_client.get_signing_profile({ profile_name: opts[:profile_name] }) + resp = + @aws.signer_client.get_signing_profile( + { profile_name: opts[:profile_name] } + ) @res = resp.to_h create_resource_methods(@res) end end def profile_name - return unless exists? + return nil unless exists? @res[:profile_name] end diff --git a/libraries/aws_ssm_maintenance_window.rb b/libraries/aws_ssm_maintenance_window.rb index f0ffc6f44..636a96e17 100644 --- a/libraries/aws_ssm_maintenance_window.rb +++ b/libraries/aws_ssm_maintenance_window.rb @@ -12,22 +12,25 @@ class AWSSESMaintenanceWindow < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(window_id)) - raise ArgumentError, "#{@__resource_name__}: window_id must be provided" unless opts[:window_id] && !opts[:window_id].empty? + validate_parameters(required: %i[window_id]) + unless opts[:window_id] && !opts[:window_id].empty? + raise ArgumentError, "#{@__resource_name__}: window_id must be provided" + end @display_name = opts[:window_id] catch_aws_errors do - resp = @aws.ssm_client.get_maintenance_window({ window_id: opts[:window_id] }) + resp = + @aws.ssm_client.get_maintenance_window({ window_id: opts[:window_id] }) @res = resp.to_h create_resource_methods(@res) end end def resource_id - @res? @res[:window_id]: @display_name + @res ? @res[:window_id] : @display_name end def window_id - return unless exists? + return nil unless exists? @res[:window_id] end diff --git a/libraries/aws_ssm_maintenance_window_target.rb b/libraries/aws_ssm_maintenance_window_target.rb index bdfc9092c..c090c9140 100644 --- a/libraries/aws_ssm_maintenance_window_target.rb +++ b/libraries/aws_ssm_maintenance_window_target.rb @@ -12,18 +12,21 @@ class AWSSESMaintenanceWindowTarget < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(window_id window_target_id)) - raise ArgumentError, "#{@__resource_name__}: window_id must be provided" unless opts[:window_id] && !opts[:window_id].empty? - raise ArgumentError, "#{@__resource_name__}: window_target_id must be provided" unless opts[:window_target_id] && !opts[:window_target_id].empty? - filter = [ - { - key: "WindowTargetId", - values: [opts[:window_target_id]], - }, - ] + validate_parameters(required: %i[window_id window_target_id]) + unless opts[:window_id] && !opts[:window_id].empty? + raise ArgumentError, "#{@__resource_name__}: window_id must be provided" + end + unless opts[:window_target_id] && !opts[:window_target_id].empty? + raise ArgumentError, + "#{@__resource_name__}: window_target_id must be provided" + end + filter = [{ key: "WindowTargetId", values: [opts[:window_target_id]] }] @display_name = opts[:window_target_id] catch_aws_errors do - resp = @aws.ssm_client.describe_maintenance_window_targets({ window_id: opts[:window_id], filters: filter }) + resp = + @aws.ssm_client.describe_maintenance_window_targets( + { window_id: opts[:window_id], filters: filter } + ) @res = resp.targets[0].to_h @window_id = @res[:window_id] @window_target_id = @res[:window_target_id] @@ -36,7 +39,7 @@ def resource_id end def window_target_id - return unless exists? + return nil unless exists? @res[:window_target_id] end diff --git a/libraries/aws_ssm_maintenance_window_task.rb b/libraries/aws_ssm_maintenance_window_task.rb index 7cde5ac01..111538956 100644 --- a/libraries/aws_ssm_maintenance_window_task.rb +++ b/libraries/aws_ssm_maintenance_window_task.rb @@ -12,18 +12,21 @@ class AWSSESMaintenanceWindowTask < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(window_id window_task_id)) - raise ArgumentError, "#{@__resource_name__}: window_id must be provided" unless opts[:window_id] && !opts[:window_id].empty? - raise ArgumentError, "#{@__resource_name__}: window_task_id must be provided" unless opts[:window_task_id] && !opts[:window_task_id].empty? - filter = [ - { - key: "WindowTaskId", - values: [opts[:window_task_id]], - }, - ] + validate_parameters(required: %i[window_id window_task_id]) + unless opts[:window_id] && !opts[:window_id].empty? + raise ArgumentError, "#{@__resource_name__}: window_id must be provided" + end + unless opts[:window_task_id] && !opts[:window_task_id].empty? + raise ArgumentError, + "#{@__resource_name__}: window_task_id must be provided" + end + filter = [{ key: "WindowTaskId", values: [opts[:window_task_id]] }] @display_name = opts[:window_task_id] catch_aws_errors do - resp = @aws.ssm_client.describe_maintenance_window_tasks({ window_id: opts[:window_id], filters: filter }) + resp = + @aws.ssm_client.describe_maintenance_window_tasks( + { window_id: opts[:window_id], filters: filter } + ) @res = resp.tasks[0].to_h @window_id = @res[:window_id] @window_task_id = @res[:window_task_id] @@ -36,7 +39,7 @@ def resource_id end def window_task_id - return unless exists? + return nil unless exists? @res[:window_task_id] end diff --git a/libraries/aws_ssm_patch_baseline.rb b/libraries/aws_ssm_patch_baseline.rb index d6b931600..67d7e7ac0 100644 --- a/libraries/aws_ssm_patch_baseline.rb +++ b/libraries/aws_ssm_patch_baseline.rb @@ -20,11 +20,14 @@ class AWSSESPatchBaseline < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(baseline_id)) - raise ArgumentError, "#{@__resource_name__}: baseline_id must be provided" unless opts[:baseline_id] && !opts[:baseline_id].empty? + validate_parameters(required: %i[baseline_id]) + unless opts[:baseline_id] && !opts[:baseline_id].empty? + raise ArgumentError, "#{@__resource_name__}: baseline_id must be provided" + end @display_name = opts[:baseline_id] catch_aws_errors do - resp = @aws.ssm_client.get_patch_baseline({ baseline_id: opts[:baseline_id] }) + resp = + @aws.ssm_client.get_patch_baseline({ baseline_id: opts[:baseline_id] }) @res = resp.to_h @baseline_id = @res[:baseline_id] @name = @res[:name] @@ -37,7 +40,7 @@ def resource_id end def baseline_id - return unless exists? + return nil unless exists? @res[:baseline_id] end @@ -54,15 +57,26 @@ def patch_filter_values end def patch_filter_groups - approval_rules.map(&:patch_rules).map(&:patch_filter_group).map(&:patch_filters) + approval_rules + .map(&:patch_rules) + .map(&:patch_filter_group) + .map(&:patch_filters) end def patch_filter_group_keys - approval_rules.map(&:patch_rules).map(&:patch_filter_group).map(&:patch_filters).map(&:key) + approval_rules + .map(&:patch_rules) + .map(&:patch_filter_group) + .map(&:patch_filters) + .map(&:key) end def patch_filter_group_values - approval_rules.map(&:patch_rules).map(&:patch_filter_group).map(&:patch_filters).map(&:values) + approval_rules + .map(&:patch_rules) + .map(&:patch_filter_group) + .map(&:patch_filters) + .map(&:values) end def compliance_levels diff --git a/libraries/aws_stepfunctions_activity.rb b/libraries/aws_stepfunctions_activity.rb index bb7a17352..8e62de1b8 100644 --- a/libraries/aws_stepfunctions_activity.rb +++ b/libraries/aws_stepfunctions_activity.rb @@ -12,18 +12,24 @@ class AWSStepFunctionsActivity < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(activity_arn)) - raise ArgumentError, "#{@__resource_name__}: activity_arn must be provided" unless opts[:activity_arn] && !opts[:activity_arn].empty? + validate_parameters(required: %i[activity_arn]) + unless opts[:activity_arn] && !opts[:activity_arn].empty? + raise ArgumentError, + "#{@__resource_name__}: activity_arn must be provided" + end @display_name = opts[:activity_arn] catch_aws_errors do - resp = @aws.states_client.describe_activity({ activity_arn: opts[:activity_arn] }) + resp = + @aws.states_client.describe_activity( + { activity_arn: opts[:activity_arn] } + ) @res = resp.to_h create_resource_methods(@res) end end def activity_arn - return unless exists? + return nil unless exists? @res[:activity_arn] end diff --git a/libraries/aws_stepfunctions_state_machine.rb b/libraries/aws_stepfunctions_state_machine.rb index b7451fd77..438ac1c7e 100644 --- a/libraries/aws_stepfunctions_state_machine.rb +++ b/libraries/aws_stepfunctions_state_machine.rb @@ -13,18 +13,24 @@ class AWSStepFunctionsStateMachine < AwsResourceBase def initialize(opts = {}) opts = { state_machine_arn: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(state_machine_arn)) - raise ArgumentError, "#{@__resource_name__}: state_machine_arn must be provided" unless opts[:state_machine_arn] && !opts[:state_machine_arn].empty? + validate_parameters(required: %i[state_machine_arn]) + unless opts[:state_machine_arn] && !opts[:state_machine_arn].empty? + raise ArgumentError, + "#{@__resource_name__}: state_machine_arn must be provided" + end @display_name = opts[:state_machine_arn] catch_aws_errors do - resp = @aws.states_client.describe_state_machine({ state_machine_arn: opts[:state_machine_arn] }) + resp = + @aws.states_client.describe_state_machine( + { state_machine_arn: opts[:state_machine_arn] } + ) @res = resp.to_h create_resource_methods(@res) end end def state_machine_arn - return unless exists? + return nil unless exists? @res[:state_machine_arn] end diff --git a/libraries/aws_synthetics_canary.rb b/libraries/aws_synthetics_canary.rb index 0b8e442bd..b104f983f 100644 --- a/libraries/aws_synthetics_canary.rb +++ b/libraries/aws_synthetics_canary.rb @@ -12,8 +12,10 @@ class AWSSyntheticsCanary < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(name)) - raise ArgumentError, "#{@__resource_name__}: name must be provided" unless opts[:name] && !opts[:name].empty? + validate_parameters(required: %i[name]) + unless opts[:name] && !opts[:name].empty? + raise ArgumentError, "#{@__resource_name__}: name must be provided" + end @display_name = opts[:name] catch_aws_errors do resp = @aws.synthetics_client.get_canary({ name: opts[:name] }) diff --git a/libraries/aws_transfer_user.rb b/libraries/aws_transfer_user.rb index 01678d7d0..bf1a0d474 100644 --- a/libraries/aws_transfer_user.rb +++ b/libraries/aws_transfer_user.rb @@ -11,12 +11,19 @@ class AWSTransferUser < AwsResourceBase def initialize(opts = {}) super(opts) - validate_parameters(required: %i(server_id user_name)) - raise ArgumentError, "#{@__resource_name__}: server_id must be provided" unless opts[:server_id] && !opts[:server_id].empty? - raise ArgumentError, "#{@__resource_name__}: user_name must be provided" unless opts[:user_name] && !opts[:user_name].empty? + validate_parameters(required: %i[server_id user_name]) + unless opts[:server_id] && !opts[:server_id].empty? + raise ArgumentError, "#{@__resource_name__}: server_id must be provided" + end + unless opts[:user_name] && !opts[:user_name].empty? + raise ArgumentError, "#{@__resource_name__}: user_name must be provided" + end @user_name = opts[:user_name] catch_aws_errors do - resp = @aws.transfer_client.describe_user({ server_id: opts[:server_id], user_name: opts[:user_name] }) + resp = + @aws.transfer_client.describe_user( + { server_id: opts[:server_id], user_name: opts[:user_name] } + ) @res = resp.user.to_h @res[:server_id] = resp.server_id create_resource_methods(@res) @@ -24,7 +31,7 @@ def initialize(opts = {}) end def user_name - return unless exists? + return nil unless exists? @res[:user_name] end diff --git a/libraries/aws_transit_gateway_connect.rb b/libraries/aws_transit_gateway_connect.rb index 3e5db2ec8..c11673765 100644 --- a/libraries/aws_transit_gateway_connect.rb +++ b/libraries/aws_transit_gateway_connect.rb @@ -14,17 +14,28 @@ def initialize(opts = {}) opts = { transit_gateway_attachment_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:transit_gateway_attachment_id]) - raise ArgumentError, "#{@__resource_name__}: transit_gateway_attachment_id must be provided" unless opts[:transit_gateway_attachment_id] && !opts[:transit_gateway_attachment_id].empty? + unless opts[:transit_gateway_attachment_id] && + !opts[:transit_gateway_attachment_id].empty? + raise ArgumentError, + "#{@__resource_name__}: transit_gateway_attachment_id must be provided" + end @display_name = opts[:transit_gateway_attachment_id] catch_aws_errors do - resp = @aws.compute_client.describe_transit_gateway_connects({ transit_gateway_attachment_ids: [opts[:transit_gateway_attachment_id]] }) + resp = + @aws.compute_client.describe_transit_gateway_connects( + { + transit_gateway_attachment_ids: [ + opts[:transit_gateway_attachment_id] + ] + } + ) @transit_gateway_connects = resp.transit_gateway_connects[0].to_h create_resource_methods(@transit_gateway_connects) end end def transit_gateway_attachment_id - return unless exists? + return nil unless exists? @transit_gateway_connects[:transit_gateway_attachment_id] end @@ -33,7 +44,11 @@ def exists? end def resource_id - @transit_gateway_connects ? @transit_gateway_connects[:transit_gateway_attachment_id] : @display_name + if @transit_gateway_connects + @transit_gateway_connects[:transit_gateway_attachment_id] + else + @display_name + end end def to_s diff --git a/libraries/aws_transit_gateway_multicast_domain.rb b/libraries/aws_transit_gateway_multicast_domain.rb index 1ef0bc3e1..9db5b1fb7 100644 --- a/libraries/aws_transit_gateway_multicast_domain.rb +++ b/libraries/aws_transit_gateway_multicast_domain.rb @@ -18,26 +18,43 @@ def initialize(opts = {}) opts = { transit_gateway_multicast_domain_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:transit_gateway_multicast_domain_id]) - raise ArgumentError, "#{@__resource_name__}: transit_gateway_multicast_domain_id must be provided" unless opts[:transit_gateway_multicast_domain_id] && !opts[:transit_gateway_multicast_domain_id].empty? + unless opts[:transit_gateway_multicast_domain_id] && + !opts[:transit_gateway_multicast_domain_id].empty? + raise ArgumentError, + "#{@__resource_name__}: transit_gateway_multicast_domain_id must be provided" + end @display_name = opts[:transit_gateway_multicast_domain_id] catch_aws_errors do - resp = @aws.compute_client.describe_transit_gateway_multicast_domains({ transit_gateway_multicast_domain_ids: [opts[:transit_gateway_multicast_domain_id]] }) - @transit_gateway_multicast_domains = resp.transit_gateway_multicast_domains[0].to_h + resp = + @aws.compute_client.describe_transit_gateway_multicast_domains( + { + transit_gateway_multicast_domain_ids: [ + opts[:transit_gateway_multicast_domain_id] + ] + } + ) + @transit_gateway_multicast_domains = + resp.transit_gateway_multicast_domains[0].to_h create_resource_methods(@transit_gateway_multicast_domains) end end def transit_gateway_multicast_domain_id - return unless exists? + return nil unless exists? @transit_gateway_multicast_domains[:transit_gateway_multicast_domain_id] end def exists? - !@transit_gateway_multicast_domains.nil? && !@transit_gateway_multicast_domains.empty? + !@transit_gateway_multicast_domains.nil? && + !@transit_gateway_multicast_domains.empty? end def resource_id - @transit_gateway_multicast_domains ? @transit_gateway_multicast_domains[:transit_gateway_multicast_domain_id] : @display_name + if @transit_gateway_multicast_domains + @transit_gateway_multicast_domains[:transit_gateway_multicast_domain_id] + else + @display_name + end end def to_s diff --git a/libraries/aws_transit_gateway_multicast_domain_association.rb b/libraries/aws_transit_gateway_multicast_domain_association.rb index 189c787b9..be56271f9 100644 --- a/libraries/aws_transit_gateway_multicast_domain_association.rb +++ b/libraries/aws_transit_gateway_multicast_domain_association.rb @@ -17,26 +17,42 @@ class AWSTransitGatewayMulticastDomainAssociation < AwsResourceBase def initialize(opts = {}) super(opts) validate_parameters(required: [:transit_gateway_multicast_domain_id]) - raise ArgumentError, "#{@__resource_name__}: transit_gateway_multicast_domain_id must be provided" unless opts[:transit_gateway_multicast_domain_id] && !opts[:transit_gateway_multicast_domain_id].empty? + unless opts[:transit_gateway_multicast_domain_id] && + !opts[:transit_gateway_multicast_domain_id].empty? + raise ArgumentError, + "#{@__resource_name__}: transit_gateway_multicast_domain_id must be provided" + end @display_name = opts[:transit_gateway_multicast_domain_id] catch_aws_errors do - resp = @aws.compute_client.get_transit_gateway_multicast_domain_associations({ transit_gateway_multicast_domain_id: opts[:transit_gateway_multicast_domain_id] }) - @multicast_domain_associations = resp.multicast_domain_associations[0].to_h + resp = + @aws.compute_client.get_transit_gateway_multicast_domain_associations( + { + transit_gateway_multicast_domain_id: + opts[:transit_gateway_multicast_domain_id] + } + ) + @multicast_domain_associations = + resp.multicast_domain_associations[0].to_h create_resource_methods(@multicast_domain_associations) end end def transit_gateway_multicast_domain_id - return unless exists? + return nil unless exists? @multicast_domain_associations[:transit_gateway_multicast_domain_id] end def exists? - !@multicast_domain_associations.nil? && !@multicast_domain_associations.empty? + !@multicast_domain_associations.nil? && + !@multicast_domain_associations.empty? end def resource_id - @multicast_domain_associations ? @multicast_domain_associations[:transit_gateway_multicast_domain_id] : @display_name + if @multicast_domain_associations + @multicast_domain_associations[:transit_gateway_multicast_domain_id] + else + @display_name + end end def to_s diff --git a/libraries/aws_transit_gateway_multicast_group_member.rb b/libraries/aws_transit_gateway_multicast_group_member.rb index c9f688e2c..7e956c892 100644 --- a/libraries/aws_transit_gateway_multicast_group_member.rb +++ b/libraries/aws_transit_gateway_multicast_group_member.rb @@ -18,17 +18,27 @@ def initialize(opts = {}) opts = { transit_gateway_multicast_domain_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:transit_gateway_multicast_domain_id]) - raise ArgumentError, "#{@__resource_name__}: transit_gateway_multicast_domain_id must be provided" unless opts[:transit_gateway_multicast_domain_id] && !opts[:transit_gateway_multicast_domain_id].empty? + unless opts[:transit_gateway_multicast_domain_id] && + !opts[:transit_gateway_multicast_domain_id].empty? + raise ArgumentError, + "#{@__resource_name__}: transit_gateway_multicast_domain_id must be provided" + end @display_name = opts[:transit_gateway_multicast_domain_id] catch_aws_errors do - resp = @aws.compute_client.search_transit_gateway_multicast_groups({ transit_gateway_multicast_domain_id: opts[:transit_gateway_multicast_domain_id] }) + resp = + @aws.compute_client.search_transit_gateway_multicast_groups( + { + transit_gateway_multicast_domain_id: + opts[:transit_gateway_multicast_domain_id] + } + ) @multicast_groups = resp.multicast_groups[0].to_h create_resource_methods(@multicast_groups) end end def transit_gateway_multicast_domain_id - return unless exists? + return nil unless exists? @multicast_groups[:transit_gateway_multicast_domain_id] end @@ -37,7 +47,11 @@ def exists? end def resource_id - @multicast_groups ? @multicast_groups[:transit_gateway_multicast_domain_id] : @display_name + if @multicast_groups + @multicast_groups[:transit_gateway_multicast_domain_id] + else + @display_name + end end def to_s diff --git a/libraries/aws_transit_gateway_multicast_group_source.rb b/libraries/aws_transit_gateway_multicast_group_source.rb index 4a72f68e9..60b7fc49d 100644 --- a/libraries/aws_transit_gateway_multicast_group_source.rb +++ b/libraries/aws_transit_gateway_multicast_group_source.rb @@ -18,17 +18,27 @@ def initialize(opts = {}) opts = { transit_gateway_multicast_domain_id: opts } if opts.is_a?(String) super(opts) validate_parameters(required: [:transit_gateway_multicast_domain_id]) - raise ArgumentError, "#{@__resource_name__}: transit_gateway_multicast_domain_id must be provided" unless opts[:transit_gateway_multicast_domain_id] && !opts[:transit_gateway_multicast_domain_id].empty? + unless opts[:transit_gateway_multicast_domain_id] && + !opts[:transit_gateway_multicast_domain_id].empty? + raise ArgumentError, + "#{@__resource_name__}: transit_gateway_multicast_domain_id must be provided" + end @display_name = opts[:transit_gateway_multicast_domain_id] catch_aws_errors do - resp = @aws.compute_client.search_transit_gateway_multicast_groups({ transit_gateway_multicast_domain_id: opts[:transit_gateway_multicast_domain_id] }) + resp = + @aws.compute_client.search_transit_gateway_multicast_groups( + { + transit_gateway_multicast_domain_id: + opts[:transit_gateway_multicast_domain_id] + } + ) @multicast_groups = resp.multicast_groups[0].to_h create_resource_methods(@multicast_groups) end end def transit_gateway_multicast_domain_id - return unless exists? + return nil unless exists? @multicast_groups[:transit_gateway_multicast_domain_id] end @@ -37,7 +47,11 @@ def exists? end def resource_id - @multicast_groups ? @multicast_groups[:transit_gateway_multicast_domain_id] : @display_name + if @multicast_groups + @multicast_groups[:transit_gateway_multicast_domain_id] + else + @display_name + end end def to_s diff --git a/libraries/aws_waf_byte_match_set.rb b/libraries/aws_waf_byte_match_set.rb index 02e6aa51d..5ca8299d0 100644 --- a/libraries/aws_waf_byte_match_set.rb +++ b/libraries/aws_waf_byte_match_set.rb @@ -13,18 +13,24 @@ class AWSWAFByteMatchSet < AwsResourceBase def initialize(opts = {}) opts = { byte_match_set_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(byte_match_set_id)) - raise ArgumentError, "#{@__resource_name__}: byte_match_set_id must be provided" unless opts[:byte_match_set_id] && !opts[:byte_match_set_id].empty? + validate_parameters(required: %i[byte_match_set_id]) + unless opts[:byte_match_set_id] && !opts[:byte_match_set_id].empty? + raise ArgumentError, + "#{@__resource_name__}: byte_match_set_id must be provided" + end @display_name = opts[:byte_match_set_id] catch_aws_errors do - resp = @aws.waf_client.get_byte_match_set({ byte_match_set_id: opts[:byte_match_set_id] }) + resp = + @aws.waf_client.get_byte_match_set( + { byte_match_set_id: opts[:byte_match_set_id] } + ) @resp = resp.byte_match_set.to_h create_resource_methods(@resp) end end def byte_match_set_id - return unless exists? + return nil unless exists? @resp[:byte_match_set_id] end diff --git a/libraries/aws_waf_ip_set.rb b/libraries/aws_waf_ip_set.rb index 9235dcd81..5de550afd 100644 --- a/libraries/aws_waf_ip_set.rb +++ b/libraries/aws_waf_ip_set.rb @@ -13,8 +13,10 @@ class AWSWAFIPSet < AwsResourceBase def initialize(opts = {}) opts = { ip_set_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(ip_set_id)) - raise ArgumentError, "#{@__resource_name__}: ip_set_id must be provided" unless opts[:ip_set_id] && !opts[:ip_set_id].empty? + validate_parameters(required: %i[ip_set_id]) + unless opts[:ip_set_id] && !opts[:ip_set_id].empty? + raise ArgumentError, "#{@__resource_name__}: ip_set_id must be provided" + end @display_name = opts[:ip_set_id] catch_aws_errors do resp = @aws.waf_client.get_ip_set({ ip_set_id: opts[:ip_set_id] }) @@ -24,7 +26,7 @@ def initialize(opts = {}) end def ip_set_id - return unless exists? + return nil unless exists? @resp[:ip_set_id] end diff --git a/libraries/aws_waf_rule.rb b/libraries/aws_waf_rule.rb index cef07fa77..954914961 100644 --- a/libraries/aws_waf_rule.rb +++ b/libraries/aws_waf_rule.rb @@ -13,8 +13,10 @@ class AWSWAFRule < AwsResourceBase def initialize(opts = {}) opts = { rule_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(rule_id)) - raise ArgumentError, "#{@__resource_name__}: rule_id must be provided" unless opts[:rule_id] && !opts[:rule_id].empty? + validate_parameters(required: %i[rule_id]) + unless opts[:rule_id] && !opts[:rule_id].empty? + raise ArgumentError, "#{@__resource_name__}: rule_id must be provided" + end @display_name = opts[:rule_id] catch_aws_errors do resp = @aws.waf_client.get_rule({ rule_id: opts[:rule_id] }) @@ -24,7 +26,7 @@ def initialize(opts = {}) end def rule_id - return unless exists? + return nil unless exists? @resp[:rule_id] end diff --git a/libraries/aws_waf_size_constraint_set.rb b/libraries/aws_waf_size_constraint_set.rb index 7848dd90c..7d34fc609 100644 --- a/libraries/aws_waf_size_constraint_set.rb +++ b/libraries/aws_waf_size_constraint_set.rb @@ -13,18 +13,25 @@ class AWSWAFSizeConstraintSet < AwsResourceBase def initialize(opts = {}) opts = { size_constraint_set_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(size_constraint_set_id)) - raise ArgumentError, "#{@__resource_name__}: size_constraint_set_id must be provided" unless opts[:size_constraint_set_id] && !opts[:size_constraint_set_id].empty? + validate_parameters(required: %i[size_constraint_set_id]) + unless opts[:size_constraint_set_id] && + !opts[:size_constraint_set_id].empty? + raise ArgumentError, + "#{@__resource_name__}: size_constraint_set_id must be provided" + end @display_name = opts[:size_constraint_set_id] catch_aws_errors do - resp = @aws.waf_client.get_size_constraint_set({ size_constraint_set_id: opts[:size_constraint_set_id] }) + resp = + @aws.waf_client.get_size_constraint_set( + { size_constraint_set_id: opts[:size_constraint_set_id] } + ) @resp = resp.size_constraint_set.to_h create_resource_methods(@resp) end end def size_constraint_set_id - return unless exists? + return nil unless exists? @resp[:size_constraint_set_id] end diff --git a/libraries/aws_waf_sql_injection_match_set.rb b/libraries/aws_waf_sql_injection_match_set.rb index 219d83547..4eaba1380 100644 --- a/libraries/aws_waf_sql_injection_match_set.rb +++ b/libraries/aws_waf_sql_injection_match_set.rb @@ -13,18 +13,25 @@ class AWSWAFSQLInjectionMatchSet < AwsResourceBase def initialize(opts = {}) opts = { sql_injection_match_set_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(sql_injection_match_set_id)) - raise ArgumentError, "#{@__resource_name__}: sql_injection_match_set_id must be provided" unless opts[:sql_injection_match_set_id] && !opts[:sql_injection_match_set_id].empty? + validate_parameters(required: %i[sql_injection_match_set_id]) + unless opts[:sql_injection_match_set_id] && + !opts[:sql_injection_match_set_id].empty? + raise ArgumentError, + "#{@__resource_name__}: sql_injection_match_set_id must be provided" + end @display_name = opts[:sql_injection_match_set_id] catch_aws_errors do - resp = @aws.waf_client.get_sql_injection_match_set({ sql_injection_match_set_id: opts[:sql_injection_match_set_id] }) + resp = + @aws.waf_client.get_sql_injection_match_set( + { sql_injection_match_set_id: opts[:sql_injection_match_set_id] } + ) @resp = resp.sql_injection_match_set.to_h create_resource_methods(@resp) end end def sql_injection_match_set_id - return unless exists? + return nil unless exists? @resp[:sql_injection_match_set_id] end diff --git a/libraries/aws_waf_web_acl.rb b/libraries/aws_waf_web_acl.rb index c84af3ddd..3d700264f 100644 --- a/libraries/aws_waf_web_acl.rb +++ b/libraries/aws_waf_web_acl.rb @@ -13,8 +13,10 @@ class AWSWAFWebACL < AwsResourceBase def initialize(opts = {}) opts = { web_acl_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(web_acl_id)) - raise ArgumentError, "#{@__resource_name__}: web_acl_id must be provided" unless opts[:web_acl_id] && !opts[:web_acl_id].empty? + validate_parameters(required: %i[web_acl_id]) + unless opts[:web_acl_id] && !opts[:web_acl_id].empty? + raise ArgumentError, "#{@__resource_name__}: web_acl_id must be provided" + end @display_name = opts[:web_acl_id] catch_aws_errors do resp = @aws.waf_client.get_web_acl({ web_acl_id: opts[:web_acl_id] }) @@ -24,7 +26,7 @@ def initialize(opts = {}) end def web_acl_id - return unless exists? + return nil unless exists? @resp[:web_acl_id] end diff --git a/libraries/aws_waf_xss_match_set.rb b/libraries/aws_waf_xss_match_set.rb index 6a4d77c13..7eb4a63a4 100644 --- a/libraries/aws_waf_xss_match_set.rb +++ b/libraries/aws_waf_xss_match_set.rb @@ -13,18 +13,24 @@ class AWSWAFXSSMatchSet < AwsResourceBase def initialize(opts = {}) opts = { xss_match_set_id: opts } if opts.is_a?(String) super(opts) - validate_parameters(required: %i(xss_match_set_id)) - raise ArgumentError, "#{@__resource_name__}: xss_match_set_id must be provided" unless opts[:xss_match_set_id] && !opts[:xss_match_set_id].empty? + validate_parameters(required: %i[xss_match_set_id]) + unless opts[:xss_match_set_id] && !opts[:xss_match_set_id].empty? + raise ArgumentError, + "#{@__resource_name__}: xss_match_set_id must be provided" + end @display_name = opts[:xss_match_set_id] catch_aws_errors do - resp = @aws.waf_client.get_xss_match_set({ xss_match_set_id: opts[:xss_match_set_id] }) + resp = + @aws.waf_client.get_xss_match_set( + { xss_match_set_id: opts[:xss_match_set_id] } + ) @resp = resp.xss_match_set.to_h create_resource_methods(@resp) end end def xss_match_set_id - return unless exists? + return nil unless exists? @resp[:xss_match_set_id] end