From b4edef0f9fef66b620076751e8fb090966a5fed7 Mon Sep 17 00:00:00 2001 From: Samir <85890442+sa-progress@users.noreply.github.com> Date: Tue, 26 Mar 2024 14:37:55 +0530 Subject: [PATCH] Automatically generated by magic modules for service: compute_v1 and resource: TargetInstance. This commit includes the following changes: - Singular Resource ERB File - Plural Resource ERB File - Terraform configuration - api.yaml configuration for product compute_v1 and resource TargetInstance Signed-off-by: Samir <85890442+sa-progress@users.noreply.github.com> --- mmv1/products/compute/api.yaml | 166 ++++++++++++++++++ .../google_compute_target_instance.erb | 22 +++ ...gle_compute_target_instance_attributes.erb | 3 + .../google_compute_target_instances.erb | 5 + .../configuration/mm-attributes.yml | 18 +- 5 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 mmv1/templates/inspec/examples/google_compute_target_instance/google_compute_target_instance.erb create mode 100644 mmv1/templates/inspec/examples/google_compute_target_instance/google_compute_target_instance_attributes.erb create mode 100644 mmv1/templates/inspec/examples/google_compute_target_instance/google_compute_target_instances.erb diff --git a/mmv1/products/compute/api.yaml b/mmv1/products/compute/api.yaml index 5819fd086..e694f1fba 100644 --- a/mmv1/products/compute/api.yaml +++ b/mmv1/products/compute/api.yaml @@ -24830,3 +24830,169 @@ objects: - :FALSE - :TRUE + + + + - !ruby/object:Api::Resource + name: TargetInstance + base_url: 'projects/{{project}}/zones/{{zone}}/targetInstances' + self_link: 'projects/{{project}}/zones/{{zone}}/targetInstances/{{targetInstance}}' + references: !ruby/object:Api::Resource::ReferenceLinks + guides: + 'Official Documentation': + api: 'https://cloud.google.com/compute/docs' + async: !ruby/object:Api::OpAsync + operation: !ruby/object:Api::OpAsync::Operation + path: 'name' + base_url: '{op_id}' + wait_ms: 1000 + result: !ruby/object:Api::OpAsync::Result + path: 'response' + resource_inside_response: true + status: !ruby/object:Api::OpAsync::Status + path: 'done' + complete: True + allowed: + - True + - False + error: !ruby/object:Api::OpAsync::Error + path: 'error' + message: 'message' + description: |- + Represents a Target Instance resource. You can use a target instance to handle traffic for one or more forwarding rules, which is ideal for forwarding protocol traffic that is managed by a single source. For example, ESP, AH, TCP, or UDP. For more information, read Target instances. + properties: + + - !ruby/object:Api::Type::String + name: 'kind' + description: | + [Output Only] The type of the resource. Always compute#targetInstance for target instances. + - !ruby/object:Api::Type::String + name: 'id' + description: | + [Output Only] The unique identifier for the resource. This identifier is defined by the server. + - !ruby/object:Api::Type::String + name: 'creationTimestamp' + description: | + [Output Only] Creation timestamp in RFC3339 text format. + - !ruby/object:Api::Type::String + name: 'name' + description: | + 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. + - !ruby/object:Api::Type::String + name: 'description' + description: | + An optional description of this resource. Provide this property when you create the resource. + - !ruby/object:Api::Type::String + name: 'zone' + description: | + [Output Only] URL of the zone where the target instance resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. + - !ruby/object:Api::Type::Enum + name: 'natPolicy' + description: | + Must have a value of NO_NAT. Protocol forwarding delivers packets while preserving the destination IP address of the forwarding rule referencing the target instance. + values: + - :NO_NAT + - !ruby/object:Api::Type::String + name: 'instance' + description: | + A URL to the virtual machine instance that handles traffic for this target instance. When creating a target instance, you can provide the fully-qualified URL or a valid partial URL to the desired virtual machine. For example, the following are all valid URLs: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /instances/instance - projects/project/zones/zone/instances/instance - zones/zone/instances/instance + - !ruby/object:Api::Type::String + name: 'selfLink' + description: | + [Output Only] Server-defined URL for the resource. + - !ruby/object:Api::Type::String + name: 'selfLinkWithId' + description: | + [Output Only] Server-defined URL for this resource with the resource id. + - !ruby/object:Api::Type::String + name: 'network' + description: | + The URL of the network this target instance uses to forward traffic. If not specified, the traffic will be forwarded to the network that the default network interface belongs to. + - !ruby/object:Api::Type::String + name: 'securityPolicy' + description: | + [Output Only] The resource URL for the security policy associated with this target instance. + + + + + - !ruby/object:Api::Resource + name: TargetInstance + base_url: 'projects/{{project}}/zones/{{zone}}/targetInstances' + self_link: 'projects/{{project}}/zones/{{zone}}/targetInstances/{{targetInstance}}' + references: !ruby/object:Api::Resource::ReferenceLinks + guides: + 'Official Documentation': + api: 'https://cloud.google.com/compute/docs' + async: !ruby/object:Api::OpAsync + operation: !ruby/object:Api::OpAsync::Operation + path: 'name' + base_url: '{op_id}' + wait_ms: 1000 + result: !ruby/object:Api::OpAsync::Result + path: 'response' + resource_inside_response: true + status: !ruby/object:Api::OpAsync::Status + path: 'done' + complete: True + allowed: + - True + - False + error: !ruby/object:Api::OpAsync::Error + path: 'error' + message: 'message' + description: |- + Represents a Target Instance resource. You can use a target instance to handle traffic for one or more forwarding rules, which is ideal for forwarding protocol traffic that is managed by a single source. For example, ESP, AH, TCP, or UDP. For more information, read Target instances. + properties: + + - !ruby/object:Api::Type::String + name: 'kind' + description: | + [Output Only] The type of the resource. Always compute#targetInstance for target instances. + - !ruby/object:Api::Type::String + name: 'id' + description: | + [Output Only] The unique identifier for the resource. This identifier is defined by the server. + - !ruby/object:Api::Type::String + name: 'creationTimestamp' + description: | + [Output Only] Creation timestamp in RFC3339 text format. + - !ruby/object:Api::Type::String + name: 'name' + description: | + 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. + - !ruby/object:Api::Type::String + name: 'description' + description: | + An optional description of this resource. Provide this property when you create the resource. + - !ruby/object:Api::Type::String + name: 'zone' + description: | + [Output Only] URL of the zone where the target instance resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. + - !ruby/object:Api::Type::Enum + name: 'natPolicy' + description: | + Must have a value of NO_NAT. Protocol forwarding delivers packets while preserving the destination IP address of the forwarding rule referencing the target instance. + values: + - :NO_NAT + - !ruby/object:Api::Type::String + name: 'instance' + description: | + A URL to the virtual machine instance that handles traffic for this target instance. When creating a target instance, you can provide the fully-qualified URL or a valid partial URL to the desired virtual machine. For example, the following are all valid URLs: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /instances/instance - projects/project/zones/zone/instances/instance - zones/zone/instances/instance + - !ruby/object:Api::Type::String + name: 'selfLink' + description: | + [Output Only] Server-defined URL for the resource. + - !ruby/object:Api::Type::String + name: 'selfLinkWithId' + description: | + [Output Only] Server-defined URL for this resource with the resource id. + - !ruby/object:Api::Type::String + name: 'network' + description: | + The URL of the network this target instance uses to forward traffic. If not specified, the traffic will be forwarded to the network that the default network interface belongs to. + - !ruby/object:Api::Type::String + name: 'securityPolicy' + description: | + [Output Only] The resource URL for the security policy associated with this target instance. + diff --git a/mmv1/templates/inspec/examples/google_compute_target_instance/google_compute_target_instance.erb b/mmv1/templates/inspec/examples/google_compute_target_instance/google_compute_target_instance.erb new file mode 100644 index 000000000..f3443ad70 --- /dev/null +++ b/mmv1/templates/inspec/examples/google_compute_target_instance/google_compute_target_instance.erb @@ -0,0 +1,22 @@ +<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%> +<% target_instance = grab_attributes(pwd)['target_instance'] -%> +describe google_compute_target_instance(project: <%= gcp_project_id -%>, targetInstance: <%= doc_generation ? "' #{target_instance['targetInstance']}'":"target_instance['targetInstance']" -%>, zone: <%= doc_generation ? "' #{target_instance['zone']}'":"target_instance['zone']" -%>) do + it { should exist } + its('kind') { should cmp <%= doc_generation ? "'#{target_instance['kind']}'" : "target_instance['kind']" -%> } + its('id') { should cmp <%= doc_generation ? "'#{target_instance['id']}'" : "target_instance['id']" -%> } + its('creation_timestamp') { should cmp <%= doc_generation ? "'#{target_instance['creation_timestamp']}'" : "target_instance['creation_timestamp']" -%> } + its('name') { should cmp <%= doc_generation ? "'#{target_instance['name']}'" : "target_instance['name']" -%> } + its('description') { should cmp <%= doc_generation ? "'#{target_instance['description']}'" : "target_instance['description']" -%> } + its('zone') { should cmp <%= doc_generation ? "'#{target_instance['zone']}'" : "target_instance['zone']" -%> } + its('nat_policy') { should cmp <%= doc_generation ? "'#{target_instance['nat_policy']}'" : "target_instance['nat_policy']" -%> } + its('instance') { should cmp <%= doc_generation ? "'#{target_instance['instance']}'" : "target_instance['instance']" -%> } + its('self_link') { should cmp <%= doc_generation ? "'#{target_instance['self_link']}'" : "target_instance['self_link']" -%> } + its('self_link_with_id') { should cmp <%= doc_generation ? "'#{target_instance['self_link_with_id']}'" : "target_instance['self_link_with_id']" -%> } + its('network') { should cmp <%= doc_generation ? "'#{target_instance['network']}'" : "target_instance['network']" -%> } + its('security_policy') { should cmp <%= doc_generation ? "'#{target_instance['security_policy']}'" : "target_instance['security_policy']" -%> } + +end + +describe google_compute_target_instance(project: <%= gcp_project_id -%>, targetInstance: <%= doc_generation ? "' #{target_instance['targetInstance']}'":"target_instance['targetInstance']" -%>, zone: <%= doc_generation ? "' #{target_instance['zone']}'":"target_instance['zone']" -%>) do + it { should_not exist } +end \ No newline at end of file diff --git a/mmv1/templates/inspec/examples/google_compute_target_instance/google_compute_target_instance_attributes.erb b/mmv1/templates/inspec/examples/google_compute_target_instance/google_compute_target_instance_attributes.erb new file mode 100644 index 000000000..229b3b194 --- /dev/null +++ b/mmv1/templates/inspec/examples/google_compute_target_instance/google_compute_target_instance_attributes.erb @@ -0,0 +1,3 @@ +gcp_project_id = input(:gcp_project_id, value: '<%= external_attribute(pwd, 'gcp_project_id') -%>', description: 'The GCP project identifier.') + + target_instance = input('target_instance', value: <%= JSON.pretty_generate(grab_attributes(pwd)['target_instance']) -%>, description: 'target_instance description') \ No newline at end of file diff --git a/mmv1/templates/inspec/examples/google_compute_target_instance/google_compute_target_instances.erb b/mmv1/templates/inspec/examples/google_compute_target_instance/google_compute_target_instances.erb new file mode 100644 index 000000000..7bb6b403c --- /dev/null +++ b/mmv1/templates/inspec/examples/google_compute_target_instance/google_compute_target_instances.erb @@ -0,0 +1,5 @@ +<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%> + <% target_instance = grab_attributes(pwd)['target_instance'] -%> + describe google_compute_target_instances(project: <%= gcp_project_id -%>, zone: <%= doc_generation ? "' #{target_instance['zone']}'":"target_instance['zone']" -%>) do + it { should exist } + end \ No newline at end of file diff --git a/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml b/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml index e196b7361..5ba2b3a3b 100644 --- a/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml +++ b/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml @@ -1116,4 +1116,20 @@ region_disk_type: valid_disk_size : "value_validdisksize" zone : "value_zone" self_link : "value_selflink" - default_disk_size_gb : "value_defaultdisksizegb" \ No newline at end of file + default_disk_size_gb : "value_defaultdisksizegb" +target_instance: + project : "value_project" + region : "value_region" + url_map : "value_urlmap" + kind : "value_kind" + id : "value_id" + creation_timestamp : "value_creationtimestamp" + name : "value_name" + description : "value_description" + zone : "value_zone" + nat_policy : "value_natpolicy" + instance : "value_instance" + self_link : "value_selflink" + self_link_with_id : "value_selflinkwithid" + network : "value_network" + security_policy : "value_securitypolicy" \ No newline at end of file