-
Notifications
You must be signed in to change notification settings - Fork 38
feat: support storage and use of custom rego engine hostnames #2315
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
Changes from all commits
c095783
99ca524
47f1078
67bb469
4a85039
6497007
253f254
f72233c
d641ed5
6180b74
be48820
bcbb7a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ type OrgItem struct { | |
ID, Name string | ||
CreatedAt *time.Time | ||
PolicyViolationBlockingStrategy string | ||
PolicyAllowedHostnames []string `json:"policyAllowedHostnames,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. accidental annotation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nope really, I wanted to hide this option if the default is set |
||
} | ||
|
||
type MembershipItem struct { | ||
|
@@ -129,9 +130,10 @@ func (action *MembershipList) ListMembers(ctx context.Context, page int, pageSiz | |
|
||
func pbOrgItemToAction(in *pb.OrgItem) *OrgItem { | ||
i := &OrgItem{ | ||
ID: in.Id, | ||
Name: in.Name, | ||
CreatedAt: toTimePtr(in.CreatedAt.AsTime()), | ||
ID: in.Id, | ||
Name: in.Name, | ||
CreatedAt: toTimePtr(in.CreatedAt.AsTime()), | ||
PolicyAllowedHostnames: in.PolicyAllowedHostnames, | ||
} | ||
|
||
if in.DefaultPolicyViolationStrategy == pb.OrgItem_POLICY_VIOLATION_BLOCKING_STRATEGY_BLOCK { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,14 +30,24 @@ func NewOrgUpdate(cfg *ActionsOpts) *OrgUpdate { | |
} | ||
|
||
type NewOrgUpdateOpts struct { | ||
BlockOnPolicyViolation *bool | ||
BlockOnPolicyViolation *bool | ||
PoliciesAllowedHostnames *[]string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks a bit weird. Slices are pointers already and are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. checking, thanks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated the pointer situation to leverage instead the duality of empty slice vs nil slice. |
||
} | ||
|
||
func (action *OrgUpdate) Run(ctx context.Context, name string, opts *NewOrgUpdateOpts) (*OrgItem, error) { | ||
client := pb.NewOrganizationServiceClient(action.cfg.CPConnection) | ||
resp, err := client.Update(ctx, &pb.OrganizationServiceUpdateRequest{ | ||
Name: name, BlockOnPolicyViolation: opts.BlockOnPolicyViolation, | ||
}) | ||
|
||
payload := &pb.OrganizationServiceUpdateRequest{ | ||
Name: name, | ||
BlockOnPolicyViolation: opts.BlockOnPolicyViolation, | ||
} | ||
|
||
if opts.PoliciesAllowedHostnames != nil { | ||
payload.PoliciesAllowedHostnames = *opts.PoliciesAllowedHostnames | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is what I mean, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is about making sure we can detect when we want to update the value vs empty it. In any case I've implemented the same by using slices |
||
payload.UpdatePoliciesAllowedHostnames = true | ||
} | ||
|
||
resp, err := client.Update(ctx, payload) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.