-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Gemini Gemini Gcp Enablement Setting resource (#12896)
Co-authored-by: Shuya Ma <[email protected]>
- Loading branch information
1 parent
5519073
commit aa0365e
Showing
3 changed files
with
145 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,71 @@ | ||
# Copyright 2025 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. | ||
|
||
--- | ||
name: GeminiGcpEnablementSetting | ||
description: The resource for managing GeminiGcpEnablement settings for Admin Control. | ||
min_version: 'beta' | ||
base_url: projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings | ||
update_mask: true | ||
self_link: projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings/{{gemini_gcp_enablement_setting_id}} | ||
create_url: projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings?geminiGcpEnablementSettingId={{gemini_gcp_enablement_setting_id}} | ||
update_verb: PATCH | ||
id_format: projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings/{{gemini_gcp_enablement_setting_id}} | ||
import_format: | ||
- projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings/{{gemini_gcp_enablement_setting_id}} | ||
mutex: projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings/{{gemini_gcp_enablement_setting_id}} | ||
examples: | ||
- name: gemini_gemini_gcp_enablement_setting_basic | ||
min_version: 'beta' | ||
primary_resource_id: example | ||
vars: | ||
gemini_gcp_enablement_setting_id: ls1-tf | ||
autogen_async: false | ||
autogen_status: R2VtaW5pR2NwRW5hYmxlbWVudFNldHRpbmc= | ||
parameters: | ||
- name: location | ||
type: String | ||
description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. | ||
immutable: true | ||
url_param_only: true | ||
required: true | ||
- name: geminiGcpEnablementSettingId | ||
type: String | ||
description: |- | ||
Required. Id of the requesting object. | ||
If auto-generating Id server-side, remove this field and | ||
gemini_gcp_enablement_setting_id from the method_signature of Create RPC | ||
immutable: true | ||
url_param_only: true | ||
required: true | ||
properties: | ||
- name: name | ||
type: String | ||
description: |- | ||
Identifier. Name of the resource. | ||
Format:projects/{project}/locations/{location}/geminiGcpEnablementSettings/{geminiGcpEnablementSetting} | ||
output: true | ||
- name: createTime | ||
type: String | ||
description: Output only. [Output only] Create time stamp. | ||
output: true | ||
- name: updateTime | ||
type: String | ||
description: Output only. [Output only] Update time stamp. | ||
output: true | ||
- name: labels | ||
type: KeyValueLabels | ||
description: Optional. Labels as key value pairs. | ||
- name: enableCustomerDataSharing | ||
type: Boolean | ||
description: Optional. Whether customer data sharing should be enabled. |
6 changes: 6 additions & 0 deletions
6
mmv1/templates/terraform/examples/gemini_gemini_gcp_enablement_setting_basic.tf.tmpl
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,6 @@ | ||
resource "google_gemini_gemini_gcp_enablement_setting" "{{$.PrimaryResourceId}}" { | ||
provider = google-beta | ||
gemini_gcp_enablement_setting_id = "{{index $.Vars "gemini_gcp_enablement_setting_id"}}" | ||
location = "global" | ||
enable_customer_data_sharing = true | ||
} |
68 changes: 68 additions & 0 deletions
68
...arty/terraform/services/gemini/resource_gemini_gemini_gcp_enablement_setting_test.go.tmpl
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,68 @@ | ||
package gemini_test | ||
{{- if ne $.TargetVersionName "ga" }} | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
"github.com/hashicorp/terraform-plugin-testing/plancheck" | ||
"github.com/hashicorp/terraform-provider-google/google/acctest" | ||
) | ||
|
||
func TestAccGeminiGeminiGcpEnablementSetting_geminiGeminiGcpEnablementSettingBasicExample_update(t *testing.T) { | ||
t.Parallel() | ||
context := map[string]interface{}{ | ||
"setting_id": fmt.Sprintf("tf-test-ls-%s", acctest.RandString(t, 10)), | ||
} | ||
acctest.VcrTest(t, resource.TestCase{ | ||
PreCheck: func() { acctest.AccTestPreCheck(t) }, | ||
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccGeminiGeminiGcpEnablementSetting_geminiGeminiGcpEnablementSettingBasicExample_basic(context), | ||
}, | ||
{ | ||
ResourceName: "google_gemini_gemini_gcp_enablement_setting.example", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"labels", "location", "gemini_gcp_enablement_setting_id", "terraform_labels"}, | ||
}, | ||
{ | ||
Config: testAccGeminiGeminiGcpEnablementSetting_geminiGeminiGcpEnablementSettingBasicExample_update(context), | ||
ConfigPlanChecks: resource.ConfigPlanChecks{ | ||
PreApply: []plancheck.PlanCheck{ | ||
plancheck.ExpectResourceAction("google_gemini_gemini_gcp_enablement_setting.example", plancheck.ResourceActionUpdate), | ||
}, | ||
}, | ||
}, | ||
{ | ||
ResourceName: "google_gemini_gemini_gcp_enablement_setting.example", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"labels", "location", "gemini_gcp_enablement_setting_id", "terraform_labels"}, | ||
}, | ||
}, | ||
}) | ||
} | ||
func testAccGeminiGeminiGcpEnablementSetting_geminiGeminiGcpEnablementSettingBasicExample_basic(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_gemini_gemini_gcp_enablement_setting" "example" { | ||
provider = google-beta | ||
gemini_gcp_enablement_setting_id = "%{setting_id}" | ||
location = "global" | ||
enable_customer_data_sharing = true | ||
} | ||
`, context) | ||
} | ||
func testAccGeminiGeminiGcpEnablementSetting_geminiGeminiGcpEnablementSettingBasicExample_update(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_gemini_gemini_gcp_enablement_setting" "example" { | ||
provider = google-beta | ||
gemini_gcp_enablement_setting_id = "%{setting_id}" | ||
location = "global" | ||
enable_customer_data_sharing = false | ||
} | ||
`, context) | ||
} | ||
{{ end }} |