Introduce API for platform hub compliance policies#406
Conversation
shaun-od
left a comment
There was a problem hiding this comment.
Just a couple of notes, can we check with the owners of the GO client if they need to review as well.
# This is the 1st commit message: Introduce platform hub policies operations # This is the commit message #2: Remove redundant file # This is the commit message #3: Remove redundant file # This is a combination of 3 commits. # This is the 1st commit message: Introduce platform hub policies operations # This is the commit message #2: Remove redundant file # This is the commit message #3: Remove redundant file
5fba0fc to
b62d98a
Compare
shaun-od
left a comment
There was a problem hiding this comment.
LGTM from my perspective. There is one change we are going to make but I'm happy with either approach.
…ng the version object At this moment we don't have an operation for consumer to load single specific version.
liam-mackie
left a comment
There was a problem hiding this comment.
Minor notes around the PlatformHubPolicyVersion which are nits - might be good to discuss, but it's a difference of opinion, rather than a real reason to block the PR.
Types provides better explanation for package consumer about operation and required input values
To follow "List" pattern from policy methods
shaun-od
left a comment
There was a problem hiding this comment.
A couple of things to look at, happy to chat if needed
pkg/platformhubpolicies/policy.go
Outdated
| ) | ||
|
|
||
| // PolicyCandidate represents a set of information to create new Hub policy. | ||
| type PolicyCandidate struct { |
There was a problem hiding this comment.
I am not sold on candidate as the suffix, would PolicyDraft be better but I am not sold on that name either.
There was a problem hiding this comment.
Renamed to PolicyDraft - for me, sounds more appropriate than ..Cadidate
pkg/platformhubpolicies/service.go
Outdated
| } | ||
|
|
||
| // GetBySlug returns the Platform Hub policy that matches given policy key. | ||
| func GetBySlug(client newclient.Client, key PolicyKey) (Policy, error) { |
There was a problem hiding this comment.
how does a user create a key if they don't already have a policy created to get it by slug? I wonder whether this method should take the gitRef and slug as parameters? What do other things do when they have GetBySlug
There was a problem hiding this comment.
Yeah, changed to two separate arguments.
For example runbook Git operations passing all required values as separate arguments
Avoid forcing user to create a type which implements previously used PolicyKey interface
Background
We want to allow user to manage compliance policies via go-client.
Part of MAS-6 (I want to create a new policy in Platform Hub)
Result
This PR introduces new package with exposed function to add new compliance policy. Other functionalities will be added in next pull requests.
Example of usage