forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integrations product. Create Client resource. (GoogleCloudPlatfor…
…m#10186) Co-authored-by: Cameron Thornton <[email protected]>
- Loading branch information
1 parent
65a0060
commit ff8b7ce
Showing
7 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
key_ring_name: my-keyring |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
34 changes: 34 additions & 0 deletions
34
mmv1/templates/terraform/examples/integrations_client_advance.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | ||
} |
3 changes: 3 additions & 0 deletions
3
mmv1/templates/terraform/examples/integrations_client_basic.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters