this.apiService = apiService;
}
private Api newApi() {
Api api = new Api();
ApiContext env = new ApiContext();
env.setDefaultContext(true);
env.setId("test");
api.getContexts().add(env);
env.setStatus(Status.ACTIVE);
/*
* env.setMaxRateLimitTPMThreshold(1); env.setMaxRateLimitTPMWarning(1);
* env.setMaxRateLimitTPSThreshold(1); env.setMaxRateLimitTPSWarning(1);
*/
api.setId("getLocation" + (new Random().nextLong()));
api.setDisplayName("test");
api.setType(ApiType.PASS_THROUGH);
api.setVersion("1.0");
api.setEndpoint("AEndpointURL");
api.setStatus(Status.ACTIVE);
ProvisionAuthentication pauth = new ProvisionAuthentication();
Authkey authKey = new Authkey();
authKey.setKeyName("key");
pauth.setAuthKey(authKey);
api.setAuthentication(pauth);
pauth.getAuths().add(AuthType.AUTHKEY);
pauth.getAuths().add(AuthType.BASIC);
pauth.getAuths().add(AuthType.IP_WHITE_LIST);
TargetHost th = new TargetHost();
th.setUrl("http://www.yahoo.com");
TargetHost th2 = new TargetHost();
th2.setUrl("http://www.google.com");
Authentication auth = new Authentication();
auth.setType("NoAuth");
Data d = new Data();
Key k = new Key();
k.setName("aKey00");
k.setValue("key000Val");
d.setKey(Arrays.asList(k));
auth.setData(d);
th.setAuthentication(auth);
th2.setAuthentication(auth);
env.setTargetHosts(Arrays.asList(th, th2));
api.setTdrEnabled(new TdrEnabled());
api.getTdrEnabled().setEnabled("true");
HTTPSType httpsType = new HTTPSType();
httpsType.setEnabled(true);
httpsType.setTlsMode(com.alu.e3.prov.restapi.model.TLSMode.ONE_WAY);
api.setHttps(httpsType);
TdrData tdrData = new TdrData();
TdrType tdrType = new TdrType();
tdrType.getType().add("apiRateLimit");
DynamicTdr dt = new DynamicTdr();
dt.setHttpHeaderName("HTTP_HEADER");
dt.setTdrPropName("propname");
dt.setTypes(tdrType);
tdrData.getDynamic().add(dt);
StaticTdr st = new StaticTdr();
st.setValue("staticValue");
st.setTdrPropName("staticName");
st.setTypes(tdrType);
tdrData.getStatic().add(st);
api.setTdr(tdrData);
return api;
}