From 70e629b0a4fde7bef6b1ce2a32b04bec094805c1 Mon Sep 17 00:00:00 2001 From: Sam Levenick <slevenick@google.com> Date: Fri, 30 Nov 2018 22:12:05 +0000 Subject: [PATCH] Plural doc generation --- docs/resources/google_compute_ssl_policies.md | 44 +++++++++++++++++++ docs/resources/google_compute_ssl_policy.md | 2 - libraries/google_compute_ssl_policies.rb | 13 ------ libraries/google_compute_ssl_policy.rb | 13 ------ .../controls/google_compute_ssl_policies.rb | 19 +++----- .../controls/google_compute_ssl_policy.rb | 12 ----- 6 files changed, 51 insertions(+), 52 deletions(-) create mode 100644 docs/resources/google_compute_ssl_policies.md diff --git a/docs/resources/google_compute_ssl_policies.md b/docs/resources/google_compute_ssl_policies.md new file mode 100644 index 000000000..551a0dca5 --- /dev/null +++ b/docs/resources/google_compute_ssl_policies.md @@ -0,0 +1,44 @@ +--- +title: About the SslPolicy resource +platform: gcp +--- + + +## Syntax +A `google_compute_ssl_policies` is used to test a Google SslPolicy resource + +## Examples +``` +resource = google_compute_ssl_policies({project: 'graphite-test-sam-chef'}) +describe resource do + it { should exist } + its('names') { should include 'inspec-gcp-ssl-policy' } + its('profiles') { should include 'CUSTOM' } + its('count') { should eq 1 } +end + +resource.names.each do |policy_name| + describe google_compute_ssl_policy({project: 'graphite-test-sam-chef', name: policy_name}) do + its('min_tls_version') { should cmp 'TLS_1_2' } + end +end +``` + +## Properties +Properties that can be accessed from the `google_compute_ssl_policies` resource: + +See [google_compute_ssl_policy.md](google_compute_ssl_policy.md) for more detailed information + * `creation_timestamps`: an array of `google_compute_ssl_policy` creation_timestamp + * `descriptions`: an array of `google_compute_ssl_policy` description + * `ids`: an array of `google_compute_ssl_policy` id + * `names`: an array of `google_compute_ssl_policy` name + * `profiles`: an array of `google_compute_ssl_policy` profile + * `min_tls_versions`: an array of `google_compute_ssl_policy` min_tls_version + * `enabled_features`: an array of `google_compute_ssl_policy` enabled_features + * `custom_features`: an array of `google_compute_ssl_policy` custom_features + * `fingerprints`: an array of `google_compute_ssl_policy` fingerprint + * `warnings`: an array of `google_compute_ssl_policy` warnings + +## Filter Criteria +This resource supports all of the above properties as filter criteria, which can be used +with `where` as a block or a method. diff --git a/docs/resources/google_compute_ssl_policy.md b/docs/resources/google_compute_ssl_policy.md index 56b342d0d..b49ee33a5 100644 --- a/docs/resources/google_compute_ssl_policy.md +++ b/docs/resources/google_compute_ssl_policy.md @@ -1,5 +1,3 @@ - - --- title: About the SslPolicy resource platform: gcp diff --git a/libraries/google_compute_ssl_policies.rb b/libraries/google_compute_ssl_policies.rb index a19bf83a2..567f84dfe 100644 --- a/libraries/google_compute_ssl_policies.rb +++ b/libraries/google_compute_ssl_policies.rb @@ -1,18 +1,5 @@ # frozen_string_literal: false -# Copyright 2018 Google Inc. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - # ---------------------------------------------------------------------------- # # *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** diff --git a/libraries/google_compute_ssl_policy.rb b/libraries/google_compute_ssl_policy.rb index d7181d74e..2576395c9 100644 --- a/libraries/google_compute_ssl_policy.rb +++ b/libraries/google_compute_ssl_policy.rb @@ -1,18 +1,5 @@ # frozen_string_literal: false -# Copyright 2018 Google Inc. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - # ---------------------------------------------------------------------------- # # *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** diff --git a/test/integration/verify-mm/controls/google_compute_ssl_policies.rb b/test/integration/verify-mm/controls/google_compute_ssl_policies.rb index dac82ade4..8616112e0 100644 --- a/test/integration/verify-mm/controls/google_compute_ssl_policies.rb +++ b/test/integration/verify-mm/controls/google_compute_ssl_policies.rb @@ -1,15 +1,3 @@ -# Copyright 2017 Google Inc. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. # ---------------------------------------------------------------------------- # # *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** @@ -40,6 +28,13 @@ it { should exist } its('names') { should include ssl_policy['name'] } its('profiles') { should include ssl_policy['profile'] } + its('count') { should eq 1 } + end + + resource.names.each do |policy_name| + describe google_compute_ssl_policy({project: project_name, name: policy_name}) do + its('min_tls_version') { should cmp ssl_policy['min_tls_version'] } + end end end end diff --git a/test/integration/verify-mm/controls/google_compute_ssl_policy.rb b/test/integration/verify-mm/controls/google_compute_ssl_policy.rb index 28e52afa2..989ce4904 100644 --- a/test/integration/verify-mm/controls/google_compute_ssl_policy.rb +++ b/test/integration/verify-mm/controls/google_compute_ssl_policy.rb @@ -1,15 +1,3 @@ -# Copyright 2017 Google Inc. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. # ---------------------------------------------------------------------------- # # *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***