diff --git a/client/project.go b/client/project.go index 66d7c87..4ead535 100644 --- a/client/project.go +++ b/client/project.go @@ -27,28 +27,28 @@ func ProjectBody(d *schema.ResourceData) models.ProjectsBodyPost { body.Metadata.PreventVul = "false" } - cveWhiteList := d.Get("cve_whitelist").([]interface{}) - log.Printf("[DEBUG] %v ", cveWhiteList) - if len(cveWhiteList) > 0 { - log.Printf("[DEBUG] %v ", expandCveWhiteList(cveWhiteList)) - body.CveWhitelist.Items = expandCveWhiteList(cveWhiteList) - body.Metadata.ReuseSysCveWhitelist = "false" + cveAllowList := d.Get("cve_allowlist").([]interface{}) + log.Printf("[DEBUG] %v ", cveAllowList) + if len(cveAllowList) > 0 { + log.Printf("[DEBUG] %v ", expandCveAllowList(cveAllowList)) + body.CveAllowlist.Items = expandCveAllowList(cveAllowList) + body.Metadata.ReuseSysCveAllowlist = "false" } else { - body.Metadata.ReuseSysCveWhitelist = "true" + body.Metadata.ReuseSysCveAllowlist = "true" } return body } -func expandCveWhiteList(cveWhitelist []interface{}) models.CveWhitelistItems { - whitelist := models.CveWhitelistItems{} +func expandCveAllowList(cveAllowlist []interface{}) models.CveAllowlistItems { + allowlist := models.CveAllowlistItems{} - for _, data := range cveWhitelist { - item := models.CveWhitelistItem{ + for _, data := range cveAllowlist { + item := models.CveAllowlistItem{ CveID: data.(string), } - whitelist = append(whitelist, item) + allowlist = append(allowlist, item) } - return whitelist + return allowlist } diff --git a/models/projects.go b/models/projects.go index 5af8bc3..b70073b 100644 --- a/models/projects.go +++ b/models/projects.go @@ -6,21 +6,21 @@ type ProjectsBodyPost struct { CountLimit int `json:"count_limit,omitempty"` ProjectName string `json:"project_name,omitempty"` RegistryID int `json:"registry_id,omitempty"` - CveWhitelist struct { - Items CveWhitelistItems `json:"items,omitempty"` + CveAllowlist struct { + Items CveAllowlistItems `json:"items,omitempty"` // Items []struct { // CveID string `json:"cve_id,omitempty"` // } `json:"items,omitempty"` ProjectID int `json:"project_id,omitempty"` ID int `json:"id,omitempty"` ExpiresAt int `json:"expires_at,omitempty"` - } `json:"cve_whitelist,omitempty"` + } `json:"cve_allowlist,omitempty"` StorageLimit int `json:"storage_limit,omitempty"` Metadata struct { EnableContentTrust string `json:"enable_content_trust,omitempty"` AutoScan string `json:"auto_scan,omitempty"` Severity string `json:"severity,omitempty"` - ReuseSysCveWhitelist string `json:"reuse_sys_cve_whitelist,omitempty"` + ReuseSysCveAllowlist string `json:"reuse_sys_cve_allowlist,omitempty"` Public string `json:"public,omitempty"` PreventVul string `json:"prevent_vul,omitempty"` } `json:"metadata,omitempty"` @@ -39,27 +39,27 @@ type ProjectsBodyResponses struct { CurrentUserRoleID int `json:"current_user_role_id"` CurrentUserRoleIds []int `json:"current_user_role_ids"` ChartCount int `json:"chart_count"` - CveWhitelist struct { + CveAllowlist struct { Items []struct { CveID string `json:"cve_id"` } `json:"items"` ProjectID int `json:"project_id"` ID int `json:"id"` ExpiresAt int `json:"expires_at"` - } `json:"cve_whitelist"` + } `json:"cve_allowlist"` Metadata struct { EnableContentTrust string `json:"enable_content_trust"` AutoScan string `json:"auto_scan"` Severity string `json:"severity"` - ReuseSysCveWhitelist string `json:"reuse_sys_cve_whitelist"` + ReuseSysCveAllowlist string `json:"reuse_sys_cve_allowlist"` Public string `json:"public"` PreventVul string `json:"prevent_vul"` } `json:"metadata"` } -type CveWhitelistItems []struct { +type CveAllowlistItems []struct { CveID string `json:"cve_id,omitempty"` } -type CveWhitelistItem struct { +type CveAllowlistItem struct { CveID string `json:"cve_id,omitempty"` } diff --git a/provider/resource_project.go b/provider/resource_project.go index e196de4..d39c9d3 100644 --- a/provider/resource_project.go +++ b/provider/resource_project.go @@ -47,7 +47,7 @@ func resourceProject() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "cve_whitelist": { + "cve_allowlist": { Type: schema.TypeList, Elem: &schema.Schema{ Type: schema.TypeString,