Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ version '0.3.0-SNAPSHOT'

buildscript {
repositories {
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
Expand All @@ -34,6 +37,9 @@ apply plugin: 'com.github.johnrengelman.shadow'

repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
}

compileJava {
Expand All @@ -46,12 +52,12 @@ ext {
version_log4j = '2.8.2'
version_guava = '19.0'
version_retrofit = '1.9.0'
version_jackson = '1.9.0'
version_jackson_yaml = '2.7.3'
version_jackson = '2.9.5'
version_jackson_yaml = '2.9.5'
version_modelmapper = '0.7.5'
version_commons_lang = '3.4'
version_guice = '4.0'
version_apiman = '1.3.1.Final'
version_apiman = '1.3.2-SNAPSHOT'

// test dependencies
version_junit = '4.12'
Expand All @@ -68,6 +74,7 @@ dependencies {
compile "com.google.guava:guava:$version_guava"
compile "com.squareup.retrofit:retrofit:$version_retrofit"
compile "com.squareup.retrofit:converter-jackson:$version_retrofit"
compile "com.fasterxml.jackson.core:jackson-annotations:$version_jackson"
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$version_jackson_yaml"
compile "org.modelmapper:modelmapper:$version_modelmapper"
compile "org.apache.commons:commons-lang3:$version_commons_lang"
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/apiman/cli/ManagerCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
import io.apiman.cli.command.core.AbstractCommand;
import io.apiman.cli.command.core.Command;
import io.apiman.cli.managerapi.command.api.command.ApiCommand;
import io.apiman.cli.managerapi.command.client.command.ClientCommand;
import io.apiman.cli.managerapi.command.gateway.command.GatewayCommand;
import io.apiman.cli.managerapi.command.org.command.OrgCommand;
import io.apiman.cli.managerapi.command.plan.command.PlanCommand;
import io.apiman.cli.managerapi.command.plugin.command.PluginCommand;
import io.apiman.cli.managerapi.declarative.command.ManagerApplyCommand;

Expand All @@ -42,6 +44,8 @@ protected void populateCommands(Map<String, Class<? extends Command>> commandMap
commandMap.put("gateway", GatewayCommand.class);
commandMap.put("plugin", PluginCommand.class);
commandMap.put("api", ApiCommand.class);
commandMap.put("client", ClientCommand.class);
commandMap.put("plan", PlanCommand.class);
commandMap.put("apply", ManagerApplyCommand.class);
}

Expand Down
24 changes: 23 additions & 1 deletion src/main/java/io/apiman/cli/command/api/model/Api.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Api {
@JsonProperty

@JsonProperty
private String name;

@JsonProperty
Expand Down Expand Up @@ -81,4 +82,25 @@ public String getVersion() {
public String getStatus() {
return status;
}

public void clearStatus() {
this.status = null;
}

public String getOrganizationName() {
return organizationName;
}

public void setOrganizationName(String organizationName) {
this.organizationName = organizationName;
}

public String getDescription() {
return description;
}

public void setName(String name) {
this.name = name;
}

}
28 changes: 28 additions & 0 deletions src/main/java/io/apiman/cli/command/api/model/ApiConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.apiman.cli.command.api.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down Expand Up @@ -46,6 +47,12 @@ public class ApiConfig {
@JsonProperty
private List<ApiGateway> gateways;

@JsonProperty
private List<ApiPlan> plans;

@JsonIgnore
private boolean hasPlans;

public ApiConfig() {
}

Expand All @@ -54,6 +61,15 @@ public ApiConfig(String endpoint, String endpointType, boolean publicApi, List<A
this.endpointType = endpointType;
this.publicApi = publicApi;
this.gateways = gateways;
this.hasPlans = false;
}

public ApiConfig(String endpoint, String endpointType, boolean publicApi, List<ApiGateway> gateways, List<ApiPlan> plans) {
this.endpoint = endpoint;
this.endpointType = endpointType;
this.publicApi = publicApi;
this.gateways = gateways;
this.plans = plans;
}

public List<ApiGateway> getGateways() {
Expand All @@ -76,6 +92,14 @@ public void setGateways(ArrayList<ApiGateway> gateways) {
this.gateways = gateways;
}

public List<ApiPlan> getPlans() {
return plans;
}

public void setPlans(ArrayList<ApiPlan> plans) {
this.plans = plans;
}

public void setPublicApi(boolean publicApi) {
this.publicApi = publicApi;
}
Expand All @@ -87,4 +111,8 @@ public boolean isPublicApi() {
public void setEndpointProperties(EndpointProperties endpointProperties) {
this.endpointProperties = endpointProperties;
}

public boolean hasPlans() {
return hasPlans;
}
}
53 changes: 53 additions & 0 deletions src/main/java/io/apiman/cli/command/api/model/ApiPlan.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright 2017 Jean-Charles Quantin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.apiman.cli.command.api.model;

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* @author Jean-Charles Quantin {@literal <jeancharles.quantin@gmail.com>}
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ApiPlan {

@JsonAlias({"name", "planId"})
private String planId;

@JsonProperty
private String version;

public ApiPlan() {
}

public ApiPlan(String planId, String version) {
this.planId = planId;
this.version = version;
}

public String getPlanId() {
return planId;
}

public String getVersion() {
return version;
}

}
4 changes: 4 additions & 0 deletions src/main/java/io/apiman/cli/command/api/model/ApiPolicy.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ public ApiPolicy(String configuration) {
this.configuration = configuration;
}

public String getConfiguration() {
return configuration;
}

public String getPolicyDefinitionId() {
return policyDefinitionId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@

package io.apiman.cli.command.api.model;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.lang.reflect.Field;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* @author Pete Cornish {@literal <outofcoffee@gmail.com>}
*/
Expand All @@ -43,6 +44,8 @@ public class EndpointProperties {
@JsonProperty("basic-auth.password")
private String password;

private Map<String, String> arbitraryFields;

public void setAuthorizationType(String authorizationType) {
this.authorizationType = authorizationType;
}
Expand Down Expand Up @@ -73,4 +76,15 @@ public Map<String, String> toMap() {
}
return map;
}

@JsonAnyGetter
public Map<String, String> getArbitraryFields() {
return arbitraryFields;
}

@JsonAnyGetter
public EndpointProperties setArbitraryFields(Map<String, String> arbitraryFields) {
this.arbitraryFields = arbitraryFields;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ApiVersion {
public class EntityVersion {
@JsonProperty
private String version;

Expand All @@ -37,7 +37,7 @@ public class ApiVersion {
@JsonProperty
final private boolean clone = false;

public ApiVersion(String version) {
public EntityVersion(String version) {
this.version = version;
}
}
40 changes: 40 additions & 0 deletions src/main/java/io/apiman/cli/command/client/model/ApiKey.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2017 Jean-Charles Quantin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.apiman.cli.command.client.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* @author Jean-Charles Quantin {@literal <jeancharles.quantin@gmail.com>}
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ApiKey {

@JsonProperty
private String apiKey;

public String getApiKey() {
return apiKey;
}

public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}

}
Loading