Skip to content

Commit

Permalink
Merge pull request #126 from inspec/dadaa1-MAGIC-MODULE-dataproc-Proj…
Browse files Browse the repository at this point in the history
…ects__regions__cluster

CHEF-7369-MAGIC-MODULE-dataproc-Projects__regions__cluster - Resource Implementation
  • Loading branch information
sa-progress authored Dec 4, 2023
2 parents 9d60d15 + 2bebdee commit 59ce7af
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 1 deletion.
150 changes: 150 additions & 0 deletions mmv1/products/dataproc/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -615,3 +615,153 @@ objects:
name: 'realm'
description: |
The name of the on-cluster Kerberos realm.
- !ruby/object:Api::Resource
name: ProjectRegionCluster
base_url: 'projects/{{projectId}}/regions/{{region}}/clusters'
self_link: 'projects/{{projectId}}/regions/{{region}}/clusters/{{clusterName}}'
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Official Documentation':
api: 'https://cloud.google.com/dataproc/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: |-
Describes the identifying information, config, and status of a Dataproc cluster
properties:

- !ruby/object:Api::Type::String
name: 'projectId'
description: |
Required. The Google Cloud Platform project ID that the cluster belongs to.
- !ruby/object:Api::Type::String
name: 'clusterName'
description: |
Required. The cluster name, which must be unique within a project. The name must start with a lowercase letter, and can contain up to 51 lowercase letters, numbers, and hyphens. It cannot end with a hyphen. The name of a deleted cluster can be reused.
- !ruby/object:Api::Type::String
name: 'config'
description: |
Optional. The cluster config for a cluster of Compute Engine Instances. Note that Dataproc may set default values, and values may change when clusters are updated.Exactly one of ClusterConfig or VirtualClusterConfig must be specified.
- !ruby/object:Api::Type::String
name: 'virtualClusterConfig'
description: |
Optional. The virtual cluster config is used when creating a Dataproc cluster that does not directly control the underlying compute resources, for example, when creating a Dataproc-on-GKE cluster (https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview). Dataproc may set default values, and values may change when clusters are updated. Exactly one of config or virtual_cluster_config must be specified.
- !ruby/object:Api::Type::NestedObject
name: 'labels'
description: |
Optional. The labels to associate with this cluster. Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). Label values may be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a cluster.
properties:
- !ruby/object:Api::Type::String
name: 'additionalProperties'
description: |
- !ruby/object:Api::Type::String
name: 'status'
description: |
Output only. Cluster status.
- !ruby/object:Api::Type::Array
name: 'statusHistory'
description: |
Output only. The previous cluster status.
item_type: Api::Type::String
- !ruby/object:Api::Type::String
name: 'clusterUuid'
description: |
Output only. A cluster UUID (Unique Universal Identifier). Dataproc generates this value when it creates the cluster.
- !ruby/object:Api::Type::String
name: 'metrics'
description: |
Output only. Contains cluster daemon metrics such as HDFS and YARN stats.Beta Feature: This report is available for testing purposes only. It may be changed before final release.



- !ruby/object:Api::Resource
name: ProjectRegionCluster
base_url: 'projects/{{projectId}}/regions/{{region}}/clusters'
self_link: 'projects/{{projectId}}/regions/{{region}}/clusters/{{clusterName}}'
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Official Documentation':
api: 'https://cloud.google.com/dataproc/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: |-
Describes the identifying information, config, and status of a Dataproc cluster
properties:

- !ruby/object:Api::Type::String
name: 'projectId'
description: |
Required. The Google Cloud Platform project ID that the cluster belongs to.
- !ruby/object:Api::Type::String
name: 'clusterName'
description: |
Required. The cluster name, which must be unique within a project. The name must start with a lowercase letter, and can contain up to 51 lowercase letters, numbers, and hyphens. It cannot end with a hyphen. The name of a deleted cluster can be reused.
- !ruby/object:Api::Type::String
name: 'config'
description: |
Optional. The cluster config for a cluster of Compute Engine Instances. Note that Dataproc may set default values, and values may change when clusters are updated.Exactly one of ClusterConfig or VirtualClusterConfig must be specified.
- !ruby/object:Api::Type::String
name: 'virtualClusterConfig'
description: |
Optional. The virtual cluster config is used when creating a Dataproc cluster that does not directly control the underlying compute resources, for example, when creating a Dataproc-on-GKE cluster (https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview). Dataproc may set default values, and values may change when clusters are updated. Exactly one of config or virtual_cluster_config must be specified.
- !ruby/object:Api::Type::NestedObject
name: 'labels'
description: |
Optional. The labels to associate with this cluster. Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). Label values may be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a cluster.
properties:
- !ruby/object:Api::Type::String
name: 'additionalProperties'
description: |
- !ruby/object:Api::Type::String
name: 'status'
description: |
Output only. Cluster status.
- !ruby/object:Api::Type::Array
name: 'statusHistory'
description: |
Output only. The previous cluster status.
item_type: Api::Type::String
- !ruby/object:Api::Type::String
name: 'clusterUuid'
description: |
Output only. A cluster UUID (Unique Universal Identifier). Dataproc generates this value when it creates the cluster.
- !ruby/object:Api::Type::String
name: 'metrics'
description: |
Output only. Contains cluster daemon metrics such as HDFS and YARN stats.Beta Feature: This report is available for testing purposes only. It may be changed before final release.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
<% project_region_cluster = grab_attributes(pwd)['project_region_cluster'] -%>
describe google_dataproc_project_region_cluster(clusterName: <%= doc_generation ? "' #{project_region_cluster['clusterName']}'":"project_region_cluster['clusterName']" -%>, projectId: <%= doc_generation ? "' #{project_region_cluster['projectId']}'":"project_region_cluster['projectId']" -%>, region: <%= doc_generation ? "' #{project_region_cluster['region']}'":"project_region_cluster['region']" -%>) do
it { should exist }

end

describe google_dataproc_project_region_cluster(clusterName: <%= doc_generation ? "' #{project_region_cluster['clusterName']}'":"project_region_cluster['clusterName']" -%>, projectId: <%= doc_generation ? "' #{project_region_cluster['projectId']}'":"project_region_cluster['projectId']" -%>, region: <%= doc_generation ? "' #{project_region_cluster['region']}'":"project_region_cluster['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.')

project_region_cluster = input('project_region_cluster', value: <%= JSON.pretty_generate(grab_attributes(pwd)['project_region_cluster']) -%>, description: 'project_region_cluster 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)}" -%>
<% project_region_cluster = grab_attributes(pwd)['project_region_cluster'] -%>
describe google_dataproc_project_region_clusters(projectId: <%= doc_generation ? "' #{project_region_cluster['projectId']}'":"project_region_cluster['projectId']" -%>, region: <%= doc_generation ? "' #{project_region_cluster['region']}'":"project_region_cluster['region']" -%>) do
it { should exist }
end
Original file line number Diff line number Diff line change
Expand Up @@ -881,8 +881,14 @@ tensorboard_experiment_run_time_series_resource:
create_time : "value_createtime"
value_type : "value_valuetype"

project_region_cluster:
cluster_name : "value_clustername"
project_id : "value_projectid"
region : "value_region"

project_location_image_version:
parent : "value_parent"

vpn_gateway:
project : "value_project"
region : "value_region"
Expand Down Expand Up @@ -919,4 +925,4 @@ organization:
display_name : "value_displayname"
apigee_project_id : "value_apigeeprojectid"
expires_at : "value_expiresat"
billing_type : "value_billingtype"
billing_type : "value_billingtype"

0 comments on commit 59ce7af

Please sign in to comment.