Skip to content

Commit

Permalink
adding location and doc schema (#8371) (#15326)
Browse files Browse the repository at this point in the history
* adding location and doc schema

* added copyright

* resolved required field, url_param_only field, description, autogen_async, async in Location

* resolved required field, url_param_only field, description, autogen_async, async in Location

* resolved hardcoded location, few fields in location, removed unnecessary enum values

* resolved project_number, added fields in location example

* DocumentSchema final changes

* added timeouts in Location

* adding missing fields from test report

* added DocumentSchema tests

* removed required field from processorType

* changed dummy_values

* removed fields under properties

* added new line

* added enum tests

* separated tests into separate files

* made Document Schema immutable

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Jul 28, 2023
1 parent c649ca8 commit 9374042
Show file tree
Hide file tree
Showing 17 changed files with 3,523 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changelog/8371.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```release-note:new-resource
`google_document_ai_warehouse_document_schema`
```
```release-note:new-resource
`google_document_ai_warehouse_location`
```
1 change: 1 addition & 0 deletions .teamcity/components/generated/services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ var services = mapOf(
"dialogflowcx" to "Dialogflowcx",
"dns" to "Dns",
"documentai" to "Documentai",
"documentaiwarehouse" to "Documentaiwarehouse",
"essentialcontacts" to "Essentialcontacts",
"eventarc" to "Eventarc",
"filestore" to "Filestore",
Expand Down
1 change: 1 addition & 0 deletions google/config_test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func configureTestBasePaths(c *transport_tpg.Config, url string) {
c.DialogflowCXBasePath = url
c.DNSBasePath = url
c.DocumentAIBasePath = url
c.DocumentAIWarehouseBasePath = url
c.EssentialContactsBasePath = url
c.FilestoreBasePath = url
c.FirestoreBasePath = url
Expand Down
1 change: 1 addition & 0 deletions google/fwmodels/provider_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type ProviderModel struct {
DialogflowCXCustomEndpoint types.String `tfsdk:"dialogflow_cx_custom_endpoint"`
DNSCustomEndpoint types.String `tfsdk:"dns_custom_endpoint"`
DocumentAICustomEndpoint types.String `tfsdk:"document_ai_custom_endpoint"`
DocumentAIWarehouseCustomEndpoint types.String `tfsdk:"document_ai_warehouse_custom_endpoint"`
EssentialContactsCustomEndpoint types.String `tfsdk:"essential_contacts_custom_endpoint"`
FilestoreCustomEndpoint types.String `tfsdk:"filestore_custom_endpoint"`
FirestoreCustomEndpoint types.String `tfsdk:"firestore_custom_endpoint"`
Expand Down
6 changes: 6 additions & 0 deletions google/fwprovider/framework_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
transport_tpg.CustomEndpointValidator(),
},
},
"document_ai_warehouse_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
transport_tpg.CustomEndpointValidator(),
},
},
"essential_contacts_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
Expand Down
10 changes: 10 additions & 0 deletions google/fwtransport/framework_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ type FrameworkProviderConfig struct {
DialogflowCXBasePath string
DNSBasePath string
DocumentAIBasePath string
DocumentAIWarehouseBasePath string
EssentialContactsBasePath string
FilestoreBasePath string
FirestoreBasePath string
Expand Down Expand Up @@ -230,6 +231,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
p.DialogflowCXBasePath = data.DialogflowCXCustomEndpoint.ValueString()
p.DNSBasePath = data.DNSCustomEndpoint.ValueString()
p.DocumentAIBasePath = data.DocumentAICustomEndpoint.ValueString()
p.DocumentAIWarehouseBasePath = data.DocumentAIWarehouseCustomEndpoint.ValueString()
p.EssentialContactsBasePath = data.EssentialContactsCustomEndpoint.ValueString()
p.FilestoreBasePath = data.FilestoreCustomEndpoint.ValueString()
p.FirestoreBasePath = data.FirestoreCustomEndpoint.ValueString()
Expand Down Expand Up @@ -773,6 +775,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo
data.DocumentAICustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.DocumentAIWarehouseCustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_DOCUMENT_AI_WAREHOUSE_CUSTOM_ENDPOINT",
}, transport_tpg.DefaultBasePaths[transport_tpg.DocumentAIWarehouseBasePathKey])
if customEndpoint != nil {
data.DocumentAIWarehouseCustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.EssentialContactsCustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_ESSENTIAL_CONTACTS_CUSTOM_ENDPOINT",
Expand Down
1 change: 1 addition & 0 deletions google/gcp_sweeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import (
_ "github.com/hashicorp/terraform-provider-google/google/services/dialogflowcx"
_ "github.com/hashicorp/terraform-provider-google/google/services/dns"
_ "github.com/hashicorp/terraform-provider-google/google/services/documentai"
_ "github.com/hashicorp/terraform-provider-google/google/services/documentaiwarehouse"
_ "github.com/hashicorp/terraform-provider-google/google/services/essentialcontacts"
_ "github.com/hashicorp/terraform-provider-google/google/services/filestore"
_ "github.com/hashicorp/terraform-provider-google/google/services/firestore"
Expand Down
13 changes: 11 additions & 2 deletions google/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import (
"github.com/hashicorp/terraform-provider-google/google/services/dialogflowcx"
"github.com/hashicorp/terraform-provider-google/google/services/dns"
"github.com/hashicorp/terraform-provider-google/google/services/documentai"
"github.com/hashicorp/terraform-provider-google/google/services/documentaiwarehouse"
"github.com/hashicorp/terraform-provider-google/google/services/essentialcontacts"
"github.com/hashicorp/terraform-provider-google/google/services/filestore"
"github.com/hashicorp/terraform-provider-google/google/services/firestore"
Expand Down Expand Up @@ -453,6 +454,11 @@ func Provider() *schema.Provider {
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"document_ai_warehouse_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"essential_contacts_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -947,9 +953,9 @@ func DatasourceMapWithErrors() (map[string]*schema.Resource, error) {
})
}

// Generated resources: 303
// Generated resources: 305
// Generated IAM resources: 204
// Total generated resources: 507
// Total generated resources: 509
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -1259,6 +1265,8 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_dns_response_policy_rule": dns.ResourceDNSResponsePolicyRule(),
"google_document_ai_processor": documentai.ResourceDocumentAIProcessor(),
"google_document_ai_processor_default_version": documentai.ResourceDocumentAIProcessorDefaultVersion(),
"google_document_ai_warehouse_document_schema": documentaiwarehouse.ResourceDocumentAIWarehouseDocumentSchema(),
"google_document_ai_warehouse_location": documentaiwarehouse.ResourceDocumentAIWarehouseLocation(),
"google_essential_contacts_contact": essentialcontacts.ResourceEssentialContactsContact(),
"google_filestore_backup": filestore.ResourceFilestoreBackup(),
"google_filestore_instance": filestore.ResourceFilestoreInstance(),
Expand Down Expand Up @@ -1736,6 +1744,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.DialogflowCXBasePath = d.Get("dialogflow_cx_custom_endpoint").(string)
config.DNSBasePath = d.Get("dns_custom_endpoint").(string)
config.DocumentAIBasePath = d.Get("document_ai_custom_endpoint").(string)
config.DocumentAIWarehouseBasePath = d.Get("document_ai_warehouse_custom_endpoint").(string)
config.EssentialContactsBasePath = d.Get("essential_contacts_custom_endpoint").(string)
config.FilestoreBasePath = d.Get("filestore_custom_endpoint").(string)
config.FirestoreBasePath = d.Get("firestore_custom_endpoint").(string)
Expand Down
Loading

0 comments on commit 9374042

Please sign in to comment.