Skip to content

Commit

Permalink
split remaining api.yaml (GoogleCloudPlatform#7407)
Browse files Browse the repository at this point in the history
  • Loading branch information
c2thorn authored and ericayyliu committed Jul 26, 2023
1 parent 0f3071c commit f9f359f
Show file tree
Hide file tree
Showing 462 changed files with 60,845 additions and 57,002 deletions.
33 changes: 24 additions & 9 deletions mmv1/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,24 +210,39 @@
resources = []
Dir["#{product_name}/*"].each do |file_path|
next if File.basename(file_path) == 'product.yaml' \
|| File.basename(file_path) == 'terraform.yaml'
|| File.basename(file_path) == 'terraform.yaml' \
|| File.extname(file_path) != '.yaml'

if override_dir
# Skip if resource will be merged in the override loop
resource_override_path = File.join(override_dir, file_path)
res_yaml = if File.exist?(resource_override_path)
next if File.exist?(resource_override_path)
end
res_yaml = File.read(file_path)
resource = Api::Compiler.new(res_yaml).run
resource.validate
resources.push(resource)
end

if override_dir
Dir["#{override_dir}#{product_name}/*"].each do |override_path|
next if File.basename(override_path) == 'product.yaml' \
|| File.basename(override_path) == 'terraform.yaml' \
|| File.extname(override_path) != '.yaml'

file_path = File.join(product_name, File.basename(override_path))
res_yaml = if File.exist?(file_path)
YAML.load_file(file_path, permitted_classes: allowed_classes) \
.merge(YAML \
.load_file(resource_override_path, permitted_classes: allowed_classes)) \
.load_file(override_path, permitted_classes: allowed_classes)) \
.to_yaml
else
File.read(file_path)
File.read(override_path)
end
else
res_yaml = File.read(file_path)
resource = Api::Compiler.new(res_yaml).run
resource.validate
resources.push(resource)
end
resource = Api::Compiler.new(res_yaml).run
resource.validate
resources.push(resource)
end
product_api.set_variable(resources, 'objects')
end
Expand Down
191 changes: 191 additions & 0 deletions mmv1/products/certificatemanager/Certificate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
# Copyright 2023 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::Resource
name: 'Certificate'
base_url: 'projects/{{project}}/locations/global/certificates'
create_url: 'projects/{{project}}/locations/global/certificates?certificateId={{name}}'
self_link: 'projects/{{project}}/locations/global/certificates/{{name}}'
update_verb: :PATCH
update_mask: true
description: |
Certificate represents a HTTP-reachable backend for a Certificate.
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'
status: !ruby/object:Api::OpAsync::Status
path: 'done'
complete: true
allowed:
- true
- false
error: !ruby/object:Api::OpAsync::Error
path: 'error'
message: 'message'
parameters:
- !ruby/object:Api::Type::String
name: 'name'
required: true
input: true
url_param_only: true
description: |
A user-defined name of the certificate. Certificate names must be unique
The name must be 1-64 characters long, and match the regular expression [a-zA-Z][a-zA-Z0-9_-]* which means the first character must be a letter,
and all following characters must be a dash, underscore, letter or digit.
properties:
- !ruby/object:Api::Type::String
name: 'description'
description: |
A human-readable description of the resource.
- !ruby/object:Api::Type::KeyValuePairs
name: 'labels'
description: 'Set of label tags associated with the Certificate resource.'
- !ruby/object:Api::Type::String
name: scope
input: true
description: |
The scope of the certificate.
DEFAULT: Certificates with default scope are served from core Google data centers.
If unsure, choose this option.
EDGE_CACHE: Certificates with scope EDGE_CACHE are special-purposed certificates,
served from non-core Google data centers.
Currently allowed only for managed certificates.
default_value: DEFAULT
- !ruby/object:Api::Type::NestedObject
name: selfManaged
input: true
exactly_one_of:
- self_managed
- managed
description: |
Certificate data for a SelfManaged Certificate.
SelfManaged Certificates are uploaded by the user. Updating such
certificates before they expire remains the user's responsibility.
properties:
- !ruby/object:Api::Type::String
name: certificatePem
exactly_one_of:
- self_managed.0.certificate_pem
- self_managed.0.pem_certificate
deprecation_message: "Deprecated in favor of `pem_certificate`"
description: |
**Deprecated** The certificate chain in PEM-encoded form.
Leaf certificate comes first, followed by intermediate ones if any.
- !ruby/object:Api::Type::String
name: privateKeyPem
exactly_one_of:
- self_managed.0.private_key_pem
- self_managed.0.pem_private_key
deprecation_message: "Deprecated in favor of `pem_private_key`"
description: |
**Deprecated** The private key of the leaf certificate in PEM-encoded form.
- !ruby/object:Api::Type::String
name: pemCertificate
exactly_one_of:
- self_managed.0.certificate_pem
- self_managed.0.pem_certificate
description: |
The certificate chain in PEM-encoded form.
Leaf certificate comes first, followed by intermediate ones if any.
- !ruby/object:Api::Type::String
name: pemPrivateKey
exactly_one_of:
- self_managed.0.private_key_pem
- self_managed.0.pem_private_key
description: |
The private key of the leaf certificate in PEM-encoded form.
- !ruby/object:Api::Type::NestedObject
name: managed
input: true
exactly_one_of:
- self_managed
- managed
description: |
Configuration and state of a Managed Certificate.
Certificate Manager provisions and renews Managed Certificates
automatically, for as long as it's authorized to do so.
properties:
- !ruby/object:Api::Type::Array
name: domains
input: true
description: |
The domains for which a managed SSL certificate will be generated.
Wildcard domains are only supported with DNS challenge resolution
item_type: Api::Type::String
- !ruby/object:Api::Type::Array
name: dnsAuthorizations
input: true
description: |
Authorizations that will be used for performing domain authorization
item_type: Api::Type::String
- !ruby/object:Api::Type::String
name: 'state'
output: true
description: |
A state of this Managed Certificate.
- !ruby/object:Api::Type::NestedObject
name: 'provisioningIssue'
output: true
description: |
Information about issues with provisioning this Managed Certificate.
properties:
- !ruby/object:Api::Type::String
name: 'reason'
output: true
description: |
Reason for provisioning failures.
- !ruby/object:Api::Type::String
name: details
output: true
description: |
Human readable explanation about the issue. Provided to help address
the configuration issues.
Not guaranteed to be stable. For programmatic access use `reason` field.
- !ruby/object:Api::Type::Array
name: 'authorizationAttemptInfo'
output: true
description: |
Detailed state of the latest authorization attempt for each domain
specified for this Managed Certificate.
item_type: !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::String
name: domain
output: true
description: |
Domain name of the authorization attempt.
- !ruby/object:Api::Type::String
name: 'state'
output: true
description: |
State of the domain for managed certificate issuance.
- !ruby/object:Api::Type::String
name: 'failureReason'
output: true
description: |
Reason for failure of the authorization attempt for the domain.
- !ruby/object:Api::Type::String
name: details
output: true
description: |
Human readable explanation for reaching the state. Provided to help
address the configuration issues.
Not guaranteed to be stable. For programmatic access use `failure_reason` field.
106 changes: 106 additions & 0 deletions mmv1/products/certificatemanager/CertificateMap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Copyright 2023 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::Resource
name: 'CertificateMap'
base_url: 'projects/{{project}}/locations/global/certificateMaps'
create_url: 'projects/{{project}}/locations/global/certificateMaps?certificateMapId={{name}}'
self_link: 'projects/{{project}}/locations/global/certificateMaps/{{name}}'
update_verb: :PATCH
update_mask: true
description: |
CertificateMap defines a collection of certificate configurations,
which are usable by any associated target proxies
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'
status: !ruby/object:Api::OpAsync::Status
path: 'done'
complete: true
allowed:
- true
- false
error: !ruby/object:Api::OpAsync::Error
path: 'error'
message: 'message'
parameters:
- !ruby/object:Api::Type::String
name: 'name'
required: true
input: true
url_param_only: true
pattern: projects/{{project}}/locations/global/certificateMaps/{{name}}
description: |
A user-defined name of the Certificate Map. Certificate Map names must be unique
globally and match the pattern `projects/*/locations/*/certificateMaps/*`.
properties:
- !ruby/object:Api::Type::String
name: 'description'
description: |
A human-readable description of the resource.
- !ruby/object:Api::Type::String
name: 'createTime'
output: true
description: |
Creation timestamp of a Certificate Map. Timestamp is in RFC3339 UTC "Zulu" format,
accurate to nanoseconds with up to nine fractional digits.
Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- !ruby/object:Api::Type::Time
name: 'updateTime'
description: |
Update timestamp of a Certificate Map. Timestamp is in RFC3339 UTC "Zulu" format,
accurate to nanoseconds with up to nine fractional digits.
Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
output: true
- !ruby/object:Api::Type::KeyValuePairs
name: 'labels'
description: |
Set of labels associated with a Certificate Map resource.
- !ruby/object:Api::Type::Array
name: 'gclbTargets'
description: |
A list of target proxies that use this Certificate Map
output: true
item_type: !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::Array
name: 'ipConfigs'
description: |
An IP configuration where this Certificate Map is serving
item_type: !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::String
name: 'ipAddress'
description : |
An external IP address
- !ruby/object:Api::Type::Array
name: 'ports'
description : |
A list of ports
item_type: Api::Type::Integer
- !ruby/object:Api::Type::String
name: 'targetHttpsProxy'
description: |
Proxy name must be in the format projects/*/locations/*/targetHttpsProxies/*.
This field is part of a union field `target_proxy`: Only one of `targetHttpsProxy` or
`targetSslProxy` may be set.
- !ruby/object:Api::Type::String
name: 'targetSslProxy'
description: |
Proxy name must be in the format projects/*/locations/*/targetSslProxies/*.
This field is part of a union field `target_proxy`: Only one of `targetHttpsProxy` or
`targetSslProxy` may be set.
Loading

0 comments on commit f9f359f

Please sign in to comment.