Skip to content

Commit 896f8cd

Browse files
authored
Merge pull request #199 from inspec/CHEF-7211-MAGIC-MODULE-compute_v1-TargetVpnGateway
CHEF-7211-MAGIC-MODULE-compute_v1-TargetVpnGateway - Resource Implementation
2 parents 158b2d1 + f8f1cd6 commit 896f8cd

5 files changed

Lines changed: 145 additions & 7 deletions

File tree

mmv1/products/compute/api.yaml

Lines changed: 104 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24833,6 +24833,103 @@ objects:
2483324833

2483424834

2483524835

24836+
- !ruby/object:Api::Resource
24837+
name: TargetVpnGateway
24838+
base_url: 'projects/{{project}}/regions/{{region}}/targetVpnGateways'
24839+
self_link: 'projects/{{project}}/regions/{{region}}/targetVpnGateways/{{targetVpnGateway}}'
24840+
references: !ruby/object:Api::Resource::ReferenceLinks
24841+
guides:
24842+
'Official Documentation':
24843+
api: 'https://cloud.google.com/compute/docs'
24844+
async: !ruby/object:Api::OpAsync
24845+
operation: !ruby/object:Api::OpAsync::Operation
24846+
path: 'name'
24847+
base_url: '{op_id}'
24848+
wait_ms: 1000
24849+
result: !ruby/object:Api::OpAsync::Result
24850+
path: 'response'
24851+
resource_inside_response: true
24852+
status: !ruby/object:Api::OpAsync::Status
24853+
path: 'done'
24854+
complete: True
24855+
allowed:
24856+
- True
24857+
- False
24858+
error: !ruby/object:Api::OpAsync::Error
24859+
path: 'error'
24860+
message: 'message'
24861+
description: |-
24862+
Represents a Target VPN Gateway resource. The target VPN gateway resource represents a Classic Cloud VPN gateway. For more information, read the the Cloud VPN Overview.
24863+
properties:
24864+
24865+
- !ruby/object:Api::Type::String
24866+
name: 'kind'
24867+
description: |
24868+
[Output Only] Type of resource. Always compute#targetVpnGateway for target VPN gateways.
24869+
- !ruby/object:Api::Type::String
24870+
name: 'id'
24871+
description: |
24872+
[Output Only] The unique identifier for the resource. This identifier is defined by the server.
24873+
- !ruby/object:Api::Type::String
24874+
name: 'creationTimestamp'
24875+
description: |
24876+
[Output Only] Creation timestamp in RFC3339 text format.
24877+
- !ruby/object:Api::Type::String
24878+
name: 'name'
24879+
description: |
24880+
Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
24881+
- !ruby/object:Api::Type::String
24882+
name: 'description'
24883+
description: |
24884+
An optional description of this resource. Provide this property when you create the resource.
24885+
- !ruby/object:Api::Type::String
24886+
name: 'region'
24887+
description: |
24888+
[Output Only] URL of the region where the target VPN gateway resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body.
24889+
- !ruby/object:Api::Type::String
24890+
name: 'network'
24891+
description: |
24892+
URL of the network to which this VPN gateway is attached. Provided by the client when the VPN gateway is created.
24893+
- !ruby/object:Api::Type::Array
24894+
name: 'tunnels'
24895+
description: |
24896+
[Output Only] A list of URLs to VpnTunnel resources. VpnTunnels are created using the compute.vpntunnels.insert method and associated with a VPN gateway.
24897+
item_type: Api::Type::String
24898+
- !ruby/object:Api::Type::Enum
24899+
name: 'status'
24900+
description: |
24901+
[Output Only] The status of the VPN gateway, which can be one of the following: CREATING, READY, FAILED, or DELETING.
24902+
values:
24903+
- :CREATING
24904+
- :DELETING
24905+
- :FAILED
24906+
- :READY
24907+
- !ruby/object:Api::Type::String
24908+
name: 'selfLink'
24909+
description: |
24910+
[Output Only] Server-defined URL for the resource.
24911+
- !ruby/object:Api::Type::Array
24912+
name: 'forwardingRules'
24913+
description: |
24914+
[Output Only] A list of URLs to the ForwardingRule resources. ForwardingRules are created using compute.forwardingRules.insert and associated with a VPN gateway.
24915+
item_type: Api::Type::String
24916+
- !ruby/object:Api::Type::NestedObject
24917+
name: 'labels'
24918+
description: |
24919+
Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty.
24920+
properties:
24921+
- !ruby/object:Api::Type::String
24922+
name: 'additionalProperties'
24923+
description: |
24924+
24925+
- !ruby/object:Api::Type::String
24926+
name: 'labelFingerprint'
24927+
description: |
24928+
A fingerprint for the labels being applied to this TargetVpnGateway, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a TargetVpnGateway.
24929+
24930+
24931+
24932+
2483624933
- !ruby/object:Api::Resource
2483724934
name: RegionSslPolicy
2483824935
base_url: 'projects/{{project}}/regions/{{region}}/sslPolicies'
@@ -24861,7 +24958,7 @@ objects:
2486124958
description: |-
2486224959
Represents an SSL Policy resource. Use SSL policies to control SSL features, such as versions and cipher suites, that are offered by Application Load Balancers and proxy Network Load Balancers. For more information, read SSL policies overview.
2486324960
properties:
24864-
24961+
2486524962
- !ruby/object:Api::Type::String
2486624963
name: 'kind'
2486724964
description: |
@@ -24967,7 +25064,7 @@ objects:
2496725064
- !ruby/object:Api::Type::Array
2496825065
name: 'data'
2496925066
description: |
24970-
[Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" }
25067+
[Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" }
2497125068
item_type: !ruby/object:Api::Type::NestedObject
2497225069
properties:
2497325070
- !ruby/object:Api::Type::String
@@ -24986,7 +25083,7 @@ objects:
2498625083
- !ruby/object:Api::Type::Enum
2498725084
name: 'tlsMode'
2498825085
description: |
24989-
Indicates whether connections should be secured using TLS. The value of this field determines how TLS is enforced. This field can be set to one of the following: - SIMPLE Secure connections with standard TLS semantics. - MUTUAL Secure connections to the backends using mutual TLS by presenting client certificates for authentication.
25086+
Indicates whether connections should be secured using TLS. The value of this field determines how TLS is enforced. This field can be set to one of the following: - SIMPLE Secure connections with standard TLS semantics. - MUTUAL Secure connections to the backends using mutual TLS by presenting client certificates for authentication.
2499025087
values:
2499125088
- :INVALID
2499225089
- :MUTUAL
@@ -25183,7 +25280,7 @@ objects:
2518325280

2518425281

2518525282

25186-
25283+
2518725284
- !ruby/object:Api::Resource
2518825285
name: RegionSslPolicy
2518925286
base_url: 'projects/{{project}}/regions/{{region}}/sslPolicies'
@@ -25212,7 +25309,7 @@ objects:
2521225309
description: |-
2521325310
Represents an SSL Policy resource. Use SSL policies to control SSL features, such as versions and cipher suites, that are offered by Application Load Balancers and proxy Network Load Balancers. For more information, read SSL policies overview.
2521425311
properties:
25215-
25312+
2521625313
- !ruby/object:Api::Type::String
2521725314
name: 'kind'
2521825315
description: |
@@ -25318,7 +25415,7 @@ objects:
2531825415
- !ruby/object:Api::Type::Array
2531925416
name: 'data'
2532025417
description: |
25321-
[Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" }
25418+
[Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" }
2532225419
item_type: !ruby/object:Api::Type::NestedObject
2532325420
properties:
2532425421
- !ruby/object:Api::Type::String
@@ -25337,7 +25434,7 @@ objects:
2533725434
- !ruby/object:Api::Type::Enum
2533825435
name: 'tlsMode'
2533925436
description: |
25340-
Indicates whether connections should be secured using TLS. The value of this field determines how TLS is enforced. This field can be set to one of the following: - SIMPLE Secure connections with standard TLS semantics. - MUTUAL Secure connections to the backends using mutual TLS by presenting client certificates for authentication.
25437+
Indicates whether connections should be secured using TLS. The value of this field determines how TLS is enforced. This field can be set to one of the following: - SIMPLE Secure connections with standard TLS semantics. - MUTUAL Secure connections to the backends using mutual TLS by presenting client certificates for authentication.
2534125438
values:
2534225439
- :INVALID
2534325440
- :MUTUAL
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
2+
<% target_vpn_gateway = grab_attributes(pwd)['target_vpn_gateway'] -%>
3+
describe google_compute_target_vpn_gateway(project: <%= gcp_project_id -%>, region: <%= doc_generation ? "' #{target_vpn_gateway['region']}'":"target_vpn_gateway['region']" -%>, targetVpnGateway: <%= doc_generation ? "' #{target_vpn_gateway['targetVpnGateway']}'":"target_vpn_gateway['targetVpnGateway']" -%>) do
4+
it { should exist }
5+
its('kind') { should cmp <%= doc_generation ? "'#{target_vpn_gateway['kind']}'" : "target_vpn_gateway['kind']" -%> }
6+
its('id') { should cmp <%= doc_generation ? "'#{target_vpn_gateway['id']}'" : "target_vpn_gateway['id']" -%> }
7+
its('creation_timestamp') { should cmp <%= doc_generation ? "'#{target_vpn_gateway['creation_timestamp']}'" : "target_vpn_gateway['creation_timestamp']" -%> }
8+
its('name') { should cmp <%= doc_generation ? "'#{target_vpn_gateway['name']}'" : "target_vpn_gateway['name']" -%> }
9+
its('description') { should cmp <%= doc_generation ? "'#{target_vpn_gateway['description']}'" : "target_vpn_gateway['description']" -%> }
10+
its('region') { should cmp <%= doc_generation ? "'#{target_vpn_gateway['region']}'" : "target_vpn_gateway['region']" -%> }
11+
its('network') { should cmp <%= doc_generation ? "'#{target_vpn_gateway['network']}'" : "target_vpn_gateway['network']" -%> }
12+
its('status') { should cmp <%= doc_generation ? "'#{target_vpn_gateway['status']}'" : "target_vpn_gateway['status']" -%> }
13+
its('self_link') { should cmp <%= doc_generation ? "'#{target_vpn_gateway['self_link']}'" : "target_vpn_gateway['self_link']" -%> }
14+
its('label_fingerprint') { should cmp <%= doc_generation ? "'#{target_vpn_gateway['label_fingerprint']}'" : "target_vpn_gateway['label_fingerprint']" -%> }
15+
16+
end
17+
18+
describe google_compute_target_vpn_gateway(project: <%= gcp_project_id -%>, region: <%= doc_generation ? "' #{target_vpn_gateway['region']}'":"target_vpn_gateway['region']" -%>, targetVpnGateway: <%= doc_generation ? "' #{target_vpn_gateway['targetVpnGateway']}'":"target_vpn_gateway['targetVpnGateway']" -%>) do
19+
it { should_not exist }
20+
end
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
gcp_project_id = input(:gcp_project_id, value: '<%= external_attribute(pwd, 'gcp_project_id') -%>', description: 'The GCP project identifier.')
2+
3+
target_vpn_gateway = input('target_vpn_gateway', value: <%= JSON.pretty_generate(grab_attributes(pwd)['target_vpn_gateway']) -%>, description: 'target_vpn_gateway description')
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
2+
<% target_vpn_gateway = grab_attributes(pwd)['target_vpn_gateway'] -%>
3+
describe google_compute_target_vpn_gateways(project: <%= gcp_project_id -%>, region: <%= doc_generation ? "' #{target_vpn_gateway['region']}'":"target_vpn_gateway['region']" -%>) do
4+
it { should exist }
5+
end

mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,19 @@ region_disk_type:
11171117
zone : "value_zone"
11181118
self_link : "value_selflink"
11191119
default_disk_size_gb : "value_defaultdisksizegb"
1120+
target_vpn_gateway:
1121+
project : "value_project"
1122+
region : "value_region"
1123+
target_vpn_gateway : "value_targetvpngateway"
1124+
kind : "value_kind"
1125+
id : "value_id"
1126+
creation_timestamp : "value_creationtimestamp"
1127+
name : "value_name"
1128+
description : "value_description"
1129+
network : "value_network"
1130+
status : "value_status"
1131+
self_link : "value_selflink"
1132+
label_fingerprint : "value_labelfingerprint"
11201133
region_ssl_policy:
11211134
commitment : "value_commitment"
11221135
project : "value_project"

0 commit comments

Comments
 (0)