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 Gemini Gemini Gcp Enablement Setting Binding resource #12897

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
102 changes: 102 additions & 0 deletions mmv1/products/gemini/GeminiGcpEnablementSettingBinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# 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: GeminiGcpEnablementSettingBinding
description: The resource for managing GeminiGcpEnablementSetting setting bindings for Admin Control.
base_url: projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings/{{gemini_gcp_enablement_setting_id}}/settingBindings
self_link: projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings/{{gemini_gcp_enablement_setting_id}}/settingBindings/{{setting_binding_id}}
create_url: projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings/{{gemini_gcp_enablement_setting_id}}/settingBindings?settingBindingId={{setting_binding_id}}
id_format: projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings/{{gemini_gcp_enablement_setting_id}}/settingBindings/{{setting_binding_id}}
update_verb: PATCH
update_mask: true
import_format:
- projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings/{{gemini_gcp_enablement_setting_id}}/settingBindings/{{setting_binding_id}}
mutex: projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings/{{gemini_gcp_enablement_setting_id}}
examples:
- name: gemini_gemini_gcp_enablement_setting_binding_basic
min_version: 'beta'
primary_resource_id: example
vars:
gemini_gcp_enablement_setting_id: ls-tf1
setting_binding_id: ls-tf1b1
target: projects/980109375338
PerlMonker303 marked this conversation as resolved.
Show resolved Hide resolved
autogen_async: true
async:
operation:
timeouts:
insert_minutes: 90
update_minutes: 90
delete_minutes: 90
base_url: '{{op_id}}'
actions:
- create
- delete
- update
type: OpAsync
result:
resource_inside_response: true
include_project: false
autogen_status: U2V0dGluZ0JpbmRpbmdCeVByb2plY3RBbmRMb2NhdGlvbkFuZEdlbWluaWdjcGVuYWJsZW1lbnRzZXR0aW5n
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: 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: settingBindingId
type: String
description: |-
Required. Id of the requesting object.
If auto-generating Id server-side, remove this field and
setting_id from the method_signature of Create RPC.
immutable: true
url_param_only: true
required: true
properties:
- name: labels
type: KeyValueLabels
description: Optional. Labels as key value pairs.
- name: target
type: String
description: Required. Target of the binding.
required: true
- name: product
PerlMonker303 marked this conversation as resolved.
Show resolved Hide resolved
type: String
description: |-
Required. Product type of the setting binding.
Possible values:
PRODUCT_UNSPECIFIED
GEMINI_CLOUD_ASSIST
GEMINI_CODE_ASSIST
- name: name
type: String
description: |-
Identifier. Name of the resource.
Format:projects/{project}/locations/{location}/{settingType}/{setting}/settingBindings/{setting_binding}
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
resource "google_gemini_gemini_gcp_enablement_setting" "basic" {
provider = google-beta
gemini_gcp_enablement_setting_id = "{{index $.Vars "gemini_gcp_enablement_setting_id"}}"
location = "global"
enable_customer_data_sharing = true
}

resource "google_gemini_gemini_gcp_enablement_setting_binding" "{{$.PrimaryResourceId}}" {
provider = google-beta
gemini_gcp_enablement_setting_id = "{{index $.Vars "gemini_gcp_enablement_setting_id"}}"
setting_binding_id = "{{index $.Vars "setting_binding_id"}}"
location = "global"
target = "{{index $.Vars "target"}}"
depends_on = [google_gemini_gemini_gcp_enablement_setting.basic]
PerlMonker303 marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package gemini_test
{{- if ne $.TargetVersionName "ga" }}

import (
"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 TestAccGeminiLoggingSettingBinding_geminiLoggingSettingBindingBasicExample_update(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"logging_setting_id": "ls-tf1",
"setting_binding_id": "ls-tf1b1",
"target": "projects/980109375338",
"new_target": "projects/283661608541",
}

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
Steps: []resource.TestStep{
{
Config: testAccGeminiLoggingSettingBinding_geminiLoggingSettingBindingBasicExample_basic(context),
},
{
ResourceName: "google_gemini_logging_setting_binding.basic_binding",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"labels", "location", "logging_setting_id", "terraform_labels"},
},
{
Config: testAccGeminiLoggingSettingBinding_geminiLoggingSettingBindingBasicExample_update(context),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("google_gemini_logging_setting_binding.basic_binding", plancheck.ResourceActionUpdate),
},
},
},
{
ResourceName: "google_gemini_logging_setting_binding.basic_binding",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"labels", "location", "logging_setting_id", "terraform_labels"},
},
},
})
}

func testAccGeminiLoggingSettingBinding_geminiLoggingSettingBindingBasicExample_basic(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_gemini_logging_setting" "basic" {
provider = google-beta
logging_setting_id = "%{logging_setting_id}"
location = "global"
log_prompts_and_responses = true
}

resource "google_gemini_logging_setting_binding" "basic_binding" {
provider = google-beta
logging_setting_id = "%{logging_setting_id}"
setting_binding_id = "%{setting_binding_id}"
location = "global"
target = "%{target}"
depends_on = [google_gemini_logging_setting.basic]
}
`, context)
}

func testAccGeminiLoggingSettingBinding_geminiLoggingSettingBindingBasicExample_update(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_gemini_logging_setting" "basic" {
provider = google-beta
logging_setting_id = "%{logging_setting_id}"
location = "global"
log_prompts_and_responses = true
}

resource "google_gemini_logging_setting_binding" "basic_binding" {
provider = google-beta
logging_setting_id = "%{logging_setting_id}"
setting_binding_id = "%{setting_binding_id}"
location = "global"
target = "%{new_target}"
depends_on = [google_gemini_logging_setting.basic]
}
`, context)
}
{{ end }}
Loading