-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Resource v1 SCC Findings Export to BQ Folder Config (#11587) (#2802)
[upstream:6d67e349fe1f372cb7cb1bc1f720f858dab78187] Signed-off-by: Modular Magician <[email protected]>
- Loading branch information
1 parent
3f96960
commit f8a4bbc
Showing
3 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
...rs/google/resources/services/securitycenter/securitycenter_folder_scc_big_query_export.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// *** AUTO GENERATED CODE *** Type: MMv1 *** | ||
// | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// This file is automatically generated by Magic Modules and manual | ||
// changes will be clobbered when the file is regenerated. | ||
// | ||
// Please read more about how to change this file in | ||
// .github/CONTRIBUTING.md. | ||
// | ||
// ---------------------------------------------------------------------------- | ||
|
||
package securitycenter | ||
|
||
import ( | ||
"reflect" | ||
|
||
"github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/cai" | ||
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource" | ||
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" | ||
) | ||
|
||
const SecurityCenterFolderSccBigQueryExportAssetType string = "securitycenter.googleapis.com/FolderSccBigQueryExport" | ||
|
||
func ResourceConverterSecurityCenterFolderSccBigQueryExport() cai.ResourceConverter { | ||
return cai.ResourceConverter{ | ||
AssetType: SecurityCenterFolderSccBigQueryExportAssetType, | ||
Convert: GetSecurityCenterFolderSccBigQueryExportCaiObject, | ||
} | ||
} | ||
|
||
func GetSecurityCenterFolderSccBigQueryExportCaiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) ([]cai.Asset, error) { | ||
name, err := cai.AssetName(d, config, "//securitycenter.googleapis.com/folders/{{folder}}/bigQueryExports/{{big_query_export_id}}") | ||
if err != nil { | ||
return []cai.Asset{}, err | ||
} | ||
if obj, err := GetSecurityCenterFolderSccBigQueryExportApiObject(d, config); err == nil { | ||
return []cai.Asset{{ | ||
Name: name, | ||
Type: SecurityCenterFolderSccBigQueryExportAssetType, | ||
Resource: &cai.AssetResource{ | ||
Version: "v1", | ||
DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/securitycenter/v1/rest", | ||
DiscoveryName: "FolderSccBigQueryExport", | ||
Data: obj, | ||
}, | ||
}}, nil | ||
} else { | ||
return []cai.Asset{}, err | ||
} | ||
} | ||
|
||
func GetSecurityCenterFolderSccBigQueryExportApiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]interface{}, error) { | ||
obj := make(map[string]interface{}) | ||
descriptionProp, err := expandSecurityCenterFolderSccBigQueryExportDescription(d.Get("description"), d, config) | ||
if err != nil { | ||
return nil, err | ||
} else if v, ok := d.GetOkExists("description"); !tpgresource.IsEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) { | ||
obj["description"] = descriptionProp | ||
} | ||
datasetProp, err := expandSecurityCenterFolderSccBigQueryExportDataset(d.Get("dataset"), d, config) | ||
if err != nil { | ||
return nil, err | ||
} else if v, ok := d.GetOkExists("dataset"); !tpgresource.IsEmptyValue(reflect.ValueOf(datasetProp)) && (ok || !reflect.DeepEqual(v, datasetProp)) { | ||
obj["dataset"] = datasetProp | ||
} | ||
filterProp, err := expandSecurityCenterFolderSccBigQueryExportFilter(d.Get("filter"), d, config) | ||
if err != nil { | ||
return nil, err | ||
} else if v, ok := d.GetOkExists("filter"); ok || !reflect.DeepEqual(v, filterProp) { | ||
obj["filter"] = filterProp | ||
} | ||
|
||
return obj, nil | ||
} | ||
|
||
func expandSecurityCenterFolderSccBigQueryExportDescription(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { | ||
return v, nil | ||
} | ||
|
||
func expandSecurityCenterFolderSccBigQueryExportDataset(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { | ||
return v, nil | ||
} | ||
|
||
func expandSecurityCenterFolderSccBigQueryExportFilter(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { | ||
return v, nil | ||
} |