-
Notifications
You must be signed in to change notification settings - Fork 15
PR: Feature Request - New Resource Notification Policy and Label selector endpoint #308
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
Conversation
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.
Nice work here. I think this is the realization of a long-standing feature request, as documented here: #10. But it's not an action-based policy rather only to be used for reporting and notification.
README.md
Outdated
{ | ||
"message-policies": [ | ||
{ | ||
"id": "b56fdcce40fd0dbe1c74791343850f6881595b26", |
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.
Is this attribute id
truly needed? Probably ok to remove.
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.
Removed
README.md
Outdated
@@ -236,6 +236,17 @@ As mentioned previously the policy file must adhere to a naming convention | |||
See additional property requirements in Query policies and the aforementioned sample Github repository. | |||
|
|||
|
|||
#### Message Policies |
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.
Is Message Policy
really the right name for this?
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.
What content are we attaching to send to the org owners?
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.
I think I see what you're trying to do. You're trying to add a label filter, right? As in you're trying to implement this feature: #10? Maybe this should be renamed to Label Policy
?
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.
Changed the name to ResourceNotificationPolicy
@@ -43,6 +43,12 @@ public DbmsOnlyPoliciesController( | |||
.map(ResponseEntity::ok); | |||
} | |||
|
|||
@DeleteMapping("/policies/message/{id}") |
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.
Not convinced on the policy type
= message
for this policy. We need to find a better type name.
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.
Likely message
should be renamed to label
.
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.
Changed the name to ResourceNotificationPolicy
.scheme("https") | ||
.host(settings.getApiHost()) | ||
.path("/v3/{type}") | ||
.queryParam("label_selector", labelSelector) |
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.
This is the crux of what you're wanting to return to the interested party (org owner)? It's the resource(s) that match(es) the label selector?
@@ -153,6 +153,22 @@ public boolean validate(HygienePolicy policy) { | |||
return valid; | |||
} | |||
|
|||
public boolean validate(MessagePolicy policy) { |
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.
@@ -74,6 +76,15 @@ public R2dbcPoliciesRepository( | |||
.then(); | |||
} | |||
|
|||
public Mono<Void> deleteMessagePolicyById(String id) { |
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.
I know we don't yet have unit tests for each policy type, but we really should add one. Happy to collaborate on authoring one with you. It would go in here: https://github.com/pacphi/cf-butler/tree/master/src/test/java/io/pivotal/cfapp/repository.
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.
Just a few questions and some wording updates in documentation. We're almost there!
README.md
Outdated
@@ -236,6 +236,17 @@ As mentioned previously the policy file must adhere to a naming convention | |||
See additional property requirements in Query policies and the aforementioned sample Github repository. | |||
|
|||
|
|||
#### Resource Notification Policies | |||
|
|||
Resource Notification policies are useful when you wants to send notification for a resource(Org, Apps, Services) to the emailid's configured on the resources as labels. |
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.
when you want to generate a report containing resources of a particular type and send that report to email recipients identified by one or more label values ascribed to the those resources.
For example, you might notify primary and/or secondary owners of a collection of a resources.
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.
Done
README.md
Outdated
"PrimaryOwner", | ||
"SecondaryOwner" | ||
], | ||
"domain": "pivotal.io" |
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.
Please let's be explicit... update domain
be email_domain
.
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.
Done changed domain attribute to email-domain
"body": "Please take a moment to review the platform updates and share it with your Org users" | ||
}, | ||
"resource-email-metadata": { | ||
"resource": "organizations", |
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.
I like that you limited metadata definition to one resource type.
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.
Are you sure that the resource type is plural form? Or is it really singular form? E.g., instead of organizations
would it be organization
?
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.
I see it's actually what's allowed in ResourceType
enum. You're good in this example.
This PR include the below changes:-