Skip to content

Commit

Permalink
Merge pull request #183 from inspec/CHEF-7202_4-MAGIC-MODULE-compute_…
Browse files Browse the repository at this point in the history
…v1-RegionDiskType

CHEF-7202_4-MAGIC-MODULE-compute_v1-RegionDiskType - Resource Implementation
  • Loading branch information
sa-progress authored Mar 13, 2024
2 parents 8f3c6ea + 7c52ecd commit e5aa5a8
Show file tree
Hide file tree
Showing 5 changed files with 248 additions and 1 deletion.
206 changes: 206 additions & 0 deletions mmv1/products/compute/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24497,3 +24497,209 @@ objects:
description: |
[Output Only] Server-defined URL for the resource.




- !ruby/object:Api::Resource
name: RegionDiskType
base_url: 'projects/{{project}}/regions/{{region}}/diskTypes'
self_link: 'projects/{{project}}/regions/{{region}}/diskTypes/{{diskType}}'
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 Disk Type resource. Google Compute Engine has two Disk Type resources: * [Regional](/compute/docs/reference/rest/v1/regionDiskTypes) * [Zonal](/compute/docs/reference/rest/v1/diskTypes) You can choose from a variety of disk types based on your needs. For more information, read Storage options. The diskTypes resource represents disk types for a zonal persistent disk. For more information, read Zonal persistent disks. The regionDiskTypes resource represents disk types for a regional persistent disk. For more information, read Regional persistent disks.
properties:

- !ruby/object:Api::Type::String
name: 'kind'
description: |
[Output Only] Type of the resource. Always compute#diskType for disk 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 description of this resource.
- !ruby/object:Api::Type::String
name: 'validDiskSize'
description: |
[Output Only] An optional textual description of the valid disk size, such as "10GB-10TB".
- !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] URL of the zone where the disk type 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::String
name: 'selfLink'
description: |
[Output Only] Server-defined URL for the resource.
- !ruby/object:Api::Type::String
name: 'defaultDiskSizeGb'
description: |
[Output Only] Server-defined default disk size in GB.
- !ruby/object:Api::Type::String
name: 'region'
description: |
[Output Only] URL of the region where the disk type resides. Only applicable for regional resources. 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::Resource
name: RegionDiskType
base_url: 'projects/{{project}}/regions/{{region}}/diskTypes'
self_link: 'projects/{{project}}/regions/{{region}}/diskTypes/{{diskType}}'
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 Disk Type resource. Google Compute Engine has two Disk Type resources: * [Regional](/compute/docs/reference/rest/v1/regionDiskTypes) * [Zonal](/compute/docs/reference/rest/v1/diskTypes) You can choose from a variety of disk types based on your needs. For more information, read Storage options. The diskTypes resource represents disk types for a zonal persistent disk. For more information, read Zonal persistent disks. The regionDiskTypes resource represents disk types for a regional persistent disk. For more information, read Regional persistent disks.
properties:

- !ruby/object:Api::Type::String
name: 'kind'
description: |
[Output Only] Type of the resource. Always compute#diskType for disk 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 description of this resource.
- !ruby/object:Api::Type::String
name: 'validDiskSize'
description: |
[Output Only] An optional textual description of the valid disk size, such as "10GB-10TB".
- !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] URL of the zone where the disk type 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::String
name: 'selfLink'
description: |
[Output Only] Server-defined URL for the resource.
- !ruby/object:Api::Type::String
name: 'defaultDiskSizeGb'
description: |
[Output Only] Server-defined default disk size in GB.
- !ruby/object:Api::Type::String
name: 'region'
description: |
[Output Only] URL of the region where the disk type resides. Only applicable for regional resources. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
<% region_disk_type = grab_attributes(pwd)['region_disk_type'] -%>
describe google_compute_region_disk_type(diskType: <%= doc_generation ? "' #{region_disk_type['diskType']}'":"region_disk_type['diskType']" -%>, project: <%= gcp_project_id -%>, region: <%= doc_generation ? "' #{region_disk_type['region']}'":"region_disk_type['region']" -%>) do
it { should exist }
its('kind') { should cmp <%= doc_generation ? "'#{region_disk_type['kind']}'" : "region_disk_type['kind']" -%> }
its('id') { should cmp <%= doc_generation ? "'#{region_disk_type['id']}'" : "region_disk_type['id']" -%> }
its('creation_timestamp') { should cmp <%= doc_generation ? "'#{region_disk_type['creation_timestamp']}'" : "region_disk_type['creation_timestamp']" -%> }
its('name') { should cmp <%= doc_generation ? "'#{region_disk_type['name']}'" : "region_disk_type['name']" -%> }
its('description') { should cmp <%= doc_generation ? "'#{region_disk_type['description']}'" : "region_disk_type['description']" -%> }
its('valid_disk_size') { should cmp <%= doc_generation ? "'#{region_disk_type['valid_disk_size']}'" : "region_disk_type['valid_disk_size']" -%> }
its('zone') { should cmp <%= doc_generation ? "'#{region_disk_type['zone']}'" : "region_disk_type['zone']" -%> }
its('self_link') { should cmp <%= doc_generation ? "'#{region_disk_type['self_link']}'" : "region_disk_type['self_link']" -%> }
its('default_disk_size_gb') { should cmp <%= doc_generation ? "'#{region_disk_type['default_disk_size_gb']}'" : "region_disk_type['default_disk_size_gb']" -%> }
its('region') { should cmp <%= doc_generation ? "'#{region_disk_type['region']}'" : "region_disk_type['region']" -%> }

end

describe google_compute_region_disk_type(diskType: <%= doc_generation ? "' #{region_disk_type['diskType']}'":"region_disk_type['diskType']" -%>, project: <%= gcp_project_id -%>, region: <%= doc_generation ? "' #{region_disk_type['region']}'":"region_disk_type['region']" -%>) 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.')

region_disk_type = input('region_disk_type', value: <%= JSON.pretty_generate(grab_attributes(pwd)['region_disk_type']) -%>, description: 'region_disk_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)}" -%>
<% region_disk_type = grab_attributes(pwd)['region_disk_type'] -%>
describe google_compute_region_disk_types(project: <%= gcp_project_id -%>, region: <%= doc_generation ? "' #{region_disk_type['region']}'":"region_disk_type['region']" -%>) do
it { should exist }
end
Original file line number Diff line number Diff line change
Expand Up @@ -1091,4 +1091,17 @@ node_type:
name : "value_name"
description : "value_description"
cpu_platform : "value_cpuplatform"
self_link : "value_selflink"
self_link : "value_selflink"
region_disk_type:
disk_type : "value_disktype"
project : "value_project"
region : "value_region"
kind : "value_kind"
id : "value_id"
creation_timestamp : "value_creationtimestamp"
name : "value_name"
description : "value_description"
valid_disk_size : "value_validdisksize"
zone : "value_zone"
self_link : "value_selflink"
default_disk_size_gb : "value_defaultdisksizegb"

0 comments on commit e5aa5a8

Please sign in to comment.