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 Release Channel Setting Binding resource #12895

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
102 changes: 102 additions & 0 deletions mmv1/products/gemini/ReleaseChannelSettingBinding.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: ReleaseChannelSettingBinding
description: The resource for managing ReleaseChannel setting bindings for Admin Control.
base_url: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}/settingBindings
self_link: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}/settingBindings/{{setting_binding_id}}
create_url: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}/settingBindings?settingBindingId={{setting_binding_id}}
id_format: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}/settingBindings/{{setting_binding_id}}
update_verb: PATCH
update_mask: true
import_format:
- projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}/settingBindings/{{setting_binding_id}}
mutex: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}
examples:
- name: gemini_release_channel_setting_binding_basic
min_version: 'beta'
primary_resource_id: example
vars:
release_channel_setting_id: ls-tf1
setting_binding_id: ls-tf1b1
target: projects/980109375338
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: U2V0dGluZ0JpbmRpbmdCeVByb2plY3RBbmRMb2NhdGlvbkFuZFJlbGVhc2VjaGFubmVsc2V0dGluZw==
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: releaseChannelSettingId
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: 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
- 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
type: String
description: |-
Required. Product type of the setting binding.
Possible values:
PRODUCT_UNSPECIFIED
GEMINI_CLOUD_ASSIST
GEMINI_CODE_ASSIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
resource "google_gemini_release_channel_setting" "basic" {
provider = google-beta
release_channel_setting_id = "{{index $.Vars "release_channel_setting_id"}}"
location = "global"
release_channel = "EXPERIMENTAL"
}

resource "google_gemini_release_channel_setting_binding" "{{$.PrimaryResourceId}}" {
provider = google-beta
release_channel_setting_id = "{{index $.Vars "release_channel_setting_id"}}"
setting_binding_id = "{{index $.Vars "setting_binding_id"}}"
location = "global"
target = "{{index $.Vars "target"}}"
depends_on = [google_gemini_release_channel_setting.basic]
}
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 TestAccGeminiReleaseChannelSettingBinding_geminiReleaseChannelSettingBindingBasicExample_update(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"release_channel_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: testAccGeminiReleaseChannelSettingBinding_geminiReleaseChannelSettingBindingBasicExample_basic(context),
},
{
ResourceName: "google_gemini_release_channel_setting_binding.basic_binding",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"labels", "location", "release_channel_setting_id", "terraform_labels"},
},
{
Config: testAccGeminiReleaseChannelSettingBinding_geminiReleaseChannelSettingBindingBasicExample_update(context),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("google_gemini_release_channel_setting_binding.basic_binding", plancheck.ResourceActionUpdate),
},
},
},
{
ResourceName: "google_gemini_release_channel_setting_binding.basic_binding",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"labels", "location", "release_channel_setting_id", "terraform_labels"},
},
},
})
}

func testAccGeminiReleaseChannelSettingBinding_geminiReleaseChannelSettingBindingBasicExample_basic(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_gemini_release_channel_setting" "basic" {
provider = google-beta
release_channel_setting_id = "%{release_channel_setting_id}"
location = "global"
release_channel = "EXPERIMENTAL"
}

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

func testAccGeminiReleaseChannelSettingBinding_geminiReleaseChannelSettingBindingBasicExample_update(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_gemini_release_channel_setting" "basic" {
provider = google-beta
release_channel_setting_id = "%{release_channel_setting_id}"
location = "global"
release_channel = "EXPERIMENTAL"
}

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