Skip to content

Commit

Permalink
Merge pull request #168 from inspec/CHEF-7197-MAGIC-MODULE-compute_v1…
Browse files Browse the repository at this point in the history
…-NodeType

CHEF-7197-MAGIC-MODULE-compute_v1-NodeType - Resource Implementation
  • Loading branch information
balasubramanian-s authored Feb 7, 2024
2 parents d591582 + a179d56 commit d859ad6
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 1 deletion.
107 changes: 107 additions & 0 deletions mmv1/products/compute/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24390,3 +24390,110 @@ objects:
- :REJECTED
- :STATUS_UNSPECIFIED




- !ruby/object:Api::Resource
name: NodeType
base_url: 'projects/{{project}}/zones/{{zone}}/nodeTypes'
self_link: 'projects/{{project}}/zones/{{zone}}/nodeTypes/{{nodeType}}'
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Official Documentation':
api: 'https://cloud.google.com/compute_v1/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: |-
Represent a sole-tenant Node Type resource. Each node within a node group must have a node type. A node type specifies the total amount of cores and memory for that node. Currently, the only available node type is n1-node-96-624 node type that has 96 vCPUs and 624 GB of memory, available in multiple zones. For more information read Node types.
properties:

- !ruby/object:Api::Type::String
name: 'kind'
description: |
[Output Only] The type of the resource. Always compute#nodeType for node types.
- !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: |
[Output Only] Name of the resource.
- !ruby/object:Api::Type::String
name: 'description'
description: |
[Output Only] An optional textual description of the resource.
- !ruby/object:Api::Type::String
name: 'cpuPlatform'
description: |
[Output Only] The CPU platform used by this node type.
- !ruby/object:Api::Type::Integer
name: 'guestCpus'
description: |
[Output Only] The number of virtual CPUs that are available to the node type.
- !ruby/object:Api::Type::Integer
name: 'memoryMb'
description: |
[Output Only] The amount of physical memory available to the node type, defined in MB.
- !ruby/object:Api::Type::Integer
name: 'localSsdGb'
description: |
[Output Only] Local SSD available to the node type, defined in GB.
- !ruby/object:Api::Type::NestedObject
name: 'deprecated'
description: |
Deprecation status for a public resource.
properties:
- !ruby/object:Api::Type::Enum
name: 'state'
description: |
The deprecation state of this resource. This can be ACTIVE, DEPRECATED, OBSOLETE, or DELETED. Operations which communicate the end of life date for an image, can use ACTIVE. Operations which create a new resource using a DEPRECATED resource will return successfully, but with a warning indicating the deprecated resource and recommending its replacement. Operations which use OBSOLETE or DELETED resources will be rejected and result in an error.
values:
- :ACTIVE
- :DELETED
- :DEPRECATED
- :OBSOLETE
- !ruby/object:Api::Type::String
name: 'replacement'
description: |
The URL of the suggested replacement for a deprecated resource. The suggested replacement resource must be the same kind of resource as the deprecated resource.
- !ruby/object:Api::Type::String
name: 'deprecated'
description: |
An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DEPRECATED. This is only informational and the status will not change unless the client explicitly changes it.
- !ruby/object:Api::Type::String
name: 'obsolete'
description: |
An optional RFC3339 timestamp on or after which the state of this resource is intended to change to OBSOLETE. This is only informational and the status will not change unless the client explicitly changes it.
- !ruby/object:Api::Type::String
name: 'deleted'
description: |
An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DELETED. This is only informational and the status will not change unless the client explicitly changes it.
- !ruby/object:Api::Type::String
name: 'zone'
description: |
[Output Only] The name of the zone where the node type resides, such as us-central1-a.
- !ruby/object:Api::Type::String
name: 'selfLink'
description: |
[Output Only] Server-defined URL for the resource.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
<% node_type = grab_attributes(pwd)['node_type'] -%>
describe google_compute_v1_node_type(nodeType: <%= doc_generation ? "' #{node_type['nodeType']}'":"node_type['nodeType']" -%>, project: <%= gcp_project_id -%>, zone: <%= doc_generation ? "' #{node_type['zone']}'":"node_type['zone']" -%>) do
it { should exist }
its('kind') { should cmp <%= doc_generation ? "'#{node_type['kind']}'" : "node_type['kind']" -%> }
its('id') { should cmp <%= doc_generation ? "'#{node_type['id']}'" : "node_type['id']" -%> }
its('creation_timestamp') { should cmp <%= doc_generation ? "'#{node_type['creation_timestamp']}'" : "node_type['creation_timestamp']" -%> }
its('name') { should cmp <%= doc_generation ? "'#{node_type['name']}'" : "node_type['name']" -%> }
its('description') { should cmp <%= doc_generation ? "'#{node_type['description']}'" : "node_type['description']" -%> }
its('cpu_platform') { should cmp <%= doc_generation ? "'#{node_type['cpu_platform']}'" : "node_type['cpu_platform']" -%> }
its('zone') { should cmp <%= doc_generation ? "'#{node_type['zone']}'" : "node_type['zone']" -%> }
its('self_link') { should cmp <%= doc_generation ? "'#{node_type['self_link']}'" : "node_type['self_link']" -%> }

end

describe google_compute_v1_node_type(nodeType: <%= doc_generation ? "' #{node_type['nodeType']}'":"node_type['nodeType']" -%>, project: <%= gcp_project_id -%>, zone: <%= doc_generation ? "' #{node_type['zone']}'":"node_type['zone']" -%>) do
it { should_not exist }
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gcp_project_id = input(:gcp_project_id, value: '<%= external_attribute(pwd, 'gcp_project_id') -%>', description: 'The GCP project identifier.')

node_type = input('node_type', value: <%= JSON.pretty_generate(grab_attributes(pwd)['node_type']) -%>, description: 'node_type description')
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
<% node_type = grab_attributes(pwd)['node_type'] -%>
describe google_compute_v1_node_types(project: <%= gcp_project_id -%>, zone: <%= doc_generation ? "' #{node_type['zone']}'":"node_type['zone']" -%>) do
it { should exist }
end
Original file line number Diff line number Diff line change
Expand Up @@ -1080,4 +1080,15 @@ organization_envgroup_attachment:
parent : "value_parent"
created_at : "value_createdat"
environment : "value_environment"
environment_group_id : "value_environmentgroupid"
environment_group_id : "value_environmentgroupid"
node_type:
node_type : "value_nodetype"
project : "value_project"
zone : "value_zone"
kind : "value_kind"
id : "value_id"
creation_timestamp : "value_creationtimestamp"
name : "value_name"
description : "value_description"
cpu_platform : "value_cpuplatform"
self_link : "value_selflink"

0 comments on commit d859ad6

Please sign in to comment.