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
[API] Endpoint to create policies #593
Conversation
Codecov Report
@@ Coverage Diff @@
## master #593 +/- ##
==========================================
- Coverage 92.74% 92.74% -0.01%
==========================================
Files 2355 2357 +2
Lines 76244 76239 -5
==========================================
- Hits 70710 70705 -5
Misses 5534 5534
Continue to review full report at Codecov.
|
499e6ad
to
5b76347
Compare
Codecov Report
@@ Coverage Diff @@
## master #593 +/- ##
==========================================
+ Coverage 92.75% 92.78% +0.03%
==========================================
Files 2355 2367 +12
Lines 76299 76668 +369
==========================================
+ Hits 70768 71137 +369
Misses 5531 5531
Continue to review full report at Codecov.
|
e1d0ec9
to
869905d
Compare
[OUTDATED]Request: {
"policy": {
"id": 1,
"name": "example name",
"version": "example version",
"schema": "{example: 'Example without validating the JSON at this point'}",
"created_at": "2019-02-13T14:11:57Z",
"updated_at": "2019-02-13T14:11:57Z"
}
} |
b2ebe29
to
1809c9a
Compare
5195ce8
to
af24b2d
Compare
e9717f9
to
6521988
Compare
@@ -1,6 +1,6 @@ | |||
import { fetchRegistry } from 'Policies/actions/PolicyRegistry' | |||
|
|||
describe('Policy Registry Actions', () => { | |||
describe('Policies Registry Actions', () => { |
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.
PolicyRegistry actions would be more accurate, since the component it refers to the component.
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 don't get what you mean by
the component it refers to the component.
"Policies Registry" was an attempt to make it clear it is about a registry of possible multiple custom policies, as opposed to a single policy registry. Even though "Policies Registry" is not grammatically incorrect AFAIK, it's probably a good thing to keep it "Policy Registry" as you said for consistency with other (most) API endpoints that also describe actions on collections of records.
Currently most of the API endpoints are in the form "Item Collection" (singular-singular), such as "Invoice List" instead of "Invoices List". Although we do have exceptions already, like "Account Features List" (plural-singular). The current endpoint to fetch APIcast policies spells it "APIcast Policies Registry" (plural-singular). I think I'll have to change that too.
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 also change the name of the rolling update and the name of the member permission section?
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.
It feels that we might want to refactor at some point to keep consistency.
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 everything to "policy registry", including the title of the already existing API endpoint
"APIcast Policies Registry" (now "APIcast Policy Registry")
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.
Variables in JS are named in cammelCase. Otherwise LGTM.
31aa2ea
to
819a715
Compare
6e018ec
to
5742226
Compare
NOT NULL constraint to fields of policies table
[policies] Instance variable set in the test to what it says it does split big test in multiple ones
… must be a tenant Policy validation method renamed to belongs_to_a_tenant ThreeScale JSON Validator Changed 'path' to 'glob' in ThreeScale::Policies::Specification file_fixture test helper
[Part 1] Rolling update to enable this because this will be deployed in SaaS 1st. Disabled for master. Authorize Rolling Update Policies & Not Master to Create a policy through the API. With CanCan [Part 2] Rolling update to enable this because this will be deployed in SaaS 1st. Rolling update feature policy_registry Check if account is tenant first in apidocs services controller Removed unnecessary mixin from apidocs services controller Refactor policy_registry rolling updates and ability
5742226
to
85a548b
Compare
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.
Looks good
There are some things that could be refactored but minor
Fixes THREESCALE-1910 - API Endpoint to create policies
Specific tasks
I recommend looking at it commit by commit.
Account
andPolicy
.tenant_id
with triggers and update the rake for "update all the current DB data fortenant_id
".policy_registry
and authenticate with this scope.schema
using this manifest: https://github.com/3scale/apicast/blob/c3e431df20f65686798d1e67d8c4e9f568ef9c08/gateway/src/apicast/policy/manifest-schema.jsonAn example of this json would be: https://github.com/3scale/apicast/blob/master/gateway/src/apicast/policy/upstream/apicast-policy.json
porta/app/controllers/admin/api/policies_controller.rb
Lines 20 to 26 in 587505f