<div dir="ltr">Here&#39;s the PR for those who want to track progress:<div><br></div><div><a href="https://github.com/apiman/apiman-cli/pull/27">https://github.com/apiman/apiman-cli/pull/27</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 18 July 2017 at 23:34, Marc Savy <span dir="ltr">&lt;<a href="mailto:marc.savy@redhat.com" target="_blank">marc.savy@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here&#39;s a preview of my proposed data format -- it reuses the format<br>
and model developed by Pete Cornish and his team; big kudos to them!<br>
[1].<br>
<br>
I&#39;m soliciting suggestions and comments, feel free to reply here (or<br>
reach out privately if that&#39;s not possible).<br>
<br>
Example:<br>
<br>
apiman-cli gateway apply -f /Users/msavy/tmp/sample.yaml<br>
<br>
```<br>
# sample.yaml<br>
---<br>
  system:<br>
    gateways:<br>
      - name: &quot;test-gw&quot;<br>
        type: &quot;REST&quot;<br>
        config:<br>
          endpoint: &quot;<a href="http://localhost:8080/apiman-gateway-api" rel="noreferrer" target="_blank">http://localhost:8080/apiman-<wbr>gateway-api</a>&quot;<br>
          username: &quot;apimanager&quot;<br>
          password: &quot;apiman123!&quot;<br>
    plugins:<br>
      - name: TestPolicyFriendlyName // (1)<br>
        groupId: &quot;io.apiman.plugins&quot;<br>
        artifactId: &quot;apiman-plugins-test-policy&quot;<br>
        version: &quot;1.3.1.Final&quot;<br>
  org:<br>
    name: &quot;test&quot;<br>
    apis:<br>
      - name: &quot;example&quot;<br>
        version: &quot;1.0&quot;<br>
        config:<br>
          endpoint: &quot;<a href="http://localhost:8080/services/echo" rel="noreferrer" target="_blank">http://localhost:8080/<wbr>services/echo</a>&quot;<br>
          endpointType: &quot;rest&quot;<br>
          public: true<br>
          gateway: &quot;test-gw&quot;<br>
        policies:<br>
          - name: &quot;CachingPolicy&quot; // (2)<br>
            config:<br>
              ttl: 60<br>
          - plugin: TestPolicyFriendlyName // (3)<br>
            config:<br>
              foo: 123<br>
```<br>
(1) Friendly name for plugin instead of having to refer to it by full GAV<br>
(2) In-built policy will be looked up to ensure it exists and resolves<br>
the correct FQCN.<br>
(3) Add a policy by plugin friendly name (else GAV)<br>
<br>
One rare edge case when multiple policies are defined in a single<br>
plugin. In that situation we allow disambiguation by providing the<br>
plugin&#39;s `id` in the `name`/`id` field:<br>
<br>
```<br>
&lt;SNIP&gt;<br>
        policies:<br>
          - name: PolicyOne<br>
            plugin: PluginWithMultiplePolicies<br>
            config:<br>
              foo: 123<br>
```<br>
<br>
Thoughts? Feedback?<br>
<br>
Still a bit of work to do before it&#39;s PR-ready but making some progress.<br>
<br>
Regards,<br>
Marc<br>
<br>
[1] With one tiny addition.<br>
<div class="HOEnZb"><div class="h5"><br>
On 7 July 2017 at 14:29, Marc Savy &lt;<a href="mailto:marc.savy@redhat.com">marc.savy@redhat.com</a>&gt; wrote:<br>
&gt; We&#39;ve had some people using the Apiman Gateway headless for a while<br>
&gt; now, either with the new immutable registry that loads from JSON[1],<br>
&gt; or simply using any existing registry via the gateway API instead of<br>
&gt; using a manager.<br>
&gt;<br>
&gt; The main issue people encounter is that policy configuration contains<br>
&gt; two fields that are difficult to work out and clumsy to encode<br>
&gt; properly[1]:<br>
&gt;<br>
&gt; - `policyImpl` requires the plugin&#39;s URI, including the path to its<br>
&gt; main class. You can work these out by looking at the plugin&#39;s source<br>
&gt; code, but that&#39;s rather circuitous and it would be nicer to just<br>
&gt; provide the plugin&#39;s GAV (like in the manager) and for it to be<br>
&gt; resolved.<br>
&gt;<br>
&gt; - `policyJsonConfig`[3] needs to be escaped properly (and must valid<br>
&gt; according to its schema).<br>
&gt;<br>
&gt; Neither of these aspects are especially user-friendly. My proposal is<br>
&gt; to extend apiman-cli&#39;s functionality to allow the Apiman Gateway to be<br>
&gt; configured directly via a YAML/JSON file (i.e. declaratively).<br>
&gt;<br>
&gt; We can therefore provide a more user-friendly interface that automates<br>
&gt; the resolution of plugins; validations and escapes the policy config;<br>
&gt; etc.<br>
&gt;<br>
&gt; A final step would be to bundle the apiman-cli tool with our distros<br>
&gt; to make it easier to access.<br>
&gt;<br>
&gt; Any thoughts?<br>
&gt;<br>
&gt; Regards,<br>
&gt; Marc<br>
&gt;<br>
&gt; [1] <a href="https://apiman.gitbooks.io/apiman-installation-guide/installation-guide/vertx/download.html#_elasticsearch" rel="noreferrer" target="_blank">https://apiman.gitbooks.io/<wbr>apiman-installation-guide/<wbr>installation-guide/vertx/<wbr>download.html#_elasticsearch</a><br>
&gt; [2]  Of course, this interface was never truly designed to be used by<br>
&gt; humans, so that&#39;s understandable<br>
&gt; [3] Unfortunately named as it can be any arbitrary string, the policy<br>
&gt; just needs to be able to decode it. For example, it could be XML.<br>
</div></div></blockquote></div><br></div>