Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Datastream service & for ConnectionProfile resource #6479

Merged
merged 13 commits into from
Sep 6, 2022
Merged
280 changes: 280 additions & 0 deletions mmv1/products/datastream/api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
# Copyright 2020 Google Inc.
melinath marked this conversation as resolved.
Show resolved Hide resolved
# 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: Datastream
versions:
- !ruby/object:Api::Product::Version
name: ga
base_url: https://datastream.googleapis.com/v1/
scopes:
- https://www.googleapis.com/auth/cloud-platform
apis_required:
- !ruby/object:Api::Product::ApiReference
name: Datastream API
url: https://console.cloud.google.com/apis/library/datastream.googleapis.com
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'
objects:
- !ruby/object:Api::Resource
name: 'ConnectionProfile'
base_url: "projects/{{project}}/locations/{{location}}/connectionProfiles"
create_url: "projects/{{project}}/locations/{{location}}/connectionProfiles?connectionProfileId={{connection_profile_id}}"
self_link: "projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}"
update_verb: :PATCH
update_mask: true
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Official Documentation': 'https://cloud.google.com/datastream/docs/create-connection-profiles'
api: 'https://cloud.google.com/datastream/docs/reference/rest/v1/projects.locations.connectionProfiles'
description: |
A set of reusable connection configurations to be used as a source or destination for a stream.
properties:
- !ruby/object:Api::Type::String
name: 'name'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to prefer renaming connection_profile_id -> name and omitting the output-only name variable because it should be identical to the resource's id field, but there is precedence for both ways so I won't block on that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the absence of a right way - I'd rather leave it called connection_profile_id because that matches the API field. would it make sense to just remove support for the name field since it duplicates id?

