Skip to content

Commit

Permalink
Add Gemini Release Channel Setting resource (#12894)
Browse files Browse the repository at this point in the history
  • Loading branch information
PerlMonker303 authored Feb 3, 2025
1 parent 0500297 commit 27fd884
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 0 deletions.
75 changes: 75 additions & 0 deletions mmv1/products/gemini/ReleaseChannelSetting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# 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: ReleaseChannelSetting
description: The resource for managing ReleaseChannel settings for Admin Control.
min_version: 'beta'
base_url: projects/{{project}}/locations/{{location}}/releaseChannelSettings
update_mask: true
self_link: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}
create_url: projects/{{project}}/locations/{{location}}/releaseChannelSettings?releaseChannelSettingId={{release_channel_setting_id}}
update_verb: PATCH
id_format: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}
import_format:
- projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}
mutex: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}
examples:
- name: gemini_release_channel_setting_basic
min_version: 'beta'
primary_resource_id: example
vars:
release_channel_setting_id: ls1-tf
autogen_async: false
autogen_status: UmVsZWFzZUNoYW5uZWxTZXR0aW5n
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: |-
Required. Id of the requesting object.
If auto-generating Id server-side, remove this field and
release_channel_setting_id from the method_signature of Create RPC
immutable: true
url_param_only: true
required: true
properties:
- 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: releaseChannel
type: String
description: |-
Optional. Release channel to be used.
Possible values:
STABLE
EXPERIMENTAL
- name: name
type: String
description: |-
Identifier. Name of the resource.
Format:projects/{project}/locations/{location}/releaseChannelSettings/{releaseChannelSetting}
output: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
resource "google_gemini_release_channel_setting" "{{$.PrimaryResourceId}}" {
provider = google-beta
release_channel_setting_id = "{{index $.Vars "release_channel_setting_id"}}"
location = "global"
release_channel = "EXPERIMENTAL"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
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 TestAccGeminiReleaseChannelSetting_geminiReleaseChannelSettingBasicExample_update(t *testing.T) {
t.Parallel()
context := map[string]interface{}{
"setting_id": "ls-tf1",
}
acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
Steps: []resource.TestStep{
{
Config: testAccGeminiReleaseChannelSetting_geminiReleaseChannelSettingBasicExample_basic(context),
},
{
ResourceName: "google_gemini_release_channel_setting.example",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"labels", "location", "release_channel_setting_id", "terraform_labels"},
},
{
Config: testAccGeminiReleaseChannelSetting_geminiReleaseChannelSettingBasicExample_update(context),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("google_gemini_release_channel_setting.example", plancheck.ResourceActionUpdate),
},
},
},
{
ResourceName: "google_gemini_release_channel_setting.example",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"labels", "location", "release_channel_setting_id", "terraform_labels"},
},
},
})
}
func testAccGeminiReleaseChannelSetting_geminiReleaseChannelSettingBasicExample_basic(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_gemini_release_channel_setting" "example" {
provider = google-beta
release_channel_setting_id = "%{setting_id}"
location = "global"
release_channel = "EXPERIMENTAL"
}
`, context)
}
func testAccGeminiReleaseChannelSetting_geminiReleaseChannelSettingBasicExample_update(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_gemini_release_channel_setting" "example" {
provider = google-beta
release_channel_setting_id = "%{setting_id}"
location = "global"
release_channel = "STABLE"
}
`, context)
}
{{ end }}

0 comments on commit 27fd884

Please sign in to comment.