api definition for 3.2 fixed
This commit is contained in:
parent
b51689ea01
commit
3a53955a99
Binary file not shown.
6
pom.xml
6
pom.xml
@ -38,6 +38,12 @@
|
|||||||
<artifactId>jackson-dataformat-yaml</artifactId>
|
<artifactId>jackson-dataformat-yaml</artifactId>
|
||||||
<version>2.19.2</version>
|
<version>2.19.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.38</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@ -2,21 +2,17 @@ package cz.trask.migration;
|
|||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.security.KeyStore;
|
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
import javax.net.ssl.SSLContext;
|
|
||||||
import javax.net.ssl.TrustManagerFactory;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@ -38,14 +34,12 @@ public abstract class AbstractProcess {
|
|||||||
protected static final String PARAM_SOURCE_APIM = "source_apim";
|
protected static final String PARAM_SOURCE_APIM = "source_apim";
|
||||||
protected static final String VERSION_32 = "v32";
|
protected static final String VERSION_32 = "v32";
|
||||||
|
|
||||||
protected ObjectMapper mapper;
|
protected static ObjectMapper mapper;
|
||||||
|
|
||||||
protected ObjectMapper mapperYaml;
|
protected static ObjectMapper mapperYaml;
|
||||||
|
|
||||||
protected ConfigManager config = ConfigManager.getInstance();
|
protected ConfigManager config = ConfigManager.getInstance();
|
||||||
|
|
||||||
private SSLContext sslCtx;
|
|
||||||
|
|
||||||
protected AbstractProcess() {
|
protected AbstractProcess() {
|
||||||
mapper = new ObjectMapper();
|
mapper = new ObjectMapper();
|
||||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
@ -63,23 +57,8 @@ public abstract class AbstractProcess {
|
|||||||
|
|
||||||
protected void setTrustStoreCredentials() {
|
protected void setTrustStoreCredentials() {
|
||||||
log.info("Setting truststore: " + config.getTruststorePath());
|
log.info("Setting truststore: " + config.getTruststorePath());
|
||||||
KeyStore trustStore;
|
System.setProperty("javax.net.ssl.trustStore", config.getTruststorePath());
|
||||||
try {
|
System.setProperty("javax.net.ssl.trustStorePassword", config.getTruststorePassword());
|
||||||
trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
|
||||||
|
|
||||||
try (FileInputStream tsFis = new FileInputStream(config.getTruststorePath())) {
|
|
||||||
trustStore.load(tsFis, config.getTruststorePassword().toCharArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
|
||||||
tmf.init(trustStore);
|
|
||||||
|
|
||||||
sslCtx = SSLContext.getInstance("TLS");
|
|
||||||
sslCtx.init(null, tmf.getTrustManagers(), null);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("Cannot set truststore.", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -252,7 +231,6 @@ public abstract class AbstractProcess {
|
|||||||
URL url = new URL(urlStr);
|
URL url = new URL(urlStr);
|
||||||
|
|
||||||
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
|
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
|
||||||
con.setSSLSocketFactory(sslCtx.getSocketFactory());
|
|
||||||
con.setRequestMethod("POST");
|
con.setRequestMethod("POST");
|
||||||
con.setDoInput(true);
|
con.setDoInput(true);
|
||||||
con.setDoOutput(true);
|
con.setDoOutput(true);
|
||||||
@ -333,8 +311,8 @@ public abstract class AbstractProcess {
|
|||||||
* @param api - zip file to upload
|
* @param api - zip file to upload
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected HttpResponse makeFileRequest(String method, String urlStr, Map<String, String> httpHeaders,
|
protected HttpResponse makeFileRequest(String method, String urlStr, Map<String, String> httpHeaders, byte[] buff,
|
||||||
byte[] buff, String attachmentFileName) throws Exception {
|
String attachmentFileName) throws Exception {
|
||||||
|
|
||||||
if (buff == null) {
|
if (buff == null) {
|
||||||
log.error("Cannot send NULL payload to rest service.");
|
log.error("Cannot send NULL payload to rest service.");
|
||||||
@ -348,7 +326,6 @@ public abstract class AbstractProcess {
|
|||||||
URL url = new URL(urlStr);
|
URL url = new URL(urlStr);
|
||||||
|
|
||||||
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
|
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
|
||||||
con.setSSLSocketFactory(sslCtx.getSocketFactory());
|
|
||||||
con.setUseCaches(false);
|
con.setUseCaches(false);
|
||||||
con.setDoOutput(true);
|
con.setDoOutput(true);
|
||||||
|
|
||||||
@ -399,4 +376,5 @@ public abstract class AbstractProcess {
|
|||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -317,10 +317,6 @@ public class ImportToApicurio extends AbstractProcess {
|
|||||||
for (ZipEntryData entry : zipEntries) {
|
for (ZipEntryData entry : zipEntries) {
|
||||||
String artifactId = api.getName() + "/" + api.getVersion() + "/" + entry.getName();
|
String artifactId = api.getName() + "/" + api.getVersion() + "/" + entry.getName();
|
||||||
|
|
||||||
// ApiDefinition apiDef = mapper.readValue(entry.getContent(),
|
|
||||||
// ApiDefinition.class);
|
|
||||||
|
|
||||||
// Create the artifact (versioned)
|
|
||||||
try (ByteArrayInputStream is = new ByteArrayInputStream(entry.getContent())) {
|
try (ByteArrayInputStream is = new ByteArrayInputStream(entry.getContent())) {
|
||||||
ArtifactMetaData meta = client.createArtifactWithVersion(entry.getType().toString(), artifactId,
|
ArtifactMetaData meta = client.createArtifactWithVersion(entry.getType().toString(), artifactId,
|
||||||
api.getVersion(), is);
|
api.getVersion(), is);
|
||||||
|
|||||||
@ -0,0 +1,5 @@
|
|||||||
|
package cz.trask.migration.mapper;
|
||||||
|
|
||||||
|
public class ApiDefinitionMapper {
|
||||||
|
|
||||||
|
}
|
||||||
170
src/main/java/cz/trask/migration/model/ApiDefinition32.java
Normal file
170
src/main/java/cz/trask/migration/model/ApiDefinition32.java
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
package cz.trask.migration.model;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||||
|
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class ApiDefinition32 {
|
||||||
|
|
||||||
|
public static class EndpointConfigDeserializer extends JsonDeserializer<EndpointConfig> {
|
||||||
|
@Override
|
||||||
|
public EndpointConfig deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||||
|
String json = p.getValueAsString();
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
return mapper.readValue(json, EndpointConfig.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IdSection id;
|
||||||
|
private String uuid;
|
||||||
|
private String type;
|
||||||
|
private String context;
|
||||||
|
private String contextTemplate;
|
||||||
|
private List<String> tags;
|
||||||
|
private List<Object> documents;
|
||||||
|
private String lastUpdated;
|
||||||
|
private List<Tier> availableTiers;
|
||||||
|
private List<Object> availableSubscriptionLevelPolicies;
|
||||||
|
private List<Object> uriTemplates;
|
||||||
|
private boolean apiHeaderChanged;
|
||||||
|
private boolean apiResourcePatternsChanged;
|
||||||
|
private String status;
|
||||||
|
private String visibility;
|
||||||
|
private List<Object> gatewayLabels;
|
||||||
|
private boolean endpointSecured;
|
||||||
|
private boolean endpointAuthDigest;
|
||||||
|
private String transports;
|
||||||
|
private String inSequence;
|
||||||
|
private boolean advertiseOnly;
|
||||||
|
private String subscriptionAvailability;
|
||||||
|
private CorsConfiguration corsConfiguration;
|
||||||
|
@JsonDeserialize(using = EndpointConfigDeserializer.class)
|
||||||
|
private EndpointConfig endpointConfig;
|
||||||
|
private String responseCache;
|
||||||
|
private int cacheTimeout;
|
||||||
|
private String implementation;
|
||||||
|
private String authorizationHeader;
|
||||||
|
private List<Object> scopes;
|
||||||
|
private boolean isDefaultVersion;
|
||||||
|
private boolean isPublishedDefaultVersion;
|
||||||
|
private List<String> keyManagers;
|
||||||
|
private List<String> environments;
|
||||||
|
private String createdTime;
|
||||||
|
private Map<String, Object> additionalProperties;
|
||||||
|
private Map<String, Object> monetizationProperties;
|
||||||
|
private boolean isMonetizationEnabled;
|
||||||
|
private List<String> environmentList;
|
||||||
|
private String apiSecurity;
|
||||||
|
private List<Object> endpoints;
|
||||||
|
private boolean enableSchemaValidation;
|
||||||
|
private List<Object> apiCategories;
|
||||||
|
private boolean enableStore;
|
||||||
|
private String accessControl;
|
||||||
|
private double rating;
|
||||||
|
private boolean isLatest;
|
||||||
|
|
||||||
|
// -------------------- inner classes --------------------
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class IdSection {
|
||||||
|
private String providerName;
|
||||||
|
private String apiName;
|
||||||
|
private String version;
|
||||||
|
private int id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class Tier {
|
||||||
|
private String name;
|
||||||
|
private String displayName;
|
||||||
|
private String description;
|
||||||
|
private int requestsPerMin;
|
||||||
|
private int requestCount;
|
||||||
|
private int unitTime;
|
||||||
|
private String timeUnit;
|
||||||
|
private String tierPlan;
|
||||||
|
private boolean stopOnQuotaReached;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class CorsConfiguration {
|
||||||
|
private boolean corsConfigurationEnabled;
|
||||||
|
private List<String> accessControlAllowOrigins;
|
||||||
|
private boolean accessControlAllowCredentials;
|
||||||
|
private List<String> accessControlAllowHeaders;
|
||||||
|
private List<String> accessControlAllowMethods;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------- typový objekt endpointConfig -----------
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class EndpointConfig {
|
||||||
|
@JsonProperty("endpoint_type")
|
||||||
|
private String endpointType;
|
||||||
|
|
||||||
|
@JsonProperty("sandbox_endpoints")
|
||||||
|
private Endpoint sandboxEndpoints;
|
||||||
|
|
||||||
|
@JsonProperty("production_endpoints")
|
||||||
|
private Endpoint productionEndpoints;
|
||||||
|
|
||||||
|
@JsonProperty("endpoint_security")
|
||||||
|
private EndpointSecurity endpointSecurity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class Endpoint {
|
||||||
|
private String url;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class EndpointSecurity {
|
||||||
|
private SecurityEnvironment sandbox;
|
||||||
|
private SecurityEnvironment production;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class SecurityEnvironment {
|
||||||
|
private String tokenUrl;
|
||||||
|
private String clientId;
|
||||||
|
private String clientSecret;
|
||||||
|
private String password;
|
||||||
|
private String username;
|
||||||
|
private String type;
|
||||||
|
private String grantType;
|
||||||
|
private boolean enabled;
|
||||||
|
private String customParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class ProxyConfigs {
|
||||||
|
private boolean proxyEnabled;
|
||||||
|
private String proxyPort;
|
||||||
|
private String proxyProtocol;
|
||||||
|
private String proxyUsername;
|
||||||
|
private String proxyPassword;
|
||||||
|
private String proxyHost;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
200
src/main/java/cz/trask/migration/model/ApiDefinition45.java
Normal file
200
src/main/java/cz/trask/migration/model/ApiDefinition45.java
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
package cz.trask.migration.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class ApiDefinition45 {
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
private String version;
|
||||||
|
private DataSection data;
|
||||||
|
|
||||||
|
@lombok.Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class DataSection {
|
||||||
|
private String id;
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
private String context;
|
||||||
|
private String version;
|
||||||
|
private String provider;
|
||||||
|
private String lifeCycleStatus;
|
||||||
|
private boolean responseCachingEnabled;
|
||||||
|
private int cacheTimeout;
|
||||||
|
private boolean hasThumbnail;
|
||||||
|
private boolean isDefaultVersion;
|
||||||
|
private boolean isRevision;
|
||||||
|
private int revisionId;
|
||||||
|
private boolean enableSchemaValidation;
|
||||||
|
private boolean enableSubscriberVerification;
|
||||||
|
private String type;
|
||||||
|
private List<String> audiences;
|
||||||
|
private List<String> transport;
|
||||||
|
private List<String> tags;
|
||||||
|
private List<String> policies;
|
||||||
|
private List<Object> organizationPolicies;
|
||||||
|
private String authorizationHeader;
|
||||||
|
private String apiKeyHeader;
|
||||||
|
private List<String> securityScheme;
|
||||||
|
private String visibility;
|
||||||
|
private List<String> visibleRoles;
|
||||||
|
private List<String> visibleTenants;
|
||||||
|
private List<String> visibleOrganizations;
|
||||||
|
private List<Object> mediationPolicies;
|
||||||
|
private ApiPolicies apiPolicies;
|
||||||
|
private String subscriptionAvailability;
|
||||||
|
private List<String> subscriptionAvailableTenants;
|
||||||
|
private List<Object> additionalProperties;
|
||||||
|
private Map<String, Object> additionalPropertiesMap;
|
||||||
|
private String accessControl;
|
||||||
|
private List<String> accessControlRoles;
|
||||||
|
private Map<String, Object> businessInformation;
|
||||||
|
private CorsConfiguration corsConfiguration;
|
||||||
|
private WebsubSubscriptionConfiguration websubSubscriptionConfiguration;
|
||||||
|
private String createdTime;
|
||||||
|
private String lastUpdatedTimestamp;
|
||||||
|
private String lastUpdatedTime;
|
||||||
|
private EndpointConfig endpointConfig;
|
||||||
|
private String endpointImplementationType;
|
||||||
|
private SubtypeConfiguration subtypeConfiguration;
|
||||||
|
private List<Object> scopes;
|
||||||
|
private List<Operation> operations;
|
||||||
|
private List<Object> categories;
|
||||||
|
private List<String> keyManagers;
|
||||||
|
private AdvertiseInfo advertiseInfo;
|
||||||
|
private String gatewayVendor;
|
||||||
|
private String gatewayType;
|
||||||
|
private List<Object> asyncTransportProtocols;
|
||||||
|
private boolean egress;
|
||||||
|
private String organizationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class ApiPolicies {
|
||||||
|
private List<Policy> request;
|
||||||
|
private List<Policy> response;
|
||||||
|
private List<Policy> fault;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class Policy {
|
||||||
|
private String policyName;
|
||||||
|
private String policyVersion;
|
||||||
|
private String policyType;
|
||||||
|
private String policyId;
|
||||||
|
private Map<String, Object> parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class CorsConfiguration {
|
||||||
|
private boolean corsConfigurationEnabled;
|
||||||
|
private List<String> accessControlAllowOrigins;
|
||||||
|
private boolean accessControlAllowCredentials;
|
||||||
|
private List<String> accessControlAllowHeaders;
|
||||||
|
private List<String> accessControlAllowMethods;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class WebsubSubscriptionConfiguration {
|
||||||
|
private boolean enable;
|
||||||
|
private String secret;
|
||||||
|
private String signingAlgorithm;
|
||||||
|
private String signatureHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class EndpointConfig {
|
||||||
|
private String endpoint_type;
|
||||||
|
private EndpointGroup sandbox_endpoints;
|
||||||
|
private EndpointGroup production_endpoints;
|
||||||
|
private EndpointSecurity endpoint_security;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class EndpointGroup {
|
||||||
|
private String url;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class EndpointSecurity {
|
||||||
|
private SecurityEnv sandbox;
|
||||||
|
private SecurityEnv production;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class SecurityEnv {
|
||||||
|
private String tokenUrl;
|
||||||
|
private String clientId;
|
||||||
|
private int connectionTimeoutDuration;
|
||||||
|
private String type;
|
||||||
|
private int socketTimeoutDuration;
|
||||||
|
private boolean enabled;
|
||||||
|
private ProxyConfigs proxyConfigs;
|
||||||
|
private String password;
|
||||||
|
private String clientSecret;
|
||||||
|
private Map<String, Object> customParameters;
|
||||||
|
private Map<String, Object> additionalProperties;
|
||||||
|
private String grantType;
|
||||||
|
private int connectionRequestTimeoutDuration;
|
||||||
|
private String username;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class ProxyConfigs {
|
||||||
|
private boolean proxyEnabled;
|
||||||
|
private String proxyPort;
|
||||||
|
private String proxyProtocol;
|
||||||
|
private String proxyUsername;
|
||||||
|
private String proxyPassword;
|
||||||
|
private String proxyHost;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class SubtypeConfiguration {
|
||||||
|
private String subtype;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class Operation {
|
||||||
|
private String id;
|
||||||
|
private String target;
|
||||||
|
private String verb;
|
||||||
|
private String authType;
|
||||||
|
private String throttlingPolicy;
|
||||||
|
private List<Object> scopes;
|
||||||
|
private List<Object> usedProductIds;
|
||||||
|
private OperationPolicies operationPolicies;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class OperationPolicies {
|
||||||
|
private List<Policy> request;
|
||||||
|
private List<Policy> response;
|
||||||
|
private List<Policy> fault;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public static class AdvertiseInfo {
|
||||||
|
private boolean advertised;
|
||||||
|
private String apiOwner;
|
||||||
|
private String vendor;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,168 +0,0 @@
|
|||||||
package cz.trask.migration.model.v32;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
|
||||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|
||||||
|
|
||||||
public class ApiDefinition {
|
|
||||||
|
|
||||||
public static class CorsConfiguration {
|
|
||||||
@JsonProperty("corsConfigurationEnabled")
|
|
||||||
public boolean corsConfigurationEnabled;
|
|
||||||
|
|
||||||
@JsonProperty("accessControlAllowOrigins")
|
|
||||||
public List<String> accessControlAllowOrigins;
|
|
||||||
|
|
||||||
@JsonProperty("accessControlAllowCredentials")
|
|
||||||
public boolean accessControlAllowCredentials;
|
|
||||||
|
|
||||||
@JsonProperty("accessControlAllowHeaders")
|
|
||||||
public List<String> accessControlAllowHeaders;
|
|
||||||
|
|
||||||
@JsonProperty("accessControlAllowMethods")
|
|
||||||
public List<String> accessControlAllowMethods;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Tier {
|
|
||||||
public String name;
|
|
||||||
public String displayName;
|
|
||||||
public String description;
|
|
||||||
public long requestsPerMin;
|
|
||||||
public long requestCount;
|
|
||||||
public int unitTime;
|
|
||||||
public String timeUnit;
|
|
||||||
public String tierPlan;
|
|
||||||
public boolean stopOnQuotaReached;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class EndpointSecurity {
|
|
||||||
public static class SecurityConfig {
|
|
||||||
public String password;
|
|
||||||
public String tokenUrl;
|
|
||||||
public String clientId;
|
|
||||||
public String clientSecret;
|
|
||||||
public String customParameters;
|
|
||||||
public String type;
|
|
||||||
public String grantType;
|
|
||||||
public boolean enabled;
|
|
||||||
public String username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SecurityConfig production;
|
|
||||||
public SecurityConfig sandbox;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Id {
|
|
||||||
public String providerName;
|
|
||||||
public String apiName;
|
|
||||||
public String version;
|
|
||||||
public long id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ApiTierPolicy {
|
|
||||||
public String name;
|
|
||||||
public String displayName;
|
|
||||||
public String description;
|
|
||||||
public long requestsPerMin;
|
|
||||||
public long requestCount;
|
|
||||||
public int unitTime;
|
|
||||||
public String timeUnit;
|
|
||||||
public String tierPlan;
|
|
||||||
public boolean stopOnQuotaReached;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class EndpointConfig {
|
|
||||||
public String endpoint_type;
|
|
||||||
public Endpoint sandbox_endpoints;
|
|
||||||
public Endpoint production_endpoints;
|
|
||||||
public EndpointSecurity endpoint_security;
|
|
||||||
|
|
||||||
public static class Endpoint {
|
|
||||||
public String url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class EndpointSecurity {
|
|
||||||
public SecurityConfig production;
|
|
||||||
public SecurityConfig sandbox;
|
|
||||||
|
|
||||||
public static class SecurityConfig {
|
|
||||||
public String password;
|
|
||||||
public String tokenUrl;
|
|
||||||
public String clientId;
|
|
||||||
public String clientSecret;
|
|
||||||
public String customParameters;
|
|
||||||
public String type;
|
|
||||||
public String grantType;
|
|
||||||
public boolean enabled;
|
|
||||||
public String username;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Hlavní pole ---
|
|
||||||
public Id id;
|
|
||||||
public String uuid;
|
|
||||||
public String type;
|
|
||||||
public String context;
|
|
||||||
public String contextTemplate;
|
|
||||||
public List<String> tags;
|
|
||||||
public List<String> documents;
|
|
||||||
public String lastUpdated;
|
|
||||||
public List<Tier> availableTiers;
|
|
||||||
public List<Object> availableSubscriptionLevelPolicies;
|
|
||||||
public List<Object> uriTemplates;
|
|
||||||
public boolean apiHeaderChanged;
|
|
||||||
public boolean apiResourcePatternsChanged;
|
|
||||||
public String status;
|
|
||||||
public String visibility;
|
|
||||||
public List<String> gatewayLabels;
|
|
||||||
public boolean endpointSecured;
|
|
||||||
public boolean endpointAuthDigest;
|
|
||||||
public String transports;
|
|
||||||
public String inSequence;
|
|
||||||
public boolean advertiseOnly;
|
|
||||||
public String subscriptionAvailability;
|
|
||||||
public CorsConfiguration corsConfiguration;
|
|
||||||
@JsonDeserialize(using = EndpointConfigDeserializer.class)
|
|
||||||
public EndpointConfig endpointConfig;
|
|
||||||
public String responseCache;
|
|
||||||
public int cacheTimeout;
|
|
||||||
public String implementation;
|
|
||||||
public String authorizationHeader;
|
|
||||||
public List<Object> scopes;
|
|
||||||
public boolean isDefaultVersion;
|
|
||||||
public boolean isPublishedDefaultVersion;
|
|
||||||
public List<String> keyManagers;
|
|
||||||
public List<String> environments;
|
|
||||||
public String createdTime;
|
|
||||||
public Map<String, Object> additionalProperties;
|
|
||||||
public Map<String, Object> monetizationProperties;
|
|
||||||
public boolean isMonetizationEnabled;
|
|
||||||
public List<String> environmentList;
|
|
||||||
public String apiSecurity;
|
|
||||||
public List<Object> endpoints;
|
|
||||||
public boolean enableSchemaValidation;
|
|
||||||
public List<Object> apiCategories;
|
|
||||||
public boolean enableStore;
|
|
||||||
public String accessControl;
|
|
||||||
public double rating;
|
|
||||||
public boolean isLatest;
|
|
||||||
|
|
||||||
public static class EndpointConfigDeserializer extends JsonDeserializer<EndpointConfig> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EndpointConfig deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
|
||||||
String json = p.getValueAsString(); // YAML string
|
|
||||||
ObjectMapper mapper = new ObjectMapper(); // běžný JSON mapper
|
|
||||||
return mapper.readValue(json, EndpointConfig.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user