From ff8b7ce768ad31143cd0e24fe0bb426309e28dc5 Mon Sep 17 00:00:00 2001 From: Rohit Jangid Date: Thu, 21 Mar 2024 03:25:51 +0530 Subject: [PATCH] Add integrations product. Create Client resource. (#10186) Co-authored-by: Cameron Thornton --- mmv1/products/integrations/Client.yaml | 112 ++++++++++++++++++ mmv1/products/integrations/product.yaml | 22 ++++ .../decoders/integrations_client.go.erb | 4 + .../integrations_client_advance.tf.erb | 34 ++++++ .../examples/integrations_client_basic.tf.erb | 3 + .../components/inputs/services_beta.kt | 5 + .../components/inputs/services_ga.kt | 5 + 7 files changed, 185 insertions(+) create mode 100644 mmv1/products/integrations/Client.yaml create mode 100644 mmv1/products/integrations/product.yaml create mode 100644 mmv1/templates/terraform/decoders/integrations_client.go.erb create mode 100644 mmv1/templates/terraform/examples/integrations_client_advance.tf.erb create mode 100644 mmv1/templates/terraform/examples/integrations_client_basic.tf.erb diff --git a/mmv1/products/integrations/Client.yaml b/mmv1/products/integrations/Client.yaml new file mode 100644 index 000000000000..b6f538e38d06 --- /dev/null +++ b/mmv1/products/integrations/Client.yaml @@ -0,0 +1,112 @@ +# Copyright 2024 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: 'Client' +description: | + Application Integration Client. +references: !ruby/object:Api::Resource::ReferenceLinks + guides: + 'Official Documentation': 'https://cloud.google.com/application-integration/docs/overview' + 'Set up Application Integration': 'https://cloud.google.com/application-integration/docs/setup-application-integration' + api: 'https://cloud.google.com/application-integration/docs/reference/rest/v1/projects.locations.clients' +base_url: 'projects/{{project}}/locations/{{location}}/clients' +self_link: 'projects/{{project}}/locations/{{location}}/clients' +immutable: true +create_url: 'projects/{{project}}/locations/{{location}}/clients:provision' +autogen_async: false +skip_delete: true +import_format: + [ + 'projects/{{project}}/locations/{{location}}/clients', + ] +mutex: Client/{{location}} +custom_code: !ruby/object:Provider::Terraform::CustomCode + decoder: templates/terraform/decoders/integrations_client.go.erb +parameters: + - !ruby/object:Api::Type::String + name: 'location' + required: true + immutable: true + url_param_only: true + description: | + Location in which client needs to be provisioned. +properties: + - !ruby/object:Api::Type::NestedObject + name: 'cloudKmsConfig' + description: | + Cloud KMS config for AuthModule to encrypt/decrypt credentials. + immutable: true + url_param_only: true + properties: + - !ruby/object:Api::Type::String + name: "kmsLocation" + required: true + description: | + Location name of the key ring, e.g. "us-west1". + - !ruby/object:Api::Type::String + name: "kmsRing" + required: true + description: | + A key ring organizes keys in a specific Google Cloud location and allows you to + manage access control on groups of keys. A key ring's name does not need to be + unique across a Google Cloud project, but must be unique within a given location. + - !ruby/object:Api::Type::String + name: "key" + required: true + description: | + A Cloud KMS key is a named object containing one or more key versions, along + with metadata for the key. A key exists on exactly one key ring tied to a + specific location. + - !ruby/object:Api::Type::String + name: "keyVersion" + description: | + Each version of a key contains key material used for encryption or signing. + A key's version is represented by an integer, starting at 1. To decrypt data + or verify a signature, you must use the same key version that was used to + encrypt or sign the data. + - !ruby/object:Api::Type::String + name: "kmsProjectId" + description: | + The Google Cloud project id of the project where the kms key stored. If empty, + the kms key is stored at the same project as customer's project and ecrypted + with CMEK, otherwise, the kms key is stored in the tenant project and + encrypted with GMEK. + - !ruby/object:Api::Type::Boolean + name: 'createSampleWorkflows' + description: | + Indicates if sample workflow should be created along with provisioning. + immutable: true + url_param_only: true + - !ruby/object:Api::Type::Boolean + name: 'provisionGmek' + description: | + Indicates provision with GMEK or CMEK. + immutable: true + url_param_only: true + - !ruby/object:Api::Type::String + name: 'runAsServiceAccount' + description: | + User input run-as service account, if empty, will bring up a new default service account. + immutable: true + url_param_only: true +examples: + - !ruby/object:Provider::Terraform::Examples + name: "integrations_client_basic" + primary_resource_id: "example" + - !ruby/object:Provider::Terraform::Examples + name: "integrations_client_advance" + primary_resource_id: "example" + skip_vcr: true + vars: + key_ring_name: my-keyring diff --git a/mmv1/products/integrations/product.yaml b/mmv1/products/integrations/product.yaml new file mode 100644 index 000000000000..6c3e6a796e60 --- /dev/null +++ b/mmv1/products/integrations/product.yaml @@ -0,0 +1,22 @@ +# 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:Api::Product +name: Integrations +display_name: Application Integration +versions: + - !ruby/object:Api::Product::Version + name: ga + base_url: https://integrations.googleapis.com/v1/ +scopes: + - https://www.googleapis.com/auth/cloud-platform diff --git a/mmv1/templates/terraform/decoders/integrations_client.go.erb b/mmv1/templates/terraform/decoders/integrations_client.go.erb new file mode 100644 index 000000000000..f0a1abfd8804 --- /dev/null +++ b/mmv1/templates/terraform/decoders/integrations_client.go.erb @@ -0,0 +1,4 @@ +// Since Client resource doesnt have any properties, +// Adding this decoder as placeholder else the linter will +// complain that the returned `res` is never used afterwards. +return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/integrations_client_advance.tf.erb b/mmv1/templates/terraform/examples/integrations_client_advance.tf.erb new file mode 100644 index 000000000000..54e2de273ca9 --- /dev/null +++ b/mmv1/templates/terraform/examples/integrations_client_advance.tf.erb @@ -0,0 +1,34 @@ +data "google_project" "test_project" { +} + +resource "google_kms_key_ring" "keyring" { + name = "<%= ctx[:vars]['key_ring_name'] %>" + location = "us-central1" +} + +resource "google_kms_crypto_key" "cryptokey" { + name = "crypto-key-example" + key_ring = google_kms_key_ring.keyring.id + rotation_period = "7776000s" + depends_on = [google_kms_key_ring.keyring] +} + +resource "google_kms_crypto_key_version" "test_key" { + crypto_key = google_kms_crypto_key.cryptokey.id + depends_on = [google_kms_crypto_key.cryptokey] +} + +resource "google_integrations_client" "<%= ctx[:primary_resource_id] %>" { + location = "us-central1" + create_sample_workflows = true + provision_gmek = true + run_as_service_account = "radndom-service-account" + cloud_kms_config { + kms_location = "us-central1" + kms_ring = google_kms_key_ring.keyring.id + key = google_kms_crypto_key.cryptokey.id + key_version = google_kms_crypto_key_version.test_key.id + kms_project_id = data.google_project.test_project.id + } + depends_on = [google_kms_crypto_key_version.test_key] +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/integrations_client_basic.tf.erb b/mmv1/templates/terraform/examples/integrations_client_basic.tf.erb new file mode 100644 index 000000000000..1fc724bcf539 --- /dev/null +++ b/mmv1/templates/terraform/examples/integrations_client_basic.tf.erb @@ -0,0 +1,3 @@ +resource "google_integrations_client" "<%= ctx[:primary_resource_id] %>" { + location = "us-central1" +} \ No newline at end of file diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt b/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt index 13510630f136..613e795bf683 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt @@ -466,6 +466,11 @@ var ServicesListBeta = mapOf( "displayName" to "Integrationconnectors", "path" to "./google-beta/services/integrationconnectors" ), + "integrations" to mapOf( + "name" to "integrations", + "displayName" to "Applicationintegration", + "path" to "./google-beta/services/integrations" + ), "kms" to mapOf( "name" to "kms", "displayName" to "Kms", diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt b/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt index f4b303eccc69..f3a3fe573889 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt @@ -461,6 +461,11 @@ var ServicesListGa = mapOf( "displayName" to "Integrationconnectors", "path" to "./google/services/integrationconnectors" ), + "integrations" to mapOf( + "name" to "integrations", + "displayName" to "Applicationintegration", + "path" to "./google/services/integrations" + ), "kms" to mapOf( "name" to "kms", "displayName" to "Kms",