output: true
description: The resource's name.
- !ruby/object:Api::Type::String
name: connectionProfileId
description: |-
The connection profile identifier.
required: true
input: true
url_param_only: true
- !ruby/object:Api::Type::String
melinath marked this conversation as resolved.
Show resolved Hide resolved
name: 'location'
description: |
The name of the location this repository is located in.
required: true
input: true
url_param_only: true
- !ruby/object:Api::Type::KeyValuePairs
name: 'labels'
description: Labels.
- !ruby/object:Api::Type::String
name: 'displayName'
required: true
description: Display name.
- !ruby/object:Api::Type::NestedObject
name: 'oracleProfile'
exactly_one_of:
- oracle_profile
- gcs_profile
- mysql_profile
- postgresql_profile
description: |
Oracle database profile.
properties:
- !ruby/object:Api::Type::String
name: 'hostname'
required: true
description: |
Hostname for the Oracle connection.
- !ruby/object:Api::Type::Integer
name: 'port'
default_value: 1521
description: |
Port for the Oracle connection.
- !ruby/object:Api::Type::String
name: 'username'
required: true
description: |
Username for the Oracle connection.
- !ruby/object:Api::Type::String
name: 'password'
required: true
description: |
Password for the Oracle connection.
- !ruby/object:Api::Type::String
name: 'databaseService'
required: true
description: |
Database for the Oracle connection.
- !ruby/object:Api::Type::KeyValuePairs
name: 'connectionAttributes'
description: Connection string attributes
- !ruby/object:Api::Type::NestedObject
name: 'gcsProfile'
exactly_one_of:
- oracle_profile
- gcs_profile
- mysql_profile
- postgresql_profile
description: |
Cloud Storage bucket profile.
properties:
- !ruby/object:Api::Type::String
name: 'bucket'
required: true
description: |
The Cloud Storage bucket name.
- !ruby/object:Api::Type::String
name: 'rootPath'
description: |
The root path inside the Cloud Storage bucket.
- !ruby/object:Api::Type::NestedObject
name: 'mysqlProfile'
exactly_one_of:
- oracle_profile
- gcs_profile
- mysql_profile
- postgresql_profile
description: |
MySQL database profile.
properties:
- !ruby/object:Api::Type::String
name: 'hostname'
required: true
description: |
Hostname for the MySQL connection.
- !ruby/object:Api::Type::Integer
name: 'port'
default_value: 3306
description: |
Port for the MySQL connection.
- !ruby/object:Api::Type::String
name: 'username'
required: true
description: |
Username for the MySQL connection.
- !ruby/object:Api::Type::String
name: 'password'
required: true
input: true
description: |
Password for the MySQL connection.
- !ruby/object:Api::Type::NestedObject
name: 'sslConfig'
description: |
SSL configuration for the MySQL connection.
properties:
- !ruby/object:Api::Type::String
name: 'clientKey'
input: true
description: |
PEM-encoded private key associated with the Client Certificate.
If this field is used then the 'client_certificate' and the
'ca_certificate' fields are mandatory.
- !ruby/object:Api::Type::Boolean
name: 'clientKeySet'
output: true
description: |
Indicates whether the clientKey field is set.
- !ruby/object:Api::Type::String
name: 'clientCertificate'
input: true
description: |
PEM-encoded certificate that will be used by the replica to
authenticate against the source database server. If this field
is used then the 'clientKey' and the 'caCertificate' fields are
mandatory.
- !ruby/object:Api::Type::Boolean
name: 'clientCertificateSet'
output: true
description: |
Indicates whether the clientCertificate field is set.
- !ruby/object:Api::Type::String
name: 'caCertificate'
input: true
description: |
PEM-encoded certificate of the CA that signed the source database
server's certificate.
- !ruby/object:Api::Type::Boolean
name: 'caCertificateSet'
output: true
description: |
Indicates whether the clientKey field is set.
- !ruby/object:Api::Type::NestedObject
name: 'postgresqlProfile'
exactly_one_of:
- oracle_profile
- gcs_profile
- mysql_profile
- postgresql_profile
description: |
PostgreSQL database profile.
properties:
- !ruby/object:Api::Type::String
name: 'hostname'
required: true
description: |
Hostname for the PostgreSQL connection.
- !ruby/object:Api::Type::Integer
name: 'port'
default_value: 5432
description: |
Port for the PostgreSQL connection.
- !ruby/object:Api::Type::String
name: 'username'
required: true
description: |
Username for the PostgreSQL connection.
- !ruby/object:Api::Type::String
name: 'password'
required: true
description: |
Password for the PostgreSQL connection.
- !ruby/object:Api::Type::String
name: 'database'
required: true
description: |
Database for the PostgreSQL connection.
- !ruby/object:Api::Type::NestedObject
name: 'forwardSshConnectivity'
description: |
Forward SSH tunnel connectivity.
properties:
- !ruby/object:Api::Type::String
name: 'hostname'
required: true
description: |
Hostname for the SSH tunnel.
- !ruby/object:Api::Type::String
name: 'username'
required: true
description: |
Username for the SSH tunnel.
- !ruby/object:Api::Type::Integer
name: 'port'
default_value: 22
description: |
Port for the SSH tunnel.
- !ruby/object:Api::Type::String
name: 'password'
input: true
description: |
SSH password.
conflicts:
- forward_ssh_connectivity.private_key
- !ruby/object:Api::Type::String
name: 'privateKey'
input: true
description: |
SSH private key.
conflicts:
- forward_ssh_connectivity.private_key
69 changes: 69 additions & 0 deletions mmv1/products/datastream/terraform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Copyright 2020 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
ConnectionProfile: !ruby/object:Overrides::Terraform::ResourceOverride
id_format: projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}
import_format: ["projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}"]
autogen_async: true
timeouts: !ruby/object:Api::Timeouts
insert_minutes: 20
melinath marked this conversation as resolved.
Show resolved Hide resolved
delete_minutes: 20
properties:
oracleProfile.password: !ruby/object:Overrides::Terraform::PropertyOverride
sensitive: true
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410
custom_flatten: templates/terraform/custom_flatten/datastream_connection_profile_oracle_profile_password.go.erb
mysqlProfile.password: !ruby/object:Overrides::Terraform::PropertyOverride
sensitive: true
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410
custom_flatten: templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_password.go.erb
mysqlProfile.sslConfig.clientKey: !ruby/object:Overrides::Terraform::PropertyOverride
sensitive: true
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410
custom_flatten: templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_ssl_config_client_key.go.erb
mysqlProfile.sslConfig.clientCertificate: !ruby/object:Overrides::Terraform::PropertyOverride
sensitive: true
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410
custom_flatten: templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_ssl_config_client_certificate.go.erb
mysqlProfile.sslConfig.caCertificate: !ruby/object:Overrides::Terraform::PropertyOverride
sensitive: true
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410
custom_flatten: templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_ssl_config_ca_certificate.go.erb
postgresqlProfile.password: !ruby/object:Overrides::Terraform::PropertyOverride
sensitive: true
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410
custom_flatten: templates/terraform/custom_flatten/datastream_connection_profile_postgresql_profile_password.go.erb
forwardSshConnectivity.password: !ruby/object:Overrides::Terraform::PropertyOverride
sensitive: true
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410
custom_flatten: templates/terraform/custom_flatten/datastream_connection_profile_forward_ssh_connectivity_password.go.erb
forwardSshConnectivity.privateKey: !ruby/object:Overrides::Terraform::PropertyOverride
sensitive: true
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410
custom_flatten: templates/terraform/custom_flatten/datastream_connection_profile_forward_ssh_connectivity_private_key.go.erb
examples:
- !ruby/object:Provider::Terraform::Examples
name: "datastream_connection_profile_basic"
primary_resource_id: "default"
vars:
connection_profile_id: "my-profile"
- !ruby/object:Provider::Terraform::Examples
name: "datastream_connection_profile_full"
primary_resource_id: "default"
# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410
ignore_read_extra:
- "forward_ssh_connectivity.0.password"
vars:
connection_profile_id: "my-profile"
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<%# The license inside this block applies to this file.
# 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.
-%>
<%# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 %>
func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return d.Get("forward_ssh_connectivity.0.password")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<%# The license inside this block applies to this file.
# 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.
-%>
<%# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 %>
func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return d.Get("forward_ssh_connectivity.0.private_key")
}
Loading