-
Couldn't load subscription status.
- Fork 13
Allow CLI to interact directly with gateway (including declarations). #28
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
|
Here's the gateway format documented informally: |
|
It's now possible (with some changes on the apiman side also) to:
I need to refactor to finally fix the awful package structuring/naming I've still not solved. Will try to do that soon as I have some ideas. Example:
{
"apis" : [ {
"publicAPI" : true,
"organizationId" : "test",
"apiId" : "example",
"version" : "1.0",
"endpoint" : "http://localhost:8080/services/echo",
"endpointType" : "rest",
"endpointContentType" : null,
"endpointProperties" : { },
"parsePayload" : false,
"apiPolicies" : [ {
"policyJsonConfig" : "{\n \"ttl\" : 60\n}",
"policyImpl" : "class:io.apiman.gateway.engine.policies.CachingPolicy"
}, {
"policyJsonConfig" : "{\n \"foo\" : 123\n}",
"policyImpl" : "plugin:io.apiman.plugins:apiman-plugins-test-policy:1.3.1.Final:war/io.apiman.plugins.test_policy.TestPolicy"
} ],
"maxPayloadBufferSize" : 0
} ],
"clients" : [ ]
Here's the definition: # Simple apiman example
---
system:
gateways:
- name: "test-gw"
plugins:
- name: TestPolicy
groupId: "io.apiman.plugins"
artifactId: "apiman-plugins-test-policy"
version: "1.3.1.Final"
org:
name: "test"
apis:
- name: "example"
version: "1.0"
config:
endpoint: "http://localhost:8080/services/echo"
endpointType: "rest"
public: true
gateway: "test-gw"
policies:
- name: "CachingPolicy"
config:
ttl: 60
- plugin: TestPolicy
config:
foo: 123 |
|
BTW guys I'd hugely appreciate your feedback. I can't hold off much longer and am going to have to do a release as people are dying for the various new stuff, bug-fixes, etc! |
|
Hi Mark, thanks for implementing this. It looks like a really useful feature for the headless gateway feature. I'll have a deeper look this week. Did you have any thoughts about the package naming? |
|
One of the problems is that there is so much repetition of terminology that it can get a touch confusing at times! In particular So, I've been thinking of structuring it (vaguely) as:
There's a bit more cross-pollination than you might think, but generally that seems an okay start. At least then when you get something along the lines of WDYT? |
|
Okay, naming/structure changes made. I'm still 100% open, so hit me with your feedback. |
93fabd5 to
3de4c0e
Compare
|
This passes locally but because there isn't a docker image for 1.3.2-SNAPSHOT it's breaking at the moment. Will look at how I can solve that. |
0600e43 to
5148ada
Compare
|
I've added an annotation whereby a command can be labelled as being available since a particular version. A version check is performed on the remote gateway API to determine whether it's >= to the indicated version. This helps avoid a bunch of confusing errors where version incompatibilities exist:
See |
|
This is ready to merge from my end -- it's getting so big now that I'd prefer to do other work on a fresh PR(s). @outofcoffee are you happy for me to merge in and then I'll rework stuff based upon any suggestions or directions you have (when you have time)? Or perhaps I should do the release from my own fork on this occasion and then we can figure out merging into here later? Happy to do what you prefer. |
|
Green 🎉 |
|
Really sorry guys, I can't wait any longer. I'm going to continue working off on my own branch and do a release from there. |
|
I didn't notice there was a bunch of work on @outofcoffee's |
|
Hi @msavy - thanks again for working on this. I’ve been testing this internally to get some feedback. Main comments so far:
|
|
Thanks for the feedback!
Yes, sadly I didn't spot that when I started the work. I'll do it tomorrow. Also: I'm trying to work on the client and plan changes contributed by other community members, but I have some concerns. Perhaps we can discuss that later. I might be able to just fix it up myself; we'll see by tomorrow evening!
Agreed; will do. That was just an oversight.
Okay, sounds good.
Will do; was an oversight. |
c03490e to
16ed5d7
Compare
|
@outofcoffee Please let me know if this gets the thumbs up. The work to rebase is all done and tested. Should be okay to merge now. I'll do docs as separate PR as this is already too large, I think! |
16ed5d7 to
2c1cdb4
Compare
… run commands. Reorganises command package structure. Factors out declarative application logic into separate services. Improves docs.
- Rejig the order of commands so that the root is now: - apiman gateway ... - apiman manager ... Shares the same fundamental data model as manager; with a small tweak to policy which is non-breaking for the manager functionality. For both inbuilt and plugin policies it resolves the correct information needed to successfully interact with the Gateway API. This should substantially simplify things. Plugins are resolved using the Manager libraries, so it should function near identically. Switch to JCommander to allow more flexible architecture. - Descriptions for each subcommand. - Custom Git-style #usage/#help to avoid information overload. - Altered initialisation to allow JCommander to use utilise subcommand and help functionality more extensively. - Same Guice injector for all instances. - Add retire and unregister commands for API and Client, respectively - Add brackets around mandatory parameters - Add commands for using new API that allows listing of entities. - Allow generation of headless gateway config from YAML declaration - Refactor project to separate out 'gatewayapi' and 'managerapi' functionality into own packages. - Add version checks on a per-command basis (see @AvailableSince annotation). - Add gateway status command. Prints Gateway API status JSON. - Use master build of Apiman to access latest API changes and test. - Tests for new functionality
2c1cdb4 to
8b66f40
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.
Rebased onto develop as discussed. Just awaiting CI to go green, then will merge.
|
Woo, thanks! |
|
Awesome work, thanks @msavy! |
Continuation of: #27
New Features
Rationale
Rejig the order of commands so that the root is now:
apiman gateway ...apiman manager ...Shares the same fundamental data model as manager; with a small tweak to policy which is non-breaking for the manager functionality.
Allows some simple commands to be run directly (rather than by declaration) such as retire, unregister, etc.
For both inbuilt and plugin policies it resolves the correct information needed to successfully interact with the Gateway API. This should substantially simplify things.
Switched to JCommander
Switch to JCommander to allow more flexible architecture.
Here's the new help layout. All thoughts welcome...
And another:
Issues
Will almost certainly want to do some package refactoring and renaming. Would like to discuss that with community.
Might want to be cleverer about sorting of certain parameters, and more clearly indicate mandatory ones.
TODO