Skip to content

Conversation

@msavy
Copy link
Member

@msavy msavy commented Jul 25, 2017

Firstly, apologies for the noisy commit timeline -- I'm happy for a squash commit when the moment is right! Was a process of discovery.

Still at seeking feedback stage, but would be hugely appreciative of thoughts as I'm obviously not a pro with this codebase.

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.

  • Declarative only for now.

  • 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.
# Simple apiman example
---
  system:
    gateways:
      - name: "test-gw"
        type: "REST"
        config:
          endpoint: "http://localhost:8080/apiman-gateway-api"
          username: "apimanager"
          password: "apiman123!"
    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
$ apiman-cli gateway apply -f /Users/msavy/tmp/sample.yaml

TODO

  • Review
  • Tests
  • Clients
  • List policies?

@msavy msavy self-assigned this Jul 25, 2017
@msavy msavy requested a review from outofcoffee July 25, 2017 15:23
compile "io.apiman:apiman-gateway-engine-beans:$version_apiman"
compile "io.apiman:apiman-common-plugin:$version_apiman"
compile "io.apiman:apiman-manager-api-core:$version_apiman"
runtime "io.apiman:apiman-distro-data:$version_apiman"
Copy link
Member Author

Choose a reason for hiding this comment

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

I was having issues with eclipse + gradle (probably should switch to intellij for good...); probably don't need this as a runtime dep.

distro-data contains various useful resources such as a list of inbuilt policies

package io.apiman.cli.command;

import com.google.common.collect.Maps;
import static io.apiman.cli.util.AuthUtil.DEFAULT_SERVER_PASSWORD;
Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, looks like my eclipse being annoying and reordering dependencies. If you have settings, I'll use those instead.

@@ -1,11 +1,11 @@
/*
* Copyright 2016 Pete Cornish
* Copyright 2017 JBoss Inc
Copy link
Member Author

Choose a reason for hiding this comment

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

This wasn't deliberate, I'll change it back. Just a refactoring artifact.

@msavy
Copy link
Member Author

msavy commented Jul 25, 2017

Here's the gateway format documented informally:

# Simple apiman example
---
  system:
    gateways:
      - name: "test-gw"
        type: "REST"
        config:
          endpoint: "http://localhost:8080/apiman-gateway-api"
          username: "apimanager"
          password: "apiman123!"
    plugins:
      - name: test-plugin # friendly name
        groupId: "io.apiman.plugins"
        artifactId: "apiman-plugins-test-policy"
        version: "1.2.4.Final"
      - name: another-test-plugin
        groupId: "io.apiman.plugins"
        artifactId: "apiman-plugins-test-policy-2"
        version: "1.2.7.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: test-plugin
            config:
               Foo: 17
               Bar: "yes"
          - name: PolicyTwo # Can be elided if only one policyDef in plugin.
            plugin: another-test-plugin
            config:
               Foo: 17
               Bar: "yes"

@msavy msavy changed the title WIP Allow gateway to be driven directly using declarations Jul 25, 2017
@msavy
Copy link
Member Author

msavy commented Jul 27, 2017

Tests were passing and now fail despite nothing having changed (90fbd8c passed before, but now fails)

@msavy
Copy link
Member Author

msavy commented Jul 27, 2017

Hmm, I think CI might have broken

@msavy
Copy link
Member Author

msavy commented Aug 1, 2017

Pulling in @rpickard to give thoughts/review -- hope you don't mind.

@rpickard
Copy link

rpickard commented Aug 5, 2017 via email

@msavy
Copy link
Member Author

msavy commented Aug 7, 2017

@rpickard yes, exactly!

BTW, I'm doing some refactoring work on my local branch to make things work a bit more sensibly, as inheritance is causing some unnecessary duplication (turns out that args4j doesn't support Java 8 interface mixins for adding extra options).

@msavy
Copy link
Member Author

msavy commented Aug 24, 2017

Guys, I've done a bunch more work to move this over to JCommander (for reasons I'll go into more detail on) and think I should probably push onto a new PR or something.

@msavy
Copy link
Member Author

msavy commented Aug 29, 2017

See #28 instead, please.

@msavy msavy closed this Aug 29, 2017
@msavy msavy reopened this Nov 28, 2017
@msavy msavy closed this Nov 28, 2017
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.

2 participants