Skip to content

Conversation

@nick-benoit
Copy link
Contributor

No description provided.

@nick-benoit nick-benoit force-pushed the add_security_exception_list branch from febf285 to e385ba4 Compare November 27, 2025 19:57
@nick-benoit nick-benoit force-pushed the add_security_exception_list branch from 5680581 to 3980a35 Compare November 27, 2025 22:23

switch resp.StatusCode() {
case http.StatusOK:
return resp, nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return resp, nil
return resp.JSON200, nil

Comment on lines 57 to 67
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",
),
Copy link
Member

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.

Suggested change
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`.",
Copy link
Member

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{
Copy link
Member

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{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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())
Copy link
Member

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{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"os_types": schema.ListAttribute{
"os_types": schema.SetAttribute{

Similarly I suspect this should be a set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants