Skip to content
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

Add "push_policy" command to the CLI #986

Merged
merged 7 commits into from
Feb 12, 2019
Merged

Add "push_policy" command to the CLI #986

merged 7 commits into from
Feb 12, 2019

Conversation

davidor
Copy link
Contributor

@davidor davidor commented Jan 30, 2019

This PR adds a command to push policy schemas to the 3scale admin portal.

I tagged it as WIP because we'll need confirmation from @hallelujah to make sure that the endpoints used and their parameters are correct.

@davidor davidor requested a review from a team as a code owner January 30, 2019 17:38
@davidor davidor added this to the 3.5 milestone Jan 30, 2019
@davidor davidor force-pushed the push-policy-schemas branch from 011713d to e8fd1b1 Compare January 30, 2019 17:41
local url = system_url(access_token, admin_portal_domain)

return http_client.post(
url, { name = name, version = version, schema = cjson.encode(manifest) }
Copy link
Contributor

Choose a reason for hiding this comment

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

You probably want back JSON, so you should send Accept: application/json and sending there JSON, so should send Content-Type: application/json.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or there should be http_ng.json.post that does it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. Fixed 👍

Copy link
Contributor

@mikz mikz left a comment

Choose a reason for hiding this comment

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

Looking great! Good job.

@davidor
Copy link
Contributor Author

davidor commented Feb 1, 2019

@hallelujah In this PR, I assume that there's going to be a https://access_token:admin_portal_domain/admin/api/registry/policies endpoint and that the POST request will accept these parameters: name, version, schema.

Can you please confirm that this looks OK to you whenever you have some time? Thanks!

@davidor davidor force-pushed the push-policy-schemas branch from e8fd1b1 to 9caadaf Compare February 1, 2019 14:09
@hallelujah
Copy link
Collaborator

@davidor yes, for parameters we will have:

  • name String which corresponds to the directory name of the policy
  • version String corresponding to the version in the schema
  • schema the string representation of the JSON schema. We will validate it upon creation.

@davidor davidor changed the title [WIP] Add "push_policy" command to the CLI Add "push_policy" command to the CLI Feb 12, 2019
@davidor davidor merged commit f087c27 into master Feb 12, 2019
@davidor davidor deleted the push-policy-schemas branch February 12, 2019 09:16
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