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

Add integrations product. Create Client resource. #10186

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions mmv1/products/integrations/Client.yaml
Original file line number Diff line number Diff line change
@@ -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:
c2thorn marked this conversation as resolved.
Show resolved Hide resolved
key_ring_name: my-keyring
22 changes: 22 additions & 0 deletions mmv1/products/integrations/product.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions mmv1/templates/terraform/decoders/integrations_client.go.erb
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resource "google_integrations_client" "<%= ctx[:primary_resource_id] %>" {
location = "us-central1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading