Skip to content

Commit

Permalink
Set Gemini provider to google-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
JumiDeluxe committed Nov 8, 2024
1 parent eb589fb commit 591be76
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 21 deletions.
10 changes: 10 additions & 0 deletions mmv1/products/cloudaicompanion/CodeRepositoryIndex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
---
name: CodeRepositoryIndex
description: The resource for managing Code Repository Indexes for Gemini Code Assist.
min_version: 'beta'
base_url: projects/{{project}}/locations/{{location}}/codeRepositoryIndexes
self_link: projects/{{project}}/locations/{{location}}/codeRepositoryIndexes/{{code_repository_index_id}}
create_url: projects/{{project}}/locations/{{location}}/codeRepositoryIndexes?codeRepositoryIndexId={{code_repository_index_id}}
Expand All @@ -22,6 +23,7 @@ import_format:
- projects/{{project}}/locations/{{location}}/codeRepositoryIndexes/{{code_repository_index_id}}
examples:
- name: "gemini_code_repository_index_basic"
min_version: 'beta'
primary_resource_id: "example"
vars:
cri_id: "cri-1"
Expand Down Expand Up @@ -51,19 +53,22 @@ 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.
min_version: 'beta'
immutable: true
url_param_only: true
required: true
- name: codeRepositoryIndexId
type: String
description: Required. Id of the requesting object
min_version: 'beta'
immutable: true
url_param_only: true
required: true
properties:
- name: updateTime
type: String
description: Output only. Update time stamp
min_version: 'beta'
output: true
- name: state
type: String
Expand All @@ -75,22 +80,27 @@ properties:
ACTIVE
DELETING
SUSPENDED
min_version: 'beta'
output: true
- name: labels
type: KeyValueLabels
description: Optional. Labels as key value pairs
min_version: 'beta'
- name: kmsKey
type: String
description: |-
Optional. Immutable. Customer-managed encryption key name, in the format
projects/*/locations/*/keyRings/*/cryptoKeys/*.
min_version: 'beta'
immutable: true
- name: name
type: String
description: Immutable. Identifier. name of resource
min_version: 'beta'
output: true
immutable: true
- name: createTime
type: String
description: Output only. Create time stamp
min_version: 'beta'
output: true
13 changes: 13 additions & 0 deletions mmv1/products/cloudaicompanion/RepositoryGroup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
---
name: RepositoryGroup
description: The resource for managing Repository Groups for Gemini Code Assist.
min_version: 'beta'
base_url: projects/{{project}}/locations/{{location}}/codeRepositoryIndexes/{{coderepositoryindex}}/repositoryGroups
self_link: projects/{{project}}/locations/{{location}}/codeRepositoryIndexes/{{coderepositoryindex}}/repositoryGroups/{{repository_group_id}}
create_url: projects/{{project}}/locations/{{location}}/codeRepositoryIndexes/{{coderepositoryindex}}/repositoryGroups?repositoryGroupId={{repository_group_id}}
Expand All @@ -22,6 +23,7 @@ import_format:
- projects/{{project}}/locations/{{location}}/codeRepositoryIndexes/{{coderepositoryindex}}/repositoryGroups/{{repository_group_id}}
examples:
- name: "gemini_repository_group_basic"
min_version: 'beta'
primary_resource_id: "example"
primary_resource_name: '"cri-1", fmt.Sprintf("tf-test-my-repo-group%s", context["random_suffix"])'
vars:
Expand Down Expand Up @@ -52,6 +54,7 @@ async:
message: message
include_project: false
iam_policy:
min_version: 'beta'
parent_resource_attribute: 'repository_group_id'
method_name_separator: ':'
fetch_iam_policy_verb: 'GET'
Expand All @@ -65,25 +68,29 @@ 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.
min_version: 'beta'
immutable: true
url_param_only: true
required: true
- name: coderepositoryindex
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.
min_version: 'beta'
immutable: true
url_param_only: true
required: true
- name: repositoryGroupId
type: String
description: Required. Id of the requesting object
min_version: 'beta'
immutable: true
url_param_only: true
required: true
properties:
- name: repositories
type: Array
description: Required. List of repositories to group
min_version: 'beta'
required: true
item_type:
type: NestedObject
Expand All @@ -93,26 +100,32 @@ properties:
description: |-
Required. The DeveloperConnect repository full resource name, relative resource name
or resource URL to be indexed.
min_version: 'beta'
required: true
- name: branchPattern
type: String
description: |-
Required. The Git branch pattern used for indexing in RE2 syntax.
See https://github.com/google/re2/wiki/syntax for syntax.
min_version: 'beta'
required: true
- name: name
type: String
description: Immutable. Identifier. name of resource
min_version: 'beta'
output: true
immutable: true
- name: createTime
type: String
description: Output only. Create time stamp
min_version: 'beta'
output: true
- name: updateTime
type: String
description: Output only. Update time stamp
min_version: 'beta'
output: true
- name: labels
type: KeyValueLabels
description: Optional. Labels as key value pairs
min_version: 'beta'
2 changes: 1 addition & 1 deletion mmv1/products/cloudaicompanion/product.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ scopes:
- https://www.googleapis.com/auth/cloud-platform
versions:
- base_url: https://cloudaicompanion.googleapis.com/v1/
name: ga
name: 'beta'
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
resource "google_gemini_code_repository_index" "example" {
provider = google-beta
location = "us-central1"
code_repository_index_id = "{{index $.Vars "cri_id"}}"
kms_key = "projects/projectExample/locations/locationExample/keyRings/keyRingExample/cryptoKeys/cryptoKeyExample"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
resource "google_gemini_repository_group" "example" {
provider = google-beta
location = "us-central1"
coderepositoryindex = "cri-1"
repository_group_id = "test-repository-group-id1"
Expand All @@ -10,6 +11,7 @@ resource "google_gemini_repository_group" "example" {
}

resource "google_developer_connect_git_repository_link" "conn" {
provider = google-beta
git_repository_link_id = "{{index $.Vars "git_repository_link_id"}}"
parent_connection = google_developer_connect_connection.github_conn.connection_id
clone_uri = "https://github.com/CC-R-github-robot/tf-test.git"
Expand All @@ -18,6 +20,7 @@ resource "google_developer_connect_git_repository_link" "conn" {
}

resource "google_developer_connect_connection" "github_conn" {
provider = google-beta
location = "us-central1"
connection_id = "{{index $.Vars "connection_id"}}"
disabled = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ var ServicesListBeta = mapOf(
"gemini" to mapOf(
"name" to "gemini",
"displayName" to "Gemini",
"path" to "./google/services/cloudaicompanion"
"path" to "./google-beta/services/cloudaicompanion"
),
"gkebackup" to mapOf(
"name" to "gkebackup",
Expand Down
29 changes: 15 additions & 14 deletions mmv1/third_party/terraform/acctest/bootstrap_test_utils.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/hashicorp/terraform-provider-google/google/tpgiamresource"
"github.com/hashicorp/terraform-provider-google/google/tpgresource"
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
transport_tpg_beta "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"

"google.golang.org/api/cloudbilling/v1"
cloudkms "google.golang.org/api/cloudkms/v1"
Expand Down Expand Up @@ -1444,7 +1445,7 @@ func BootstrapGitRepository(t *testing.T, gitRepositoryLinkId, location, cloneUr
config.DeveloperConnectBasePath, config.Project, location, parentConnectionId, gitRepositoryLinkId)

headers := make(http.Header)
_, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
_, err := transport_tpg_beta.SendRequest(transport_tpg_beta.SendRequestOptions{
Config: config,
Method: "GET",
Project: config.Project,
Expand All @@ -1453,7 +1454,7 @@ func BootstrapGitRepository(t *testing.T, gitRepositoryLinkId, location, cloneUr
Headers: headers,
})

if err != nil && transport_tpg.IsGoogleApiErrorWithCode(err, 404) {
if err != nil && transport_tpg_beta.IsGoogleApiErrorWithCode(err, 404) {
log.Printf("[DEBUG] Git repository link %q not found, bootstrapping", gitRepositoryLinkId)
obj := map[string]interface{}{
"clone_uri": cloneUri,
Expand All @@ -1463,7 +1464,7 @@ func BootstrapGitRepository(t *testing.T, gitRepositoryLinkId, location, cloneUr
postURL := fmt.Sprintf("%sprojects/%s/locations/%s/connections/%s/gitRepositoryLinks?gitRepositoryLinkId=%s",
config.DeveloperConnectBasePath, config.Project, location, parentConnectionId, gitRepositoryLinkId)
headers := make(http.Header)
res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
res, err := transport_tpg_beta.SendRequest(transport_tpg_beta.SendRequestOptions{
Config: config,
Method: "POST",
Project: config.Project,
Expand All @@ -1486,7 +1487,7 @@ func BootstrapGitRepository(t *testing.T, gitRepositoryLinkId, location, cloneUr
t.Fatalf("Error bootstrapping git repository link %q: %s", gitRepositoryLinkId, err)
}

_, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
_, err = transport_tpg_beta.SendRequest(transport_tpg_beta.SendRequestOptions{
Config: config,
Method: "GET",
Project: config.Project,
Expand Down Expand Up @@ -1519,7 +1520,7 @@ func BootstrapDeveloperConnection(t *testing.T, connectionId, location, tokenRes
config.DeveloperConnectBasePath, config.Project, location, connectionId)

headers := make(http.Header)
_, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
_, err := transport_tpg_beta.SendRequest(transport_tpg_beta.SendRequestOptions{
Config: config,
Method: "GET",
Project: config.Project,
Expand All @@ -1546,7 +1547,7 @@ func BootstrapDeveloperConnection(t *testing.T, connectionId, location, tokenRes
postURL := fmt.Sprintf("%sprojects/%s/locations/%s/connections?connectionId=%s",
config.DeveloperConnectBasePath, config.Project, location, connectionId)
headers := make(http.Header)
res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
res, err := transport_tpg_beta.SendRequest(transport_tpg_beta.SendRequestOptions{
Config: config,
Method: "POST",
Project: config.Project,
Expand All @@ -1569,7 +1570,7 @@ func BootstrapDeveloperConnection(t *testing.T, connectionId, location, tokenRes
t.Fatalf("Error creating developer connection group %q: %s", connectionId, err)
}

_, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
_, err = transport_tpg_beta.SendRequest(transport_tpg_beta.SendRequestOptions{
Config: config,
Method: "GET",
Project: config.Project,
Expand Down Expand Up @@ -1602,7 +1603,7 @@ func BoostrapSharedRepositoryGroup(t *testing.T, repositoryGroupId, location, la
config.GeminiBasePath, config.Project, location, codeRepositoryIndexId, repositoryGroupId)

headers := make(http.Header)
_, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
_, err := transport_tpg_beta.SendRequest(transport_tpg_beta.SendRequestOptions{
Config: config,
Method: "GET",
Project: config.Project,
Expand All @@ -1626,7 +1627,7 @@ func BoostrapSharedRepositoryGroup(t *testing.T, repositoryGroupId, location, la
}

headers := make(http.Header)
res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
res, err := transport_tpg_beta.SendRequest(transport_tpg_beta.SendRequestOptions{
Config: config,
Method: "POST",
Project: config.Project,
Expand All @@ -1649,7 +1650,7 @@ func BoostrapSharedRepositoryGroup(t *testing.T, repositoryGroupId, location, la
t.Errorf("Error getting shared repository group %q: %s", repositoryGroupId, err)
}

_, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
_, err = transport_tpg_beta.SendRequest(transport_tpg_beta.SendRequestOptions{
Config: config,
Method: "GET",
Project: config.Project,
Expand Down Expand Up @@ -1690,7 +1691,7 @@ func BootstrapSharedCodeRepositoryIndex(t *testing.T, codeRepositoryIndexId, loc
getURL := fmt.Sprintf("%sprojects/%s/locations/%s/codeRepositoryIndexes/%s", config.GeminiBasePath, config.Project, location, codeRepositoryIndexId)

headers := make(http.Header)
_, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
_, err := transport_tpg_beta.SendRequest(transport_tpg_beta.SendRequestOptions{
Config: config,
Method: "GET",
Project: config.Project,
Expand All @@ -1701,7 +1702,7 @@ func BootstrapSharedCodeRepositoryIndex(t *testing.T, codeRepositoryIndexId, loc
})

// CRI not found responds with 404 not found
if err != nil && transport_tpg.IsGoogleApiErrorWithCode(err, 404) {
if err != nil && transport_tpg_beta.IsGoogleApiErrorWithCode(err, 404) {
log.Printf("[DEBUG] Code repository index %q not found, bootstrapping", codeRepositoryIndexId)
postURL := fmt.Sprintf("%sprojects/%s/locations/%s/codeRepositoryIndexes?codeRepositoryIndexId=%s", config.GeminiBasePath, config.Project, location, codeRepositoryIndexId)
obj := make(map[string]interface{})
Expand All @@ -1713,7 +1714,7 @@ func BootstrapSharedCodeRepositoryIndex(t *testing.T, codeRepositoryIndexId, loc
}

headers := make(http.Header)
res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
res, err := transport_tpg_beta.SendRequest(transport_tpg_beta.SendRequestOptions{
Config: config,
Method: "POST",
Project: config.Project,
Expand All @@ -1738,7 +1739,7 @@ func BootstrapSharedCodeRepositoryIndex(t *testing.T, codeRepositoryIndexId, loc
}

for {
res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
res, err := transport_tpg_beta.SendRequest(transport_tpg_beta.SendRequestOptions{
Config: config,
Method: "GET",
Project: config.Project,
Expand Down
Loading

0 comments on commit 591be76

Please sign in to comment.