Skip to content

Commit

Permalink
Add storageinsights product and ReportConfig resource type. (#8799) (#…
Browse files Browse the repository at this point in the history
…15819)

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Sep 12, 2023
1 parent 4e75ffb commit c0c6796
Show file tree
Hide file tree
Showing 13 changed files with 1,794 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/8799.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_storage_insights_report_config`
```
5 changes: 5 additions & 0 deletions .teamcity/components/generated/services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,11 @@ var services = mapOf(
"displayName" to "Storage",
"path" to "./google/services/storage"
),
"storageinsights" to mapOf(
"name" to "storageinsights",
"displayName" to "Storageinsights",
"path" to "./google/services/storageinsights"
),
"storagetransfer" to mapOf(
"name" to "storagetransfer",
"displayName" to "Storagetransfer",
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 @@ -115,6 +115,7 @@ type ProviderModel struct {
SpannerCustomEndpoint types.String `tfsdk:"spanner_custom_endpoint"`
SQLCustomEndpoint types.String `tfsdk:"sql_custom_endpoint"`
StorageCustomEndpoint types.String `tfsdk:"storage_custom_endpoint"`
StorageInsightsCustomEndpoint types.String `tfsdk:"storage_insights_custom_endpoint"`
StorageTransferCustomEndpoint types.String `tfsdk:"storage_transfer_custom_endpoint"`
TagsCustomEndpoint types.String `tfsdk:"tags_custom_endpoint"`
TPUCustomEndpoint types.String `tfsdk:"tpu_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 @@ -659,6 +659,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
transport_tpg.CustomEndpointValidator(),
},
},
"storage_insights_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
transport_tpg.CustomEndpointValidator(),
},
},
"storage_transfer_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 @@ -139,6 +139,7 @@ type FrameworkProviderConfig struct {
SpannerBasePath string
SQLBasePath string
StorageBasePath string
StorageInsightsBasePath string
StorageTransferBasePath string
TagsBasePath string
TPUBasePath string
Expand Down Expand Up @@ -274,6 +275,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
p.SpannerBasePath = data.SpannerCustomEndpoint.ValueString()
p.SQLBasePath = data.SQLCustomEndpoint.ValueString()
p.StorageBasePath = data.StorageCustomEndpoint.ValueString()
p.StorageInsightsBasePath = data.StorageInsightsCustomEndpoint.ValueString()
p.StorageTransferBasePath = data.StorageTransferCustomEndpoint.ValueString()
p.TagsBasePath = data.TagsCustomEndpoint.ValueString()
p.TPUBasePath = data.TPUCustomEndpoint.ValueString()
Expand Down Expand Up @@ -1133,6 +1135,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo
data.StorageCustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.StorageInsightsCustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_STORAGE_INSIGHTS_CUSTOM_ENDPOINT",
}, transport_tpg.DefaultBasePaths[transport_tpg.StorageInsightsBasePathKey])
if customEndpoint != nil {
data.StorageInsightsCustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.StorageTransferCustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_STORAGE_TRANSFER_CUSTOM_ENDPOINT",
Expand Down
12 changes: 10 additions & 2 deletions google/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ import (
"github.com/hashicorp/terraform-provider-google/google/services/spanner"
"github.com/hashicorp/terraform-provider-google/google/services/sql"
"github.com/hashicorp/terraform-provider-google/google/services/storage"
"github.com/hashicorp/terraform-provider-google/google/services/storageinsights"
"github.com/hashicorp/terraform-provider-google/google/services/storagetransfer"
"github.com/hashicorp/terraform-provider-google/google/services/tags"
"github.com/hashicorp/terraform-provider-google/google/services/tpu"
Expand Down Expand Up @@ -678,6 +679,11 @@ func Provider() *schema.Provider {
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"storage_insights_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"storage_transfer_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -980,9 +986,9 @@ func DatasourceMapWithErrors() (map[string]*schema.Resource, error) {
})
}

// Generated resources: 320
// Generated resources: 321
// Generated IAM resources: 207
// Total generated resources: 527
// Total generated resources: 528
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -1482,6 +1488,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_storage_default_object_access_control": storage.ResourceStorageDefaultObjectAccessControl(),
"google_storage_hmac_key": storage.ResourceStorageHmacKey(),
"google_storage_object_access_control": storage.ResourceStorageObjectAccessControl(),
"google_storage_insights_report_config": storageinsights.ResourceStorageInsightsReportConfig(),
"google_storage_transfer_agent_pool": storagetransfer.ResourceStorageTransferAgentPool(),
"google_tags_tag_binding": tags.ResourceTagsTagBinding(),
"google_tags_tag_key": tags.ResourceTagsTagKey(),
Expand Down Expand Up @@ -1834,6 +1841,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.SpannerBasePath = d.Get("spanner_custom_endpoint").(string)
config.SQLBasePath = d.Get("sql_custom_endpoint").(string)
config.StorageBasePath = d.Get("storage_custom_endpoint").(string)
config.StorageInsightsBasePath = d.Get("storage_insights_custom_endpoint").(string)
config.StorageTransferBasePath = d.Get("storage_transfer_custom_endpoint").(string)
config.TagsBasePath = d.Get("tags_custom_endpoint").(string)
config.TPUBasePath = d.Get("tpu_custom_endpoint").(string)
Expand Down
Loading

0 comments on commit c0c6796

Please sign in to comment.