Skip to content

Commit

Permalink
Merge branch 'GoogleCloudPlatform:main' into gpu-config
Browse files Browse the repository at this point in the history
  • Loading branch information
grac3gao authored Oct 6, 2022
2 parents 7da9f35 + 45c341d commit 0816c24
Show file tree
Hide file tree
Showing 50 changed files with 1,227 additions and 59 deletions.
4 changes: 2 additions & 2 deletions mmv1/api/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def required_properties
def all_nested_properties(props)
nested = props
props.each do |prop|
if !prop.flatten_object && prop.nested_properties?
if !prop.flatten_object && !prop.nested_properties.nil?
nested += all_nested_properties(prop.nested_properties)
end
end
Expand Down Expand Up @@ -449,7 +449,7 @@ def resourcerefs_for_properties(props, original_obj)
rrefs.concat(resourcerefs_for_properties(p.resource_ref
.required_properties,
original_obj))
elsif p.nested_properties?
elsif !p.nested_properties.nil?
rrefs.concat(resourcerefs_for_properties(p.nested_properties, original_obj))
elsif p.is_a? Api::Type::Array
if p.item_type.is_a? Api::Type::ResourceRef
Expand Down
6 changes: 1 addition & 5 deletions mmv1/api/type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,7 @@ def class

# Returns nested properties for this property.
def nested_properties
[]
end

def nested_properties?
!nested_properties.empty?
nil
end

