Skip to content

Commit 301aca6

Browse files
Add Code Repository Index resource (#12338) (#8781)
[upstream:04174a883cf719344a49b5d8ddce33074f29dcf2] Signed-off-by: Modular Magician <[email protected]>
1 parent 13cdd50 commit 301aca6

14 files changed

+1036
-3
lines changed

Diff for: .changelog/12338.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-resource
2+
`google_gemini_code_repository_index`
3+
```

Diff for: google-beta/acctest/bootstrap_test_utils.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ func NewServiceNetworkSettings(options ...func(*ServiceNetworkSettings)) *Servic
503503
// must be deleted first. After the service instances are deleted, some service producers delay the deletion
504504
// utnil a waiting period has passed. For example, after four days that you delete a SQL instance,
505505
// the service networking connection can be deleted.
506-
// That is the reason to use the shared service networking connection for thest resources.
506+
// That is the reason to use the shared service networking connection for test resources.
507507
// https://cloud.google.com/vpc/docs/configure-private-services-access#removing-connection
508508
//
509509
// testId specifies the test for which a shared network and a gobal address are used/initialized.

Diff for: google-beta/fwmodels/provider_model.go

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ type ProviderModel struct {
102102
FirebaseHostingCustomEndpoint types.String `tfsdk:"firebase_hosting_custom_endpoint"`
103103
FirebaseStorageCustomEndpoint types.String `tfsdk:"firebase_storage_custom_endpoint"`
104104
FirestoreCustomEndpoint types.String `tfsdk:"firestore_custom_endpoint"`
105+
GeminiCustomEndpoint types.String `tfsdk:"gemini_custom_endpoint"`
105106
GKEBackupCustomEndpoint types.String `tfsdk:"gke_backup_custom_endpoint"`
106107
GKEHubCustomEndpoint types.String `tfsdk:"gke_hub_custom_endpoint"`
107108
GKEHub2CustomEndpoint types.String `tfsdk:"gke_hub2_custom_endpoint"`

Diff for: google-beta/fwprovider/framework_provider.go

+6
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
590590
transport_tpg.CustomEndpointValidator(),
591591
},
592592
},
593+
"gemini_custom_endpoint": &schema.StringAttribute{
594+
Optional: true,
595+
Validators: []validator.String{
596+
transport_tpg.CustomEndpointValidator(),
597+
},
598+
},
593599
"gke_backup_custom_endpoint": &schema.StringAttribute{
594600
Optional: true,
595601
Validators: []validator.String{

Diff for: google-beta/provider/provider.go

+6
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,11 @@ func Provider() *schema.Provider {
508508
Optional: true,
509509
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
510510
},
511+
"gemini_custom_endpoint": {
512+
Type: schema.TypeString,
513+
Optional: true,
514+
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
515+
},
511516
"gke_backup_custom_endpoint": {
512517
Type: schema.TypeString,
513518
Optional: true,
@@ -1122,6 +1127,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
11221127
config.FirebaseHostingBasePath = d.Get("firebase_hosting_custom_endpoint").(string)
11231128
config.FirebaseStorageBasePath = d.Get("firebase_storage_custom_endpoint").(string)
11241129
config.FirestoreBasePath = d.Get("firestore_custom_endpoint").(string)
1130+
config.GeminiBasePath = d.Get("gemini_custom_endpoint").(string)
11251131
config.GKEBackupBasePath = d.Get("gke_backup_custom_endpoint").(string)
11261132
config.GKEHubBasePath = d.Get("gke_hub_custom_endpoint").(string)
11271133
config.GKEHub2BasePath = d.Get("gke_hub2_custom_endpoint").(string)

Diff for: google-beta/provider/provider_mmv1_resources.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ import (
7676
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/firebasehosting"
7777
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/firebasestorage"
7878
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/firestore"
79+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/gemini"
7980
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/gkebackup"
8081
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/gkehub"
8182
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/gkehub2"
@@ -507,9 +508,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{
507508
}
508509

509510
// Resources
510-
// Generated resources: 558
511+
// Generated resources: 559
511512
// Generated IAM resources: 291
512-
// Total generated resources: 849
513+
// Total generated resources: 850
513514
var generatedResources = map[string]*schema.Resource{
514515
"google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(),
515516
"google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(),
@@ -976,6 +977,7 @@ var generatedResources = map[string]*schema.Resource{
976977
"google_firestore_document": firestore.ResourceFirestoreDocument(),
977978
"google_firestore_field": firestore.ResourceFirestoreField(),
978979
"google_firestore_index": firestore.ResourceFirestoreIndex(),
980+
"google_gemini_code_repository_index": gemini.ResourceGeminiCodeRepositoryIndex(),
979981
"google_gke_backup_backup_plan": gkebackup.ResourceGKEBackupBackupPlan(),
980982
"google_gke_backup_backup_plan_iam_binding": tpgiamresource.ResourceIamBinding(gkebackup.GKEBackupBackupPlanIamSchema, gkebackup.GKEBackupBackupPlanIamUpdaterProducer, gkebackup.GKEBackupBackupPlanIdParseFunc),
981983
"google_gke_backup_backup_plan_iam_member": tpgiamresource.ResourceIamMember(gkebackup.GKEBackupBackupPlanIamSchema, gkebackup.GKEBackupBackupPlanIamUpdaterProducer, gkebackup.GKEBackupBackupPlanIdParseFunc),

Diff for: google-beta/services/gemini/gemini_operation.go

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
4+
// ----------------------------------------------------------------------------
5+
//
6+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
7+
//
8+
// ----------------------------------------------------------------------------
9+
//
10+
// This file is automatically generated by Magic Modules and manual
11+
// changes will be clobbered when the file is regenerated.
12+
//
13+
// Please read more about how to change this file in
14+
// .github/CONTRIBUTING.md.
15+
//
16+
// ----------------------------------------------------------------------------
17+
18+
package gemini
19+
20+
import (
21+
"encoding/json"
22+
"errors"
23+
"fmt"
24+
"time"
25+
26+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
27+
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
28+
)
29+
30+
type GeminiOperationWaiter struct {
31+
Config *transport_tpg.Config
32+
UserAgent string
33+
Project string
34+
tpgresource.CommonOperationWaiter
35+
}
36+
37+
func (w *GeminiOperationWaiter) QueryOp() (interface{}, error) {
38+
if w == nil {
39+
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
40+
}
41+
// Returns the proper get.
42+
url := fmt.Sprintf("%s%s", w.Config.GeminiBasePath, w.CommonOperationWaiter.Op.Name)
43+
44+
return transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
45+
Config: w.Config,
46+
Method: "GET",
47+
Project: w.Project,
48+
RawURL: url,
49+
UserAgent: w.UserAgent,
50+
})
51+
}
52+
53+
func createGeminiWaiter(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string) (*GeminiOperationWaiter, error) {
54+
w := &GeminiOperationWaiter{
55+
Config: config,
56+
UserAgent: userAgent,
57+
Project: project,
58+
}
59+
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
60+
return nil, err
61+
}
62+
return w, nil
63+
}
64+
65+
// nolint: deadcode,unused
66+
func GeminiOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
67+
w, err := createGeminiWaiter(config, op, project, activity, userAgent)
68+
if err != nil {
69+
return err
70+
}
71+
if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil {
72+
return err
73+
}
74+
rawResponse := []byte(w.CommonOperationWaiter.Op.Response)
75+
if len(rawResponse) == 0 {
76+
return errors.New("`resource` not set in operation response")
77+
}
78+
return json.Unmarshal(rawResponse, response)
79+
}
80+
81+
func GeminiOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
82+
if val, ok := op["name"]; !ok || val == "" {
83+
// This was a synchronous call - there is no operation to wait for.
84+
return nil
85+
}
86+
w, err := createGeminiWaiter(config, op, project, activity, userAgent)
87+
if err != nil {
88+
// If w is nil, the op was synchronous.
89+
return err
90+
}
91+
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
92+
}

0 commit comments

Comments
 (0)