-
Notifications
You must be signed in to change notification settings - Fork 123
Add security exception list #1495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
febf285 to
e385ba4
Compare
…tack into add_security_exception_list
5680581 to
3980a35
Compare
|
|
||
| switch resp.StatusCode() { | ||
| case http.StatusOK: | ||
| return resp, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return resp, nil | |
| return resp.JSON200, nil |
| MarkdownDescription: "The type of exception list. Can be one of: `detection`, `endpoint`, `endpoint_trusted_apps`, `endpoint_events`, `endpoint_host_isolation_exceptions`, `endpoint_blocklists`.", | ||
| Required: true, | ||
| Validators: []validator.String{ | ||
| stringvalidator.OneOf( | ||
| "detection", | ||
| "endpoint", | ||
| "endpoint_trusted_apps", | ||
| "endpoint_events", | ||
| "endpoint_host_isolation_exceptions", | ||
| "endpoint_blocklists", | ||
| ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have the same thing in #1489 and I didn't comment on it there. :/
WDYT about pulling the list of valid options out to a variable so we could do something like this mashup of Golang and Javascript but in a way that actually compiles.
| MarkdownDescription: "The type of exception list. Can be one of: `detection`, `endpoint`, `endpoint_trusted_apps`, `endpoint_events`, `endpoint_host_isolation_exceptions`, `endpoint_blocklists`.", | |
| Required: true, | |
| Validators: []validator.String{ | |
| stringvalidator.OneOf( | |
| "detection", | |
| "endpoint", | |
| "endpoint_trusted_apps", | |
| "endpoint_events", | |
| "endpoint_host_isolation_exceptions", | |
| "endpoint_blocklists", | |
| ), | |
| MarkdownDescription: fmt.Sprintf("The type of exception list. Can be one of: %s.", strings.Join(validExceptionListTypes.Map(t => "`${t}`"), ", ")), | |
| Required: true, | |
| Validators: []validator.String{ | |
| stringvalidator.OneOf( | |
| validExceptionListTypes... | |
| ), |
| }, | ||
| }, | ||
| "os_types": schema.ListAttribute{ | ||
| MarkdownDescription: "Array of OS types for which the exceptions apply. Valid values: `linux`, `macos`, `windows`.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have a OneOf validator here?
| } | ||
|
|
||
| // Build the request body | ||
| body := kbapi.CreateExceptionListJSONRequestBody{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this into a function in models.go
| Optional: true, | ||
| ElementType: types.StringType, | ||
| }, | ||
| "tags": schema.ListAttribute{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "tags": schema.ListAttribute{ | |
| "tags": schema.SetAttribute{ |
Do duplicates matter? Should we be worried about the API returning these in a different order?
| ClusterId: model.SpaceID.ValueString(), | ||
| ResourceId: string(apiResp.Id), | ||
| } | ||
| model.ID = types.StringValue(compId.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly can we build the model in models.go
| stringplanmodifier.RequiresReplace(), | ||
| }, | ||
| }, | ||
| "os_types": schema.ListAttribute{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "os_types": schema.ListAttribute{ | |
| "os_types": schema.SetAttribute{ |
Similarly I suspect this should be a set
No description provided.