def removed?
Expand Down
3 changes: 2 additions & 1 deletion mmv1/overrides/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def build(api, overrides, res_override_class = Overrides::ResourceOverride,

validator = Overrides::Validator.new(api, overrides)
validator.run

build_product(api, overrides, resource: res_override_class, property: prop_override_class)
end

Expand Down Expand Up @@ -131,7 +132,7 @@ def build_property(old_property, property_overrides, override_classes, prefix =
new_prop = build_primitive_property(old_property,
property_overrides["#{prefix}#{old_property.name}"],
override_classes)
if old_property.nested_properties?
unless old_property.nested_properties.nil?
new_props = old_property.nested_properties.map do |p|
build_property(p, property_overrides, override_classes,
"#{prefix}#{old_property.name}.")
Expand Down
8 changes: 7 additions & 1 deletion mmv1/overrides/terraform/resource_override.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ def self.attributes
:read_error_transform,

# If true, only generate tests and cgc samples
:cgc_only
:cgc_only,

# If true, resources that failed creation will be marked as tainted. As a consequence
# these resources will be deleted and recreated on the next apply call. This pattern
# is preferred over deleting the resource directly in post_create_failure hooks.
:taint_resource_on_failed_create
]
end

Expand Down Expand Up @@ -130,6 +135,7 @@ def validate
check :supports_indirect_user_project_override, type: :boolean, default: false
check :read_error_transform, type: String
check :cgc_only, type: :boolean, default: false
check :taint_resource_on_failed_create, type: :boolean, default: false
end

def apply(resource)
Expand Down
97 changes: 97 additions & 0 deletions mmv1/products/bigquerydatapolicy/api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Copyright 2022 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
!ruby/object:Api::Product
name: BigqueryDatapolicy
display_name: BigQuery Data Policy
scopes:
- https://www.googleapis.com/auth/cloud-platform
versions:
- !ruby/object:Api::Product::Version
name: beta
base_url: https://bigquerydatapolicy.googleapis.com/v1beta1/
apis_required:
- !ruby/object:Api::Product::ApiReference
name: BigQuery Data Policy API
url: https://console.cloud.google.com/apis/library/bigquerydatapolicy.googleapis.com/
objects:
- !ruby/object:Api::Resource
name: "DataPolicy"
min_version: beta
base_url: projects/{{project}}/locations/{{location}}/dataPolicies
create_url: projects/{{project}}/locations/{{location}}/dataPolicies
self_link: projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}
update_verb: :PATCH
update_mask: true
description: A BigQuery Data Policy
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
"Official Documentation": "https://cloud.google.com/bigquery/docs/column-data-masking-intro"
api: "https://cloud.google.com/bigquery/docs/reference/bigquerydatapolicy/rest/v1beta1/projects.locations.dataPolicies/create"
iam_policy: !ruby/object:Api::Resource::IamPolicy
exclude: false
method_name_separator: ":"
fetch_iam_policy_verb: :POST
parent_resource_attribute: "data_policy_id"
import_format:
[
"projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}",
"{{data_policy_id}}"
]
properties:
- !ruby/object:Api::Type::String
name: name
description: |-
Resource name of this data policy, in the format of projects/{project_number}/locations/{locationId}/dataPolicies/{dataPolicyId}.
output: true
- !ruby/object:Api::Type::String
name: dataPolicyId
description: |-
User-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {dataPolicyId} in part of the resource name.
required: true
input: true
- !ruby/object:Api::Type::String
name: location
description: |
The name of the location of the data policy.
required: true
input: true
url_param_only: true
- !ruby/object:Api::Type::String
name: policyTag
description: |-
Policy tag resource name, in the format of projects/{project_number}/locations/{locationId}/taxonomies/{taxonomyId}/policyTags/{policyTag_id}.
required: true
- !ruby/object:Api::Type::Enum
name: dataPolicyType
description: |
The enrollment level of the service.
required: true
values:
- :COLUMN_LEVEL_SECURITY_POLICY
- :DATA_MASKING_POLICY
- !ruby/object:Api::Type::NestedObject
name: "dataMaskingPolicy"
description: |
The data masking policy that specifies the data masking rule to use.
properties:
- !ruby/object:Api::Type::Enum
name: "predefinedExpression"
required: true
description: |-
The available masking rules. Learn more here: https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options.
values:
- :SHA256
- :ALWAYS_NULL
- :DEFAULT_MASKING_VALUE
36 changes: 36 additions & 0 deletions mmv1/products/bigquerydatapolicy/terraform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2022 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
!ruby/object:Provider::Terraform::Config
overrides: !ruby/object:Overrides::ResourceOverrides
DataPolicy: !ruby/object:Overrides::Terraform::ResourceOverride
id_format: projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}
import_format:
[
"projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}",
"{{project}}/{{location}}/{{data_policy_id}}",
"{{location}}/{{data_policy_id}}"
]
examples:
- !ruby/object:Provider::Terraform::Examples
name: "bigquery_datapolicy_data_policy_basic"
min_version: beta
primary_resource_id: "data_policy"
primary_resource_name: 'fmt.Sprintf("tf_test_data_policy%s", context["random_suffix"])'
vars:
data_policy_id: "data_policy"
taxonomy: "taxonomy"
properties:
policyTag: !ruby/object:Overrides::Terraform::PropertyOverride
diff_suppress_func: "projectNumberDiffSuppress"
14 changes: 12 additions & 2 deletions mmv1/products/bigqueryreservation/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ display_name: BigQuery Reservation
versions:
- !ruby/object:Api::Product::Version
name: beta
base_url: https://bigqueryreservation.googleapis.com/v1beta1/
base_url: https://bigqueryreservation.googleapis.com/v1/
- !ruby/object:Api::Product::Version
name: ga
base_url: https://bigqueryreservation.googleapis.com/v1/
Expand All @@ -39,7 +39,7 @@ objects:
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
"Introduction to Reservations": "https://cloud.google.com/bigquery/docs/reservations-intro"
api: "https://cloud.google.com/bigquery/docs/reference/reservations/rest/v1beta1/projects.locations.reservations/create"
api: "https://cloud.google.com/bigquery/docs/reference/reservations/rest/v1/projects.locations.reservations/create"
parameters:
- !ruby/object:Api::Type::String
name: 'location'
Expand Down Expand Up @@ -70,3 +70,13 @@ objects:
If false, any query using this reservation will use idle slots from other reservations within
the same admin project. If true, a query using this reservation will execute with the slot
capacity specified above at most.
- !ruby/object:Api::Type::Integer
name: 'concurrency'
default_value: 0
description: |
Maximum number of queries that are allowed to run concurrently in this reservation. This is a soft limit due to asynchronous nature of the system and various optimizations for small queries. Default value is 0 which means that concurrency will be automatically set based on the reservation size.
- !ruby/object:Api::Type::Boolean
name: 'multiRegionAuxiliary'
description: |
Applicable only for reservations located within one of the BigQuery multi-regions (US or EU).
If set to true, this reservation is placed in the organization's secondary region which is designated for disaster recovery purposes. If false, this reservation is placed in the organization's default region.
93 changes: 89 additions & 4 deletions mmv1/products/compute/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15450,9 +15450,7 @@ objects:
this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
- !ruby/object:Api::Resource
name: 'RegionTargetHttpProxy'
kind: 'compute#targetHttpProxy'
base_url: projects/{{project}}/regions/{{region}}/targetHttpProxies
collection_url_key: 'items'
has_self_link: true
input: true
description: |
Expand Down Expand Up @@ -15525,9 +15523,7 @@ objects:
update_url: 'projects/{{project}}/regions/{{region}}/targetHttpProxies/{{name}}/setUrlMap'
- !ruby/object:Api::Resource
name: 'RegionTargetHttpsProxy'
kind: 'compute#targetHttpsProxy'
base_url: projects/{{project}}/regions/{{region}}/targetHttpsProxies
collection_url_key: 'items'
has_self_link: true
input: true
description: |
Expand Down Expand Up @@ -15647,6 +15643,95 @@ objects:
required: true
update_verb: :POST
update_url: 'projects/{{project}}/regions/{{region}}/targetHttpsProxies/{{name}}/setUrlMap'
- !ruby/object:Api::Resource
name: 'RegionTargetTcpProxy'
base_url: projects/{{project}}/regions/{{region}}/targetTcpProxies
has_self_link: true
input: true
description: |
Represents a RegionTargetTcpProxy resource, which is used by one or more
forwarding rules to route incoming TCP requests to a regional TCP proxy load
balancer.
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Official Documentation':
'https://cloud.google.com/load-balancing/docs/tcp/internal-proxy'
api: 'https://cloud.google.com/compute/docs/reference/rest/beta/targetTcpProxies'
min_version: beta
async: !ruby/object:Api::OpAsync
operation: !ruby/object:Api::OpAsync::Operation
kind: 'compute#operation'
path: 'name'
base_url: 'projects/{{project}}/regions/{{region}}/operations/{{op_id}}'
wait_ms: 1000
result: !ruby/object:Api::OpAsync::Result
path: 'targetLink'
status: !ruby/object:Api::OpAsync::Status
path: 'status'
complete: 'DONE'
allowed:
- 'PENDING'
- 'RUNNING'
- 'DONE'
error: !ruby/object:Api::OpAsync::Error
path: 'error/errors'
message: 'message'
parameters:
- !ruby/object:Api::Type::ResourceRef
name: 'region'
resource: 'Region'
imports: 'name'
required: true
input: true
description: |
The region where the regional proxy resides.
properties:
- !ruby/object:Api::Type::Time
name: 'creationTimestamp'
description: 'Creation timestamp in RFC3339 text format.'
output: true
- !ruby/object:Api::Type::String
name: 'description'
description: 'An optional description of this resource.'
input: true
- !ruby/object:Api::Type::Integer
name: 'proxyId'
api_name: 'id'
description: 'The unique identifier for the resource.'
output: true
- !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.
input: true
required: true
- !ruby/object:Api::Type::Enum
name: 'proxyHeader'
description: |
Specifies the type of proxy header to append before sending data to
the backend.
values:
- :NONE
- :PROXY_V1
default_value: :NONE
- !ruby/object:Api::Type::ResourceRef
name: 'service'
resource: 'RegionBackendService'
imports: 'selfLink'
description: |
A reference to the BackendService resource.
required: true
- !ruby/object:Api::Type::Boolean
name: 'proxyBind'
description: |
This field only applies when the forwarding rule that references
this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
- !ruby/object:Api::Resource
name: 'TargetInstance'
kind: 'compute#targetInstance'
Expand Down
21 changes: 21 additions & 0 deletions mmv1/products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3221,6 +3221,27 @@ overrides: !ruby/object:Overrides::ResourceOverrides
default_value: :NONE
proxyBind: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
RegionTargetTcpProxy: !ruby/object:Overrides::Terraform::ResourceOverride
examples:
- !ruby/object:Provider::Terraform::Examples
name: "region_target_tcp_proxy_basic"
primary_resource_id: "default"
vars:
region_target_tcp_proxy_name: "test-proxy"
region_backend_service_name: "backend-service"
health_check_name: "health-check"
properties:
service: !ruby/object:Overrides::Terraform::PropertyOverride
name: backendService
proxyBind: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
region: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
required: false
custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb'
description: |
The Region in which the created target TCP proxy should reside.
If it is not provided, the provider region is used.
TargetVpnGateway: !ruby/object:Overrides::Terraform::ResourceOverride
name: 'VpnGateway'
docs: !ruby/object:Provider::Terraform::Docs
Expand Down
Loading

0 comments on commit 0816c24

Please sign in to comment.