diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java index a69ae339f2..425c9a1141 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java @@ -60,7 +60,6 @@ public class ApiApplicationRegistrationServiceImpl implements ApiApplicationRegi } String username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm() .getRealmConfiguration().getAdminUserName(); - username = username + "@" + APIUtil.getTenantDomainOftheUser(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(username); APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService(); ApiApplicationKey apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys( @@ -96,7 +95,7 @@ public class ApiApplicationRegistrationServiceImpl implements ApiApplicationRegi return Response.status(Response.Status.NOT_ACCEPTABLE).entity("APIs(Tags) are not allowed to this user." ).build(); } - String username = APIUtil.getAuthenticatedUser() + "@" + APIUtil.getTenantDomainOftheUser(); + String username = APIUtil.getAuthenticatedUser(); APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService(); String validityPeriod; if (registrationProfile.getValidityPeriod() == null) { @@ -104,27 +103,11 @@ public class ApiApplicationRegistrationServiceImpl implements ApiApplicationRegi } else { validityPeriod = registrationProfile.getValidityPeriod(); } - if (registrationProfile.isMappingAnExistingOAuthApp()) { - JSONObject jsonStringObject = new JSONObject(); - jsonStringObject.put(ApiApplicationConstants.JSONSTRING_USERNAME_TAG, username); - jsonStringObject.put(ApiApplicationConstants.JSONSTRING_KEY_TYPE_TAG, - ApiApplicationConstants.DEFAULT_TOKEN_TYPE); - jsonStringObject.put(ApiApplicationConstants.OAUTH_CLIENT_ID, registrationProfile.getConsumerKey()); - jsonStringObject.put(ApiApplicationConstants.OAUTH_CLIENT_SECRET, - registrationProfile.getConsumerSecret()); - jsonStringObject.put(ApiApplicationConstants.JSONSTRING_VALIDITY_PERIOD_TAG, validityPeriod); - apiManagementProviderService.registerExistingOAuthApplicationToAPIApplication( - jsonStringObject.toJSONString(), registrationProfile.getApplicationName(), - registrationProfile.getConsumerKey(), username, registrationProfile.isAllowedToAllDomains(), - ApiApplicationConstants.DEFAULT_TOKEN_TYPE, registrationProfile.getTags()); - return Response.status(Response.Status.ACCEPTED).entity("true").build(); - } else { - ApiApplicationKey apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys( - registrationProfile.getApplicationName(), registrationProfile.getTags(), - ApiApplicationConstants.DEFAULT_TOKEN_TYPE, username, - registrationProfile.isAllowedToAllDomains(), validityPeriod); - return Response.status(Response.Status.CREATED).entity(apiApplicationKey.toString()).build(); - } + ApiApplicationKey apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys( + registrationProfile.getApplicationName(), registrationProfile.getTags(), + ApiApplicationConstants.DEFAULT_TOKEN_TYPE, username, + registrationProfile.isAllowedToAllDomains(), validityPeriod); + return Response.status(Response.Status.CREATED).entity(apiApplicationKey.toString()).build(); } catch (APIManagerException e) { String msg = "Error occurred while registering an application '" + registrationProfile.getApplicationName() + "'"; diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/util/RegistrationProfile.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/util/RegistrationProfile.java index b1634923f3..ef63946fd3 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/util/RegistrationProfile.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/util/RegistrationProfile.java @@ -37,10 +37,6 @@ public class RegistrationProfile { private String tags[]; @XmlElement(required = true) private boolean isAllowedToAllDomains; - @XmlElement(required = true) - private boolean isMappingAnExistingOAuthApp; - private String consumerKey; - private String consumerSecret; @XmlElement(required = false) private String validityPeriod; @@ -68,30 +64,6 @@ public class RegistrationProfile { this.isAllowedToAllDomains = isAllowedToAllDomains; } - public boolean isMappingAnExistingOAuthApp() { - return isMappingAnExistingOAuthApp; - } - - public void setIsMappingAnExistingOAuthApp(boolean isMappingAnExistingOAuthApp) { - this.isMappingAnExistingOAuthApp = isMappingAnExistingOAuthApp; - } - - public String getConsumerKey() { - return consumerKey; - } - - public void setConsumerKey(String consumerKey) { - this.consumerKey = consumerKey; - } - - public String getConsumerSecret() { - return consumerSecret; - } - - public void setConsumerSecret(String consumerSecret) { - this.consumerSecret = consumerSecret; - } - public String getValidityPeriod() { return validityPeriod; } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml index bfa9db9dbc..405ffaf903 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml @@ -51,14 +51,10 @@ org.wso2.carbon org.wso2.carbon.logging - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.impl - - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.api - + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.integration.client + com.googlecode.json-simple.wso2 json-simple @@ -100,16 +96,14 @@ org.osgi.service.component, org.apache.commons.logging.*, org.wso2.carbon.user.core.*, - org.wso2.carbon.apimgt.api;version="${carbon.api.mgt.version.range}", - org.wso2.carbon.apimgt.api.model;version="${carbon.api.mgt.version.range}", - org.wso2.carbon.apimgt.impl;version="${carbon.api.mgt.version.range}", org.wso2.carbon.user.api, org.wso2.carbon.utils.multitenancy, org.json.simple, org.wso2.carbon.context, org.wso2.carbon.base, org.wso2.carbon.registry.core.*;resolution:=optional, - org.wso2.carbon.registry.indexing.*; version="${carbon.registry.imp.pkg.version.range}" + org.wso2.carbon.registry.indexing.*; version="${carbon.registry.imp.pkg.version.range}", + org.wso2.carbon.apimgt.integration.client.* !org.wso2.carbon.apimgt.application.extension.internal, diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java index 7e04924dc4..8cad8b016f 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java @@ -41,15 +41,7 @@ public interface APIManagementProviderService { */ ApiApplicationKey generateAndRetrieveApplicationKeys(String apiApplicationName, String tags[], String keyType, String username, boolean isAllowedAllDomains, - String validityTime) - throws APIManagerException; - - /** - * Register existing Oauth application as apim application. - */ - void registerExistingOAuthApplicationToAPIApplication(String jsonString, String applicationName, String clientId, - String username, boolean isAllowedAllDomains, String keyType, - String tags[]) throws APIManagerException; + String validityTime) throws APIManagerException; /** * Remove APIM Application. diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java index 087a6ee4a2..07f8a2a8a7 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java @@ -20,21 +20,18 @@ package org.wso2.carbon.apimgt.application.extension; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.json.simple.JSONObject; -import org.wso2.carbon.apimgt.api.APIConsumer; -import org.wso2.carbon.apimgt.api.APIManagementException; -import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.application.extension.constants.ApiApplicationConstants; import org.wso2.carbon.apimgt.application.extension.dto.ApiApplicationKey; import org.wso2.carbon.apimgt.application.extension.exception.APIManagerException; +import org.wso2.carbon.apimgt.application.extension.internal.APIApplicationManagerExtensionDataHolder; import org.wso2.carbon.apimgt.application.extension.util.APIManagerUtil; -import org.wso2.carbon.apimgt.impl.APIConstants; -import org.wso2.carbon.apimgt.impl.APIManagerFactory; +import org.wso2.carbon.apimgt.integration.client.store.*; +import org.wso2.carbon.apimgt.integration.client.store.model.*; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; -import org.wso2.carbon.utils.multitenancy.MultitenantUtils; -import java.util.Map; -import java.util.Set; +import java.util.ArrayList; +import java.util.List; /** * This class represents an implementation of APIManagementProviderService. @@ -42,81 +39,20 @@ import java.util.Set; public class APIManagementProviderServiceImpl implements APIManagementProviderService { private static final Log log = LogFactory.getLog(APIManagementProviderServiceImpl.class); - - /** - * {@inheritDoc} - */ - @Override - public void registerExistingOAuthApplicationToAPIApplication(String jsonString, String applicationName, - String clientId, String username, - boolean isAllowedAllDomains, String keyType, - String tags[]) throws APIManagerException { - try { - APIManagerUtil.loadTenantRegistry(); - APIConsumer apiConsumer = APIManagerFactory.getInstance().getAPIConsumer(username); - if (apiConsumer != null) { - String groupId = getLoggedInUserGroupId(username, APIManagerUtil.getTenantDomain()); - int applicationId = createApplication(apiConsumer, applicationName, username, groupId); - Subscriber subscriber = apiConsumer.getSubscriber(username); - if (subscriber == null) { - String tenantDomain = MultitenantUtils.getTenantDomain(username); - addSubscriber(username, "", groupId, APIManagerUtil.getTenantId(tenantDomain)); - subscriber = apiConsumer.getSubscriber(username); - } - Application[] applications = apiConsumer.getApplications(subscriber, groupId); - Application application = null; - for (Application app : applications) { - if (app.getId() == applicationId) { - application = app; - } - } - if (application == null) { - throw new APIManagerException( - "Api application creation failed for " + applicationName + " to the user " + username); - } - - OAuthApplicationInfo oAuthApp = application.getOAuthApp(keyType); - if (oAuthApp != null) { - if (oAuthApp.getClientId().equals(clientId)) { - if (tags != null && tags.length > 0) { - createApplicationAndSubscribeToAPIs(applicationName, tags, username); - } - return; - } else { - throw new APIManagerException("Api application already mapped to another OAuth App"); - } - } - - apiConsumer.mapExistingOAuthClient(jsonString, username, clientId, applicationName, - ApiApplicationConstants.DEFAULT_TOKEN_TYPE); - if (tags != null && tags.length > 0) { - createApplicationAndSubscribeToAPIs(applicationName, tags, username); - } - } - } catch (APIManagementException e) { - throw new APIManagerException( - "Failed registering the OAuth app [ clientId " + clientId + " ] with api manager application", e); - } - } + private static final String CONTENT_TYPE = "application/json"; + private static final int MAX_API_PER_TAG = 200; @Override public void removeAPIApplication(String applicationName, String username) throws APIManagerException { - try { - APIManagerUtil.loadTenantRegistry(); - APIConsumer apiConsumer = APIManagerFactory.getInstance().getAPIConsumer(username); - if (apiConsumer != null) { - String groupId = getLoggedInUserGroupId(username, APIManagerUtil.getTenantDomain()); - Application[] applications = apiConsumer.getApplications(new Subscriber(username), groupId); - for (Application application : applications) { - if (application.getName().equals(applicationName)) { - apiConsumer.removeApplication(application); - break; - } - } - } - } catch (APIManagementException e) { - throw new APIManagerException( - "Failed to remove the application [ application name " + applicationName + " ]", e); + + StoreClient storeClient = APIApplicationManagerExtensionDataHolder.getInstance().getIntegrationClientService() + .getStoreClient(); + ApplicationList applicationList = storeClient.getApplications() + .applicationsGet("", applicationName, 1, 0, CONTENT_TYPE, null); + if (applicationList.getList() != null && applicationList.getList().size() > 0) { + ApplicationInfo applicationInfo = applicationList.getList().get(0); + storeClient.getIndividualApplication().applicationsApplicationIdDelete(applicationInfo.getApplicationId(), + null, null); } } @@ -124,203 +60,104 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe * {@inheritDoc} */ @Override - public synchronized ApiApplicationKey generateAndRetrieveApplicationKeys(String apiApplicationName, String tags[], + public synchronized ApiApplicationKey generateAndRetrieveApplicationKeys(String applicationName, String tags[], String keyType, String username, boolean isAllowedAllDomains, String validityTime) throws APIManagerException { - try { - APIManagerUtil.loadTenantRegistry(); - APIConsumer apiConsumer = APIManagerFactory.getInstance().getAPIConsumer(username); - String groupId = getLoggedInUserGroupId(username, APIManagerUtil.getTenantDomain()); - int applicationId = createApplicationAndSubscribeToAPIs(apiApplicationName, tags, username); - Application[] applications = apiConsumer.getApplications(apiConsumer.getSubscriber(username), groupId); - Application application = null; - for (Application app : applications) { - if (app.getId() == applicationId) { - application = app; - } - } - if (application == null) { - throw new APIManagerException( - "Api application creation failed for " + apiApplicationName + " to the user " + username); - } - - OAuthApplicationInfo oAuthApp = application.getOAuthApp(keyType); - if (oAuthApp != null) { - ApiApplicationKey apiApplicationKey = new ApiApplicationKey(); - apiApplicationKey.setConsumerKey(oAuthApp.getClientId()); - apiApplicationKey.setConsumerSecret(oAuthApp.getClientSecret()); - return apiApplicationKey; - } - String[] allowedDomains = new String[1]; - if (isAllowedAllDomains) { - allowedDomains[0] = ApiApplicationConstants.ALLOWED_DOMAINS; - } else { - allowedDomains[0] = APIManagerUtil.getTenantDomain(); - } - String ownerJsonString = "{\"username\":\"" + username + "\"}"; - Map keyDetails = apiConsumer.requestApprovalForApplicationRegistration(username, - apiApplicationName, - keyType, "", - allowedDomains, - validityTime, - "null", - groupId, - ownerJsonString); - ApiApplicationKey apiApplicationKey = new ApiApplicationKey(); - apiApplicationKey.setConsumerKey((String) keyDetails.get(APIConstants.FrontEndParameterNames - .CONSUMER_KEY)); - apiApplicationKey.setConsumerSecret((String) keyDetails.get( - APIConstants.FrontEndParameterNames.CONSUMER_SECRET)); - return apiApplicationKey; - } catch (APIManagementException e) { - throw new APIManagerException("Failed to register a api application : " + apiApplicationName, e); + StoreClient storeClient = APIApplicationManagerExtensionDataHolder.getInstance().getIntegrationClientService() + .getStoreClient(); + ApplicationList applicationList = storeClient.getApplications() + .applicationsGet("", applicationName, 1, 0, CONTENT_TYPE, null); + Application application; + if (applicationList == null || applicationList.getList() == null || applicationList.getList().size() == 0) { + //create application; + application = new Application(); + application.setName(applicationName); + application.setSubscriber(username); + application.setDescription(""); + application.setThrottlingTier(ApiApplicationConstants.DEFAULT_TIER); + application.setGroupId(""); + application = storeClient.getIndividualApplication().applicationsPost(application, CONTENT_TYPE); + } else { + ApplicationInfo applicationInfo = applicationList.getList().get(0); + application = storeClient.getIndividualApplication() + .applicationsApplicationIdGet(applicationInfo.getApplicationId(), CONTENT_TYPE, null, null); } - } - - private int createApplication(APIConsumer apiConsumer, String applicationName, String username, String groupId) - throws APIManagerException { - try { - if (apiConsumer != null) { - if (apiConsumer.getSubscriber(username) == null) { - String tenantDomain = MultitenantUtils.getTenantDomain(username); - addSubscriber(username, "", groupId, APIManagerUtil.getTenantId(tenantDomain)); - } - Application application = apiConsumer.getApplicationsByName(username, applicationName, groupId); - if (application == null) { - Subscriber subscriber = apiConsumer.getSubscriber(username); - application = new Application(applicationName, subscriber); - application.setTier(ApiApplicationConstants.DEFAULT_TIER); - application.setGroupId(groupId); - return apiConsumer.addApplication(application, username); - } else { - if (log.isDebugEnabled()) { - log.debug("Application [" + applicationName + "] already exists for Subscriber [" + username + - "]"); - } - return application.getId(); - } - } else { - throw new APIManagerException("Failed to retrieve the api consumer for username" + username); - } - } catch (APIManagementException e) { - throw new APIManagerException("Failed to create application [name:" + applicationName + " , username:" - + username + ", " + "groupId:" + groupId, e); + if (application == null) { + throw new APIManagerException ( + "Api application creation failed for " + applicationName + " to the user " + username); } - } - - private void addSubscription(APIConsumer apiConsumer, APIIdentifier apiId, int applicationId, String username) - throws APIManagerException { - try { - if (apiConsumer != null) { - APIIdentifier apiIdentifier = new APIIdentifier(apiId.getProviderName(), apiId.getApiName(), - apiId.getVersion()); - apiIdentifier.setTier(ApiApplicationConstants.DEFAULT_TIER); - apiConsumer.addSubscription(apiIdentifier, username, applicationId); - if (log.isDebugEnabled()) { - log.debug("Successfully created subscription for API : " + apiId + " from application : " + - applicationId); + // subscribe to apis. + if (tags != null && tags.length > 0) { + for (String tag: tags) { + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); + APIList apiList = storeClient.getApis().apisGet(MAX_API_PER_TAG, 0, tenantDomain, "tag:" + tag + , CONTENT_TYPE, null); + if (apiList.getList() != null && apiList.getList().size() == 0) { + apiList = storeClient.getApis().apisGet(MAX_API_PER_TAG, 0 + , MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, "tag:" + tag, CONTENT_TYPE, null); } - } else { - throw new APIManagerException("API provider configured for the given API configuration is null. " + - "Thus, the API is not published"); - } - } catch (APIManagementException e) { - throw new APIManagerException("Failed to create subscription for api name : " + apiId.getApiName(), e); - } - } - - private void addSubscriber(String subscriberName, String subscriberEmail, String groupId, int tenantId) - throws APIManagerException { - if (log.isDebugEnabled()) { - log.debug("Creating subscriber with name " + subscriberName); - } - try { - APIConsumer consumer = APIManagerFactory.getInstance().getAPIConsumer(subscriberName); - if (consumer != null) { - synchronized (consumer) { - if (consumer.getSubscriber(subscriberName) == null) { - consumer.addSubscriber(subscriberName, groupId); - if (log.isDebugEnabled()) { - log.debug("Successfully created subscriber with name : " + subscriberName + - " with groupID : " + groupId); - } - } - } - } else { - throw new APIManagerException("API provider configured for the given API configuration is null. " + - "Thus, the API is not published"); - } - } catch (APIManagementException e) { - throw new APIManagerException("API provider configured for the given API configuration is null. " + - "Thus, the API is not published", e); - } - } - - /** - * This method registers an api application and then subscribe the application to the api. - * - * @param apiApplicationName name of the application. - * @param tags are used subscribe the apis with the tag. - * @param username subscription is created for the user. - * @throws APIManagerException - */ - private int createApplicationAndSubscribeToAPIs(String apiApplicationName, String tags[], String username) - throws APIManagerException { - try { - APIConsumer apiConsumer = APIManagerFactory.getInstance().getAPIConsumer(username); - String groupId = getLoggedInUserGroupId(username, APIManagerUtil.getTenantDomain()); - int applicationId = createApplication(apiConsumer, apiApplicationName, username, groupId); - Subscriber subscriber = apiConsumer.getSubscriber(username); - Set userVisibleAPIs = null; - for (String tag : tags) { - Set tagAPIs = apiConsumer.getAPIsWithTag(tag, APIManagerUtil.getTenantDomain()); - if (userVisibleAPIs == null) { - userVisibleAPIs = tagAPIs; - } else { - userVisibleAPIs.addAll(tagAPIs); - } - } - if (userVisibleAPIs != null) { - Set subscribedAPIs = apiConsumer.getSubscribedAPIs(subscriber, apiApplicationName, - groupId); - for (API userVisibleAPI : userVisibleAPIs) { - APIIdentifier apiIdentifier = userVisibleAPI.getId(); - boolean isSubscribed = false; - if (subscribedAPIs != null) { - for (SubscribedAPI subscribedAPI : subscribedAPIs) { - if (subscribedAPI.getApiId().equals(apiIdentifier)) { - isSubscribed = true; + if (apiList.getList() != null && apiList.getList().size() > 0) { + for (APIInfo apiInfo : apiList.getList()) { + Subscription subscription = new Subscription(); + //fix for APIMANAGER-5566 admin-AT-tenant1.com-Tenant1API1-1.0.0 + String id = apiInfo.getProvider().replace("@", "-AT-") + + "-" + apiInfo.getName()+ "-" + apiInfo.getVersion(); + subscription.setApiIdentifier(id); + subscription.setApplicationId(application.getApplicationId()); + subscription.tier(ApiApplicationConstants.DEFAULT_TIER); + SubscriptionList subscriptionList = storeClient.getSubscriptions().subscriptionsGet + (id, application.getApplicationId(), "", 0, 100, CONTENT_TYPE, null); + boolean subscriptionExist = false; + if (subscriptionList.getList() != null && subscriptionList.getList().size() > 0) { + for (Subscription subs : subscriptionList.getList()) { + if (subs.getApiIdentifier().equals(id) && subs.getApplicationId().equals( + application.getApplicationId())) { + subscriptionExist = true; + break; + } } } - } - if (!isSubscribed) { - addSubscription(apiConsumer, apiIdentifier, applicationId, username); + if (!subscriptionExist) { + storeClient.getIndividualSubscription().subscriptionsPost(subscription, CONTENT_TYPE); + } } } } - return applicationId; - } catch (APIManagementException e) { - throw new APIManagerException("Failed to fetch device apis information for the user " + username, e); } - } + //end of subscription - private String getLoggedInUserGroupId(String username, String tenantDomain) throws APIManagerException { - JSONObject loginInfoJsonObj = new JSONObject(); - try { - APIConsumer apiConsumer = APIManagerFactory.getInstance().getAPIConsumer(username); - loginInfoJsonObj.put("user", username); - if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) { - loginInfoJsonObj.put("isSuperTenant", true); - } else { - loginInfoJsonObj.put("isSuperTenant", false); + List applicationKeys = application.getKeys(); + if (applicationKeys != null) { + for (ApplicationKey applicationKey : applicationKeys) { + if (keyType.equals(applicationKey.getKeyType().toString())) { + ApiApplicationKey apiApplicationKey = new ApiApplicationKey(); + apiApplicationKey.setConsumerKey(applicationKey.getConsumerKey()); + apiApplicationKey.setConsumerSecret(applicationKey.getConsumerSecret()); + return apiApplicationKey; + } } - String loginInfoString = loginInfoJsonObj.toString(); - return apiConsumer.getGroupIds(loginInfoString); - } catch (APIManagementException e) { - throw new APIManagerException("Unable to get groupIds of user " + username, e); } + + ApplicationKeyGenerateRequest applicationKeyGenerateRequest = new ApplicationKeyGenerateRequest(); + List allowedDomains = new ArrayList<>(); + if (isAllowedAllDomains) { + allowedDomains.add(ApiApplicationConstants.ALLOWED_DOMAINS); + } else { + allowedDomains.add(APIManagerUtil.getTenantDomain()); + } + applicationKeyGenerateRequest.setAccessAllowDomains(allowedDomains); + applicationKeyGenerateRequest.setCallbackUrl(""); + applicationKeyGenerateRequest.setKeyType(ApplicationKeyGenerateRequest.KeyTypeEnum.PRODUCTION); + applicationKeyGenerateRequest.setValidityTime(validityTime); + + ApplicationKey applicationKey = storeClient.getIndividualApplication().applicationsGenerateKeysPost( + application.getApplicationId(), applicationKeyGenerateRequest, CONTENT_TYPE, null, null); + ApiApplicationKey apiApplicationKey = new ApiApplicationKey(); + apiApplicationKey.setConsumerKey(applicationKey.getConsumerKey()); + apiApplicationKey.setConsumerSecret(applicationKey.getConsumerSecret()); + return apiApplicationKey; } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionDataHolder.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionDataHolder.java index 6beb0bbb62..cf7cbadea4 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionDataHolder.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionDataHolder.java @@ -18,6 +18,7 @@ package org.wso2.carbon.apimgt.application.extension.internal; import org.wso2.carbon.apimgt.application.extension.APIManagementProviderService; +import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; import org.wso2.carbon.registry.core.service.TenantRegistryLoader; import org.wso2.carbon.registry.indexing.service.TenantIndexingLoader; import org.wso2.carbon.user.core.service.RealmService; @@ -30,6 +31,7 @@ public class APIApplicationManagerExtensionDataHolder { private TenantManager tenantManager; private TenantRegistryLoader tenantRegistryLoader; private TenantIndexingLoader indexLoader; + private IntegrationClientService integrationClientService; private APIApplicationManagerExtensionDataHolder() { } @@ -86,4 +88,13 @@ public class APIApplicationManagerExtensionDataHolder { public TenantIndexingLoader getIndexLoaderService(){ return indexLoader; } + + public IntegrationClientService getIntegrationClientService() { + return integrationClientService; + } + + public void setIntegrationClientService( + IntegrationClientService integrationClientService) { + this.integrationClientService = integrationClientService; + } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionServiceComponent.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionServiceComponent.java index 27104c13bd..c79f80d3b2 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionServiceComponent.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionServiceComponent.java @@ -23,6 +23,7 @@ import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext;; import org.wso2.carbon.apimgt.application.extension.APIManagementProviderService; import org.wso2.carbon.apimgt.application.extension.APIManagementProviderServiceImpl; +import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; import org.wso2.carbon.registry.core.service.TenantRegistryLoader; import org.wso2.carbon.registry.indexing.service.TenantIndexingLoader; import org.wso2.carbon.user.core.service.RealmService; @@ -48,6 +49,11 @@ import org.wso2.carbon.user.core.service.RealmService; * policy="dynamic" * bind="setRealmService" * unbind="unsetRealmService" + * interface="org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService" + * cardinality="1..1" + * policy="dynamic" + * bind="setIntegrationClientService" + * unbind="unsetIntegrationClientService" */ public class APIApplicationManagerExtensionServiceComponent { @@ -86,6 +92,17 @@ public class APIApplicationManagerExtensionServiceComponent { APIApplicationManagerExtensionDataHolder.getInstance().setIndexLoaderService(null); } + protected void setIntegrationClientService(IntegrationClientService integrationClientService) { + if (integrationClientService != null && log.isDebugEnabled()) { + log.debug("integrationClientService initialized"); + } + APIApplicationManagerExtensionDataHolder.getInstance().setIntegrationClientService(integrationClientService); + } + + protected void unsetIntegrationClientService(IntegrationClientService integrationClientService) { + APIApplicationManagerExtensionDataHolder.getInstance().setIntegrationClientService(null); + } + /** * Sets Realm Service. * diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml new file mode 100644 index 0000000000..392a6e364c --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml @@ -0,0 +1,141 @@ + + + + + + apimgt-extensions + org.wso2.carbon.devicemgt + 2.0.12-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.apimgt.integration.client + 2.0.12-SNAPSHOT + bundle + WSO2 Carbon - API Management Integration Client + WSO2 Carbon - API Management Integration Client + http://wso2.org + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + 1.4.0 + true + + + ${project.artifactId} + ${project.artifactId} + ${project.version} + APIM Integration + org.wso2.carbon.apimgt.integration.client.internal + + org.wso2.carbon.apimgt.integration.client.*, + !org.wso2.carbon.apimgt.integration.client.internal + + + org.osgi.framework, + org.osgi.service.component, + feign, + feign.codec, + feign.auth, + feign.gson, + javax.ws.rs, + javax.xml.bind, + javax.xml.bind.annotation, + javax.xml.parsers;resolution:=optional, + org.apache.commons.logging, + org.w3c.dom, + org.wso2.carbon.context, + org.wso2.carbon.identity.jwt.client.*, + org.wso2.carbon.user.api, + org.wso2.carbon.utils, + com.fasterxml.jackson.annotation, + io.swagger.annotations, + org.wso2.carbon.core.util, + javax.xml, + org.wso2.carbon.base + + + jsr311-api, + feign-jaxrs + + + + + + + + + + org.wso2.carbon + org.wso2.carbon.logging + + + org.eclipse.osgi + org.eclipse.osgi + + + org.eclipse.osgi + org.eclipse.osgi.services + + + com.google.code.gson + gson + + + javax.ws.rs + jsr311-api + + + + io.swagger + swagger-annotations + + + junit + junit + + + io.github.openfeign + feign-core + + + io.github.openfeign + feign-jackson + + + io.github.openfeign + feign-jaxrs + + + io.github.openfeign + feign-gson + + + + org.testng + testng + + + org.wso2.carbon.devicemgt + org.wso2.carbon.identity.jwt.client.extension + + + + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/IntegrationClientServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/IntegrationClientServiceImpl.java new file mode 100644 index 0000000000..7878bcfffd --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/IntegrationClientServiceImpl.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client; + +import feign.RequestInterceptor; +import org.wso2.carbon.apimgt.integration.client.publisher.PublisherClient; +import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; +import org.wso2.carbon.apimgt.integration.client.store.StoreClient; + +public class IntegrationClientServiceImpl implements IntegrationClientService { + + private static StoreClient storeClient; + private static PublisherClient publisherClient; + + public IntegrationClientServiceImpl() { + RequestInterceptor oAuthRequestInterceptor = new OAuthRequestInterceptor(); + storeClient = new StoreClient(oAuthRequestInterceptor); + publisherClient = new PublisherClient(oAuthRequestInterceptor); + } + @Override + public StoreClient getStoreClient() { + return storeClient; + } + + @Override + public PublisherClient getPublisherClient() { + return publisherClient; + } +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/OAuthRequestInterceptor.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/OAuthRequestInterceptor.java new file mode 100755 index 0000000000..2f893d74cb --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/OAuthRequestInterceptor.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * 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 org.wso2.carbon.apimgt.integration.client; + +import feign.Feign; +import feign.RequestInterceptor; +import feign.RequestTemplate; +import feign.auth.BasicAuthRequestInterceptor; +import feign.gson.GsonDecoder; +import feign.gson.GsonEncoder; +import feign.jaxrs.JAXRSContract; +import org.wso2.carbon.apimgt.integration.client.configs.APIMConfigReader; +import org.wso2.carbon.apimgt.integration.client.exception.APIMClientOAuthException; +import org.wso2.carbon.apimgt.integration.client.internal.APIIntegrationClientDataHolder; +import org.wso2.carbon.apimgt.integration.client.model.ClientProfile; +import org.wso2.carbon.apimgt.integration.client.model.DCRClient; +import org.wso2.carbon.apimgt.integration.client.model.OAuthApplication; +import org.wso2.carbon.apimgt.integration.client.util.PropertyUtils; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.identity.jwt.client.extension.JWTClient; +import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; +import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException; +import org.wso2.carbon.user.api.UserStoreException; + +import java.util.HashMap; +import java.util.Map; + +/** + * This is a request interceptor to add oauth token header. + */ +public class OAuthRequestInterceptor implements RequestInterceptor { + + private static final String APPLICATION_NAME = "api_integration_client"; + private static final String GRANT_TYPES = "password refresh_token urn:ietf:params:oauth:grant-type:jwt-bearer"; + private static final String REQUIRED_SCOPE = + "apim:api_create apim:api_view apim:api_publish apim:subscribe apim:tier_view apim:tier_manage " + + "apim:subscription_view apim:subscription_block"; + private static final long DEFAULT_REFRESH_TIME_OFFSET_IN_MILLIS = 100000; + private DCRClient dcrClient; + private static OAuthApplication oAuthApplication; + private static Map tenantUserTokenMap = new HashMap<>(); + + /** + * Creates an interceptor that authenticates all requests. + */ + public OAuthRequestInterceptor() { + String username = APIMConfigReader.getInstance().getConfig().getUsername(); + String password = APIMConfigReader.getInstance().getConfig().getPassword(); + dcrClient = Feign.builder().requestInterceptor( + new BasicAuthRequestInterceptor(username, password)) + .contract(new JAXRSContract()).encoder(new GsonEncoder()).decoder(new GsonDecoder()) + .target(DCRClient.class, PropertyUtils.replaceProperties( + APIMConfigReader.getInstance().getConfig().getDcrEndpoint())); + } + + @Override + public void apply(RequestTemplate template) { + if (oAuthApplication == null) { + //had to do on demand initialization due to start up error. + ClientProfile clientProfile = new ClientProfile(); + clientProfile.setClientName(APPLICATION_NAME); + clientProfile.setCallbackUrl(""); + clientProfile.setGrantType(GRANT_TYPES); + clientProfile.setOwner(APIMConfigReader.getInstance().getConfig().getUsername()); + clientProfile.setSaasApp(true); + oAuthApplication = dcrClient.register(clientProfile); + } + try { + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); + String username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); + if (!tenantDomain.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)) { + username = username + "@" + tenantDomain; + } + AccessTokenInfo tenantBasedAccessTokenInfo = tenantUserTokenMap.get(username); + if ((tenantBasedAccessTokenInfo == null || + ((System.currentTimeMillis() + DEFAULT_REFRESH_TIME_OFFSET_IN_MILLIS) > + tenantBasedAccessTokenInfo.getExpiresIn()))) { + + JWTClient jwtClient = APIIntegrationClientDataHolder.getInstance().getJwtClientManagerService() + .getJWTClient(); + tenantBasedAccessTokenInfo = jwtClient.getAccessToken(oAuthApplication.getClientId(), + oAuthApplication.getClientSecret(), username, + REQUIRED_SCOPE); + tenantBasedAccessTokenInfo.setExpiresIn( + System.currentTimeMillis() + (tenantBasedAccessTokenInfo.getExpiresIn() * 1000)); + tenantUserTokenMap.put(username, tenantBasedAccessTokenInfo); + + } + if (tenantBasedAccessTokenInfo.getAccessToken() != null) { + String headerValue = "Bearer " + tenantBasedAccessTokenInfo.getAccessToken(); + template.header("Authorization", headerValue); + } + } catch (JWTClientException e) { + throw new APIMClientOAuthException("failed to retrieve oauth token using jwt", e); + } + } + +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/configs/APIMConfig.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/configs/APIMConfig.java new file mode 100644 index 0000000000..1e3d34c746 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/configs/APIMConfig.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.configs; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * This holds the configuration api manager integration. + */ +@XmlRootElement(name = "APIMConfiguration") +public class APIMConfig { + + String dcrEndpoint; + String tokenEndpoint; + String publisherEndpoint; + String storeEndpoint; + String username; + String password; + + @XmlElement(name = "DCREndpoint", required = true) + public String getDcrEndpoint() { + return dcrEndpoint; + } + + public void setDcrEndpoint(String dcrEndpoint) { + this.dcrEndpoint = dcrEndpoint; + } + + @XmlElement(name = "TokenEndpoint", required = true) + public String getTokenEndpoint() { + return tokenEndpoint; + } + + public void setTokenEndpoint(String tokenEndpoint) { + this.tokenEndpoint = tokenEndpoint; + } + + @XmlElement(name = "PublisherEndpoint", required = true) + public String getPublisherEndpoint() { + return publisherEndpoint; + } + + public void setPublisherEndpoint(String publisherEndpoint) { + this.publisherEndpoint = publisherEndpoint; + } + + @XmlElement(name = "StoreEndpoint", required = true) + public String getStoreEndpoint() { + return storeEndpoint; + } + + public void setStoreEndpoint(String storeEndpoint) { + this.storeEndpoint = storeEndpoint; + } + + @XmlElement(name = "Username", required = true) + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + @XmlElement(name = "Password", required = true) + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/configs/APIMConfigReader.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/configs/APIMConfigReader.java new file mode 100644 index 0000000000..8655a4d6a2 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/configs/APIMConfigReader.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.configs; + +import org.w3c.dom.Document; +import org.wso2.carbon.apimgt.integration.client.exception.APIMClientException; +import org.wso2.carbon.apimgt.integration.client.exception.InvalidConfigurationStateException; +import org.wso2.carbon.utils.CarbonUtils; + +import javax.xml.XMLConstants; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.File; + +/** + * This holds the configuration parser for api integration.xml + */ +public class APIMConfigReader { + + private static APIMConfig config; + private static APIMConfigReader configReader= new APIMConfigReader(); + private static boolean isInitialized = false; + private static final String API_INTEGRATION_CONFIG_PATH = + CarbonUtils.getCarbonConfigDirPath() + File.separator + "apim-integration.xml"; + + private APIMConfigReader() { + + } + + private static String apimIntegrationXmlFilePath = ""; + + //TOD file may be a part of another file + public static APIMConfigReader getInstance() { + if (!isInitialized) { + try { + init(); + } catch (APIMClientException e) { + throw new InvalidConfigurationStateException("Webapp Authenticator Configuration is not " + + "initialized properly"); + } + } + return configReader; + } + + public static void init() throws APIMClientException { + try { + File apimConfigFile = new File(API_INTEGRATION_CONFIG_PATH); + Document doc = convertToDocument(apimConfigFile); + + JAXBContext ctx = JAXBContext.newInstance(APIMConfig.class); + Unmarshaller unmarshaller = ctx.createUnmarshaller(); + config = (APIMConfig) unmarshaller.unmarshal(doc); + isInitialized = true; + } catch (JAXBException e) { + throw new APIMClientException("Error occurred while un-marshalling APIMConfig", e); + } + } + + private static Document convertToDocument(File file) throws APIMClientException { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + try { + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + DocumentBuilder docBuilder = factory.newDocumentBuilder(); + return docBuilder.parse(file); + } catch (Exception e) { + throw new APIMClientException("Error occurred while parsing file 'apim-integration.xml' to a org.w3c.dom.Document", e); + } + } + + public APIMConfig getConfig() { + return config; + } + +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/exception/APIMClientException.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/exception/APIMClientException.java new file mode 100644 index 0000000000..f893f6d276 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/exception/APIMClientException.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.exception; + +/** + * This holds api client exception. + */ +public class APIMClientException extends Exception { + + private static final long serialVersionUID = -3976392476319079281L; + private String responseReason; + private int responseStatus; + private String methodKey; + + APIMClientException(String methodKey, String reason, int status) { + super("Exception occured while invoking " + methodKey + " status = " + status + " reason = " + reason); + this.methodKey = methodKey; + this.responseReason = reason; + this.responseStatus = status; + } + + APIMClientException(String message) { + super(message); + } + + public APIMClientException(String message, Exception e) { + super(message, e); + } + + public String getResponseReason() { + return responseReason; + } + + public int getResponseStatus() { + return responseStatus; + } + + public String getMethodKey() { + return methodKey; + } + +} \ No newline at end of file diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/exception/APIMClientOAuthException.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/exception/APIMClientOAuthException.java new file mode 100644 index 0000000000..48f92d5abd --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/exception/APIMClientOAuthException.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.exception; + +/** + * This holds api client exception. + */ +public class APIMClientOAuthException extends RuntimeException { + + private static final long serialVersionUID = -3976392476319079281L; + private String responseReason; + private int responseStatus; + private String methodKey; + + APIMClientOAuthException(String methodKey, String reason, int status) { + super("Exception occured while invoking " + methodKey + " status = " + status + " reason = " + reason); + this.methodKey = methodKey; + this.responseReason = reason; + this.responseStatus = status; + } + + APIMClientOAuthException(String message) { + super(message); + } + + public APIMClientOAuthException(String message, Exception e) { + super(message, e); + } + + public String getResponseReason() { + return responseReason; + } + + public int getResponseStatus() { + return responseStatus; + } + + public String getMethodKey() { + return methodKey; + } + +} \ No newline at end of file diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/exception/InvalidConfigurationStateException.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/exception/InvalidConfigurationStateException.java new file mode 100644 index 0000000000..dedb63c4bd --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/exception/InvalidConfigurationStateException.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.exception; + +/** + * This error is thrown when there is an issue with the client. + */ +public class InvalidConfigurationStateException extends RuntimeException { + + private static final long serialVersionUID = -3151279311329070397L; + + private String errorMessage; + private int errorCode; + + public InvalidConfigurationStateException(int errorCode, String message) { + super(message); + this.errorCode = errorCode; + } + + public InvalidConfigurationStateException(int errorCode, String message, Throwable cause) { + super(message, cause); + this.errorCode = errorCode; + } + + public int getErrorCode() { + return errorCode; + } + + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public InvalidConfigurationStateException(String msg, Exception nestedEx) { + super(msg, nestedEx); + setErrorMessage(msg); + } + + public InvalidConfigurationStateException(String message, Throwable cause) { + super(message, cause); + setErrorMessage(message); + } + + public InvalidConfigurationStateException(String msg) { + super(msg); + setErrorMessage(msg); + } + + public InvalidConfigurationStateException() { + super(); + } + + public InvalidConfigurationStateException(Throwable cause) { + super(cause); + } + +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/internal/APIIntegrationClientDataHolder.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/internal/APIIntegrationClientDataHolder.java new file mode 100644 index 0000000000..a53572cf25 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/internal/APIIntegrationClientDataHolder.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.internal; + + +import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService; + +/** + * This holds the required service for this component + */ +public class APIIntegrationClientDataHolder { + private static APIIntegrationClientDataHolder thisInstance = new APIIntegrationClientDataHolder(); + private JWTClientManagerService jwtClientManagerService; + private APIIntegrationClientDataHolder() { + } + + + public static APIIntegrationClientDataHolder getInstance() { + return thisInstance; + } + + public void setJwtClientManagerService(JWTClientManagerService jwtClientManagerService) { + this.jwtClientManagerService = jwtClientManagerService; + } + + public JWTClientManagerService getJwtClientManagerService() { + return jwtClientManagerService; + } +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/internal/APIIntegrationClientServiceComponent.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/internal/APIIntegrationClientServiceComponent.java new file mode 100644 index 0000000000..aaf178b718 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/internal/APIIntegrationClientServiceComponent.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.internal; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; +import org.wso2.carbon.apimgt.integration.client.IntegrationClientServiceImpl; +import org.wso2.carbon.apimgt.integration.client.configs.APIMConfigReader; +import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; +import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService; + +/** + * @scr.component name="org.wso2.carbon.api.integration.client" immediate="true" + * @scr.reference name="api.integration.client.service" + * interface="org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService" + * cardinality="1..1" + * policy="dynamic" + * bind="setJWTClientManagerService" + * unbind="unsetJWTClientManagerService" + */ +public class APIIntegrationClientServiceComponent { + + private static Log log = LogFactory.getLog(APIIntegrationClientServiceComponent.class); + + protected void activate(ComponentContext componentContext) { + try { + if (log.isDebugEnabled()) { + log.debug("Initializing apimgt client bundle"); + } + + /* Initializing webapp publisher configuration */ + APIMConfigReader.init(); + BundleContext bundleContext = componentContext.getBundleContext(); + bundleContext.registerService(IntegrationClientService.class.getName(), new IntegrationClientServiceImpl(), null); + + if (log.isDebugEnabled()) { + log.debug("apimgt client bundle has been successfully initialized"); + } + } catch (Throwable e) { + log.error("Error occurred while initializing apimgt client bundle", e); + } + } + + protected void deactivate(ComponentContext componentContext) { + //do nothing + } + + protected void setJWTClientManagerService(JWTClientManagerService jwtClientManagerService) { + if (jwtClientManagerService != null) { + log.debug("jwtClientManagerService service is initialized"); + } + APIIntegrationClientDataHolder.getInstance().setJwtClientManagerService(jwtClientManagerService); + } + + protected void unsetJWTClientManagerService(JWTClientManagerService jwtClientManagerService) { + APIIntegrationClientDataHolder.getInstance().setJwtClientManagerService(null); + } + +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/model/ClientProfile.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/model/ClientProfile.java new file mode 100644 index 0000000000..fe1821d3a4 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/model/ClientProfile.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.model; + +/** + * DTO fo DCR request. + */ +public class ClientProfile { + + private String clientName; + private String callbackUrl; + private String tokenScope; + private String owner; + private String grantType; + private boolean saasApp; + + public String getClientName() { + return clientName; + } + + public void setClientName(String clientName) { + this.clientName = clientName; + } + + public String getCallbackUrl() { + return callbackUrl; + } + + public void setCallbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + } + + public String getTokenScope() { + return tokenScope; + } + + public void setTokenScope(String tokenScope) { + this.tokenScope = tokenScope; + } + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getGrantType() { + return grantType; + } + + public void setGrantType(String grantTypem) { + this.grantType = grantTypem; + } + + public boolean isSaasApp() { + return saasApp; + } + + public void setSaasApp(boolean saasApp) { + this.saasApp = saasApp; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{\n"); + + sb.append(" clientName: ").append(clientName).append("\n"); + sb.append(" callbackUrl: ").append("callbackUrl").append("\n"); + sb.append(" grantType: ").append(grantType).append("\n"); + sb.append(" tokenScope: ").append(tokenScope).append("\n"); + sb.append(" owner: ").append(owner).append("\n"); + sb.append(" saasApp: ").append(saasApp).append("\n"); + sb.append("}\n"); + return sb.toString(); + } + +} diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedPasswordGrantHandler.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/model/DCRClient.java similarity index 57% rename from components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedPasswordGrantHandler.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/model/DCRClient.java index 8a5be8bc8d..2adcfa45ad 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedPasswordGrantHandler.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/model/DCRClient.java @@ -16,17 +16,21 @@ * under the License. */ -package org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant; +package org.wso2.carbon.apimgt.integration.client.model; -import org.wso2.carbon.device.mgt.oauth.extensions.OAuthExtUtils; -import org.wso2.carbon.identity.oauth2.token.OAuthTokenReqMessageContext; +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; -@SuppressWarnings("unused") -public class ExtendedPasswordGrantHandler extends org.wso2.carbon.apimgt.keymgt.handlers.ExtendedPasswordGrantHandler { +/** + * DCR Rest resource. + */ +@Path("/") +public interface DCRClient { - @Override - public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) { - return OAuthExtUtils.setScopes(tokReqMsgCtx); - } + // DCR APIs + @POST + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + OAuthApplication register(ClientProfile registrationProfile); } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/model/OAuthApplication.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/model/OAuthApplication.java new file mode 100644 index 0000000000..7f3bf458f4 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/model/OAuthApplication.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.model; + +public class OAuthApplication { + + private String jsonString; + private String appOwner; + private String clientName; + private String callBackURL; + private String isSaasApplication; + private String clientId; + private String clientSecret; + + public String getJsonString() { + return jsonString; + } + + public void setJsonString(String jsonString) { + this.jsonString = jsonString; + } + + public String getAppOwner() { + return appOwner; + } + + public void setAppOwner(String appOwner) { + this.appOwner = appOwner; + } + + public String getClientName() { + return clientName; + } + + public void setClientName(String clientName) { + this.clientName = clientName; + } + + public String getCallBackURL() { + return callBackURL; + } + + public void setCallBackURL(String callBackURL) { + this.callBackURL = callBackURL; + } + + public String getIsSaasApplication() { + return isSaasApplication; + } + + public void setIsSaasApplication(String isSaasApplication) { + this.isSaasApplication = isSaasApplication; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getClientSecret() { + return clientSecret; + } + + public void setClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OAuthApplication {\n"); + + sb.append(" jsonString: ").append(jsonString).append("\n"); + sb.append(" appOwner: ").append(appOwner).append("\n"); + sb.append(" clientName: ").append(clientName).append("\n"); + sb.append(" callBackURL: ").append(callBackURL).append("\n"); + sb.append(" isSaasApplication: ").append(isSaasApplication).append("\n"); + sb.append(" clientId: ").append(isSaasApplication).append("\n"); + sb.append(" clientSecret: ").append(clientSecret).append("\n"); + sb.append("}\n"); + return sb.toString(); + } + +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/PublisherClient.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/PublisherClient.java new file mode 100644 index 0000000000..ab1e130954 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/PublisherClient.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.publisher; + +import feign.Feign; +import feign.RequestInterceptor; +import feign.gson.GsonDecoder; +import feign.gson.GsonEncoder; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.apimgt.integration.client.configs.APIMConfigReader; +import org.wso2.carbon.apimgt.integration.client.publisher.api.*; +import org.wso2.carbon.core.util.Utils; + +/** + * Publisher client generated using swagger. + */ +public class PublisherClient { + + private static final org.apache.commons.logging.Log log = LogFactory.getLog(PublisherClient.class); + private APIsApi api = null; + private APIDocumentApi document = null; + private ApplicationsApi application = null; + private EnvironmentsApi environments = null; + private SubscriptionsApi subscriptions = null; + private TiersApi tiers = null; + + + /** + * PublisherClient constructor - Initialize a PublisherClient instance + * + */ + public PublisherClient(RequestInterceptor requestInterceptor) { + Feign.Builder builder = Feign.builder().requestInterceptor(requestInterceptor) + .encoder(new GsonEncoder()).decoder(new GsonDecoder()); + String basePath = Utils.replaceSystemProperty(APIMConfigReader.getInstance().getConfig().getPublisherEndpoint()); + + api = builder.target(APIsApi.class, basePath); + document = builder.target(APIDocumentApi.class, basePath); + application = builder.target(ApplicationsApi.class, basePath); + environments = builder.target(EnvironmentsApi.class, basePath); + subscriptions = builder.target(SubscriptionsApi.class, basePath); + tiers = builder.target(TiersApi.class, basePath); + } + + public APIsApi getApi() { + return api; + } + + public APIDocumentApi getDocument() { + return document; + } + + public ApplicationsApi getApplication() { + return application; + } + + public EnvironmentsApi getEnvironments() { + return environments; + } + + public SubscriptionsApi getSubscriptions() { + return subscriptions; + } + + public TiersApi getTiers() { + return tiers; + } +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/APIDocumentApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/APIDocumentApi.java new file mode 100644 index 0000000000..86942d349f --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/APIDocumentApi.java @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.publisher.api; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.wso2.carbon.apimgt.integration.client.publisher.model.Document; +import org.wso2.carbon.apimgt.integration.client.publisher.model.DocumentList; + + +import java.io.File; + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public interface APIDocumentApi { + + + /** + * Get document content + * Downloads a FILE type document/get the inline content or source url of a certain document. + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param documentId **Document Identifier** (required) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource. (optional) + * @return void + */ + @RequestLine("GET /apis/{apiId}/documents/{documentId}/content") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}" + }) + void apisApiIdDocumentsDocumentIdContentGet(@Param("apiId") String apiId, @Param("documentId") String documentId, + @Param("accept") String accept, @Param("ifNoneMatch") String ifNoneMatch, + @Param("ifModifiedSince") String ifModifiedSince); + + /** + * Update API document content. + * Upload a file to a document or add inline content to the document. Document's source type should be **FILE** in order to upload a file to the document using **file** parameter. Document's source type should be **INLINE** in order to add inline content to the document using **inlineContent** parameter. Only one of **file** or **inlineContent** can be specified at one time. + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param documentId **Document Identifier** (required) + * @param contentType Media type of the entity in the body. Default is JSON. (required) + * @param file Document to upload (optional) + * @param inlineContent Inline content of the document (optional) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return Document + */ + @RequestLine("POST /apis/{apiId}/documents/{documentId}/content") + @Headers({ + "Content-type: multipart/form-data", + "Accept: application/json", + "Content-Type: {contentType}", + + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + Document apisApiIdDocumentsDocumentIdContentPost(@Param("apiId") String apiId, @Param("documentId") String documentId, + @Param("contentType") String contentType, @Param("file") File file, + @Param("inlineContent") String inlineContent, + @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince); + + /** + * Delete an API Document + * Delete a document of an API + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param documentId **Document Identifier** (required) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return void + */ + @RequestLine("DELETE /apis/{apiId}/documents/{documentId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + void apisApiIdDocumentsDocumentIdDelete(@Param("apiId") String apiId, @Param("documentId") String documentId, + @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince); + + /** + * Get an API Document + * Get a particular document associated with an API. + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param documentId **Document Identifier** (required) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly + * retrieved variant of the resource. (optional) + * @return Document + */ + @RequestLine("GET /apis/{apiId}/documents/{documentId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}" + }) + Document apisApiIdDocumentsDocumentIdGet(@Param("apiId") String apiId, @Param("documentId") String documentId, + @Param("accept") String accept, @Param("ifNoneMatch") String ifNoneMatch, + @Param("ifModifiedSince") String ifModifiedSince); + + /** + * Update an API Document + * Update document details. + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param documentId **Document Identifier** (required) + * @param body Document object that needs to be added (required) + * @param contentType Media type of the entity in the body. Default is JSON. (required) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return Document + */ + @RequestLine("PUT /apis/{apiId}/documents/{documentId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Content-Type: {contentType}", + + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + Document apisApiIdDocumentsDocumentIdPut(@Param("apiId") String apiId, @Param("documentId") String documentId, + Document body, @Param("contentType") String contentType, + @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince); + + /** + * Get API Documents + * Get a list of documents belonging to an API. + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param limit Maximum size of resource array to return. (optional, default to 25) + * @param offset Starting point within the complete list of items qualified. (optional, default to 0) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @return DocumentList + */ + @RequestLine("GET /apis/{apiId}/documents?limit={limit}&offset={offset}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}" + }) + DocumentList apisApiIdDocumentsGet(@Param("apiId") String apiId, @Param("limit") Integer limit, + @Param("offset") Integer offset, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch); + + /** + * Add a new document + * Add a new document to an API + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param body Document object that needs to be added (required) + * @param contentType Media type of the entity in the body. Default is JSON. (required) + * @return Document + */ + @RequestLine("POST /apis/{apiId}/documents") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Content-Type: {contentType}" + }) + Document apisApiIdDocumentsPost(@Param("apiId") String apiId, Document body, @Param("contentType") String contentType); +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/APIsApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/APIsApi.java new file mode 100644 index 0000000000..b1bb6fe021 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/APIsApi.java @@ -0,0 +1,262 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.publisher.api; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.wso2.carbon.apimgt.integration.client.publisher.model.API; +import org.wso2.carbon.apimgt.integration.client.publisher.model.APIList; +import org.wso2.carbon.apimgt.integration.client.publisher.model.FileInfo; + + +import java.io.File; + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public interface APIsApi { + + + /** + * Delete API + * Delete an existing API + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return void + */ + @RequestLine("DELETE /apis/{apiId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + void apisApiIdDelete(@Param("apiId") String apiId, @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince); + + /** + * Get API details + * Get details of an API + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource. (optional) + * @return API + */ + @RequestLine("GET /apis/{apiId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}" + }) + API apisApiIdGet(@Param("apiId") String apiId, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch, @Param("ifModifiedSince") String ifModifiedSince); + + /** + * Update an existing API + * Update an existing API + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param body API object that needs to be added (required) + * @param contentType Media type of the entity in the body. Default is JSON. (required) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return API + */ + @RequestLine("PUT /apis/{apiId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Content-Type: {contentType}", + + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + API apisApiIdPut(@Param("apiId") String apiId, API body, @Param("contentType") String contentType, + @Param("ifMatch") String ifMatch, @Param("ifUnmodifiedSince") String ifUnmodifiedSince); + + /** + * Get API Definition + * Get the swagger of an API + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource. (optional) + * @return void + */ + @RequestLine("GET /apis/{apiId}/swagger") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}" + }) + void apisApiIdSwaggerGet(@Param("apiId") String apiId, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch, @Param("ifModifiedSince") String ifModifiedSince); + + /** + * Update API Definition + * Update an existing swagger definition of an API + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param apiDefinition Swagger definition of the API (required) + * @param contentType Media type of the entity in the body. Default is JSON. (required) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return void + */ + @RequestLine("PUT /apis/{apiId}/swagger") + @Headers({ + "Content-type: multipart/form-data", + "Accept: application/json", + "Content-Type: {contentType}", + + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + void apisApiIdSwaggerPut(@Param("apiId") String apiId, @Param("apiDefinition") String apiDefinition, + @Param("contentType") String contentType, @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince); + + /** + * Get the thumbnail image + * Downloads a thumbnail image of an API + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource. (optional) + * @return void + */ + @RequestLine("GET /apis/{apiId}/thumbnail") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}" + }) + void apisApiIdThumbnailGet(@Param("apiId") String apiId, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch, @Param("ifModifiedSince") String ifModifiedSince); + + /** + * Upload a thumbnail image + * Upload a thumbnail image to an API. + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param file Image to upload (required) + * @param contentType Media type of the entity in the body. Default is JSON. (required) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return FileInfo + */ + @RequestLine("POST /apis/{apiId}/thumbnail") + @Headers({ + "Content-type: multipart/form-data", + "Accept: application/json", + "Content-Type: {contentType}", + + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + FileInfo apisApiIdThumbnailPost(@Param("apiId") String apiId, @Param("file") File file, + @Param("contentType") String contentType, @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince); + + /** + * Change API Status + * Change the lifecycle of an API + * @param action The action to demote or promote the state of the API. Supported actions are [ **Publish, Deploy as a Prototype, Demote to Created, Demote to Prototyped, Block, Deprecate, Re-Publish, Retire **] (required) + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API I. Should be formatted as **provider-name-version**. (required) + * @param lifecycleChecklist You can specify additional checklist items by using an **\"attribute:\"** modifier. Eg: \"Deprecate Old Versions:true\" will deprecate older versions of a particular API when it is promoted to Published state from Created state. Multiple checklist items can be given in \"attribute1:true, attribute2:false\" format. Supported checklist items are as follows. 1. **Deprecate Old Versions**: Setting this to true will deprecate older versions of a particular API when it is promoted to Published state from Created state. 2. **Require Re-Subscription**: If you set this to true, users need to re subscribe to the API although they may have subscribed to an older version. (optional) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return void + */ + @RequestLine("POST /apis/change-lifecycle?action={action}&lifecycleChecklist={lifecycleChecklist}&apiId={apiId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + void apisChangeLifecyclePost(@Param("action") String action, @Param("apiId") String apiId, + @Param("lifecycleChecklist") String lifecycleChecklist, @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince); + + /** + * Copy API + * Create a new API by copying an existing API + * @param newVersion Version of the new API. (required) + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API I. Should be formatted as **provider-name-version**. (required) + * @return void + */ + @RequestLine("POST /apis/copy-api?newVersion={newVersion}&apiId={apiId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json" + }) + void apisCopyApiPost(@Param("newVersion") String newVersion, @Param("apiId") String apiId); + + /** + * Get all APIs + * Get a list of available APIs qualifying under a given search condition. + * @param limit Maximum size of resource array to return. (optional, default to 25) + * @param offset Starting point within the complete list of items qualified. (optional, default to 0) + * @param query **Search condition**. You can search in attributes by using an **\"attribute:\"** modifier. Eg. \"provider:wso2\" will match an API if the provider of the API contains \"wso2\". Supported attribute modifiers are [**version, context, status, description, subcontext, doc, provider**] If no advanced attribute modifier has been specified, search will match the given query string against API Name. (optional) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of + * the resourec. (optional) + * @return APIList + */ + @RequestLine("GET /apis?limit={limit}&offset={offset}&query={query}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}" + }) + APIList apisGet(@Param("limit") Integer limit, @Param("offset") Integer offset, @Param("query") String query, + @Param("accept") String accept, @Param("ifNoneMatch") String ifNoneMatch); + + /** + * Create a new API + * Create a new API + * @param body API object that needs to be added (required) + * @param contentType Media type of the entity in the body. Default is JSON. (required) + * @return API + */ + @RequestLine("POST /apis") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Content-Type: {contentType}" + }) + API apisPost(API body, @Param("contentType") String contentType); +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/ApplicationsApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/ApplicationsApi.java new file mode 100644 index 0000000000..228755ffdf --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/ApplicationsApi.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.publisher.api; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.wso2.carbon.apimgt.integration.client.publisher.model.Application; + + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public interface ApplicationsApi { + + + /** + * Get Application + * Get application details + * @param applicationId **Application Identifier** consisting of the UUID of the Application. (required) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource. (optional) + * @return Application + */ + @RequestLine("GET /applications/{applicationId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}" + }) + Application applicationsApplicationIdGet(@Param("applicationId") String applicationId, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch, + @Param("ifModifiedSince") String ifModifiedSince); +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/EnvironmentsApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/EnvironmentsApi.java new file mode 100644 index 0000000000..babc1b7949 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/EnvironmentsApi.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.publisher.api; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.wso2.carbon.apimgt.integration.client.publisher.model.EnvironmentList; + + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public interface EnvironmentsApi { + + + /** + * Get gateway environments + * Get a list of gateway environments configured previously. + * @param apiId Will return environment list for the provided API. (optional) + * @return EnvironmentList + */ + @RequestLine("GET /environments?apiId={apiId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json" + }) + EnvironmentList environmentsGet(@Param("apiId") String apiId); +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/SubscriptionsApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/SubscriptionsApi.java new file mode 100644 index 0000000000..b9e11e3141 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/SubscriptionsApi.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.publisher.api; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.wso2.carbon.apimgt.integration.client.publisher.model.Subscription; +import org.wso2.carbon.apimgt.integration.client.publisher.model.SubscriptionList; + + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public interface SubscriptionsApi { + + + /** + * Block a subscription + * Block a subscription. + * @param subscriptionId Subscription Id (required) + * @param blockState Subscription block state. (required) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return void + */ + @RequestLine("POST /subscriptions/block-subscription?subscriptionId={subscriptionId}&blockState={blockState}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + void subscriptionsBlockSubscriptionPost(@Param("subscriptionId") String subscriptionId, + @Param("blockState") String blockState, @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince); + + /** + * Get All Subscriptions + * Get subscription list. The API Identifier and corresponding Application Identifier the subscriptions of which are to be returned are passed as parameters. + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API I. Should be formatted as **provider-name-version**. (required) + * @param limit Maximum size of resource array to return. (optional, default to 25) + * @param offset Starting point within the complete list of items qualified. (optional, default to 0) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @return SubscriptionList + */ + @RequestLine("GET /subscriptions?apiId={apiId}&limit={limit}&offset={offset}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}" + }) + SubscriptionList subscriptionsGet(@Param("apiId") String apiId, @Param("limit") Integer limit, + @Param("offset") Integer offset, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch); + + /** + * Get a Subscription + * Get subscription details + * @param subscriptionId Subscription Id (required) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource. (optional) + * @return Subscription + */ + @RequestLine("GET /subscriptions/{subscriptionId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}" + }) + Subscription subscriptionsSubscriptionIdGet(@Param("subscriptionId") String subscriptionId, + @Param("accept") String accept, @Param("ifNoneMatch") String ifNoneMatch, + @Param("ifModifiedSince") String ifModifiedSince); + + /** + * Unblock a Subscription + * Unblock a subscription. + * @param subscriptionId Subscription Id (required) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return void + */ + @RequestLine("POST /subscriptions/unblock-subscription?subscriptionId={subscriptionId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + void subscriptionsUnblockSubscriptionPost(@Param("subscriptionId") String subscriptionId, + @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince); +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/TiersApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/TiersApi.java new file mode 100644 index 0000000000..b25c26b948 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/api/TiersApi.java @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.publisher.api; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.wso2.carbon.apimgt.integration.client.publisher.model.Tier; +import org.wso2.carbon.apimgt.integration.client.publisher.model.TierList; +import org.wso2.carbon.apimgt.integration.client.publisher.model.TierPermission; + + +import java.util.List; + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public interface TiersApi { + + + /** + * List Tiers + * Get available tiers + * @param tierLevel List API or Application or Resource type tiers. (required) + * @param limit Maximum size of resource array to return. (optional, default to 25) + * @param offset Starting point within the complete list of items qualified. (optional, default to 0) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @return TierList + */ + @RequestLine("GET /tiers/{tierLevel}?limit={limit}&offset={offset}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}" + }) + TierList tiersTierLevelGet(@Param("tierLevel") String tierLevel, @Param("limit") Integer limit, + @Param("offset") Integer offset, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch); + + /** + * Add a new Tier + * Add a new tier + * @param body Tier object that should to be added (required) + * @param tierLevel List API or Application or Resource type tiers. (required) + * @param contentType Media type of the entity in the body. Default is JSON. (required) + * @return Tier + */ + @RequestLine("POST /tiers/{tierLevel}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Content-Type: {contentType}" + }) + Tier tiersTierLevelPost(Tier body, @Param("tierLevel") String tierLevel, @Param("contentType") String contentType); + + /** + * Delete a Tier + * Remove a tier + * @param tierName Tier name (required) + * @param tierLevel List API or Application or Resource type tiers. (required) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return void + */ + @RequestLine("DELETE /tiers/{tierLevel}/{tierName}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + void tiersTierLevelTierNameDelete(@Param("tierName") String tierName, @Param("tierLevel") String tierLevel, + @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince); + + /** + * Get a Tier + * Get tier details + * @param tierName Tier name (required) + * @param tierLevel List API or Application or Resource type tiers. (required) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource. (optional) + * @return Tier + */ + @RequestLine("GET /tiers/{tierLevel}/{tierName}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}" + }) + Tier tiersTierLevelTierNameGet(@Param("tierName") String tierName, @Param("tierLevel") String tierLevel, + @Param("accept") String accept, @Param("ifNoneMatch") String ifNoneMatch, + @Param("ifModifiedSince") String ifModifiedSince); + + /** + * Update a Tier + * Update tier details + * @param tierName Tier name (required) + * @param body Tier object that needs to be modified (required) + * @param tierLevel List API or Application or Resource type tiers. (required) + * @param contentType Media type of the entity in the body. Default is JSON. (required) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return Tier + */ + @RequestLine("PUT /tiers/{tierLevel}/{tierName}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Content-Type: {contentType}", + + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + Tier tiersTierLevelTierNamePut(@Param("tierName") String tierName, Tier body, @Param("tierLevel") String tierLevel, + @Param("contentType") String contentType, @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince); + + /** + * Update Tier Permission + * Update tier permission + * @param tierName Name of the tier (required) + * @param tierLevel List API or Application or Resource type tiers. (required) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @param permissions (optional) + * @return List + */ + @RequestLine("POST /tiers/update-permission?tierName={tierName}&tierLevel={tierLevel}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + List tiersUpdatePermissionPost(@Param("tierName") String tierName, @Param("tierLevel") String tierLevel, + @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince, TierPermission permissions); +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/API.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/API.java new file mode 100644 index 0000000000..0e881e9922 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/API.java @@ -0,0 +1,847 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * API + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class API { + @JsonProperty("id") + private String id = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("description") + private String description = null; + + @JsonProperty("context") + private String context = null; + + @JsonProperty("version") + private String version = null; + + @JsonProperty("provider") + private String provider = null; + + @JsonProperty("apiDefinition") + private String apiDefinition = null; + + @JsonProperty("wsdlUri") + private String wsdlUri = null; + + @JsonProperty("status") + private String status = null; + + @JsonProperty("responseCaching") + private String responseCaching = null; + + @JsonProperty("cacheTimeout") + private Integer cacheTimeout = null; + + @JsonProperty("destinationStatsEnabled") + private String destinationStatsEnabled = null; + + @JsonProperty("isDefaultVersion") + private Boolean isDefaultVersion = null; + + @JsonProperty("transport") + private List transport = new ArrayList(); + + @JsonProperty("tags") + private List tags = new ArrayList(); + + @JsonProperty("tiers") + private List tiers = new ArrayList(); + + @JsonProperty("maxTps") + private APIMaxTps maxTps = null; + + @JsonProperty("thumbnailUri") + private String thumbnailUri = null; + + /** + * Gets or Sets visibility + */ + public enum VisibilityEnum { + PUBLIC("PUBLIC"), + + PRIVATE("PRIVATE"), + + RESTRICTED("RESTRICTED"), + + CONTROLLED("CONTROLLED"); + + private String value; + + VisibilityEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static VisibilityEnum fromValue(String text) { + for (VisibilityEnum b : VisibilityEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("visibility") + private VisibilityEnum visibility = null; + + @JsonProperty("visibleRoles") + private List visibleRoles = new ArrayList(); + + @JsonProperty("visibleTenants") + private List visibleTenants = new ArrayList(); + + @JsonProperty("endpointConfig") + private String endpointConfig = null; + + @JsonProperty("endpointSecurity") + private APIEndpointSecurity endpointSecurity = null; + + @JsonProperty("gatewayEnvironments") + private String gatewayEnvironments = null; + + @JsonProperty("sequences") + private List sequences = new ArrayList(); + + /** + * Gets or Sets subscriptionAvailability + */ + public enum SubscriptionAvailabilityEnum { + current_tenant("current_tenant"), + + all_tenants("all_tenants"), + + specific_tenants("specific_tenants"); + + private String value; + + SubscriptionAvailabilityEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SubscriptionAvailabilityEnum fromValue(String text) { + for (SubscriptionAvailabilityEnum b : SubscriptionAvailabilityEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("subscriptionAvailability") + private SubscriptionAvailabilityEnum subscriptionAvailability = null; + + @JsonProperty("subscriptionAvailableTenants") + private List subscriptionAvailableTenants = new ArrayList(); + + @JsonProperty("businessInformation") + private APIBusinessInformation businessInformation = null; + + @JsonProperty("corsConfiguration") + private APICorsConfiguration corsConfiguration = null; + + public API id(String id) { + this.id = id; + return this; + } + + /** + * UUID of the api registry artifact + * @return id + **/ + @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", value = "UUID of the api registry artifact ") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public API name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "CalculatorAPI", required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public API description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @ApiModelProperty(example = "A calculator API that supports basic operations", value = "") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public API context(String context) { + this.context = context; + return this; + } + + /** + * Get context + * @return context + **/ + @ApiModelProperty(example = "CalculatorAPI", required = true, value = "") + public String getContext() { + return context; + } + + public void setContext(String context) { + this.context = context; + } + + public API version(String version) { + this.version = version; + return this; + } + + /** + * Get version + * @return version + **/ + @ApiModelProperty(example = "1.0.0", required = true, value = "") + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public API provider(String provider) { + this.provider = provider; + return this; + } + + /** + * If the provider value is not given user invoking the api will be used as the provider. + * @return provider + **/ + @ApiModelProperty(example = "admin", value = "If the provider value is not given user invoking the api will be used as the provider. ") + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + + public API apiDefinition(String apiDefinition) { + this.apiDefinition = apiDefinition; + return this; + } + + /** + * Swagger definition of the API which contains details about URI templates and scopes + * @return apiDefinition + **/ + @ApiModelProperty(example = "null", required = true, value = "Swagger definition of the API which contains details about URI templates and scopes ") + public String getApiDefinition() { + return apiDefinition; + } + + public void setApiDefinition(String apiDefinition) { + this.apiDefinition = apiDefinition; + } + + public API wsdlUri(String wsdlUri) { + this.wsdlUri = wsdlUri; + return this; + } + + /** + * WSDL URL if the API is based on a WSDL endpoint + * @return wsdlUri + **/ + @ApiModelProperty(example = "http://www.webservicex.com/globalweather.asmx?wsdl", value = "WSDL URL if the API is based on a WSDL endpoint ") + public String getWsdlUri() { + return wsdlUri; + } + + public void setWsdlUri(String wsdlUri) { + this.wsdlUri = wsdlUri; + } + + public API status(String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(example = "CREATED", value = "") + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public API responseCaching(String responseCaching) { + this.responseCaching = responseCaching; + return this; + } + + /** + * Get responseCaching + * @return responseCaching + **/ + @ApiModelProperty(example = "Disabled", value = "") + public String getResponseCaching() { + return responseCaching; + } + + public void setResponseCaching(String responseCaching) { + this.responseCaching = responseCaching; + } + + public API cacheTimeout(Integer cacheTimeout) { + this.cacheTimeout = cacheTimeout; + return this; + } + + /** + * Get cacheTimeout + * @return cacheTimeout + **/ + @ApiModelProperty(example = "300", value = "") + public Integer getCacheTimeout() { + return cacheTimeout; + } + + public void setCacheTimeout(Integer cacheTimeout) { + this.cacheTimeout = cacheTimeout; + } + + public API destinationStatsEnabled(String destinationStatsEnabled) { + this.destinationStatsEnabled = destinationStatsEnabled; + return this; + } + + /** + * Get destinationStatsEnabled + * @return destinationStatsEnabled + **/ + @ApiModelProperty(example = "Disabled", value = "") + public String getDestinationStatsEnabled() { + return destinationStatsEnabled; + } + + public void setDestinationStatsEnabled(String destinationStatsEnabled) { + this.destinationStatsEnabled = destinationStatsEnabled; + } + + public API isDefaultVersion(Boolean isDefaultVersion) { + this.isDefaultVersion = isDefaultVersion; + return this; + } + + /** + * Get isDefaultVersion + * @return isDefaultVersion + **/ + @ApiModelProperty(example = "false", required = true, value = "") + public Boolean getIsDefaultVersion() { + return isDefaultVersion; + } + + public void setIsDefaultVersion(Boolean isDefaultVersion) { + this.isDefaultVersion = isDefaultVersion; + } + + public API transport(List transport) { + this.transport = transport; + return this; + } + + public API addTransportItem(String transportItem) { + this.transport.add(transportItem); + return this; + } + + /** + * Supported transports for the API (http and/or https). + * @return transport + **/ + @ApiModelProperty(example = "null", required = true, value = "Supported transports for the API (http and/or https). ") + public List getTransport() { + return transport; + } + + public void setTransport(List transport) { + this.transport = transport; + } + + public API tags(List tags) { + this.tags = tags; + return this; + } + + public API addTagsItem(String tagsItem) { + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @ApiModelProperty(example = "null", value = "") + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public API tiers(List tiers) { + this.tiers = tiers; + return this; + } + + public API addTiersItem(String tiersItem) { + this.tiers.add(tiersItem); + return this; + } + + /** + * Get tiers + * @return tiers + **/ + @ApiModelProperty(example = "null", required = true, value = "") + public List getTiers() { + return tiers; + } + + public void setTiers(List tiers) { + this.tiers = tiers; + } + + public API maxTps(APIMaxTps maxTps) { + this.maxTps = maxTps; + return this; + } + + /** + * Get maxTps + * @return maxTps + **/ + @ApiModelProperty(example = "null", value = "") + public APIMaxTps getMaxTps() { + return maxTps; + } + + public void setMaxTps(APIMaxTps maxTps) { + this.maxTps = maxTps; + } + + public API thumbnailUri(String thumbnailUri) { + this.thumbnailUri = thumbnailUri; + return this; + } + + /** + * Get thumbnailUri + * @return thumbnailUri + **/ + @ApiModelProperty(example = "/apis/01234567-0123-0123-0123-012345678901/thumbnail", value = "") + public String getThumbnailUri() { + return thumbnailUri; + } + + public void setThumbnailUri(String thumbnailUri) { + this.thumbnailUri = thumbnailUri; + } + + public API visibility(VisibilityEnum visibility) { + this.visibility = visibility; + return this; + } + + /** + * Get visibility + * @return visibility + **/ + @ApiModelProperty(example = "PUBLIC", required = true, value = "") + public VisibilityEnum getVisibility() { + return visibility; + } + + public void setVisibility(VisibilityEnum visibility) { + this.visibility = visibility; + } + + public API visibleRoles(List visibleRoles) { + this.visibleRoles = visibleRoles; + return this; + } + + public API addVisibleRolesItem(String visibleRolesItem) { + this.visibleRoles.add(visibleRolesItem); + return this; + } + + /** + * Get visibleRoles + * @return visibleRoles + **/ + @ApiModelProperty(example = "null", value = "") + public List getVisibleRoles() { + return visibleRoles; + } + + public void setVisibleRoles(List visibleRoles) { + this.visibleRoles = visibleRoles; + } + + public API visibleTenants(List visibleTenants) { + this.visibleTenants = visibleTenants; + return this; + } + + public API addVisibleTenantsItem(String visibleTenantsItem) { + this.visibleTenants.add(visibleTenantsItem); + return this; + } + + /** + * Get visibleTenants + * @return visibleTenants + **/ + @ApiModelProperty(example = "null", value = "") + public List getVisibleTenants() { + return visibleTenants; + } + + public void setVisibleTenants(List visibleTenants) { + this.visibleTenants = visibleTenants; + } + + public API endpointConfig(String endpointConfig) { + this.endpointConfig = endpointConfig; + return this; + } + + /** + * Get endpointConfig + * @return endpointConfig + **/ + @ApiModelProperty(example = "{"production_endpoints":{"url":"http://localhost:9763/am/sample/calculator/v1/api","config":null},"implementation_status":"managed","endpoint_type":"http"}", required = true, value = "") + public String getEndpointConfig() { + return endpointConfig; + } + + public void setEndpointConfig(String endpointConfig) { + this.endpointConfig = endpointConfig; + } + + public API endpointSecurity(APIEndpointSecurity endpointSecurity) { + this.endpointSecurity = endpointSecurity; + return this; + } + + /** + * Get endpointSecurity + * @return endpointSecurity + **/ + @ApiModelProperty(example = "null", value = "") + public APIEndpointSecurity getEndpointSecurity() { + return endpointSecurity; + } + + public void setEndpointSecurity(APIEndpointSecurity endpointSecurity) { + this.endpointSecurity = endpointSecurity; + } + + public API gatewayEnvironments(String gatewayEnvironments) { + this.gatewayEnvironments = gatewayEnvironments; + return this; + } + + /** + * Comma separated list of gateway environments. + * @return gatewayEnvironments + **/ + @ApiModelProperty(example = "Production and Sandbox", value = "Comma separated list of gateway environments. ") + public String getGatewayEnvironments() { + return gatewayEnvironments; + } + + public void setGatewayEnvironments(String gatewayEnvironments) { + this.gatewayEnvironments = gatewayEnvironments; + } + + public API sequences(List sequences) { + this.sequences = sequences; + return this; + } + + public API addSequencesItem(Sequence sequencesItem) { + this.sequences.add(sequencesItem); + return this; + } + + /** + * Get sequences + * @return sequences + **/ + @ApiModelProperty(example = "null", value = "") + public List getSequences() { + return sequences; + } + + public void setSequences(List sequences) { + this.sequences = sequences; + } + + public API subscriptionAvailability(SubscriptionAvailabilityEnum subscriptionAvailability) { + this.subscriptionAvailability = subscriptionAvailability; + return this; + } + + /** + * Get subscriptionAvailability + * @return subscriptionAvailability + **/ + @ApiModelProperty(example = "current_tenant", value = "") + public SubscriptionAvailabilityEnum getSubscriptionAvailability() { + return subscriptionAvailability; + } + + public void setSubscriptionAvailability(SubscriptionAvailabilityEnum subscriptionAvailability) { + this.subscriptionAvailability = subscriptionAvailability; + } + + public API subscriptionAvailableTenants(List subscriptionAvailableTenants) { + this.subscriptionAvailableTenants = subscriptionAvailableTenants; + return this; + } + + public API addSubscriptionAvailableTenantsItem(String subscriptionAvailableTenantsItem) { + this.subscriptionAvailableTenants.add(subscriptionAvailableTenantsItem); + return this; + } + + /** + * Get subscriptionAvailableTenants + * @return subscriptionAvailableTenants + **/ + @ApiModelProperty(example = "null", value = "") + public List getSubscriptionAvailableTenants() { + return subscriptionAvailableTenants; + } + + public void setSubscriptionAvailableTenants(List subscriptionAvailableTenants) { + this.subscriptionAvailableTenants = subscriptionAvailableTenants; + } + + public API businessInformation(APIBusinessInformation businessInformation) { + this.businessInformation = businessInformation; + return this; + } + + /** + * Get businessInformation + * @return businessInformation + **/ + @ApiModelProperty(example = "null", value = "") + public APIBusinessInformation getBusinessInformation() { + return businessInformation; + } + + public void setBusinessInformation(APIBusinessInformation businessInformation) { + this.businessInformation = businessInformation; + } + + public API corsConfiguration(APICorsConfiguration corsConfiguration) { + this.corsConfiguration = corsConfiguration; + return this; + } + + /** + * Get corsConfiguration + * @return corsConfiguration + **/ + @ApiModelProperty(example = "null", value = "") + public APICorsConfiguration getCorsConfiguration() { + return corsConfiguration; + } + + public void setCorsConfiguration(APICorsConfiguration corsConfiguration) { + this.corsConfiguration = corsConfiguration; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + API API = (org.wso2.carbon.apimgt.integration.client.publisher.model.API) o; + return Objects.equals(this.id, API.id) && + Objects.equals(this.name, API.name) && + Objects.equals(this.description, API.description) && + Objects.equals(this.context, API.context) && + Objects.equals(this.version, API.version) && + Objects.equals(this.provider, API.provider) && + Objects.equals(this.apiDefinition, API.apiDefinition) && + Objects.equals(this.wsdlUri, API.wsdlUri) && + Objects.equals(this.status, API.status) && + Objects.equals(this.responseCaching, API.responseCaching) && + Objects.equals(this.cacheTimeout, API.cacheTimeout) && + Objects.equals(this.destinationStatsEnabled, API.destinationStatsEnabled) && + Objects.equals(this.isDefaultVersion, API.isDefaultVersion) && + Objects.equals(this.transport, API.transport) && + Objects.equals(this.tags, API.tags) && + Objects.equals(this.tiers, API.tiers) && + Objects.equals(this.maxTps, API.maxTps) && + Objects.equals(this.thumbnailUri, API.thumbnailUri) && + Objects.equals(this.visibility, API.visibility) && + Objects.equals(this.visibleRoles, API.visibleRoles) && + Objects.equals(this.visibleTenants, API.visibleTenants) && + Objects.equals(this.endpointConfig, API.endpointConfig) && + Objects.equals(this.endpointSecurity, API.endpointSecurity) && + Objects.equals(this.gatewayEnvironments, API.gatewayEnvironments) && + Objects.equals(this.sequences, API.sequences) && + Objects.equals(this.subscriptionAvailability, API.subscriptionAvailability) && + Objects.equals(this.subscriptionAvailableTenants, API.subscriptionAvailableTenants) && + Objects.equals(this.businessInformation, API.businessInformation) && + Objects.equals(this.corsConfiguration, API.corsConfiguration); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, context, version, provider, apiDefinition, wsdlUri, status, responseCaching, cacheTimeout, destinationStatsEnabled, isDefaultVersion, transport, tags, tiers, maxTps, thumbnailUri, visibility, visibleRoles, visibleTenants, endpointConfig, endpointSecurity, gatewayEnvironments, sequences, subscriptionAvailability, subscriptionAvailableTenants, businessInformation, corsConfiguration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class API {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" context: ").append(toIndentedString(context)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" apiDefinition: ").append(toIndentedString(apiDefinition)).append("\n"); + sb.append(" wsdlUri: ").append(toIndentedString(wsdlUri)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" responseCaching: ").append(toIndentedString(responseCaching)).append("\n"); + sb.append(" cacheTimeout: ").append(toIndentedString(cacheTimeout)).append("\n"); + sb.append(" destinationStatsEnabled: ").append(toIndentedString(destinationStatsEnabled)).append("\n"); + sb.append(" isDefaultVersion: ").append(toIndentedString(isDefaultVersion)).append("\n"); + sb.append(" transport: ").append(toIndentedString(transport)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" tiers: ").append(toIndentedString(tiers)).append("\n"); + sb.append(" maxTps: ").append(toIndentedString(maxTps)).append("\n"); + sb.append(" thumbnailUri: ").append(toIndentedString(thumbnailUri)).append("\n"); + sb.append(" visibility: ").append(toIndentedString(visibility)).append("\n"); + sb.append(" visibleRoles: ").append(toIndentedString(visibleRoles)).append("\n"); + sb.append(" visibleTenants: ").append(toIndentedString(visibleTenants)).append("\n"); + sb.append(" endpointConfig: ").append(toIndentedString(endpointConfig)).append("\n"); + sb.append(" endpointSecurity: ").append(toIndentedString(endpointSecurity)).append("\n"); + sb.append(" gatewayEnvironments: ").append(toIndentedString(gatewayEnvironments)).append("\n"); + sb.append(" sequences: ").append(toIndentedString(sequences)).append("\n"); + sb.append(" subscriptionAvailability: ").append(toIndentedString(subscriptionAvailability)).append("\n"); + sb.append(" subscriptionAvailableTenants: ").append(toIndentedString(subscriptionAvailableTenants)).append("\n"); + sb.append(" businessInformation: ").append(toIndentedString(businessInformation)).append("\n"); + sb.append(" corsConfiguration: ").append(toIndentedString(corsConfiguration)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APIBusinessInformation.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APIBusinessInformation.java new file mode 100644 index 0000000000..0ef7335d5e --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APIBusinessInformation.java @@ -0,0 +1,168 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * APIBusinessInformation + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class APIBusinessInformation { + @JsonProperty("businessOwner") + private String businessOwner = null; + + @JsonProperty("businessOwnerEmail") + private String businessOwnerEmail = null; + + @JsonProperty("technicalOwner") + private String technicalOwner = null; + + @JsonProperty("technicalOwnerEmail") + private String technicalOwnerEmail = null; + + public APIBusinessInformation businessOwner(String businessOwner) { + this.businessOwner = businessOwner; + return this; + } + + /** + * Get businessOwner + * @return businessOwner + **/ + @ApiModelProperty(example = "businessowner", value = "") + public String getBusinessOwner() { + return businessOwner; + } + + public void setBusinessOwner(String businessOwner) { + this.businessOwner = businessOwner; + } + + public APIBusinessInformation businessOwnerEmail(String businessOwnerEmail) { + this.businessOwnerEmail = businessOwnerEmail; + return this; + } + + /** + * Get businessOwnerEmail + * @return businessOwnerEmail + **/ + @ApiModelProperty(example = "businessowner@wso2.com", value = "") + public String getBusinessOwnerEmail() { + return businessOwnerEmail; + } + + public void setBusinessOwnerEmail(String businessOwnerEmail) { + this.businessOwnerEmail = businessOwnerEmail; + } + + public APIBusinessInformation technicalOwner(String technicalOwner) { + this.technicalOwner = technicalOwner; + return this; + } + + /** + * Get technicalOwner + * @return technicalOwner + **/ + @ApiModelProperty(example = "technicalowner", value = "") + public String getTechnicalOwner() { + return technicalOwner; + } + + public void setTechnicalOwner(String technicalOwner) { + this.technicalOwner = technicalOwner; + } + + public APIBusinessInformation technicalOwnerEmail(String technicalOwnerEmail) { + this.technicalOwnerEmail = technicalOwnerEmail; + return this; + } + + /** + * Get technicalOwnerEmail + * @return technicalOwnerEmail + **/ + @ApiModelProperty(example = "technicalowner@wso2.com", value = "") + public String getTechnicalOwnerEmail() { + return technicalOwnerEmail; + } + + public void setTechnicalOwnerEmail(String technicalOwnerEmail) { + this.technicalOwnerEmail = technicalOwnerEmail; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + APIBusinessInformation aPIBusinessInformation = (APIBusinessInformation) o; + return Objects.equals(this.businessOwner, aPIBusinessInformation.businessOwner) && + Objects.equals(this.businessOwnerEmail, aPIBusinessInformation.businessOwnerEmail) && + Objects.equals(this.technicalOwner, aPIBusinessInformation.technicalOwner) && + Objects.equals(this.technicalOwnerEmail, aPIBusinessInformation.technicalOwnerEmail); + } + + @Override + public int hashCode() { + return Objects.hash(businessOwner, businessOwnerEmail, technicalOwner, technicalOwnerEmail); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class APIBusinessInformation {\n"); + + sb.append(" businessOwner: ").append(toIndentedString(businessOwner)).append("\n"); + sb.append(" businessOwnerEmail: ").append(toIndentedString(businessOwnerEmail)).append("\n"); + sb.append(" technicalOwner: ").append(toIndentedString(technicalOwner)).append("\n"); + sb.append(" technicalOwnerEmail: ").append(toIndentedString(technicalOwnerEmail)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APICorsConfiguration.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APICorsConfiguration.java new file mode 100644 index 0000000000..707e5c08fc --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APICorsConfiguration.java @@ -0,0 +1,210 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * CORS configuration for the API + */ +@ApiModel(description = "CORS configuration for the API ") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class APICorsConfiguration { + @JsonProperty("corsConfigurationEnabled") + private Boolean corsConfigurationEnabled = false; + + @JsonProperty("accessControlAllowOrigins") + private List accessControlAllowOrigins = new ArrayList(); + + @JsonProperty("accessControlAllowCredentials") + private Boolean accessControlAllowCredentials = false; + + @JsonProperty("accessControlAllowHeaders") + private List accessControlAllowHeaders = new ArrayList(); + + @JsonProperty("accessControlAllowMethods") + private List accessControlAllowMethods = new ArrayList(); + + public APICorsConfiguration corsConfigurationEnabled(Boolean corsConfigurationEnabled) { + this.corsConfigurationEnabled = corsConfigurationEnabled; + return this; + } + + /** + * Get corsConfigurationEnabled + * @return corsConfigurationEnabled + **/ + @ApiModelProperty(example = "null", value = "") + public Boolean getCorsConfigurationEnabled() { + return corsConfigurationEnabled; + } + + public void setCorsConfigurationEnabled(Boolean corsConfigurationEnabled) { + this.corsConfigurationEnabled = corsConfigurationEnabled; + } + + public APICorsConfiguration accessControlAllowOrigins(List accessControlAllowOrigins) { + this.accessControlAllowOrigins = accessControlAllowOrigins; + return this; + } + + public APICorsConfiguration addAccessControlAllowOriginsItem(String accessControlAllowOriginsItem) { + this.accessControlAllowOrigins.add(accessControlAllowOriginsItem); + return this; + } + + /** + * Get accessControlAllowOrigins + * @return accessControlAllowOrigins + **/ + @ApiModelProperty(example = "null", value = "") + public List getAccessControlAllowOrigins() { + return accessControlAllowOrigins; + } + + public void setAccessControlAllowOrigins(List accessControlAllowOrigins) { + this.accessControlAllowOrigins = accessControlAllowOrigins; + } + + public APICorsConfiguration accessControlAllowCredentials(Boolean accessControlAllowCredentials) { + this.accessControlAllowCredentials = accessControlAllowCredentials; + return this; + } + + /** + * Get accessControlAllowCredentials + * @return accessControlAllowCredentials + **/ + @ApiModelProperty(example = "null", value = "") + public Boolean getAccessControlAllowCredentials() { + return accessControlAllowCredentials; + } + + public void setAccessControlAllowCredentials(Boolean accessControlAllowCredentials) { + this.accessControlAllowCredentials = accessControlAllowCredentials; + } + + public APICorsConfiguration accessControlAllowHeaders(List accessControlAllowHeaders) { + this.accessControlAllowHeaders = accessControlAllowHeaders; + return this; + } + + public APICorsConfiguration addAccessControlAllowHeadersItem(String accessControlAllowHeadersItem) { + this.accessControlAllowHeaders.add(accessControlAllowHeadersItem); + return this; + } + + /** + * Get accessControlAllowHeaders + * @return accessControlAllowHeaders + **/ + @ApiModelProperty(example = "null", value = "") + public List getAccessControlAllowHeaders() { + return accessControlAllowHeaders; + } + + public void setAccessControlAllowHeaders(List accessControlAllowHeaders) { + this.accessControlAllowHeaders = accessControlAllowHeaders; + } + + public APICorsConfiguration accessControlAllowMethods(List accessControlAllowMethods) { + this.accessControlAllowMethods = accessControlAllowMethods; + return this; + } + + public APICorsConfiguration addAccessControlAllowMethodsItem(String accessControlAllowMethodsItem) { + this.accessControlAllowMethods.add(accessControlAllowMethodsItem); + return this; + } + + /** + * Get accessControlAllowMethods + * @return accessControlAllowMethods + **/ + @ApiModelProperty(example = "null", value = "") + public List getAccessControlAllowMethods() { + return accessControlAllowMethods; + } + + public void setAccessControlAllowMethods(List accessControlAllowMethods) { + this.accessControlAllowMethods = accessControlAllowMethods; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + APICorsConfiguration aPICorsConfiguration = (APICorsConfiguration) o; + return Objects.equals(this.corsConfigurationEnabled, aPICorsConfiguration.corsConfigurationEnabled) && + Objects.equals(this.accessControlAllowOrigins, aPICorsConfiguration.accessControlAllowOrigins) && + Objects.equals(this.accessControlAllowCredentials, aPICorsConfiguration.accessControlAllowCredentials) && + Objects.equals(this.accessControlAllowHeaders, aPICorsConfiguration.accessControlAllowHeaders) && + Objects.equals(this.accessControlAllowMethods, aPICorsConfiguration.accessControlAllowMethods); + } + + @Override + public int hashCode() { + return Objects.hash(corsConfigurationEnabled, accessControlAllowOrigins, accessControlAllowCredentials, accessControlAllowHeaders, accessControlAllowMethods); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class APICorsConfiguration {\n"); + + sb.append(" corsConfigurationEnabled: ").append(toIndentedString(corsConfigurationEnabled)).append("\n"); + sb.append(" accessControlAllowOrigins: ").append(toIndentedString(accessControlAllowOrigins)).append("\n"); + sb.append(" accessControlAllowCredentials: ").append(toIndentedString(accessControlAllowCredentials)).append("\n"); + sb.append(" accessControlAllowHeaders: ").append(toIndentedString(accessControlAllowHeaders)).append("\n"); + sb.append(" accessControlAllowMethods: ").append(toIndentedString(accessControlAllowMethods)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APIEndpointSecurity.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APIEndpointSecurity.java new file mode 100644 index 0000000000..9ffc7088ec --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APIEndpointSecurity.java @@ -0,0 +1,176 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * APIEndpointSecurity + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class APIEndpointSecurity { + /** + * Gets or Sets type + */ + public enum TypeEnum { + BASIC("basic"), + + DIGEST("digest"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String text) { + for (TypeEnum b : TypeEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("type") + private TypeEnum type = null; + + @JsonProperty("username") + private String username = null; + + @JsonProperty("password") + private String password = null; + + public APIEndpointSecurity type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @ApiModelProperty(example = "basic", value = "") + public TypeEnum getType() { + return type; + } + + public void setType(TypeEnum type) { + this.type = type; + } + + public APIEndpointSecurity username(String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + **/ + @ApiModelProperty(example = "admin", value = "") + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public APIEndpointSecurity password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @ApiModelProperty(example = "password", value = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + APIEndpointSecurity aPIEndpointSecurity = (APIEndpointSecurity) o; + return Objects.equals(this.type, aPIEndpointSecurity.type) && + Objects.equals(this.username, aPIEndpointSecurity.username) && + Objects.equals(this.password, aPIEndpointSecurity.password); + } + + @Override + public int hashCode() { + return Objects.hash(type, username, password); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class APIEndpointSecurity {\n"); + + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APIInfo.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APIInfo.java new file mode 100644 index 0000000000..05abbdc698 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APIInfo.java @@ -0,0 +1,237 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * APIInfo + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class APIInfo { + @JsonProperty("id") + private String id = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("description") + private String description = null; + + @JsonProperty("context") + private String context = null; + + @JsonProperty("version") + private String version = null; + + @JsonProperty("provider") + private String provider = null; + + @JsonProperty("status") + private String status = null; + + public APIInfo id(String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", value = "") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public APIInfo name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "CalculatorAPI", value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public APIInfo description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @ApiModelProperty(example = "A calculator API that supports basic operations", value = "") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public APIInfo context(String context) { + this.context = context; + return this; + } + + /** + * Get context + * @return context + **/ + @ApiModelProperty(example = "CalculatorAPI", value = "") + public String getContext() { + return context; + } + + public void setContext(String context) { + this.context = context; + } + + public APIInfo version(String version) { + this.version = version; + return this; + } + + /** + * Get version + * @return version + **/ + @ApiModelProperty(example = "1.0.0", value = "") + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public APIInfo provider(String provider) { + this.provider = provider; + return this; + } + + /** + * If the provider value is not given, the user invoking the API will be used as the provider. + * @return provider + **/ + @ApiModelProperty(example = "admin", value = "If the provider value is not given, the user invoking the API will be used as the provider. ") + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + + public APIInfo status(String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(example = "CREATED", value = "") + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + APIInfo aPIInfo = (APIInfo) o; + return Objects.equals(this.id, aPIInfo.id) && + Objects.equals(this.name, aPIInfo.name) && + Objects.equals(this.description, aPIInfo.description) && + Objects.equals(this.context, aPIInfo.context) && + Objects.equals(this.version, aPIInfo.version) && + Objects.equals(this.provider, aPIInfo.provider) && + Objects.equals(this.status, aPIInfo.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, context, version, provider, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class APIInfo {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" context: ").append(toIndentedString(context)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APIList.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APIList.java new file mode 100644 index 0000000000..f62fea9a8c --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APIList.java @@ -0,0 +1,175 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * APIList + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class APIList { + @JsonProperty("count") + private Integer count = null; + + @JsonProperty("next") + private String next = null; + + @JsonProperty("previous") + private String previous = null; + + @JsonProperty("list") + private List list = new ArrayList(); + + public APIList count(Integer count) { + this.count = count; + return this; + } + + /** + * Number of APIs returned. + * @return count + **/ + @ApiModelProperty(example = "1", value = "Number of APIs returned. ") + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public APIList next(String next) { + this.next = next; + return this; + } + + /** + * Link to the next subset of resources qualified. Empty if no more resources are to be returned. + * @return next + **/ + @ApiModelProperty(example = "/apis?limit=1&offset=2&query=", value = "Link to the next subset of resources qualified. Empty if no more resources are to be returned. ") + public String getNext() { + return next; + } + + public void setNext(String next) { + this.next = next; + } + + public APIList previous(String previous) { + this.previous = previous; + return this; + } + + /** + * Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. + * @return previous + **/ + @ApiModelProperty(example = "/apis?limit=1&offset=0&query=", value = "Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. ") + public String getPrevious() { + return previous; + } + + public void setPrevious(String previous) { + this.previous = previous; + } + + public APIList list(List list) { + this.list = list; + return this; + } + + public APIList addListItem(APIInfo listItem) { + this.list.add(listItem); + return this; + } + + /** + * Get list + * @return list + **/ + @ApiModelProperty(example = "null", value = "") + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + APIList aPIList = (APIList) o; + return Objects.equals(this.count, aPIList.count) && + Objects.equals(this.next, aPIList.next) && + Objects.equals(this.previous, aPIList.previous) && + Objects.equals(this.list, aPIList.list); + } + + @Override + public int hashCode() { + return Objects.hash(count, next, previous, list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class APIList {\n"); + + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" next: ").append(toIndentedString(next)).append("\n"); + sb.append(" previous: ").append(toIndentedString(previous)).append("\n"); + sb.append(" list: ").append(toIndentedString(list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APIMaxTps.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APIMaxTps.java new file mode 100644 index 0000000000..a6a83ffd53 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/APIMaxTps.java @@ -0,0 +1,122 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * APIMaxTps + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class APIMaxTps { + @JsonProperty("production") + private Long production = null; + + @JsonProperty("sandbox") + private Long sandbox = null; + + public APIMaxTps production(Long production) { + this.production = production; + return this; + } + + /** + * Get production + * @return production + **/ + @ApiModelProperty(example = "1000", value = "") + public Long getProduction() { + return production; + } + + public void setProduction(Long production) { + this.production = production; + } + + public APIMaxTps sandbox(Long sandbox) { + this.sandbox = sandbox; + return this; + } + + /** + * Get sandbox + * @return sandbox + **/ + @ApiModelProperty(example = "1000", value = "") + public Long getSandbox() { + return sandbox; + } + + public void setSandbox(Long sandbox) { + this.sandbox = sandbox; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + APIMaxTps aPIMaxTps = (APIMaxTps) o; + return Objects.equals(this.production, aPIMaxTps.production) && + Objects.equals(this.sandbox, aPIMaxTps.sandbox); + } + + @Override + public int hashCode() { + return Objects.hash(production, sandbox); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class APIMaxTps {\n"); + + sb.append(" production: ").append(toIndentedString(production)).append("\n"); + sb.append(" sandbox: ").append(toIndentedString(sandbox)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Application.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Application.java new file mode 100644 index 0000000000..09e0fa9429 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Application.java @@ -0,0 +1,214 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * Application + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class Application { + @JsonProperty("applicationId") + private String applicationId = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("subscriber") + private String subscriber = null; + + @JsonProperty("throttlingTier") + private String throttlingTier = null; + + @JsonProperty("description") + private String description = null; + + @JsonProperty("groupId") + private String groupId = null; + + public Application applicationId(String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Get applicationId + * @return applicationId + **/ + @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", value = "") + public String getApplicationId() { + return applicationId; + } + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + public Application name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "CalculatorApp", required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Application subscriber(String subscriber) { + this.subscriber = subscriber; + return this; + } + + /** + * Get subscriber + * @return subscriber + **/ + @ApiModelProperty(example = "admin", value = "") + public String getSubscriber() { + return subscriber; + } + + public void setSubscriber(String subscriber) { + this.subscriber = subscriber; + } + + public Application throttlingTier(String throttlingTier) { + this.throttlingTier = throttlingTier; + return this; + } + + /** + * Get throttlingTier + * @return throttlingTier + **/ + @ApiModelProperty(example = "Unlimited", required = true, value = "") + public String getThrottlingTier() { + return throttlingTier; + } + + public void setThrottlingTier(String throttlingTier) { + this.throttlingTier = throttlingTier; + } + + public Application description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @ApiModelProperty(example = "Sample calculator application", value = "") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Application groupId(String groupId) { + this.groupId = groupId; + return this; + } + + /** + * Get groupId + * @return groupId + **/ + @ApiModelProperty(example = "", value = "") + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Application application = (Application) o; + return Objects.equals(this.applicationId, application.applicationId) && + Objects.equals(this.name, application.name) && + Objects.equals(this.subscriber, application.subscriber) && + Objects.equals(this.throttlingTier, application.throttlingTier) && + Objects.equals(this.description, application.description) && + Objects.equals(this.groupId, application.groupId); + } + + @Override + public int hashCode() { + return Objects.hash(applicationId, name, subscriber, throttlingTier, description, groupId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Application {\n"); + + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" subscriber: ").append(toIndentedString(subscriber)).append("\n"); + sb.append(" throttlingTier: ").append(toIndentedString(throttlingTier)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" groupId: ").append(toIndentedString(groupId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Document.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Document.java new file mode 100644 index 0000000000..d0dfa2ad90 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Document.java @@ -0,0 +1,365 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * Document + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class Document { + @JsonProperty("documentId") + private String documentId = null; + + @JsonProperty("name") + private String name = null; + + /** + * Gets or Sets type + */ + public enum TypeEnum { + HOWTO("HOWTO"), + + SAMPLES("SAMPLES"), + + PUBLIC_FORUM("PUBLIC_FORUM"), + + SUPPORT_FORUM("SUPPORT_FORUM"), + + API_MESSAGE_FORMAT("API_MESSAGE_FORMAT"), + + SWAGGER_DOC("SWAGGER_DOC"), + + OTHER("OTHER"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String text) { + for (TypeEnum b : TypeEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("type") + private TypeEnum type = null; + + @JsonProperty("summary") + private String summary = null; + + /** + * Gets or Sets sourceType + */ + public enum SourceTypeEnum { + INLINE("INLINE"), + + URL("URL"), + + FILE("FILE"); + + private String value; + + SourceTypeEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SourceTypeEnum fromValue(String text) { + for (SourceTypeEnum b : SourceTypeEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("sourceType") + private SourceTypeEnum sourceType = null; + + @JsonProperty("sourceUrl") + private String sourceUrl = null; + + @JsonProperty("otherTypeName") + private String otherTypeName = null; + + /** + * Gets or Sets visibility + */ + public enum VisibilityEnum { + OWNER_ONLY("OWNER_ONLY"), + + PRIVATE("PRIVATE"), + + API_LEVEL("API_LEVEL"); + + private String value; + + VisibilityEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static VisibilityEnum fromValue(String text) { + for (VisibilityEnum b : VisibilityEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("visibility") + private VisibilityEnum visibility = null; + + public Document documentId(String documentId) { + this.documentId = documentId; + return this; + } + + /** + * Get documentId + * @return documentId + **/ + @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", value = "") + public String getDocumentId() { + return documentId; + } + + public void setDocumentId(String documentId) { + this.documentId = documentId; + } + + public Document name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "CalculatorDoc", required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Document type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @ApiModelProperty(example = "HOWTO", required = true, value = "") + public TypeEnum getType() { + return type; + } + + public void setType(TypeEnum type) { + this.type = type; + } + + public Document summary(String summary) { + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @ApiModelProperty(example = "Summary of Calculator Documentation", value = "") + public String getSummary() { + return summary; + } + + public void setSummary(String summary) { + this.summary = summary; + } + + public Document sourceType(SourceTypeEnum sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Get sourceType + * @return sourceType + **/ + @ApiModelProperty(example = "INLINE", required = true, value = "") + public SourceTypeEnum getSourceType() { + return sourceType; + } + + public void setSourceType(SourceTypeEnum sourceType) { + this.sourceType = sourceType; + } + + public Document sourceUrl(String sourceUrl) { + this.sourceUrl = sourceUrl; + return this; + } + + /** + * Get sourceUrl + * @return sourceUrl + **/ + @ApiModelProperty(example = "", value = "") + public String getSourceUrl() { + return sourceUrl; + } + + public void setSourceUrl(String sourceUrl) { + this.sourceUrl = sourceUrl; + } + + public Document otherTypeName(String otherTypeName) { + this.otherTypeName = otherTypeName; + return this; + } + + /** + * Get otherTypeName + * @return otherTypeName + **/ + @ApiModelProperty(example = "", value = "") + public String getOtherTypeName() { + return otherTypeName; + } + + public void setOtherTypeName(String otherTypeName) { + this.otherTypeName = otherTypeName; + } + + public Document visibility(VisibilityEnum visibility) { + this.visibility = visibility; + return this; + } + + /** + * Get visibility + * @return visibility + **/ + @ApiModelProperty(example = "API_LEVEL", required = true, value = "") + public VisibilityEnum getVisibility() { + return visibility; + } + + public void setVisibility(VisibilityEnum visibility) { + this.visibility = visibility; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Document document = (Document) o; + return Objects.equals(this.documentId, document.documentId) && + Objects.equals(this.name, document.name) && + Objects.equals(this.type, document.type) && + Objects.equals(this.summary, document.summary) && + Objects.equals(this.sourceType, document.sourceType) && + Objects.equals(this.sourceUrl, document.sourceUrl) && + Objects.equals(this.otherTypeName, document.otherTypeName) && + Objects.equals(this.visibility, document.visibility); + } + + @Override + public int hashCode() { + return Objects.hash(documentId, name, type, summary, sourceType, sourceUrl, otherTypeName, visibility); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Document {\n"); + + sb.append(" documentId: ").append(toIndentedString(documentId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).append("\n"); + sb.append(" sourceUrl: ").append(toIndentedString(sourceUrl)).append("\n"); + sb.append(" otherTypeName: ").append(toIndentedString(otherTypeName)).append("\n"); + sb.append(" visibility: ").append(toIndentedString(visibility)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/DocumentList.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/DocumentList.java new file mode 100644 index 0000000000..9a9c16003f --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/DocumentList.java @@ -0,0 +1,175 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * DocumentList + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class DocumentList { + @JsonProperty("count") + private Integer count = null; + + @JsonProperty("next") + private String next = null; + + @JsonProperty("previous") + private String previous = null; + + @JsonProperty("list") + private List list = new ArrayList(); + + public DocumentList count(Integer count) { + this.count = count; + return this; + } + + /** + * Number of Documents returned. + * @return count + **/ + @ApiModelProperty(example = "1", value = "Number of Documents returned. ") + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public DocumentList next(String next) { + this.next = next; + return this; + } + + /** + * Link to the next subset of resources qualified. Empty if no more resources are to be returned. + * @return next + **/ + @ApiModelProperty(example = "/apis/01234567-0123-0123-0123-012345678901/documents?limit=1&offset=2", value = "Link to the next subset of resources qualified. Empty if no more resources are to be returned. ") + public String getNext() { + return next; + } + + public void setNext(String next) { + this.next = next; + } + + public DocumentList previous(String previous) { + this.previous = previous; + return this; + } + + /** + * Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. + * @return previous + **/ + @ApiModelProperty(example = "/apis/01234567-0123-0123-0123-012345678901/documents?limit=1&offset=0", value = "Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. ") + public String getPrevious() { + return previous; + } + + public void setPrevious(String previous) { + this.previous = previous; + } + + public DocumentList list(List list) { + this.list = list; + return this; + } + + public DocumentList addListItem(Document listItem) { + this.list.add(listItem); + return this; + } + + /** + * Get list + * @return list + **/ + @ApiModelProperty(example = "null", value = "") + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DocumentList documentList = (DocumentList) o; + return Objects.equals(this.count, documentList.count) && + Objects.equals(this.next, documentList.next) && + Objects.equals(this.previous, documentList.previous) && + Objects.equals(this.list, documentList.list); + } + + @Override + public int hashCode() { + return Objects.hash(count, next, previous, list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DocumentList {\n"); + + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" next: ").append(toIndentedString(next)).append("\n"); + sb.append(" previous: ").append(toIndentedString(previous)).append("\n"); + sb.append(" list: ").append(toIndentedString(list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Environment.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Environment.java new file mode 100644 index 0000000000..7744ed91b7 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Environment.java @@ -0,0 +1,191 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * Environment + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class Environment { + @JsonProperty("name") + private String name = null; + + @JsonProperty("type") + private String type = null; + + @JsonProperty("serverUrl") + private String serverUrl = null; + + @JsonProperty("showInApiConsole") + private Boolean showInApiConsole = null; + + @JsonProperty("endpoints") + private EnvironmentEndpoints endpoints = null; + + public Environment name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "Production and Sandbox", required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Environment type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @ApiModelProperty(example = "hybrid", required = true, value = "") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Environment serverUrl(String serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + /** + * Get serverUrl + * @return serverUrl + **/ + @ApiModelProperty(example = "https://localhost:9443//services/", required = true, value = "") + public String getServerUrl() { + return serverUrl; + } + + public void setServerUrl(String serverUrl) { + this.serverUrl = serverUrl; + } + + public Environment showInApiConsole(Boolean showInApiConsole) { + this.showInApiConsole = showInApiConsole; + return this; + } + + /** + * Get showInApiConsole + * @return showInApiConsole + **/ + @ApiModelProperty(example = "true", required = true, value = "") + public Boolean getShowInApiConsole() { + return showInApiConsole; + } + + public void setShowInApiConsole(Boolean showInApiConsole) { + this.showInApiConsole = showInApiConsole; + } + + public Environment endpoints(EnvironmentEndpoints endpoints) { + this.endpoints = endpoints; + return this; + } + + /** + * Get endpoints + * @return endpoints + **/ + @ApiModelProperty(example = "null", required = true, value = "") + public EnvironmentEndpoints getEndpoints() { + return endpoints; + } + + public void setEndpoints(EnvironmentEndpoints endpoints) { + this.endpoints = endpoints; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Environment environment = (Environment) o; + return Objects.equals(this.name, environment.name) && + Objects.equals(this.type, environment.type) && + Objects.equals(this.serverUrl, environment.serverUrl) && + Objects.equals(this.showInApiConsole, environment.showInApiConsole) && + Objects.equals(this.endpoints, environment.endpoints); + } + + @Override + public int hashCode() { + return Objects.hash(name, type, serverUrl, showInApiConsole, endpoints); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Environment {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" serverUrl: ").append(toIndentedString(serverUrl)).append("\n"); + sb.append(" showInApiConsole: ").append(toIndentedString(showInApiConsole)).append("\n"); + sb.append(" endpoints: ").append(toIndentedString(endpoints)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/EnvironmentEndpoints.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/EnvironmentEndpoints.java new file mode 100644 index 0000000000..d25686dcdb --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/EnvironmentEndpoints.java @@ -0,0 +1,122 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * EnvironmentEndpoints + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class EnvironmentEndpoints { + @JsonProperty("http") + private String http = null; + + @JsonProperty("https") + private String https = null; + + public EnvironmentEndpoints http(String http) { + this.http = http; + return this; + } + + /** + * HTTP environment URL + * @return http + **/ + @ApiModelProperty(example = "http://localhost:8280", value = "HTTP environment URL") + public String getHttp() { + return http; + } + + public void setHttp(String http) { + this.http = http; + } + + public EnvironmentEndpoints https(String https) { + this.https = https; + return this; + } + + /** + * HTTPS environment URL + * @return https + **/ + @ApiModelProperty(example = "https://localhost:8244", value = "HTTPS environment URL") + public String getHttps() { + return https; + } + + public void setHttps(String https) { + this.https = https; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnvironmentEndpoints environmentEndpoints = (EnvironmentEndpoints) o; + return Objects.equals(this.http, environmentEndpoints.http) && + Objects.equals(this.https, environmentEndpoints.https); + } + + @Override + public int hashCode() { + return Objects.hash(http, https); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnvironmentEndpoints {\n"); + + sb.append(" http: ").append(toIndentedString(http)).append("\n"); + sb.append(" https: ").append(toIndentedString(https)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/EnvironmentList.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/EnvironmentList.java new file mode 100644 index 0000000000..6440009cb2 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/EnvironmentList.java @@ -0,0 +1,129 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * EnvironmentList + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class EnvironmentList { + @JsonProperty("count") + private Integer count = null; + + @JsonProperty("list") + private List list = new ArrayList(); + + public EnvironmentList count(Integer count) { + this.count = count; + return this; + } + + /** + * Number of Environments returned. + * @return count + **/ + @ApiModelProperty(example = "1", value = "Number of Environments returned. ") + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public EnvironmentList list(List list) { + this.list = list; + return this; + } + + public EnvironmentList addListItem(Environment listItem) { + this.list.add(listItem); + return this; + } + + /** + * Get list + * @return list + **/ + @ApiModelProperty(example = "null", value = "") + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnvironmentList environmentList = (EnvironmentList) o; + return Objects.equals(this.count, environmentList.count) && + Objects.equals(this.list, environmentList.list); + } + + @Override + public int hashCode() { + return Objects.hash(count, list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnvironmentList {\n"); + + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" list: ").append(toIndentedString(list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Error.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Error.java new file mode 100644 index 0000000000..94ced5af6b --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Error.java @@ -0,0 +1,198 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * Error + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class Error { + @JsonProperty("code") + private Long code = null; + + @JsonProperty("message") + private String message = null; + + @JsonProperty("description") + private String description = null; + + @JsonProperty("moreInfo") + private String moreInfo = null; + + @JsonProperty("error") + private List error = new ArrayList(); + + public Error code(Long code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @ApiModelProperty(example = "null", required = true, value = "") + public Long getCode() { + return code; + } + + public void setCode(Long code) { + this.code = code; + } + + public Error message(String message) { + this.message = message; + return this; + } + + /** + * Error message. + * @return message + **/ + @ApiModelProperty(example = "null", required = true, value = "Error message.") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Error description(String description) { + this.description = description; + return this; + } + + /** + * A detail description about the error message. + * @return description + **/ + @ApiModelProperty(example = "null", value = "A detail description about the error message. ") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Error moreInfo(String moreInfo) { + this.moreInfo = moreInfo; + return this; + } + + /** + * Preferably an url with more details about the error. + * @return moreInfo + **/ + @ApiModelProperty(example = "null", value = "Preferably an url with more details about the error. ") + public String getMoreInfo() { + return moreInfo; + } + + public void setMoreInfo(String moreInfo) { + this.moreInfo = moreInfo; + } + + public Error error(List error) { + this.error = error; + return this; + } + + public Error addErrorItem(ErrorListItem errorItem) { + this.error.add(errorItem); + return this; + } + + /** + * If there are more than one error list them out. For example, list out validation errors by each field. + * @return error + **/ + @ApiModelProperty(example = "null", value = "If there are more than one error list them out. For example, list out validation errors by each field. ") + public List getError() { + return error; + } + + public void setError(List error) { + this.error = error; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error error = (Error) o; + return Objects.equals(this.code, error.code) && + Objects.equals(this.message, error.message) && + Objects.equals(this.description, error.description) && + Objects.equals(this.moreInfo, error.moreInfo) && + Objects.equals(this.error, error.error); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, description, moreInfo, error); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" moreInfo: ").append(toIndentedString(moreInfo)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/ErrorListItem.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/ErrorListItem.java new file mode 100644 index 0000000000..a25c6827a3 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/ErrorListItem.java @@ -0,0 +1,122 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * ErrorListItem + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class ErrorListItem { + @JsonProperty("code") + private String code = null; + + @JsonProperty("message") + private String message = null; + + public ErrorListItem code(String code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @ApiModelProperty(example = "null", required = true, value = "") + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public ErrorListItem message(String message) { + this.message = message; + return this; + } + + /** + * Description about individual errors occurred + * @return message + **/ + @ApiModelProperty(example = "null", required = true, value = "Description about individual errors occurred ") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorListItem errorListItem = (ErrorListItem) o; + return Objects.equals(this.code, errorListItem.code) && + Objects.equals(this.message, errorListItem.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorListItem {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/FileInfo.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/FileInfo.java new file mode 100644 index 0000000000..bfcd100386 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/FileInfo.java @@ -0,0 +1,122 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * FileInfo + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class FileInfo { + @JsonProperty("relativePath") + private String relativePath = null; + + @JsonProperty("mediaType") + private String mediaType = null; + + public FileInfo relativePath(String relativePath) { + this.relativePath = relativePath; + return this; + } + + /** + * relative location of the file (excluding the base context and host of the Publisher API) + * @return relativePath + **/ + @ApiModelProperty(example = "apis/01234567-0123-0123-0123-012345678901/thumbnail", value = "relative location of the file (excluding the base context and host of the Publisher API)") + public String getRelativePath() { + return relativePath; + } + + public void setRelativePath(String relativePath) { + this.relativePath = relativePath; + } + + public FileInfo mediaType(String mediaType) { + this.mediaType = mediaType; + return this; + } + + /** + * media-type of the file + * @return mediaType + **/ + @ApiModelProperty(example = "image/jpeg", value = "media-type of the file") + public String getMediaType() { + return mediaType; + } + + public void setMediaType(String mediaType) { + this.mediaType = mediaType; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileInfo fileInfo = (FileInfo) o; + return Objects.equals(this.relativePath, fileInfo.relativePath) && + Objects.equals(this.mediaType, fileInfo.mediaType); + } + + @Override + public int hashCode() { + return Objects.hash(relativePath, mediaType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileInfo {\n"); + + sb.append(" relativePath: ").append(toIndentedString(relativePath)).append("\n"); + sb.append(" mediaType: ").append(toIndentedString(mediaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Sequence.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Sequence.java new file mode 100644 index 0000000000..7cd5b67d86 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Sequence.java @@ -0,0 +1,145 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * Sequence + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class Sequence { + @JsonProperty("name") + private String name = null; + + @JsonProperty("config") + private String config = null; + + @JsonProperty("type") + private String type = null; + + public Sequence name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "log_in_message", required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Sequence config(String config) { + this.config = config; + return this; + } + + /** + * Get config + * @return config + **/ + @ApiModelProperty(example = "", value = "") + public String getConfig() { + return config; + } + + public void setConfig(String config) { + this.config = config; + } + + public Sequence type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @ApiModelProperty(example = "in", value = "") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Sequence sequence = (Sequence) o; + return Objects.equals(this.name, sequence.name) && + Objects.equals(this.config, sequence.config) && + Objects.equals(this.type, sequence.type); + } + + @Override + public int hashCode() { + return Objects.hash(name, config, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Sequence {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Subscription.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Subscription.java new file mode 100644 index 0000000000..5a4c4c3ca6 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Subscription.java @@ -0,0 +1,228 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * Subscription + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class Subscription { + @JsonProperty("subscriptionId") + private String subscriptionId = null; + + @JsonProperty("applicationId") + private String applicationId = null; + + @JsonProperty("apiIdentifier") + private String apiIdentifier = null; + + @JsonProperty("tier") + private String tier = null; + + /** + * Gets or Sets status + */ + public enum StatusEnum { + BLOCKED("BLOCKED"), + + PROD_ONLY_BLOCKED("PROD_ONLY_BLOCKED"), + + UNBLOCKED("UNBLOCKED"), + + ON_HOLD("ON_HOLD"), + + REJECTED("REJECTED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("status") + private StatusEnum status = null; + + public Subscription subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get subscriptionId + * @return subscriptionId + **/ + @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", value = "") + public String getSubscriptionId() { + return subscriptionId; + } + + public void setSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + } + + public Subscription applicationId(String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Get applicationId + * @return applicationId + **/ + @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", required = true, value = "") + public String getApplicationId() { + return applicationId; + } + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + public Subscription apiIdentifier(String apiIdentifier) { + this.apiIdentifier = apiIdentifier; + return this; + } + + /** + * Get apiIdentifier + * @return apiIdentifier + **/ + @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", required = true, value = "") + public String getApiIdentifier() { + return apiIdentifier; + } + + public void setApiIdentifier(String apiIdentifier) { + this.apiIdentifier = apiIdentifier; + } + + public Subscription tier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get tier + * @return tier + **/ + @ApiModelProperty(example = "Unlimited", required = true, value = "") + public String getTier() { + return tier; + } + + public void setTier(String tier) { + this.tier = tier; + } + + public Subscription status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(example = "UNBLOCKED", value = "") + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Subscription subscription = (Subscription) o; + return Objects.equals(this.subscriptionId, subscription.subscriptionId) && + Objects.equals(this.applicationId, subscription.applicationId) && + Objects.equals(this.apiIdentifier, subscription.apiIdentifier) && + Objects.equals(this.tier, subscription.tier) && + Objects.equals(this.status, subscription.status); + } + + @Override + public int hashCode() { + return Objects.hash(subscriptionId, applicationId, apiIdentifier, tier, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Subscription {\n"); + + sb.append(" subscriptionId: ").append(toIndentedString(subscriptionId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" apiIdentifier: ").append(toIndentedString(apiIdentifier)).append("\n"); + sb.append(" tier: ").append(toIndentedString(tier)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/SubscriptionList.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/SubscriptionList.java new file mode 100644 index 0000000000..5c167402cd --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/SubscriptionList.java @@ -0,0 +1,175 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * SubscriptionList + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class SubscriptionList { + @JsonProperty("count") + private Integer count = null; + + @JsonProperty("next") + private String next = null; + + @JsonProperty("previous") + private String previous = null; + + @JsonProperty("list") + private List list = new ArrayList(); + + public SubscriptionList count(Integer count) { + this.count = count; + return this; + } + + /** + * Number of Subscriptions returned. + * @return count + **/ + @ApiModelProperty(example = "1", value = "Number of Subscriptions returned. ") + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public SubscriptionList next(String next) { + this.next = next; + return this; + } + + /** + * Link to the next subset of resources qualified. Empty if no more resources are to be returned. + * @return next + **/ + @ApiModelProperty(example = "/subscriptions?limit=1&offset=2&apiId=01234567-0123-0123-0123-012345678901&groupId=", value = "Link to the next subset of resources qualified. Empty if no more resources are to be returned. ") + public String getNext() { + return next; + } + + public void setNext(String next) { + this.next = next; + } + + public SubscriptionList previous(String previous) { + this.previous = previous; + return this; + } + + /** + * Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. + * @return previous + **/ + @ApiModelProperty(example = "/subscriptions?limit=1&offset=0&apiId=01234567-0123-0123-0123-012345678901&groupId=", value = "Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. ") + public String getPrevious() { + return previous; + } + + public void setPrevious(String previous) { + this.previous = previous; + } + + public SubscriptionList list(List list) { + this.list = list; + return this; + } + + public SubscriptionList addListItem(Subscription listItem) { + this.list.add(listItem); + return this; + } + + /** + * Get list + * @return list + **/ + @ApiModelProperty(example = "null", value = "") + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SubscriptionList subscriptionList = (SubscriptionList) o; + return Objects.equals(this.count, subscriptionList.count) && + Objects.equals(this.next, subscriptionList.next) && + Objects.equals(this.previous, subscriptionList.previous) && + Objects.equals(this.list, subscriptionList.list); + } + + @Override + public int hashCode() { + return Objects.hash(count, next, previous, list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubscriptionList {\n"); + + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" next: ").append(toIndentedString(next)).append("\n"); + sb.append(" previous: ").append(toIndentedString(previous)).append("\n"); + sb.append(" list: ").append(toIndentedString(list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Tier.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Tier.java new file mode 100644 index 0000000000..7f0aa83910 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/Tier.java @@ -0,0 +1,353 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + + +/** + * Tier + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class Tier { + @JsonProperty("name") + private String name = null; + + @JsonProperty("description") + private String description = null; + + /** + * Gets or Sets tierLevel + */ + public enum TierLevelEnum { + API("api"), + + APPLICATION("application"), + + RESOURCE("resource"); + + private String value; + + TierLevelEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TierLevelEnum fromValue(String text) { + for (TierLevelEnum b : TierLevelEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("tierLevel") + private TierLevelEnum tierLevel = null; + + @JsonProperty("attributes") + private Map attributes = new HashMap(); + + @JsonProperty("requestCount") + private Long requestCount = null; + + @JsonProperty("unitTime") + private Long unitTime = null; + + @JsonProperty("timeUnit") + private String timeUnit = null; + + /** + * This attribute declares whether this tier is available under commercial or free + */ + public enum TierPlanEnum { + FREE("FREE"), + + COMMERCIAL("COMMERCIAL"); + + private String value; + + TierPlanEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TierPlanEnum fromValue(String text) { + for (TierPlanEnum b : TierPlanEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("tierPlan") + private TierPlanEnum tierPlan = null; + + @JsonProperty("stopOnQuotaReach") + private Boolean stopOnQuotaReach = null; + + public Tier name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "Platinum", required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Tier description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @ApiModelProperty(example = "Allows 50 request(s) per minute.", value = "") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Tier tierLevel(TierLevelEnum tierLevel) { + this.tierLevel = tierLevel; + return this; + } + + /** + * Get tierLevel + * @return tierLevel + **/ + @ApiModelProperty(example = "api", value = "") + public TierLevelEnum getTierLevel() { + return tierLevel; + } + + public void setTierLevel(TierLevelEnum tierLevel) { + this.tierLevel = tierLevel; + } + + public Tier attributes(Map attributes) { + this.attributes = attributes; + return this; + } + + public Tier putAttributesItem(String key, String attributesItem) { + this.attributes.put(key, attributesItem); + return this; + } + + /** + * Custom attributes added to the tier policy + * @return attributes + **/ + @ApiModelProperty(example = "null", value = "Custom attributes added to the tier policy ") + public Map getAttributes() { + return attributes; + } + + public void setAttributes(Map attributes) { + this.attributes = attributes; + } + + public Tier requestCount(Long requestCount) { + this.requestCount = requestCount; + return this; + } + + /** + * Maximum number of requests which can be sent within a provided unit time + * @return requestCount + **/ + @ApiModelProperty(example = "50", required = true, value = "Maximum number of requests which can be sent within a provided unit time ") + public Long getRequestCount() { + return requestCount; + } + + public void setRequestCount(Long requestCount) { + this.requestCount = requestCount; + } + + public Tier unitTime(Long unitTime) { + this.unitTime = unitTime; + return this; + } + + /** + * Get unitTime + * @return unitTime + **/ + @ApiModelProperty(example = "60000", required = true, value = "") + public Long getUnitTime() { + return unitTime; + } + + public void setUnitTime(Long unitTime) { + this.unitTime = unitTime; + } + + public Tier timeUnit(String timeUnit) { + this.timeUnit = timeUnit; + return this; + } + + /** + * Get timeUnit + * @return timeUnit + **/ + @ApiModelProperty(example = "min", value = "") + public String getTimeUnit() { + return timeUnit; + } + + public void setTimeUnit(String timeUnit) { + this.timeUnit = timeUnit; + } + + public Tier tierPlan(TierPlanEnum tierPlan) { + this.tierPlan = tierPlan; + return this; + } + + /** + * This attribute declares whether this tier is available under commercial or free + * @return tierPlan + **/ + @ApiModelProperty(example = "FREE", required = true, value = "This attribute declares whether this tier is available under commercial or free ") + public TierPlanEnum getTierPlan() { + return tierPlan; + } + + public void setTierPlan(TierPlanEnum tierPlan) { + this.tierPlan = tierPlan; + } + + public Tier stopOnQuotaReach(Boolean stopOnQuotaReach) { + this.stopOnQuotaReach = stopOnQuotaReach; + return this; + } + + /** + * By making this attribute to false, you are capabale of sending requests even if the request count exceeded within a unit time + * @return stopOnQuotaReach + **/ + @ApiModelProperty(example = "true", required = true, value = "By making this attribute to false, you are capabale of sending requests even if the request count exceeded within a unit time ") + public Boolean getStopOnQuotaReach() { + return stopOnQuotaReach; + } + + public void setStopOnQuotaReach(Boolean stopOnQuotaReach) { + this.stopOnQuotaReach = stopOnQuotaReach; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tier tier = (Tier) o; + return Objects.equals(this.name, tier.name) && + Objects.equals(this.description, tier.description) && + Objects.equals(this.tierLevel, tier.tierLevel) && + Objects.equals(this.attributes, tier.attributes) && + Objects.equals(this.requestCount, tier.requestCount) && + Objects.equals(this.unitTime, tier.unitTime) && + Objects.equals(this.timeUnit, tier.timeUnit) && + Objects.equals(this.tierPlan, tier.tierPlan) && + Objects.equals(this.stopOnQuotaReach, tier.stopOnQuotaReach); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, tierLevel, attributes, requestCount, unitTime, timeUnit, tierPlan, stopOnQuotaReach); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tier {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" tierLevel: ").append(toIndentedString(tierLevel)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" requestCount: ").append(toIndentedString(requestCount)).append("\n"); + sb.append(" unitTime: ").append(toIndentedString(unitTime)).append("\n"); + sb.append(" timeUnit: ").append(toIndentedString(timeUnit)).append("\n"); + sb.append(" tierPlan: ").append(toIndentedString(tierPlan)).append("\n"); + sb.append(" stopOnQuotaReach: ").append(toIndentedString(stopOnQuotaReach)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/TierList.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/TierList.java new file mode 100644 index 0000000000..a93c73e401 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/TierList.java @@ -0,0 +1,175 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * TierList + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class TierList { + @JsonProperty("count") + private Integer count = null; + + @JsonProperty("next") + private String next = null; + + @JsonProperty("previous") + private String previous = null; + + @JsonProperty("list") + private List list = new ArrayList(); + + public TierList count(Integer count) { + this.count = count; + return this; + } + + /** + * Number of Tiers returned. + * @return count + **/ + @ApiModelProperty(example = "1", value = "Number of Tiers returned. ") + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public TierList next(String next) { + this.next = next; + return this; + } + + /** + * Link to the next subset of resources qualified. Empty if no more resources are to be returned. + * @return next + **/ + @ApiModelProperty(example = "/tiers/api?limit=1&offset=2", value = "Link to the next subset of resources qualified. Empty if no more resources are to be returned. ") + public String getNext() { + return next; + } + + public void setNext(String next) { + this.next = next; + } + + public TierList previous(String previous) { + this.previous = previous; + return this; + } + + /** + * Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. + * @return previous + **/ + @ApiModelProperty(example = "/tiers/api?limit=1&offset=0", value = "Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. ") + public String getPrevious() { + return previous; + } + + public void setPrevious(String previous) { + this.previous = previous; + } + + public TierList list(List list) { + this.list = list; + return this; + } + + public TierList addListItem(Tier listItem) { + this.list.add(listItem); + return this; + } + + /** + * Get list + * @return list + **/ + @ApiModelProperty(example = "null", value = "") + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TierList tierList = (TierList) o; + return Objects.equals(this.count, tierList.count) && + Objects.equals(this.next, tierList.next) && + Objects.equals(this.previous, tierList.previous) && + Objects.equals(this.list, tierList.list); + } + + @Override + public int hashCode() { + return Objects.hash(count, next, previous, list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TierList {\n"); + + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" next: ").append(toIndentedString(next)).append("\n"); + sb.append(" previous: ").append(toIndentedString(previous)).append("\n"); + sb.append(" list: ").append(toIndentedString(list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/TierPermission.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/TierPermission.java new file mode 100644 index 0000000000..8069b9d1c9 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/model/TierPermission.java @@ -0,0 +1,160 @@ +/** + * WSO2 API Manager - Publisher API + * This document specifies a **RESTful API** for WSO2 **API Manager** - Publisher. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.publisher.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * TierPermission + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:49.624+05:30") +public class TierPermission { + /** + * Gets or Sets permissionType + */ + public enum PermissionTypeEnum { + ALLOW("allow"), + + DENY("deny"); + + private String value; + + PermissionTypeEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static PermissionTypeEnum fromValue(String text) { + for (PermissionTypeEnum b : PermissionTypeEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("permissionType") + private PermissionTypeEnum permissionType = null; + + @JsonProperty("roles") + private List roles = new ArrayList(); + + public TierPermission permissionType(PermissionTypeEnum permissionType) { + this.permissionType = permissionType; + return this; + } + + /** + * Get permissionType + * @return permissionType + **/ + @ApiModelProperty(example = "deny", required = true, value = "") + public PermissionTypeEnum getPermissionType() { + return permissionType; + } + + public void setPermissionType(PermissionTypeEnum permissionType) { + this.permissionType = permissionType; + } + + public TierPermission roles(List roles) { + this.roles = roles; + return this; + } + + public TierPermission addRolesItem(String rolesItem) { + this.roles.add(rolesItem); + return this; + } + + /** + * Get roles + * @return roles + **/ + @ApiModelProperty(example = "null", required = true, value = "") + public List getRoles() { + return roles; + } + + public void setRoles(List roles) { + this.roles = roles; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TierPermission tierPermission = (TierPermission) o; + return Objects.equals(this.permissionType, tierPermission.permissionType) && + Objects.equals(this.roles, tierPermission.roles); + } + + @Override + public int hashCode() { + return Objects.hash(permissionType, roles); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TierPermission {\n"); + + sb.append(" permissionType: ").append(toIndentedString(permissionType)).append("\n"); + sb.append(" roles: ").append(toIndentedString(roles)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/service/IntegrationClientService.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/service/IntegrationClientService.java new file mode 100644 index 0000000000..0ac7e4616f --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/service/IntegrationClientService.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.service; + + +import org.wso2.carbon.apimgt.integration.client.publisher.PublisherClient; +import org.wso2.carbon.apimgt.integration.client.store.StoreClient; + +/** + * This is a service that can be called upon to access store and publisher. + */ +public interface IntegrationClientService { + + /** + * + * @return API Store Client. + */ + StoreClient getStoreClient(); + + /** + * + * @return API Publisher Client. + */ + PublisherClient getPublisherClient(); + +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/StoreClient.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/StoreClient.java new file mode 100644 index 0000000000..da22e8ef7b --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/StoreClient.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.store; + +import feign.Feign; +import feign.RequestInterceptor; +import feign.gson.GsonDecoder; +import feign.gson.GsonEncoder; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.apimgt.integration.client.configs.APIMConfigReader; +import org.wso2.carbon.apimgt.integration.client.store.api.*; +import org.wso2.carbon.core.util.Utils; + +/** + * API Store client, created using swagger gen. + */ +public class StoreClient { + + private static final org.apache.commons.logging.Log log = LogFactory.getLog(StoreClient.class); + private ApisAPIApi apis = null; + private APIindividualApi individualApi = null; + private ApplicationCollectionApi applications = null; + private ApplicationindividualApi individualApplication = null; + private SubscriptionCollectionApi subscriptions = null; + private SubscriptionindividualApi individualSubscription = null; + private TierindividualApi individualTier = null; + private TagCollectionApi tags = null; + private TierCollectionApi tiers = null; + + + public StoreClient(RequestInterceptor requestInterceptor) { + + Feign.Builder builder = Feign.builder().requestInterceptor(requestInterceptor) + .encoder(new GsonEncoder()).decoder(new GsonDecoder()); + String basePath = Utils.replaceSystemProperty(APIMConfigReader.getInstance().getConfig().getStoreEndpoint()); + + apis = builder.target(ApisAPIApi.class, basePath); + individualApi = builder.target(APIindividualApi.class, basePath); + applications = builder.target(ApplicationCollectionApi.class, basePath); + individualApplication = builder.target(ApplicationindividualApi.class, basePath); + subscriptions = builder.target(SubscriptionCollectionApi.class, basePath); + individualSubscription = builder.target(SubscriptionindividualApi.class, basePath); + tags = builder.target(TagCollectionApi.class, basePath); + tiers = builder.target(TierCollectionApi.class, basePath); + individualTier = builder.target(TierindividualApi.class, basePath); + + } + + public ApisAPIApi getApis() { + return apis; + } + + public APIindividualApi getIndividualApi() { + return individualApi; + } + + public ApplicationCollectionApi getApplications() { + return applications; + } + + public ApplicationindividualApi getIndividualApplication() { + return individualApplication; + } + + public SubscriptionCollectionApi getSubscriptions() { + return subscriptions; + } + + public SubscriptionindividualApi getIndividualSubscription() { + return individualSubscription; + } + + public TierindividualApi getIndividualTier() { + return individualTier; + } + + public TagCollectionApi getTags() { + return tags; + } + + public TierCollectionApi getTiers() { + return tiers; + } +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/APIindividualApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/APIindividualApi.java new file mode 100644 index 0000000000..ebbff73ebf --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/APIindividualApi.java @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.store.api; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.wso2.carbon.apimgt.integration.client.store.model.API; +import org.wso2.carbon.apimgt.integration.client.store.model.Document; +import org.wso2.carbon.apimgt.integration.client.store.model.DocumentList; + + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public interface APIindividualApi { + + + /** + * Downloads a FILE type document/get the inline content or source url of a certain document. + * Downloads a FILE type document/get the inline content or source url of a certain document. + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param documentId **Document Identifier** (required) + * @param xWSO2Tenant For cross-tenant invocations, this is used to specify the tenant domain, where the resource need to be retirieved from. (optional) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource. (optional) + * @return void + */ + @RequestLine("GET /apis/{apiId}/documents/{documentId}/content") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "X-WSO2-Tenant: {xWSO2Tenant}", + + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}" + }) + void apisApiIdDocumentsDocumentIdContentGet(@Param("apiId") String apiId, @Param("documentId") String documentId, + @Param("xWSO2Tenant") String xWSO2Tenant, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch, + @Param("ifModifiedSince") String ifModifiedSince); + + /** + * Get a particular document associated with an API. + * Get a particular document associated with an API. + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param documentId **Document Identifier** (required) + * @param xWSO2Tenant For cross-tenant invocations, this is used to specify the tenant domain, where the resource need to be retirieved from. (optional) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource. (optional) + * @return Document + */ + @RequestLine("GET /apis/{apiId}/documents/{documentId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "X-WSO2-Tenant: {xWSO2Tenant}", + + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}" + }) + Document apisApiIdDocumentsDocumentIdGet(@Param("apiId") String apiId, @Param("documentId") String documentId, + @Param("xWSO2Tenant") String xWSO2Tenant, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch, + @Param("ifModifiedSince") String ifModifiedSince); + + /** + * Get a list of documents belonging to an API. + * Get a list of documents belonging to an API. + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param limit Maximum size of resource array to return. (optional, default to 25) + * @param offset Starting point within the complete list of items qualified. (optional, default to 0) + * @param xWSO2Tenant For cross-tenant invocations, this is used to specify the tenant domain, where the resource need to be retirieved from. (optional) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @return DocumentList + */ + @RequestLine("GET /apis/{apiId}/documents?limit={limit}&offset={offset}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "X-WSO2-Tenant: {xWSO2Tenant}", + + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}" + }) + DocumentList apisApiIdDocumentsGet(@Param("apiId") String apiId, @Param("limit") Integer limit, + @Param("offset") Integer offset, @Param("xWSO2Tenant") String xWSO2Tenant, + @Param("accept") String accept, @Param("ifNoneMatch") String ifNoneMatch); + + /** + * Get Details of API + * Get details of an API + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource. (optional) + * @param xWSO2Tenant For cross-tenant invocations, this is used to specify the tenant domain, where the resource need to be retirieved from. (optional) + * @return API + */ + @RequestLine("GET /apis/{apiId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}", + + "X-WSO2-Tenant: {xWSO2Tenant}" + }) + API apisApiIdGet(@Param("apiId") String apiId, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch, @Param("ifModifiedSince") String ifModifiedSince, + @Param("xWSO2Tenant") String xWSO2Tenant); + + /** + * Get the swagger of an API + * Get the swagger of an API + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource. (optional) + * @param xWSO2Tenant For cross-tenant invocations, this is used to specify the tenant domain, where the resource need to be retirieved from. (optional) + * @return void + */ + @RequestLine("GET /apis/{apiId}/swagger") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}", + + "X-WSO2-Tenant: {xWSO2Tenant}" + }) + void apisApiIdSwaggerGet(@Param("apiId") String apiId, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch, @Param("ifModifiedSince") String ifModifiedSince, + @Param("xWSO2Tenant") String xWSO2Tenant); + + /** + * Get the thumbnail image + * Downloads a thumbnail image of an API + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**. (required) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly + * retrieved variant of the resource. (optional) + * @return void + */ + @RequestLine("GET /apis/{apiId}/thumbnail") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}" + }) + void apisApiIdThumbnailGet(@Param("apiId") String apiId, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch, @Param("ifModifiedSince") String ifModifiedSince); +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/ApisAPIApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/ApisAPIApi.java new file mode 100644 index 0000000000..35ccfdd3c0 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/ApisAPIApi.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.store.api; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.wso2.carbon.apimgt.integration.client.store.model.APIList; + + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public interface ApisAPIApi { + + + /** + * Retrieving APIs + * Get a list of available APIs qualifying under a given search condition. + * @param limit Maximum size of resource array to return. (optional, default to 25) + * @param offset Starting point within the complete list of items qualified. (optional, default to 0) + * @param xWSO2Tenant For cross-tenant invocations, this is used to specify the tenant domain, where the resource need to be retirieved from. (optional) + * @param query **Search condition**. You can search in attributes by using an **\"attribute:\"** modifier. Eg. \"provider:wso2\" will match an API if the provider of the API is exactly \"wso2\". Additionally you can use wildcards. Eg. \"provider:wso2\\*\" will match an API if the provider of the API starts with \"wso2\". Supported attribute modifiers are [**version, context, status, description, subcontext, doc, provider, tag**] If no advanced attribute modifier has been specified, search will match the given query string against API Name. (optional) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @return APIList + */ + @RequestLine("GET /apis?limit={limit}&offset={offset}&query={query}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "X-WSO2-Tenant: {xWSO2Tenant}", + + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}" + }) + APIList apisGet(@Param("limit") Integer limit, @Param("offset") Integer offset, + @Param("xWSO2Tenant") String xWSO2Tenant, @Param("query") String query, + @Param("accept") String accept, @Param("ifNoneMatch") String ifNoneMatch); +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/ApplicationCollectionApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/ApplicationCollectionApi.java new file mode 100644 index 0000000000..f627e4dcc3 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/ApplicationCollectionApi.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.store.api; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.wso2.carbon.apimgt.integration.client.store.model.ApplicationList; + + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public interface ApplicationCollectionApi { + + + /** + * Get a list of applications + * Get a list of applications + * @param groupId Application Group Id (optional) + * @param query **Search condition**. You can search for an application by specifying the name as \"query\" attribute. Eg. \"app1\" will match an application if the name is exactly \"app1\". Currently this does not support wildcards. Given name must exactly match the application name. (optional) + * @param limit Maximum size of resource array to return. (optional, default to 25) + * @param offset Starting point within the complete list of items qualified. (optional, default to 0) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @return ApplicationList + */ + @RequestLine("GET /applications?groupId={groupId}&query={query}&limit={limit}&offset={offset}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}" + }) + ApplicationList applicationsGet(@Param("groupId") String groupId, @Param("query") String query, + @Param("limit") Integer limit, @Param("offset") Integer offset, + @Param("accept") String accept, @Param("ifNoneMatch") String ifNoneMatch); +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/ApplicationindividualApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/ApplicationindividualApi.java new file mode 100644 index 0000000000..7c2cabcd3f --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/ApplicationindividualApi.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.store.api; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.wso2.carbon.apimgt.integration.client.store.model.Application; +import org.wso2.carbon.apimgt.integration.client.store.model.ApplicationKey; +import org.wso2.carbon.apimgt.integration.client.store.model.ApplicationKeyGenerateRequest; + + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public interface ApplicationindividualApi { + + + /** + * Remove an application + * Remove an application + * @param applicationId **Application Identifier** consisting of the UUID of the Application. (required) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return void + */ + @RequestLine("DELETE /applications/{applicationId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + void applicationsApplicationIdDelete(@Param("applicationId") String applicationId, @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince); + + /** + * Get application details + * Get application details + * @param applicationId **Application Identifier** consisting of the UUID of the Application. (required) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource. (optional) + * @return Application + */ + @RequestLine("GET /applications/{applicationId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}" + }) + Application applicationsApplicationIdGet(@Param("applicationId") String applicationId, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch, + @Param("ifModifiedSince") String ifModifiedSince); + + /** + * Update application details + * Update application details + * @param applicationId **Application Identifier** consisting of the UUID of the Application. (required) + * @param body Application object that needs to be updated (required) + * @param contentType Media type of the entity in the body. Default is JSON. (required) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return Application + */ + @RequestLine("PUT /applications/{applicationId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Content-Type: {contentType}", + + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + Application applicationsApplicationIdPut(@Param("applicationId") String applicationId, Application body, + @Param("contentType") String contentType, @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince); + + /** + * Generate keys for application + * Generate keys for application + * @param applicationId **Application Identifier** consisting of the UUID of the Application. (required) + * @param body Application object the keys of which are to be generated (required) + * @param contentType Media type of the entity in the body. Default is JSON. (required) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return ApplicationKey + */ + @RequestLine("POST /applications/generate-keys?applicationId={applicationId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Content-Type: {contentType}", + + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + ApplicationKey applicationsGenerateKeysPost(@Param("applicationId") String applicationId, + ApplicationKeyGenerateRequest body, + @Param("contentType") String contentType, + @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince); + + /** + * Create a new application. + * Create a new application. + * @param body Application object that is to be created. (required) + * @param contentType Media type of the entity in the body. Default is JSON. (required) + * @return Application + */ + @RequestLine("POST /applications") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Content-Type: {contentType}" + }) + Application applicationsPost(Application body, @Param("contentType") String contentType); +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/SubscriptionCollectionApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/SubscriptionCollectionApi.java new file mode 100644 index 0000000000..43075305f6 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/SubscriptionCollectionApi.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.store.api; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.wso2.carbon.apimgt.integration.client.store.model.SubscriptionList; + + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public interface SubscriptionCollectionApi { + + + /** + * Get subscription list. + * Get subscription list. The API Identifier or Application Identifier the subscriptions of which are to be returned are passed as parameters. + * @param apiId **API ID** consisting of the **UUID** of the API. The combination of the provider of the API, name of the API and the version is also accepted as a valid API I. Should be formatted as **provider-name-version**. (required) + * @param applicationId **Application Identifier** consisting of the UUID of the Application. (required) + * @param groupId Application Group Id (optional) + * @param offset Starting point within the complete list of items qualified. (optional, default to 0) + * @param limit Maximum size of resource array to return. (optional, default to 25) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @return SubscriptionList + */ + @RequestLine("GET /subscriptions?apiId={apiId}&applicationId={applicationId}&groupId={groupId}&offset={offset}&limit={limit}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}" + }) + SubscriptionList subscriptionsGet(@Param("apiId") String apiId, @Param("applicationId") String applicationId, + @Param("groupId") String groupId, @Param("offset") Integer offset, + @Param("limit") Integer limit, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch); +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/SubscriptionindividualApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/SubscriptionindividualApi.java new file mode 100644 index 0000000000..adf57708a4 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/SubscriptionindividualApi.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.store.api; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.wso2.carbon.apimgt.integration.client.store.model.Subscription; + + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public interface SubscriptionindividualApi { + + + /** + * Add a new subscription + * Add a new subscription + * @param body Subscription object that should to be added (required) + * @param contentType Media type of the entity in the body. Default is JSON. (required) + * @return Subscription + */ + @RequestLine("POST /subscriptions") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Content-Type: {contentType}" + }) + Subscription subscriptionsPost(Subscription body, @Param("contentType") String contentType); + + /** + * Remove subscription + * Remove subscription + * @param subscriptionId Subscription Id (required) + * @param ifMatch Validator for conditional requests; based on ETag. (optional) + * @param ifUnmodifiedSince Validator for conditional requests; based on Last Modified header. (optional) + * @return void + */ + @RequestLine("DELETE /subscriptions/{subscriptionId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "If-Match: {ifMatch}", + + "If-Unmodified-Since: {ifUnmodifiedSince}" + }) + void subscriptionsSubscriptionIdDelete(@Param("subscriptionId") String subscriptionId, + @Param("ifMatch") String ifMatch, + @Param("ifUnmodifiedSince") String ifUnmodifiedSince); + + /** + * Get subscription details + * Get subscription details + * @param subscriptionId Subscription Id (required) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource. (optional) + * @return Subscription + */ + @RequestLine("GET /subscriptions/{subscriptionId}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}" + }) + Subscription subscriptionsSubscriptionIdGet(@Param("subscriptionId") String subscriptionId, + @Param("accept") String accept, @Param("ifNoneMatch") String ifNoneMatch, + @Param("ifModifiedSince") String ifModifiedSince); +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/TagCollectionApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/TagCollectionApi.java new file mode 100644 index 0000000000..e57da1494c --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/TagCollectionApi.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.store.api; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.wso2.carbon.apimgt.integration.client.store.model.TagList; + + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public interface TagCollectionApi { + + + /** + * Get a list of tags that are already added to APIs + * Get a list of tags that are already added to APIs + * @param limit Maximum size of resource array to return. (optional, default to 25) + * @param offset Starting point within the complete list of items qualified. (optional, default to 0) + * @param xWSO2Tenant For cross-tenant invocations, this is used to specify the tenant domain, where the resource need to be retirieved from. (optional) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @return TagList + */ + @RequestLine("GET /tags?limit={limit}&offset={offset}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "X-WSO2-Tenant: {xWSO2Tenant}", + + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}" + }) + TagList tagsGet(@Param("limit") Integer limit, @Param("offset") Integer offset, + @Param("xWSO2Tenant") String xWSO2Tenant, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch); +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/TierCollectionApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/TierCollectionApi.java new file mode 100644 index 0000000000..bf8dce98a1 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/TierCollectionApi.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.store.api; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.wso2.carbon.apimgt.integration.client.store.model.TierList; + + +import java.util.List; + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public interface TierCollectionApi { + + + /** + * Get available tiers + * Get available tiers + * @param tierLevel List API or Application type tiers. (required) + * @param limit Maximum size of resource array to return. (optional, default to 25) + * @param offset Starting point within the complete list of items qualified. (optional, default to 0) + * @param xWSO2Tenant For cross-tenant invocations, this is used to specify the tenant domain, where the resource need to be retirieved from. (optional) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @return List + */ + @RequestLine("GET /tiers/{tierLevel}?limit={limit}&offset={offset}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "X-WSO2-Tenant: {xWSO2Tenant}", + + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}" + }) + List tiersTierLevelGet(@Param("tierLevel") String tierLevel, @Param("limit") Integer limit, + @Param("offset") Integer offset, @Param("xWSO2Tenant") String xWSO2Tenant, + @Param("accept") String accept, @Param("ifNoneMatch") String ifNoneMatch); +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/TierindividualApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/TierindividualApi.java new file mode 100644 index 0000000000..c62d53503e --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/TierindividualApi.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.store.api; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.wso2.carbon.apimgt.integration.client.store.model.Tier; + + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public interface TierindividualApi { + + + /** + * Get tier details + * Get tier details + * @param tierName Tier name (required) + * @param tierLevel List API or Application type tiers. (required) + * @param xWSO2Tenant For cross-tenant invocations, this is used to specify the tenant domain, where the resource need to be retirieved from. (optional) + * @param accept Media types acceptable for the response. Default is JSON. (optional, default to JSON) + * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec. (optional) + * @param ifModifiedSince Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource. (optional) + * @return Tier + */ + @RequestLine("GET /tiers/{tierLevel}/{tierName}") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "X-WSO2-Tenant: {xWSO2Tenant}", + + "Accept: {accept}", + + "If-None-Match: {ifNoneMatch}", + + "If-Modified-Since: {ifModifiedSince}" + }) + Tier tiersTierLevelTierNameGet(@Param("tierName") String tierName, @Param("tierLevel") String tierLevel, + @Param("xWSO2Tenant") String xWSO2Tenant, @Param("accept") String accept, + @Param("ifNoneMatch") String ifNoneMatch, + @Param("ifModifiedSince") String ifModifiedSince); +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/API.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/API.java new file mode 100644 index 0000000000..90ea61fe6f --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/API.java @@ -0,0 +1,466 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * API + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class API { + @JsonProperty("id") + private String id = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("description") + private String description = null; + + @JsonProperty("context") + private String context = null; + + @JsonProperty("version") + private String version = null; + + @JsonProperty("provider") + private String provider = null; + + @JsonProperty("apiDefinition") + private String apiDefinition = null; + + @JsonProperty("wsdlUri") + private String wsdlUri = null; + + @JsonProperty("status") + private String status = null; + + @JsonProperty("isDefaultVersion") + private Boolean isDefaultVersion = null; + + @JsonProperty("transport") + private List transport = new ArrayList(); + + @JsonProperty("tags") + private List tags = new ArrayList(); + + @JsonProperty("tiers") + private List tiers = new ArrayList(); + + @JsonProperty("thumbnailUrl") + private String thumbnailUrl = null; + + @JsonProperty("endpointURLs") + private List endpointURLs = new ArrayList(); + + @JsonProperty("businessInformation") + private APIBusinessInformation businessInformation = null; + + public API id(String id) { + this.id = id; + return this; + } + + /** + * UUID of the api registry artifact + * @return id + **/ + @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", value = "UUID of the api registry artifact ") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public API name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "CalculatorAPI", required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public API description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @ApiModelProperty(example = "A calculator API that supports basic operations", value = "") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public API context(String context) { + this.context = context; + return this; + } + + /** + * Get context + * @return context + **/ + @ApiModelProperty(example = "CalculatorAPI", required = true, value = "") + public String getContext() { + return context; + } + + public void setContext(String context) { + this.context = context; + } + + public API version(String version) { + this.version = version; + return this; + } + + /** + * Get version + * @return version + **/ + @ApiModelProperty(example = "1.0.0", required = true, value = "") + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public API provider(String provider) { + this.provider = provider; + return this; + } + + /** + * If the provider value is not given user invoking the api will be used as the provider. + * @return provider + **/ + @ApiModelProperty(example = "admin", required = true, value = "If the provider value is not given user invoking the api will be used as the provider. ") + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + + public API apiDefinition(String apiDefinition) { + this.apiDefinition = apiDefinition; + return this; + } + + /** + * Swagger definition of the API which contains details about URI templates and scopes + * @return apiDefinition + **/ + @ApiModelProperty(example = "", required = true, value = "Swagger definition of the API which contains details about URI templates and scopes ") + public String getApiDefinition() { + return apiDefinition; + } + + public void setApiDefinition(String apiDefinition) { + this.apiDefinition = apiDefinition; + } + + public API wsdlUri(String wsdlUri) { + this.wsdlUri = wsdlUri; + return this; + } + + /** + * WSDL URL if the API is based on a WSDL endpoint + * @return wsdlUri + **/ + @ApiModelProperty(example = "http://www.webservicex.com/globalweather.asmx?wsdl", value = "WSDL URL if the API is based on a WSDL endpoint ") + public String getWsdlUri() { + return wsdlUri; + } + + public void setWsdlUri(String wsdlUri) { + this.wsdlUri = wsdlUri; + } + + public API status(String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(example = "PUBLISHED", required = true, value = "") + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public API isDefaultVersion(Boolean isDefaultVersion) { + this.isDefaultVersion = isDefaultVersion; + return this; + } + + /** + * Get isDefaultVersion + * @return isDefaultVersion + **/ + @ApiModelProperty(example = "false", value = "") + public Boolean getIsDefaultVersion() { + return isDefaultVersion; + } + + public void setIsDefaultVersion(Boolean isDefaultVersion) { + this.isDefaultVersion = isDefaultVersion; + } + + public API transport(List transport) { + this.transport = transport; + return this; + } + + public API addTransportItem(String transportItem) { + this.transport.add(transportItem); + return this; + } + + /** + * Get transport + * @return transport + **/ + @ApiModelProperty(example = "null", value = "") + public List getTransport() { + return transport; + } + + public void setTransport(List transport) { + this.transport = transport; + } + + public API tags(List tags) { + this.tags = tags; + return this; + } + + public API addTagsItem(String tagsItem) { + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @ApiModelProperty(example = "null", value = "") + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public API tiers(List tiers) { + this.tiers = tiers; + return this; + } + + public API addTiersItem(String tiersItem) { + this.tiers.add(tiersItem); + return this; + } + + /** + * Get tiers + * @return tiers + **/ + @ApiModelProperty(example = "null", value = "") + public List getTiers() { + return tiers; + } + + public void setTiers(List tiers) { + this.tiers = tiers; + } + + public API thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + /** + * Get thumbnailUrl + * @return thumbnailUrl + **/ + @ApiModelProperty(example = "", value = "") + public String getThumbnailUrl() { + return thumbnailUrl; + } + + public void setThumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + } + + public API endpointURLs(List endpointURLs) { + this.endpointURLs = endpointURLs; + return this; + } + + public API addEndpointURLsItem(APIEndpointURLs endpointURLsItem) { + this.endpointURLs.add(endpointURLsItem); + return this; + } + + /** + * Get endpointURLs + * @return endpointURLs + **/ + @ApiModelProperty(example = "null", value = "") + public List getEndpointURLs() { + return endpointURLs; + } + + public void setEndpointURLs(List endpointURLs) { + this.endpointURLs = endpointURLs; + } + + public API businessInformation(APIBusinessInformation businessInformation) { + this.businessInformation = businessInformation; + return this; + } + + /** + * Get businessInformation + * @return businessInformation + **/ + @ApiModelProperty(example = "null", value = "") + public APIBusinessInformation getBusinessInformation() { + return businessInformation; + } + + public void setBusinessInformation(APIBusinessInformation businessInformation) { + this.businessInformation = businessInformation; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + API API = (org.wso2.carbon.apimgt.integration.client.store.model.API) o; + return Objects.equals(this.id, API.id) && + Objects.equals(this.name, API.name) && + Objects.equals(this.description, API.description) && + Objects.equals(this.context, API.context) && + Objects.equals(this.version, API.version) && + Objects.equals(this.provider, API.provider) && + Objects.equals(this.apiDefinition, API.apiDefinition) && + Objects.equals(this.wsdlUri, API.wsdlUri) && + Objects.equals(this.status, API.status) && + Objects.equals(this.isDefaultVersion, API.isDefaultVersion) && + Objects.equals(this.transport, API.transport) && + Objects.equals(this.tags, API.tags) && + Objects.equals(this.tiers, API.tiers) && + Objects.equals(this.thumbnailUrl, API.thumbnailUrl) && + Objects.equals(this.endpointURLs, API.endpointURLs) && + Objects.equals(this.businessInformation, API.businessInformation); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, context, version, provider, apiDefinition, wsdlUri, status, isDefaultVersion, transport, tags, tiers, thumbnailUrl, endpointURLs, businessInformation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class API {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" context: ").append(toIndentedString(context)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" apiDefinition: ").append(toIndentedString(apiDefinition)).append("\n"); + sb.append(" wsdlUri: ").append(toIndentedString(wsdlUri)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" isDefaultVersion: ").append(toIndentedString(isDefaultVersion)).append("\n"); + sb.append(" transport: ").append(toIndentedString(transport)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" tiers: ").append(toIndentedString(tiers)).append("\n"); + sb.append(" thumbnailUrl: ").append(toIndentedString(thumbnailUrl)).append("\n"); + sb.append(" endpointURLs: ").append(toIndentedString(endpointURLs)).append("\n"); + sb.append(" businessInformation: ").append(toIndentedString(businessInformation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/APIBusinessInformation.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/APIBusinessInformation.java new file mode 100644 index 0000000000..dea7cc81fe --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/APIBusinessInformation.java @@ -0,0 +1,168 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * APIBusinessInformation + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class APIBusinessInformation { + @JsonProperty("businessOwner") + private String businessOwner = null; + + @JsonProperty("businessOwnerEmail") + private String businessOwnerEmail = null; + + @JsonProperty("technicalOwner") + private String technicalOwner = null; + + @JsonProperty("technicalOwnerEmail") + private String technicalOwnerEmail = null; + + public APIBusinessInformation businessOwner(String businessOwner) { + this.businessOwner = businessOwner; + return this; + } + + /** + * Get businessOwner + * @return businessOwner + **/ + @ApiModelProperty(example = "businessowner", value = "") + public String getBusinessOwner() { + return businessOwner; + } + + public void setBusinessOwner(String businessOwner) { + this.businessOwner = businessOwner; + } + + public APIBusinessInformation businessOwnerEmail(String businessOwnerEmail) { + this.businessOwnerEmail = businessOwnerEmail; + return this; + } + + /** + * Get businessOwnerEmail + * @return businessOwnerEmail + **/ + @ApiModelProperty(example = "businessowner@wso2.com", value = "") + public String getBusinessOwnerEmail() { + return businessOwnerEmail; + } + + public void setBusinessOwnerEmail(String businessOwnerEmail) { + this.businessOwnerEmail = businessOwnerEmail; + } + + public APIBusinessInformation technicalOwner(String technicalOwner) { + this.technicalOwner = technicalOwner; + return this; + } + + /** + * Get technicalOwner + * @return technicalOwner + **/ + @ApiModelProperty(example = "technicalowner", value = "") + public String getTechnicalOwner() { + return technicalOwner; + } + + public void setTechnicalOwner(String technicalOwner) { + this.technicalOwner = technicalOwner; + } + + public APIBusinessInformation technicalOwnerEmail(String technicalOwnerEmail) { + this.technicalOwnerEmail = technicalOwnerEmail; + return this; + } + + /** + * Get technicalOwnerEmail + * @return technicalOwnerEmail + **/ + @ApiModelProperty(example = "technicalowner@wso2.com", value = "") + public String getTechnicalOwnerEmail() { + return technicalOwnerEmail; + } + + public void setTechnicalOwnerEmail(String technicalOwnerEmail) { + this.technicalOwnerEmail = technicalOwnerEmail; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + APIBusinessInformation aPIBusinessInformation = (APIBusinessInformation) o; + return Objects.equals(this.businessOwner, aPIBusinessInformation.businessOwner) && + Objects.equals(this.businessOwnerEmail, aPIBusinessInformation.businessOwnerEmail) && + Objects.equals(this.technicalOwner, aPIBusinessInformation.technicalOwner) && + Objects.equals(this.technicalOwnerEmail, aPIBusinessInformation.technicalOwnerEmail); + } + + @Override + public int hashCode() { + return Objects.hash(businessOwner, businessOwnerEmail, technicalOwner, technicalOwnerEmail); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class APIBusinessInformation {\n"); + + sb.append(" businessOwner: ").append(toIndentedString(businessOwner)).append("\n"); + sb.append(" businessOwnerEmail: ").append(toIndentedString(businessOwnerEmail)).append("\n"); + sb.append(" technicalOwner: ").append(toIndentedString(technicalOwner)).append("\n"); + sb.append(" technicalOwnerEmail: ").append(toIndentedString(technicalOwnerEmail)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/APIEndpointURLs.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/APIEndpointURLs.java new file mode 100644 index 0000000000..28d2f87098 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/APIEndpointURLs.java @@ -0,0 +1,145 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * APIEndpointURLs + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class APIEndpointURLs { + @JsonProperty("environmentName") + private String environmentName = null; + + @JsonProperty("environmentType") + private String environmentType = null; + + @JsonProperty("environmentURLs") + private APIEnvironmentURLs environmentURLs = null; + + public APIEndpointURLs environmentName(String environmentName) { + this.environmentName = environmentName; + return this; + } + + /** + * Get environmentName + * @return environmentName + **/ + @ApiModelProperty(example = "Production and Sandbox", value = "") + public String getEnvironmentName() { + return environmentName; + } + + public void setEnvironmentName(String environmentName) { + this.environmentName = environmentName; + } + + public APIEndpointURLs environmentType(String environmentType) { + this.environmentType = environmentType; + return this; + } + + /** + * Get environmentType + * @return environmentType + **/ + @ApiModelProperty(example = "hybrid", value = "") + public String getEnvironmentType() { + return environmentType; + } + + public void setEnvironmentType(String environmentType) { + this.environmentType = environmentType; + } + + public APIEndpointURLs environmentURLs(APIEnvironmentURLs environmentURLs) { + this.environmentURLs = environmentURLs; + return this; + } + + /** + * Get environmentURLs + * @return environmentURLs + **/ + @ApiModelProperty(example = "null", value = "") + public APIEnvironmentURLs getEnvironmentURLs() { + return environmentURLs; + } + + public void setEnvironmentURLs(APIEnvironmentURLs environmentURLs) { + this.environmentURLs = environmentURLs; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + APIEndpointURLs aPIEndpointURLs = (APIEndpointURLs) o; + return Objects.equals(this.environmentName, aPIEndpointURLs.environmentName) && + Objects.equals(this.environmentType, aPIEndpointURLs.environmentType) && + Objects.equals(this.environmentURLs, aPIEndpointURLs.environmentURLs); + } + + @Override + public int hashCode() { + return Objects.hash(environmentName, environmentType, environmentURLs); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class APIEndpointURLs {\n"); + + sb.append(" environmentName: ").append(toIndentedString(environmentName)).append("\n"); + sb.append(" environmentType: ").append(toIndentedString(environmentType)).append("\n"); + sb.append(" environmentURLs: ").append(toIndentedString(environmentURLs)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/APIEnvironmentURLs.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/APIEnvironmentURLs.java new file mode 100644 index 0000000000..339c4a16eb --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/APIEnvironmentURLs.java @@ -0,0 +1,122 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * APIEnvironmentURLs + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class APIEnvironmentURLs { + @JsonProperty("http") + private String http = null; + + @JsonProperty("https") + private String https = null; + + public APIEnvironmentURLs http(String http) { + this.http = http; + return this; + } + + /** + * HTTP environment URL + * @return http + **/ + @ApiModelProperty(example = "http://192.168.56.1:8280/phoneverify/1.0.0", value = "HTTP environment URL") + public String getHttp() { + return http; + } + + public void setHttp(String http) { + this.http = http; + } + + public APIEnvironmentURLs https(String https) { + this.https = https; + return this; + } + + /** + * HTTPS environment URL + * @return https + **/ + @ApiModelProperty(example = "https://192.168.56.1:8243/phoneverify/1.0.0", value = "HTTPS environment URL") + public String getHttps() { + return https; + } + + public void setHttps(String https) { + this.https = https; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + APIEnvironmentURLs aPIEnvironmentURLs = (APIEnvironmentURLs) o; + return Objects.equals(this.http, aPIEnvironmentURLs.http) && + Objects.equals(this.https, aPIEnvironmentURLs.https); + } + + @Override + public int hashCode() { + return Objects.hash(http, https); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class APIEnvironmentURLs {\n"); + + sb.append(" http: ").append(toIndentedString(http)).append("\n"); + sb.append(" https: ").append(toIndentedString(https)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/APIInfo.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/APIInfo.java new file mode 100644 index 0000000000..b6ac4f4548 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/APIInfo.java @@ -0,0 +1,237 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * APIInfo + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class APIInfo { + @JsonProperty("id") + private String id = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("description") + private String description = null; + + @JsonProperty("context") + private String context = null; + + @JsonProperty("version") + private String version = null; + + @JsonProperty("provider") + private String provider = null; + + @JsonProperty("status") + private String status = null; + + public APIInfo id(String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", value = "") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public APIInfo name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "CalculatorAPI", value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public APIInfo description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @ApiModelProperty(example = "A calculator API that supports basic operations", value = "") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public APIInfo context(String context) { + this.context = context; + return this; + } + + /** + * Get context + * @return context + **/ + @ApiModelProperty(example = "CalculatorAPI", value = "") + public String getContext() { + return context; + } + + public void setContext(String context) { + this.context = context; + } + + public APIInfo version(String version) { + this.version = version; + return this; + } + + /** + * Get version + * @return version + **/ + @ApiModelProperty(example = "1.0.0", value = "") + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public APIInfo provider(String provider) { + this.provider = provider; + return this; + } + + /** + * If the provider value is not given, the user invoking the API will be used as the provider. + * @return provider + **/ + @ApiModelProperty(example = "admin", value = "If the provider value is not given, the user invoking the API will be used as the provider. ") + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + + public APIInfo status(String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(example = "PUBLISHED", value = "") + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + APIInfo aPIInfo = (APIInfo) o; + return Objects.equals(this.id, aPIInfo.id) && + Objects.equals(this.name, aPIInfo.name) && + Objects.equals(this.description, aPIInfo.description) && + Objects.equals(this.context, aPIInfo.context) && + Objects.equals(this.version, aPIInfo.version) && + Objects.equals(this.provider, aPIInfo.provider) && + Objects.equals(this.status, aPIInfo.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, context, version, provider, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class APIInfo {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" context: ").append(toIndentedString(context)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/APIList.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/APIList.java new file mode 100644 index 0000000000..1801088d6c --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/APIList.java @@ -0,0 +1,175 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * APIList + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class APIList { + @JsonProperty("count") + private Integer count = null; + + @JsonProperty("next") + private String next = null; + + @JsonProperty("previous") + private String previous = null; + + @JsonProperty("list") + private List list = new ArrayList(); + + public APIList count(Integer count) { + this.count = count; + return this; + } + + /** + * Number of APIs returned. + * @return count + **/ + @ApiModelProperty(example = "1", value = "Number of APIs returned. ") + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public APIList next(String next) { + this.next = next; + return this; + } + + /** + * Link to the next subset of resources qualified. Empty if no more resources are to be returned. + * @return next + **/ + @ApiModelProperty(example = "/apis?limit=1&offset=2&query=", value = "Link to the next subset of resources qualified. Empty if no more resources are to be returned. ") + public String getNext() { + return next; + } + + public void setNext(String next) { + this.next = next; + } + + public APIList previous(String previous) { + this.previous = previous; + return this; + } + + /** + * Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. + * @return previous + **/ + @ApiModelProperty(example = "/apis?limit=1&offset=0&query=", value = "Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. ") + public String getPrevious() { + return previous; + } + + public void setPrevious(String previous) { + this.previous = previous; + } + + public APIList list(List list) { + this.list = list; + return this; + } + + public APIList addListItem(APIInfo listItem) { + this.list.add(listItem); + return this; + } + + /** + * Get list + * @return list + **/ + @ApiModelProperty(example = "null", value = "") + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + APIList aPIList = (APIList) o; + return Objects.equals(this.count, aPIList.count) && + Objects.equals(this.next, aPIList.next) && + Objects.equals(this.previous, aPIList.previous) && + Objects.equals(this.list, aPIList.list); + } + + @Override + public int hashCode() { + return Objects.hash(count, next, previous, list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class APIList {\n"); + + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" next: ").append(toIndentedString(next)).append("\n"); + sb.append(" previous: ").append(toIndentedString(previous)).append("\n"); + sb.append(" list: ").append(toIndentedString(list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Application.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Application.java new file mode 100644 index 0000000000..6dd92ccddf --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Application.java @@ -0,0 +1,290 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * Application + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class Application { + @JsonProperty("applicationId") + private String applicationId = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("subscriber") + private String subscriber = null; + + @JsonProperty("throttlingTier") + private String throttlingTier = null; + + @JsonProperty("callbackUrl") + private String callbackUrl = null; + + @JsonProperty("description") + private String description = null; + + @JsonProperty("status") + private String status = ""; + + @JsonProperty("groupId") + private String groupId = null; + + @JsonProperty("keys") + private List keys = new ArrayList(); + + public Application applicationId(String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Get applicationId + * @return applicationId + **/ + @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", value = "") + public String getApplicationId() { + return applicationId; + } + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + public Application name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "CalculatorApp", required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Application subscriber(String subscriber) { + this.subscriber = subscriber; + return this; + } + + /** + * If subscriber is not given user invoking the API will be taken as the subscriber. + * @return subscriber + **/ + @ApiModelProperty(example = "admin", value = "If subscriber is not given user invoking the API will be taken as the subscriber. ") + public String getSubscriber() { + return subscriber; + } + + public void setSubscriber(String subscriber) { + this.subscriber = subscriber; + } + + public Application throttlingTier(String throttlingTier) { + this.throttlingTier = throttlingTier; + return this; + } + + /** + * Get throttlingTier + * @return throttlingTier + **/ + @ApiModelProperty(example = "Unlimited", required = true, value = "") + public String getThrottlingTier() { + return throttlingTier; + } + + public void setThrottlingTier(String throttlingTier) { + this.throttlingTier = throttlingTier; + } + + public Application callbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + return this; + } + + /** + * Get callbackUrl + * @return callbackUrl + **/ + @ApiModelProperty(example = "", value = "") + public String getCallbackUrl() { + return callbackUrl; + } + + public void setCallbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + } + + public Application description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @ApiModelProperty(example = "Sample calculator application", value = "") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Application status(String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(example = "APPROVED", value = "") + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Application groupId(String groupId) { + this.groupId = groupId; + return this; + } + + /** + * Get groupId + * @return groupId + **/ + @ApiModelProperty(example = "", value = "") + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public Application keys(List keys) { + this.keys = keys; + return this; + } + + public Application addKeysItem(ApplicationKey keysItem) { + this.keys.add(keysItem); + return this; + } + + /** + * Get keys + * @return keys + **/ + @ApiModelProperty(example = "null", value = "") + public List getKeys() { + return keys; + } + + public void setKeys(List keys) { + this.keys = keys; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Application application = (Application) o; + return Objects.equals(this.applicationId, application.applicationId) && + Objects.equals(this.name, application.name) && + Objects.equals(this.subscriber, application.subscriber) && + Objects.equals(this.throttlingTier, application.throttlingTier) && + Objects.equals(this.callbackUrl, application.callbackUrl) && + Objects.equals(this.description, application.description) && + Objects.equals(this.status, application.status) && + Objects.equals(this.groupId, application.groupId) && + Objects.equals(this.keys, application.keys); + } + + @Override + public int hashCode() { + return Objects.hash(applicationId, name, subscriber, throttlingTier, callbackUrl, description, status, groupId, keys); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Application {\n"); + + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" subscriber: ").append(toIndentedString(subscriber)).append("\n"); + sb.append(" throttlingTier: ").append(toIndentedString(throttlingTier)).append("\n"); + sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" groupId: ").append(toIndentedString(groupId)).append("\n"); + sb.append(" keys: ").append(toIndentedString(keys)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/ApplicationInfo.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/ApplicationInfo.java new file mode 100644 index 0000000000..f1307b9338 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/ApplicationInfo.java @@ -0,0 +1,237 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * ApplicationInfo + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class ApplicationInfo { + @JsonProperty("applicationId") + private String applicationId = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("subscriber") + private String subscriber = null; + + @JsonProperty("throttlingTier") + private String throttlingTier = null; + + @JsonProperty("description") + private String description = null; + + @JsonProperty("status") + private String status = null; + + @JsonProperty("groupId") + private String groupId = null; + + public ApplicationInfo applicationId(String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Get applicationId + * @return applicationId + **/ + @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", value = "") + public String getApplicationId() { + return applicationId; + } + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + public ApplicationInfo name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "CalculatorApp", value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ApplicationInfo subscriber(String subscriber) { + this.subscriber = subscriber; + return this; + } + + /** + * Get subscriber + * @return subscriber + **/ + @ApiModelProperty(example = "admin", value = "") + public String getSubscriber() { + return subscriber; + } + + public void setSubscriber(String subscriber) { + this.subscriber = subscriber; + } + + public ApplicationInfo throttlingTier(String throttlingTier) { + this.throttlingTier = throttlingTier; + return this; + } + + /** + * Get throttlingTier + * @return throttlingTier + **/ + @ApiModelProperty(example = "Unlimited", value = "") + public String getThrottlingTier() { + return throttlingTier; + } + + public void setThrottlingTier(String throttlingTier) { + this.throttlingTier = throttlingTier; + } + + public ApplicationInfo description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @ApiModelProperty(example = "Sample calculator application", value = "") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public ApplicationInfo status(String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(example = "APPROVED", value = "") + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public ApplicationInfo groupId(String groupId) { + this.groupId = groupId; + return this; + } + + /** + * Get groupId + * @return groupId + **/ + @ApiModelProperty(example = "", value = "") + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationInfo applicationInfo = (ApplicationInfo) o; + return Objects.equals(this.applicationId, applicationInfo.applicationId) && + Objects.equals(this.name, applicationInfo.name) && + Objects.equals(this.subscriber, applicationInfo.subscriber) && + Objects.equals(this.throttlingTier, applicationInfo.throttlingTier) && + Objects.equals(this.description, applicationInfo.description) && + Objects.equals(this.status, applicationInfo.status) && + Objects.equals(this.groupId, applicationInfo.groupId); + } + + @Override + public int hashCode() { + return Objects.hash(applicationId, name, subscriber, throttlingTier, description, status, groupId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationInfo {\n"); + + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" subscriber: ").append(toIndentedString(subscriber)).append("\n"); + sb.append(" throttlingTier: ").append(toIndentedString(throttlingTier)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" groupId: ").append(toIndentedString(groupId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/ApplicationKey.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/ApplicationKey.java new file mode 100644 index 0000000000..a49d1522a6 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/ApplicationKey.java @@ -0,0 +1,252 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * ApplicationKey + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class ApplicationKey { + @JsonProperty("consumerKey") + private String consumerKey = null; + + @JsonProperty("consumerSecret") + private String consumerSecret = null; + + @JsonProperty("supportedGrantTypes") + private List supportedGrantTypes = new ArrayList(); + + @JsonProperty("keyState") + private String keyState = null; + + /** + * Key type + */ + public enum KeyTypeEnum { + PRODUCTION("PRODUCTION"), + + SANDBOX("SANDBOX"); + + private String value; + + KeyTypeEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KeyTypeEnum fromValue(String text) { + for (KeyTypeEnum b : KeyTypeEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("keyType") + private KeyTypeEnum keyType = null; + + @JsonProperty("token") + private Token token = null; + + public ApplicationKey consumerKey(String consumerKey) { + this.consumerKey = consumerKey; + return this; + } + + /** + * Consumer key of the application + * @return consumerKey + **/ + @ApiModelProperty(example = "vYDoc9s7IgAFdkSyNDaswBX7ejoa", value = "Consumer key of the application") + public String getConsumerKey() { + return consumerKey; + } + + public void setConsumerKey(String consumerKey) { + this.consumerKey = consumerKey; + } + + public ApplicationKey consumerSecret(String consumerSecret) { + this.consumerSecret = consumerSecret; + return this; + } + + /** + * Consumer secret of the application + * @return consumerSecret + **/ + @ApiModelProperty(example = "TIDlOFkpzB7WjufO3OJUhy1fsvAa", value = "Consumer secret of the application") + public String getConsumerSecret() { + return consumerSecret; + } + + public void setConsumerSecret(String consumerSecret) { + this.consumerSecret = consumerSecret; + } + + public ApplicationKey supportedGrantTypes(List supportedGrantTypes) { + this.supportedGrantTypes = supportedGrantTypes; + return this; + } + + public ApplicationKey addSupportedGrantTypesItem(String supportedGrantTypesItem) { + this.supportedGrantTypes.add(supportedGrantTypesItem); + return this; + } + + /** + * Supported grant types for the application + * @return supportedGrantTypes + **/ + @ApiModelProperty(example = "null", value = "Supported grant types for the application") + public List getSupportedGrantTypes() { + return supportedGrantTypes; + } + + public void setSupportedGrantTypes(List supportedGrantTypes) { + this.supportedGrantTypes = supportedGrantTypes; + } + + public ApplicationKey keyState(String keyState) { + this.keyState = keyState; + return this; + } + + /** + * State of the key generation of the application + * @return keyState + **/ + @ApiModelProperty(example = "APPROVED", value = "State of the key generation of the application") + public String getKeyState() { + return keyState; + } + + public void setKeyState(String keyState) { + this.keyState = keyState; + } + + public ApplicationKey keyType(KeyTypeEnum keyType) { + this.keyType = keyType; + return this; + } + + /** + * Key type + * @return keyType + **/ + @ApiModelProperty(example = "PRODUCTION", value = "Key type") + public KeyTypeEnum getKeyType() { + return keyType; + } + + public void setKeyType(KeyTypeEnum keyType) { + this.keyType = keyType; + } + + public ApplicationKey token(Token token) { + this.token = token; + return this; + } + + /** + * Get token + * @return token + **/ + @ApiModelProperty(example = "null", value = "") + public Token getToken() { + return token; + } + + public void setToken(Token token) { + this.token = token; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationKey applicationKey = (ApplicationKey) o; + return Objects.equals(this.consumerKey, applicationKey.consumerKey) && + Objects.equals(this.consumerSecret, applicationKey.consumerSecret) && + Objects.equals(this.supportedGrantTypes, applicationKey.supportedGrantTypes) && + Objects.equals(this.keyState, applicationKey.keyState) && + Objects.equals(this.keyType, applicationKey.keyType) && + Objects.equals(this.token, applicationKey.token); + } + + @Override + public int hashCode() { + return Objects.hash(consumerKey, consumerSecret, supportedGrantTypes, keyState, keyType, token); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationKey {\n"); + + sb.append(" consumerKey: ").append(toIndentedString(consumerKey)).append("\n"); + sb.append(" consumerSecret: ").append(toIndentedString(consumerSecret)).append("\n"); + sb.append(" supportedGrantTypes: ").append(toIndentedString(supportedGrantTypes)).append("\n"); + sb.append(" keyState: ").append(toIndentedString(keyState)).append("\n"); + sb.append(" keyType: ").append(toIndentedString(keyType)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/ApplicationKeyGenerateRequest.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/ApplicationKeyGenerateRequest.java new file mode 100644 index 0000000000..8b7cf21d9d --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/ApplicationKeyGenerateRequest.java @@ -0,0 +1,234 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * ApplicationKeyGenerateRequest + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class ApplicationKeyGenerateRequest { + /** + * Gets or Sets keyType + */ + public enum KeyTypeEnum { + PRODUCTION("PRODUCTION"), + + SANDBOX("SANDBOX"); + + private String value; + + KeyTypeEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KeyTypeEnum fromValue(String text) { + for (KeyTypeEnum b : KeyTypeEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("keyType") + private KeyTypeEnum keyType = null; + + @JsonProperty("validityTime") + private String validityTime = null; + + @JsonProperty("callbackUrl") + private String callbackUrl = null; + + @JsonProperty("accessAllowDomains") + private List accessAllowDomains = new ArrayList(); + + @JsonProperty("scopes") + private List scopes = new ArrayList(); + + public ApplicationKeyGenerateRequest keyType(KeyTypeEnum keyType) { + this.keyType = keyType; + return this; + } + + /** + * Get keyType + * @return keyType + **/ + @ApiModelProperty(example = "PRODUCTION", required = true, value = "") + public KeyTypeEnum getKeyType() { + return keyType; + } + + public void setKeyType(KeyTypeEnum keyType) { + this.keyType = keyType; + } + + public ApplicationKeyGenerateRequest validityTime(String validityTime) { + this.validityTime = validityTime; + return this; + } + + /** + * Get validityTime + * @return validityTime + **/ + @ApiModelProperty(example = "3600", required = true, value = "") + public String getValidityTime() { + return validityTime; + } + + public void setValidityTime(String validityTime) { + this.validityTime = validityTime; + } + + public ApplicationKeyGenerateRequest callbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + return this; + } + + /** + * Callback URL + * @return callbackUrl + **/ + @ApiModelProperty(example = "", value = "Callback URL") + public String getCallbackUrl() { + return callbackUrl; + } + + public void setCallbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + } + + public ApplicationKeyGenerateRequest accessAllowDomains(List accessAllowDomains) { + this.accessAllowDomains = accessAllowDomains; + return this; + } + + public ApplicationKeyGenerateRequest addAccessAllowDomainsItem(String accessAllowDomainsItem) { + this.accessAllowDomains.add(accessAllowDomainsItem); + return this; + } + + /** + * Allowed domains for the access token + * @return accessAllowDomains + **/ + @ApiModelProperty(example = "null", required = true, value = "Allowed domains for the access token") + public List getAccessAllowDomains() { + return accessAllowDomains; + } + + public void setAccessAllowDomains(List accessAllowDomains) { + this.accessAllowDomains = accessAllowDomains; + } + + public ApplicationKeyGenerateRequest scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public ApplicationKeyGenerateRequest addScopesItem(String scopesItem) { + this.scopes.add(scopesItem); + return this; + } + + /** + * Allowed scopes for the access token + * @return scopes + **/ + @ApiModelProperty(example = "null", value = "Allowed scopes for the access token") + public List getScopes() { + return scopes; + } + + public void setScopes(List scopes) { + this.scopes = scopes; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationKeyGenerateRequest applicationKeyGenerateRequest = (ApplicationKeyGenerateRequest) o; + return Objects.equals(this.keyType, applicationKeyGenerateRequest.keyType) && + Objects.equals(this.validityTime, applicationKeyGenerateRequest.validityTime) && + Objects.equals(this.callbackUrl, applicationKeyGenerateRequest.callbackUrl) && + Objects.equals(this.accessAllowDomains, applicationKeyGenerateRequest.accessAllowDomains) && + Objects.equals(this.scopes, applicationKeyGenerateRequest.scopes); + } + + @Override + public int hashCode() { + return Objects.hash(keyType, validityTime, callbackUrl, accessAllowDomains, scopes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationKeyGenerateRequest {\n"); + + sb.append(" keyType: ").append(toIndentedString(keyType)).append("\n"); + sb.append(" validityTime: ").append(toIndentedString(validityTime)).append("\n"); + sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); + sb.append(" accessAllowDomains: ").append(toIndentedString(accessAllowDomains)).append("\n"); + sb.append(" scopes: ").append(toIndentedString(scopes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/ApplicationList.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/ApplicationList.java new file mode 100644 index 0000000000..b89c62e6a7 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/ApplicationList.java @@ -0,0 +1,175 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * ApplicationList + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class ApplicationList { + @JsonProperty("count") + private Integer count = null; + + @JsonProperty("next") + private String next = null; + + @JsonProperty("previous") + private String previous = null; + + @JsonProperty("list") + private List list = new ArrayList(); + + public ApplicationList count(Integer count) { + this.count = count; + return this; + } + + /** + * Number of applications returned. + * @return count + **/ + @ApiModelProperty(example = "1", value = "Number of applications returned. ") + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public ApplicationList next(String next) { + this.next = next; + return this; + } + + /** + * Link to the next subset of resources qualified. Empty if no more resources are to be returned. + * @return next + **/ + @ApiModelProperty(example = "/applications?limit=1&offset=2&groupId=", value = "Link to the next subset of resources qualified. Empty if no more resources are to be returned. ") + public String getNext() { + return next; + } + + public void setNext(String next) { + this.next = next; + } + + public ApplicationList previous(String previous) { + this.previous = previous; + return this; + } + + /** + * Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. + * @return previous + **/ + @ApiModelProperty(example = "/applications?limit=1&offset=0&groupId=", value = "Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. ") + public String getPrevious() { + return previous; + } + + public void setPrevious(String previous) { + this.previous = previous; + } + + public ApplicationList list(List list) { + this.list = list; + return this; + } + + public ApplicationList addListItem(ApplicationInfo listItem) { + this.list.add(listItem); + return this; + } + + /** + * Get list + * @return list + **/ + @ApiModelProperty(example = "null", value = "") + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationList applicationList = (ApplicationList) o; + return Objects.equals(this.count, applicationList.count) && + Objects.equals(this.next, applicationList.next) && + Objects.equals(this.previous, applicationList.previous) && + Objects.equals(this.list, applicationList.list); + } + + @Override + public int hashCode() { + return Objects.hash(count, next, previous, list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationList {\n"); + + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" next: ").append(toIndentedString(next)).append("\n"); + sb.append(" previous: ").append(toIndentedString(previous)).append("\n"); + sb.append(" list: ").append(toIndentedString(list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Document.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Document.java new file mode 100644 index 0000000000..39d6760933 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Document.java @@ -0,0 +1,310 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * Document + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class Document { + @JsonProperty("documentId") + private String documentId = null; + + @JsonProperty("name") + private String name = null; + + /** + * Gets or Sets type + */ + public enum TypeEnum { + HOWTO("HOWTO"), + + SAMPLES("SAMPLES"), + + PUBLIC_FORUM("PUBLIC_FORUM"), + + SUPPORT_FORUM("SUPPORT_FORUM"), + + API_MESSAGE_FORMAT("API_MESSAGE_FORMAT"), + + SWAGGER_DOC("SWAGGER_DOC"), + + OTHER("OTHER"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String text) { + for (TypeEnum b : TypeEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("type") + private TypeEnum type = null; + + @JsonProperty("summary") + private String summary = null; + + /** + * Gets or Sets sourceType + */ + public enum SourceTypeEnum { + INLINE("INLINE"), + + URL("URL"), + + FILE("FILE"); + + private String value; + + SourceTypeEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SourceTypeEnum fromValue(String text) { + for (SourceTypeEnum b : SourceTypeEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("sourceType") + private SourceTypeEnum sourceType = null; + + @JsonProperty("sourceUrl") + private String sourceUrl = null; + + @JsonProperty("otherTypeName") + private String otherTypeName = null; + + public Document documentId(String documentId) { + this.documentId = documentId; + return this; + } + + /** + * Get documentId + * @return documentId + **/ + @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", value = "") + public String getDocumentId() { + return documentId; + } + + public void setDocumentId(String documentId) { + this.documentId = documentId; + } + + public Document name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "CalculatorDoc", required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Document type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @ApiModelProperty(example = "HOWTO", required = true, value = "") + public TypeEnum getType() { + return type; + } + + public void setType(TypeEnum type) { + this.type = type; + } + + public Document summary(String summary) { + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @ApiModelProperty(example = "Summary of Calculator Documentation", value = "") + public String getSummary() { + return summary; + } + + public void setSummary(String summary) { + this.summary = summary; + } + + public Document sourceType(SourceTypeEnum sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Get sourceType + * @return sourceType + **/ + @ApiModelProperty(example = "INLINE", required = true, value = "") + public SourceTypeEnum getSourceType() { + return sourceType; + } + + public void setSourceType(SourceTypeEnum sourceType) { + this.sourceType = sourceType; + } + + public Document sourceUrl(String sourceUrl) { + this.sourceUrl = sourceUrl; + return this; + } + + /** + * Get sourceUrl + * @return sourceUrl + **/ + @ApiModelProperty(example = "", value = "") + public String getSourceUrl() { + return sourceUrl; + } + + public void setSourceUrl(String sourceUrl) { + this.sourceUrl = sourceUrl; + } + + public Document otherTypeName(String otherTypeName) { + this.otherTypeName = otherTypeName; + return this; + } + + /** + * Get otherTypeName + * @return otherTypeName + **/ + @ApiModelProperty(example = "", value = "") + public String getOtherTypeName() { + return otherTypeName; + } + + public void setOtherTypeName(String otherTypeName) { + this.otherTypeName = otherTypeName; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Document document = (Document) o; + return Objects.equals(this.documentId, document.documentId) && + Objects.equals(this.name, document.name) && + Objects.equals(this.type, document.type) && + Objects.equals(this.summary, document.summary) && + Objects.equals(this.sourceType, document.sourceType) && + Objects.equals(this.sourceUrl, document.sourceUrl) && + Objects.equals(this.otherTypeName, document.otherTypeName); + } + + @Override + public int hashCode() { + return Objects.hash(documentId, name, type, summary, sourceType, sourceUrl, otherTypeName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Document {\n"); + + sb.append(" documentId: ").append(toIndentedString(documentId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).append("\n"); + sb.append(" sourceUrl: ").append(toIndentedString(sourceUrl)).append("\n"); + sb.append(" otherTypeName: ").append(toIndentedString(otherTypeName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/DocumentList.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/DocumentList.java new file mode 100644 index 0000000000..f3cb981965 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/DocumentList.java @@ -0,0 +1,175 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * DocumentList + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class DocumentList { + @JsonProperty("count") + private Integer count = null; + + @JsonProperty("next") + private String next = null; + + @JsonProperty("previous") + private String previous = null; + + @JsonProperty("list") + private List list = new ArrayList(); + + public DocumentList count(Integer count) { + this.count = count; + return this; + } + + /** + * Number of Documents returned. + * @return count + **/ + @ApiModelProperty(example = "1", value = "Number of Documents returned. ") + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public DocumentList next(String next) { + this.next = next; + return this; + } + + /** + * Link to the next subset of resources qualified. Empty if no more resources are to be returned. + * @return next + **/ + @ApiModelProperty(example = "/apis/01234567-0123-0123-0123-012345678901/documents?limit=1&offset=2", value = "Link to the next subset of resources qualified. Empty if no more resources are to be returned. ") + public String getNext() { + return next; + } + + public void setNext(String next) { + this.next = next; + } + + public DocumentList previous(String previous) { + this.previous = previous; + return this; + } + + /** + * Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. + * @return previous + **/ + @ApiModelProperty(example = "/apis/01234567-0123-0123-0123-012345678901/documents?limit=1&offset=0", value = "Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. ") + public String getPrevious() { + return previous; + } + + public void setPrevious(String previous) { + this.previous = previous; + } + + public DocumentList list(List list) { + this.list = list; + return this; + } + + public DocumentList addListItem(Document listItem) { + this.list.add(listItem); + return this; + } + + /** + * Get list + * @return list + **/ + @ApiModelProperty(example = "null", value = "") + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DocumentList documentList = (DocumentList) o; + return Objects.equals(this.count, documentList.count) && + Objects.equals(this.next, documentList.next) && + Objects.equals(this.previous, documentList.previous) && + Objects.equals(this.list, documentList.list); + } + + @Override + public int hashCode() { + return Objects.hash(count, next, previous, list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DocumentList {\n"); + + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" next: ").append(toIndentedString(next)).append("\n"); + sb.append(" previous: ").append(toIndentedString(previous)).append("\n"); + sb.append(" list: ").append(toIndentedString(list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Error.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Error.java new file mode 100644 index 0000000000..6b234db0a8 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Error.java @@ -0,0 +1,198 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * Error + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class Error { + @JsonProperty("code") + private Long code = null; + + @JsonProperty("message") + private String message = null; + + @JsonProperty("description") + private String description = null; + + @JsonProperty("moreInfo") + private String moreInfo = null; + + @JsonProperty("error") + private List error = new ArrayList(); + + public Error code(Long code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @ApiModelProperty(example = "null", required = true, value = "") + public Long getCode() { + return code; + } + + public void setCode(Long code) { + this.code = code; + } + + public Error message(String message) { + this.message = message; + return this; + } + + /** + * Error message. + * @return message + **/ + @ApiModelProperty(example = "null", required = true, value = "Error message.") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Error description(String description) { + this.description = description; + return this; + } + + /** + * A detail description about the error message. + * @return description + **/ + @ApiModelProperty(example = "null", value = "A detail description about the error message. ") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Error moreInfo(String moreInfo) { + this.moreInfo = moreInfo; + return this; + } + + /** + * Preferably an url with more details about the error. + * @return moreInfo + **/ + @ApiModelProperty(example = "null", value = "Preferably an url with more details about the error. ") + public String getMoreInfo() { + return moreInfo; + } + + public void setMoreInfo(String moreInfo) { + this.moreInfo = moreInfo; + } + + public Error error(List error) { + this.error = error; + return this; + } + + public Error addErrorItem(ErrorListItem errorItem) { + this.error.add(errorItem); + return this; + } + + /** + * If there are more than one error list them out. For example, list out validation errors by each field. + * @return error + **/ + @ApiModelProperty(example = "null", value = "If there are more than one error list them out. For example, list out validation errors by each field. ") + public List getError() { + return error; + } + + public void setError(List error) { + this.error = error; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error error = (Error) o; + return Objects.equals(this.code, error.code) && + Objects.equals(this.message, error.message) && + Objects.equals(this.description, error.description) && + Objects.equals(this.moreInfo, error.moreInfo) && + Objects.equals(this.error, error.error); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, description, moreInfo, error); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" moreInfo: ").append(toIndentedString(moreInfo)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/ErrorListItem.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/ErrorListItem.java new file mode 100644 index 0000000000..7bbe4a336f --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/ErrorListItem.java @@ -0,0 +1,122 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * ErrorListItem + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class ErrorListItem { + @JsonProperty("code") + private String code = null; + + @JsonProperty("message") + private String message = null; + + public ErrorListItem code(String code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @ApiModelProperty(example = "null", required = true, value = "") + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public ErrorListItem message(String message) { + this.message = message; + return this; + } + + /** + * Description about individual errors occurred + * @return message + **/ + @ApiModelProperty(example = "null", required = true, value = "Description about individual errors occurred ") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorListItem errorListItem = (ErrorListItem) o; + return Objects.equals(this.code, errorListItem.code) && + Objects.equals(this.message, errorListItem.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorListItem {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Subscription.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Subscription.java new file mode 100644 index 0000000000..d2275ce76c --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Subscription.java @@ -0,0 +1,228 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * Subscription + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class Subscription { + @JsonProperty("subscriptionId") + private String subscriptionId = null; + + @JsonProperty("applicationId") + private String applicationId = null; + + @JsonProperty("apiIdentifier") + private String apiIdentifier = null; + + @JsonProperty("tier") + private String tier = null; + + /** + * Gets or Sets status + */ + public enum StatusEnum { + BLOCKED("BLOCKED"), + + PROD_ONLY_BLOCKED("PROD_ONLY_BLOCKED"), + + UNBLOCKED("UNBLOCKED"), + + ON_HOLD("ON_HOLD"), + + REJECTED("REJECTED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("status") + private StatusEnum status = null; + + public Subscription subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get subscriptionId + * @return subscriptionId + **/ + @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", value = "") + public String getSubscriptionId() { + return subscriptionId; + } + + public void setSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + } + + public Subscription applicationId(String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Get applicationId + * @return applicationId + **/ + @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", required = true, value = "") + public String getApplicationId() { + return applicationId; + } + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + public Subscription apiIdentifier(String apiIdentifier) { + this.apiIdentifier = apiIdentifier; + return this; + } + + /** + * Get apiIdentifier + * @return apiIdentifier + **/ + @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", required = true, value = "") + public String getApiIdentifier() { + return apiIdentifier; + } + + public void setApiIdentifier(String apiIdentifier) { + this.apiIdentifier = apiIdentifier; + } + + public Subscription tier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get tier + * @return tier + **/ + @ApiModelProperty(example = "Unlimited", required = true, value = "") + public String getTier() { + return tier; + } + + public void setTier(String tier) { + this.tier = tier; + } + + public Subscription status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(example = "UNBLOCKED", value = "") + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Subscription subscription = (Subscription) o; + return Objects.equals(this.subscriptionId, subscription.subscriptionId) && + Objects.equals(this.applicationId, subscription.applicationId) && + Objects.equals(this.apiIdentifier, subscription.apiIdentifier) && + Objects.equals(this.tier, subscription.tier) && + Objects.equals(this.status, subscription.status); + } + + @Override + public int hashCode() { + return Objects.hash(subscriptionId, applicationId, apiIdentifier, tier, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Subscription {\n"); + + sb.append(" subscriptionId: ").append(toIndentedString(subscriptionId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" apiIdentifier: ").append(toIndentedString(apiIdentifier)).append("\n"); + sb.append(" tier: ").append(toIndentedString(tier)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/SubscriptionList.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/SubscriptionList.java new file mode 100644 index 0000000000..b6688838ec --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/SubscriptionList.java @@ -0,0 +1,175 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * SubscriptionList + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class SubscriptionList { + @JsonProperty("count") + private Integer count = null; + + @JsonProperty("next") + private String next = null; + + @JsonProperty("previous") + private String previous = null; + + @JsonProperty("list") + private List list = new ArrayList(); + + public SubscriptionList count(Integer count) { + this.count = count; + return this; + } + + /** + * Number of Subscriptions returned. + * @return count + **/ + @ApiModelProperty(example = "1", value = "Number of Subscriptions returned. ") + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public SubscriptionList next(String next) { + this.next = next; + return this; + } + + /** + * Link to the next subset of resources qualified. Empty if no more resources are to be returned. + * @return next + **/ + @ApiModelProperty(example = "/subscriptions?limit=1&offset=2&apiId=01234567-0123-0123-0123-012345678901&groupId=", value = "Link to the next subset of resources qualified. Empty if no more resources are to be returned. ") + public String getNext() { + return next; + } + + public void setNext(String next) { + this.next = next; + } + + public SubscriptionList previous(String previous) { + this.previous = previous; + return this; + } + + /** + * Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. + * @return previous + **/ + @ApiModelProperty(example = "/subscriptions?limit=1&offset=0&apiId=01234567-0123-0123-0123-012345678901&groupId=", value = "Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. ") + public String getPrevious() { + return previous; + } + + public void setPrevious(String previous) { + this.previous = previous; + } + + public SubscriptionList list(List list) { + this.list = list; + return this; + } + + public SubscriptionList addListItem(Subscription listItem) { + this.list.add(listItem); + return this; + } + + /** + * Get list + * @return list + **/ + @ApiModelProperty(example = "null", value = "") + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SubscriptionList subscriptionList = (SubscriptionList) o; + return Objects.equals(this.count, subscriptionList.count) && + Objects.equals(this.next, subscriptionList.next) && + Objects.equals(this.previous, subscriptionList.previous) && + Objects.equals(this.list, subscriptionList.list); + } + + @Override + public int hashCode() { + return Objects.hash(count, next, previous, list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubscriptionList {\n"); + + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" next: ").append(toIndentedString(next)).append("\n"); + sb.append(" previous: ").append(toIndentedString(previous)).append("\n"); + sb.append(" list: ").append(toIndentedString(list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Tag.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Tag.java new file mode 100644 index 0000000000..7370df7c68 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Tag.java @@ -0,0 +1,122 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + + +/** + * Tag + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class Tag { + @JsonProperty("name") + private String name = null; + + @JsonProperty("weight") + private Integer weight = null; + + public Tag name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "tag1", required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Tag weight(Integer weight) { + this.weight = weight; + return this; + } + + /** + * Get weight + * @return weight + **/ + @ApiModelProperty(example = "5", required = true, value = "") + public Integer getWeight() { + return weight; + } + + public void setWeight(Integer weight) { + this.weight = weight; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.name, tag.name) && + Objects.equals(this.weight, tag.weight); + } + + @Override + public int hashCode() { + return Objects.hash(name, weight); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" weight: ").append(toIndentedString(weight)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/TagList.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/TagList.java new file mode 100644 index 0000000000..543a6c83f2 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/TagList.java @@ -0,0 +1,175 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * TagList + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class TagList { + @JsonProperty("count") + private Integer count = null; + + @JsonProperty("next") + private String next = null; + + @JsonProperty("previous") + private String previous = null; + + @JsonProperty("list") + private List list = new ArrayList(); + + public TagList count(Integer count) { + this.count = count; + return this; + } + + /** + * Number of Tags returned. + * @return count + **/ + @ApiModelProperty(example = "1", value = "Number of Tags returned. ") + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public TagList next(String next) { + this.next = next; + return this; + } + + /** + * Link to the next subset of resources qualified. Empty if no more resources are to be returned. + * @return next + **/ + @ApiModelProperty(example = "/tags?limit=1&offset=2", value = "Link to the next subset of resources qualified. Empty if no more resources are to be returned. ") + public String getNext() { + return next; + } + + public void setNext(String next) { + this.next = next; + } + + public TagList previous(String previous) { + this.previous = previous; + return this; + } + + /** + * Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. + * @return previous + **/ + @ApiModelProperty(example = "/tags?limit=1&offset=0", value = "Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. ") + public String getPrevious() { + return previous; + } + + public void setPrevious(String previous) { + this.previous = previous; + } + + public TagList list(List list) { + this.list = list; + return this; + } + + public TagList addListItem(Tag listItem) { + this.list.add(listItem); + return this; + } + + /** + * Get list + * @return list + **/ + @ApiModelProperty(example = "null", value = "") + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagList tagList = (TagList) o; + return Objects.equals(this.count, tagList.count) && + Objects.equals(this.next, tagList.next) && + Objects.equals(this.previous, tagList.previous) && + Objects.equals(this.list, tagList.list); + } + + @Override + public int hashCode() { + return Objects.hash(count, next, previous, list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagList {\n"); + + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" next: ").append(toIndentedString(next)).append("\n"); + sb.append(" previous: ").append(toIndentedString(previous)).append("\n"); + sb.append(" list: ").append(toIndentedString(list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Tier.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Tier.java new file mode 100644 index 0000000000..1f44116b02 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Tier.java @@ -0,0 +1,328 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + + +/** + * Tier + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class Tier { + @JsonProperty("name") + private String name = null; + + @JsonProperty("description") + private String description = null; + + /** + * Gets or Sets tierLevel + */ + public enum TierLevelEnum { + API("api"), + + APPLICATION("application"); + + private String value; + + TierLevelEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TierLevelEnum fromValue(String text) { + for (TierLevelEnum b : TierLevelEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("tierLevel") + private TierLevelEnum tierLevel = null; + + @JsonProperty("attributes") + private Map attributes = new HashMap(); + + @JsonProperty("requestCount") + private Long requestCount = null; + + @JsonProperty("unitTime") + private Long unitTime = null; + + /** + * This attribute declares whether this tier is available under commercial or free + */ + public enum TierPlanEnum { + FREE("FREE"), + + COMMERCIAL("COMMERCIAL"); + + private String value; + + TierPlanEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TierPlanEnum fromValue(String text) { + for (TierPlanEnum b : TierPlanEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("tierPlan") + private TierPlanEnum tierPlan = null; + + @JsonProperty("stopOnQuotaReach") + private Boolean stopOnQuotaReach = null; + + public Tier name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "Platinum", required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Tier description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @ApiModelProperty(example = "Allows 50 request(s) per minute.", value = "") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Tier tierLevel(TierLevelEnum tierLevel) { + this.tierLevel = tierLevel; + return this; + } + + /** + * Get tierLevel + * @return tierLevel + **/ + @ApiModelProperty(example = "api", value = "") + public TierLevelEnum getTierLevel() { + return tierLevel; + } + + public void setTierLevel(TierLevelEnum tierLevel) { + this.tierLevel = tierLevel; + } + + public Tier attributes(Map attributes) { + this.attributes = attributes; + return this; + } + + public Tier putAttributesItem(String key, String attributesItem) { + this.attributes.put(key, attributesItem); + return this; + } + + /** + * Custom attributes added to the tier policy + * @return attributes + **/ + @ApiModelProperty(example = "null", value = "Custom attributes added to the tier policy ") + public Map getAttributes() { + return attributes; + } + + public void setAttributes(Map attributes) { + this.attributes = attributes; + } + + public Tier requestCount(Long requestCount) { + this.requestCount = requestCount; + return this; + } + + /** + * Maximum number of requests which can be sent within a provided unit time + * @return requestCount + **/ + @ApiModelProperty(example = "50", required = true, value = "Maximum number of requests which can be sent within a provided unit time ") + public Long getRequestCount() { + return requestCount; + } + + public void setRequestCount(Long requestCount) { + this.requestCount = requestCount; + } + + public Tier unitTime(Long unitTime) { + this.unitTime = unitTime; + return this; + } + + /** + * Get unitTime + * @return unitTime + **/ + @ApiModelProperty(example = "60000", required = true, value = "") + public Long getUnitTime() { + return unitTime; + } + + public void setUnitTime(Long unitTime) { + this.unitTime = unitTime; + } + + public Tier tierPlan(TierPlanEnum tierPlan) { + this.tierPlan = tierPlan; + return this; + } + + /** + * This attribute declares whether this tier is available under commercial or free + * @return tierPlan + **/ + @ApiModelProperty(example = "FREE", required = true, value = "This attribute declares whether this tier is available under commercial or free ") + public TierPlanEnum getTierPlan() { + return tierPlan; + } + + public void setTierPlan(TierPlanEnum tierPlan) { + this.tierPlan = tierPlan; + } + + public Tier stopOnQuotaReach(Boolean stopOnQuotaReach) { + this.stopOnQuotaReach = stopOnQuotaReach; + return this; + } + + /** + * If this attribute is set to false, you are capabale of sending requests even if the request count exceeded within a unit time + * @return stopOnQuotaReach + **/ + @ApiModelProperty(example = "true", required = true, value = "If this attribute is set to false, you are capabale of sending requests even if the request count exceeded within a unit time ") + public Boolean getStopOnQuotaReach() { + return stopOnQuotaReach; + } + + public void setStopOnQuotaReach(Boolean stopOnQuotaReach) { + this.stopOnQuotaReach = stopOnQuotaReach; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tier tier = (Tier) o; + return Objects.equals(this.name, tier.name) && + Objects.equals(this.description, tier.description) && + Objects.equals(this.tierLevel, tier.tierLevel) && + Objects.equals(this.attributes, tier.attributes) && + Objects.equals(this.requestCount, tier.requestCount) && + Objects.equals(this.unitTime, tier.unitTime) && + Objects.equals(this.tierPlan, tier.tierPlan) && + Objects.equals(this.stopOnQuotaReach, tier.stopOnQuotaReach); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, tierLevel, attributes, requestCount, unitTime, tierPlan, stopOnQuotaReach); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tier {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" tierLevel: ").append(toIndentedString(tierLevel)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" requestCount: ").append(toIndentedString(requestCount)).append("\n"); + sb.append(" unitTime: ").append(toIndentedString(unitTime)).append("\n"); + sb.append(" tierPlan: ").append(toIndentedString(tierPlan)).append("\n"); + sb.append(" stopOnQuotaReach: ").append(toIndentedString(stopOnQuotaReach)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/TierList.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/TierList.java new file mode 100644 index 0000000000..82bdb76a0c --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/TierList.java @@ -0,0 +1,175 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * TierList + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class TierList { + @JsonProperty("count") + private Integer count = null; + + @JsonProperty("next") + private String next = null; + + @JsonProperty("previous") + private String previous = null; + + @JsonProperty("list") + private List list = new ArrayList(); + + public TierList count(Integer count) { + this.count = count; + return this; + } + + /** + * Number of Tiers returned. + * @return count + **/ + @ApiModelProperty(example = "1", value = "Number of Tiers returned. ") + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public TierList next(String next) { + this.next = next; + return this; + } + + /** + * Link to the next subset of resources qualified. Empty if no more resources are to be returned. + * @return next + **/ + @ApiModelProperty(example = "/tiers/api?limit=1&offset=2", value = "Link to the next subset of resources qualified. Empty if no more resources are to be returned. ") + public String getNext() { + return next; + } + + public void setNext(String next) { + this.next = next; + } + + public TierList previous(String previous) { + this.previous = previous; + return this; + } + + /** + * Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. + * @return previous + **/ + @ApiModelProperty(example = "/tiers/api?limit=1&offset=0", value = "Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. ") + public String getPrevious() { + return previous; + } + + public void setPrevious(String previous) { + this.previous = previous; + } + + public TierList list(List list) { + this.list = list; + return this; + } + + public TierList addListItem(Tier listItem) { + this.list.add(listItem); + return this; + } + + /** + * Get list + * @return list + **/ + @ApiModelProperty(example = "null", value = "") + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TierList tierList = (TierList) o; + return Objects.equals(this.count, tierList.count) && + Objects.equals(this.next, tierList.next) && + Objects.equals(this.previous, tierList.previous) && + Objects.equals(this.list, tierList.list); + } + + @Override + public int hashCode() { + return Objects.hash(count, next, previous, list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TierList {\n"); + + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" next: ").append(toIndentedString(next)).append("\n"); + sb.append(" previous: ").append(toIndentedString(previous)).append("\n"); + sb.append(" list: ").append(toIndentedString(list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Token.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Token.java new file mode 100644 index 0000000000..f90d15d7c3 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/model/Token.java @@ -0,0 +1,152 @@ +/** + * WSO2 API Manager - Store + * This document specifies a **RESTful API** for WSO2 **API Manager** - Store. It is written with [swagger 2](http://swagger.io/). + * + * OpenAPI spec version: 0.10.0 + * Contact: architecture@wso2.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * 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 org.wso2.carbon.apimgt.integration.client.store.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * Token + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") +public class Token { + @JsonProperty("accessToken") + private String accessToken = null; + + @JsonProperty("tokenScopes") + private List tokenScopes = new ArrayList(); + + @JsonProperty("validityTime") + private Long validityTime = null; + + public Token accessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Access token + * @return accessToken + **/ + @ApiModelProperty(example = "1.2345678901234568E30", value = "Access token") + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + public Token tokenScopes(List tokenScopes) { + this.tokenScopes = tokenScopes; + return this; + } + + public Token addTokenScopesItem(String tokenScopesItem) { + this.tokenScopes.add(tokenScopesItem); + return this; + } + + /** + * Valid scopes for the access token + * @return tokenScopes + **/ + @ApiModelProperty(example = "null", value = "Valid scopes for the access token") + public List getTokenScopes() { + return tokenScopes; + } + + public void setTokenScopes(List tokenScopes) { + this.tokenScopes = tokenScopes; + } + + public Token validityTime(Long validityTime) { + this.validityTime = validityTime; + return this; + } + + /** + * Maximum validity time for the access token + * @return validityTime + **/ + @ApiModelProperty(example = "3600", value = "Maximum validity time for the access token") + public Long getValidityTime() { + return validityTime; + } + + public void setValidityTime(Long validityTime) { + this.validityTime = validityTime; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Token token = (Token) o; + return Objects.equals(this.accessToken, token.accessToken) && + Objects.equals(this.tokenScopes, token.tokenScopes) && + Objects.equals(this.validityTime, token.validityTime); + } + + @Override + public int hashCode() { + return Objects.hash(accessToken, tokenScopes, validityTime); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Token {\n"); + + sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); + sb.append(" tokenScopes: ").append(toIndentedString(tokenScopes)).append("\n"); + sb.append(" validityTime: ").append(toIndentedString(validityTime)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/util/PropertyUtils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/util/PropertyUtils.java new file mode 100644 index 0000000000..83d162fdb4 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/util/PropertyUtils.java @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.integration.client.util; + + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class PropertyUtils { + + //This method is only used if the mb features are within DAS. + public static String replaceProperties(String text) { + String regex = "\\$\\{(.*?)\\}"; + Pattern pattern = Pattern.compile(regex); + Matcher matchPattern = pattern.matcher(text); + while (matchPattern.find()) { + String sysPropertyName = matchPattern.group(1); + String sysPropertyValue = System.getProperty(sysPropertyName); + if (sysPropertyValue != null && !sysPropertyName.isEmpty()) { + text = text.replaceAll("\\$\\{(" + sysPropertyName + ")\\}", sysPropertyValue); + } + } + return text; + } +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml index fbb852538c..3c9db88b63 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml @@ -47,14 +47,6 @@ org.testng testng - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.api - - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.impl - org.wso2.tomcat tomcat @@ -111,6 +103,10 @@ org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.common + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.integration.client + @@ -147,22 +143,30 @@ com.google.gson.*, org.apache.catalina, org.apache.catalina.core, - org.wso2.carbon.apimgt.api, - org.wso2.carbon.apimgt.api.model, - org.wso2.carbon.apimgt.impl, org.apache.axis2.*;version="${axis2.osgi.version.range}", org.wso2.carbon.core, org.apache.commons.lang, org.wso2.carbon.utils, org.wso2.carbon.apimgt.annotations.*, org.wso2.carbon.governance.lcm.util.*, - org.wso2.carbon.registry.core.* + org.wso2.carbon.registry.core.*, + io.swagger.annotations, + javax.net.ssl, + org.scannotation, + org.scannotation.archiveiterator, + org.w3c.dom, + org.wso2.carbon.apimgt.integration.client.*, + org.wso2.carbon.context, + org.wso2.carbon.core.util, + org.wso2.carbon.user.api, + org.wso2.carbon.user.core.*, + org.wso2.carbon.utils.multitenancy javax.ws.rs-api, scribe;scope=compile|runtime;inline=false; - * + * diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIConfig.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIConfig.java index 02200f1c76..ca020bd83a 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIConfig.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIConfig.java @@ -18,17 +18,11 @@ */ package org.wso2.carbon.apimgt.webapp.publisher; -import org.wso2.carbon.apimgt.api.APIManagementException; -import org.wso2.carbon.apimgt.api.APIProvider; -import org.wso2.carbon.apimgt.api.model.URITemplate; -import org.wso2.carbon.apimgt.impl.APIConstants; -import org.wso2.carbon.apimgt.impl.APIManagerFactory; -import org.wso2.carbon.utils.multitenancy.MultitenantUtils; +import org.wso2.carbon.apimgt.webapp.publisher.dto.ApiScope; +import org.wso2.carbon.apimgt.webapp.publisher.dto.ApiUriTemplate; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlTransient; -import java.util.List; import java.util.Set; /** @@ -53,26 +47,16 @@ public class APIConfig { private String name; private String owner; private String context; - private String contextTemplate; private String endpoint; private String version; private String policy; private String transports; - private APIProvider provider; private boolean isSecured; - private Set uriTemplates; - private List tenants; + private Set uriTemplates; private boolean isSharedWithAllTenants; private String tenantDomain; private String[] tags; - - public void init() throws APIManagementException { - try { - this.provider = APIManagerFactory.getInstance().getAPIProvider(owner); - } catch (APIManagementException e) { - throw new APIManagementException("Error occurred while initializing API provider", e); - } - } + private Set scopes; @XmlElement(name = "Policy", required = true) public String getPolicy() { @@ -84,20 +68,6 @@ public class APIConfig { this.policy = policy; } - @XmlElement(name = "ContextTemplate", required = true) - public String getContextTemplate() { - return contextTemplate; - } - - public void setContextTemplate(String contextTemplate) { - this.contextTemplate = contextTemplate; - } - - @XmlTransient - public APIProvider getProvider() { - return provider; - } - @XmlElement(name = "Name", required = true) public String getName() { return name; @@ -168,12 +138,12 @@ public class APIConfig { } @XmlElement(name = "UriTemplates", required = false) - public Set getUriTemplates() { + public Set getUriTemplates() { return uriTemplates; } @SuppressWarnings("unused") - public void setUriTemplates(Set uriTemplates) { + public void setUriTemplates(Set uriTemplates) { this.uriTemplates = uriTemplates; } @@ -206,4 +176,12 @@ public class APIConfig { public void setTags(String[] tags) { this.tags = tags; } + + public Set getScopes() { + return scopes; + } + + public void setScopes(Set scopes) { + this.scopes = scopes; + } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherService.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherService.java index c41a684968..81a3a60859 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherService.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherService.java @@ -18,18 +18,12 @@ */ package org.wso2.carbon.apimgt.webapp.publisher; -import org.wso2.carbon.apimgt.api.APIManagementException; -import org.wso2.carbon.apimgt.api.FaultGatewaysException; -import org.wso2.carbon.apimgt.api.model.API; -import org.wso2.carbon.apimgt.api.model.APIIdentifier; -import java.util.List; + +import org.wso2.carbon.apimgt.webapp.publisher.exception.APIManagerPublisherException; /** * This interface represents all methods related to API manipulation that's done as part of API-Management tasks. * - * Note: Ideally, this has to come from the API-Management components. However, due to lack of clean APIs - * (as OSGi declarative services, etc) provided for API publishing and related tasks, this was introduced at the device - * management core implementation layer. */ public interface APIPublisherService { @@ -37,23 +31,8 @@ public interface APIPublisherService { * This method registers an API within the underlying API-Management infrastructure. * * @param api An instance of the bean that passes metadata related to the API being published - * @throws APIManagementException Is thrown if some unexpected event occurs while publishing the API + * @throws APIManagerPublisherException Is thrown if some unexpected event occurs while publishing the API */ - void publishAPI(API api) throws APIManagementException, FaultGatewaysException; + void publishAPI(APIConfig api) throws APIManagerPublisherException; - /** - * This method removes an API that's already published within the underlying API-Management infrastructure. - * - * @param id An instance of the bean that carries API identification related metadata - * @throws APIManagementException Is thrown if some unexpected event occurs while removing the API - */ - void removeAPI(APIIdentifier id) throws APIManagementException; - - /** - * This method registers a collection of APIs within the underlying API-Management infrastructure. - * - * @param apis A list of the beans that passes metadata related to the APIs being published - * @throws APIManagementException Is thrown if some unexpected event occurs while publishing the APIs - */ - void publishAPIs(List apis) throws APIManagementException, FaultGatewaysException; } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java index 14a922b355..9e21d731f0 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -18,28 +18,15 @@ */ package org.wso2.carbon.apimgt.webapp.publisher; -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.reflect.TypeToken; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.apimgt.api.APIManagementException; -import org.wso2.carbon.apimgt.api.APIProvider; -import org.wso2.carbon.apimgt.api.FaultGatewaysException; -import org.wso2.carbon.apimgt.api.model.*; -import org.wso2.carbon.apimgt.impl.APIManagerFactory; +import feign.FeignException; +import org.wso2.carbon.apimgt.integration.client.publisher.PublisherClient; +import org.wso2.carbon.apimgt.integration.client.publisher.model.*; import org.wso2.carbon.apimgt.webapp.publisher.config.WebappPublisherConfig; +import org.wso2.carbon.apimgt.webapp.publisher.exception.APIManagerPublisherException; import org.wso2.carbon.apimgt.webapp.publisher.internal.APIPublisherDataHolder; +import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.governance.lcm.util.CommonUtil; -import org.wso2.carbon.registry.core.exceptions.RegistryException; -import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; - -import javax.xml.stream.XMLStreamException; -import java.io.FileNotFoundException; import java.util.*; /** @@ -47,176 +34,122 @@ import java.util.*; * API publishing related operations. */ public class APIPublisherServiceImpl implements APIPublisherService { - - private static final Log log = LogFactory.getLog(APIPublisherServiceImpl.class); + private static final String UNLIMITED_TIER = "Unlimited"; + private static final String API_PUBLISH_ENVIRONMENT = "Production and Sandbox"; + private static final String CONTENT_TYPE = "application/json"; + private static final String PUBLISHED_STATUS = "PUBLISHED"; + private static final String CREATED_STATUS = "CREATED"; private static final String PUBLISH_ACTION = "Publish"; @Override - public void publishAPI(final API api) throws APIManagementException, FaultGatewaysException { - String tenantDomain = MultitenantUtils.getTenantDomain(api.getApiOwner()); + public void publishAPI(APIConfig apiConfig) throws APIManagerPublisherException { + String tenantDomain = MultitenantUtils.getTenantDomain(apiConfig.getOwner()); PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(apiConfig.getOwner()); try { - int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); - // Below code snippet is added to load API Lifecycle in tenant mode. - RegistryService registryService = APIPublisherDataHolder.getInstance().getRegistryService(); - CommonUtil.addDefaultLifecyclesIfNotAvailable(registryService.getConfigSystemRegistry(tenantId), - CommonUtil.getRootSystemRegistry(tenantId)); - APIProvider provider = APIManagerFactory.getInstance().getAPIProvider(api.getApiOwner()); - MultitenantUtils.getTenantDomain(api.getApiOwner()); - processHttpVerbs(api); - if (provider != null) { - if (provider.isDuplicateContextTemplate(api.getContext())) { - throw new APIManagementException( - "Error occurred while adding the API. A duplicate API" + - " context already exists for " + api.getContext()); + PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService() + .getPublisherClient(); + API api = getAPI(apiConfig); + APIList apiList = publisherClient.getApi().apisGet(100, 0, "name:" + api.getName(), CONTENT_TYPE, null); + + if (!isExist(api, apiList)) { + api = publisherClient.getApi().apisPost(api, CONTENT_TYPE); + if (CREATED_STATUS.equals(api.getStatus())) { + publisherClient.getApi().apisChangeLifecyclePost(PUBLISH_ACTION, api.getId(), null, null, null); } - if (!provider.isAPIAvailable(api.getId())) { - provider.addAPI(api); - provider.changeLifeCycleStatus(api.getId(), PUBLISH_ACTION); - if (log.isDebugEnabled()) { - log.debug("Successfully published API '" + api.getId().getApiName() + - "' with context '" + api.getContext() + "' and version '" - + api.getId().getVersion() + "'"); - } - } else { - if (WebappPublisherConfig.getInstance().isEnabledUpdateApi()) { - if (provider.getAPI(api.getId()).getStatus() == APIStatus.CREATED) { - provider.changeLifeCycleStatus(api.getId(), PUBLISH_ACTION); - } - api.setStatus(APIStatus.PUBLISHED); - provider.updateAPI(api); - if (log.isDebugEnabled()) { - log.debug("An API already exists with the name '" + api.getId().getApiName() + - "', context '" + api.getContext() + "' and version '" - + api.getId().getVersion() + "'. Thus, the API config is updated"); - } - } - } - provider.saveSwagger20Definition(api.getId(), createSwaggerDefinition(api)); } else { - throw new APIManagementException("API provider configured for the given API configuration " + - "is null. Thus, the API is not published"); + if (WebappPublisherConfig.getInstance().isEnabledUpdateApi()) { + for (APIInfo apiInfo : apiList.getList()) { + if (api.getName().equals(apiInfo.getName()) && api.getVersion().equals(apiInfo.getVersion())) { + api = publisherClient.getApi().apisApiIdPut(apiInfo.getId(), api, CONTENT_TYPE, null, null); + if (CREATED_STATUS.equals(api.getStatus())) { + publisherClient.getApi().apisChangeLifecyclePost(PUBLISH_ACTION, api.getId(), null, null, + null); + } + } + + } + } } - } catch (FileNotFoundException e) { - throw new APIManagementException("Failed to retrieve life cycle file ", e); - } catch (RegistryException e) { - throw new APIManagementException("Failed to access the registry ", e); - } catch (XMLStreamException e) { - throw new APIManagementException("Failed parsing the lifecycle xml.", e); + } catch (FeignException e) { + throw new APIManagerPublisherException(e); } finally { PrivilegedCarbonContext.endTenantFlow(); } } - private String createSwaggerDefinition(API api) { - Map httpVerbsMap = new HashMap<>(); - List scopes = new ArrayList<>(); - - for (URITemplate uriTemplate : api.getUriTemplates()) { - JsonObject response = new JsonObject(); - response.addProperty("200", ""); - - JsonObject responses = new JsonObject(); - responses.add("responses", response); - JsonObject httpVerbs = httpVerbsMap.get(uriTemplate.getUriTemplate()); - if (httpVerbs == null) { - httpVerbs = new JsonObject(); - } - JsonObject httpVerb = new JsonObject(); - httpVerb.add("responses", response); - - httpVerb.addProperty("x-auth-type", "Application%20%26%20Application%20User"); - httpVerb.addProperty("x-throttling-tier", "Unlimited"); - if (uriTemplate.getScope() != null) { - httpVerb.addProperty("x-scope", uriTemplate.getScope().getName()); - scopes.add(uriTemplate.getScope()); - } - httpVerbs.add(uriTemplate.getHTTPVerb().toLowerCase(), httpVerb); - httpVerbsMap.put(uriTemplate.getUriTemplate(), httpVerbs); + private boolean isExist(API api, APIList apiList) { + if (apiList == null || apiList.getList() == null || apiList.getList().size() == 0) { + return false; } - - Iterator it = httpVerbsMap.entrySet().iterator(); - JsonObject paths = new JsonObject(); - while (it.hasNext()) { - Map.Entry pair = (Map.Entry) it.next(); - paths.add(pair.getKey(), pair.getValue()); - it.remove(); - } - - JsonObject info = new JsonObject(); - info.addProperty("title", api.getId().getApiName()); - info.addProperty("version", api.getId().getVersion()); - - JsonObject swaggerDefinition = new JsonObject(); - swaggerDefinition.add("paths", paths); - swaggerDefinition.addProperty("swagger", "2.0"); - swaggerDefinition.add("info", info); - - // adding scopes to swagger definition - if (!api.getScopes().isEmpty()) { - Gson gson = new Gson(); - JsonElement element = gson.toJsonTree(api.getScopes(), new TypeToken>() { - }.getType()); - if (element != null) { - JsonArray apiScopes = element.getAsJsonArray(); - JsonObject apim = new JsonObject(); - apim.add("x-wso2-scopes", apiScopes); - JsonObject wso2Security = new JsonObject(); - wso2Security.add("apim", apim); - swaggerDefinition.add("x-wso2-security", wso2Security); + for (APIInfo existingApi : apiList.getList()) { + if (existingApi.getName().equals(api.getName()) && existingApi.getVersion().equals(api.getVersion())) { + return true; } } - if (log.isDebugEnabled()) { - log.debug("API swagger definition: " + swaggerDefinition.toString()); - } - return swaggerDefinition.toString(); + return false; } - /** - * Sometimes the httpVerb string attribute is not existing in - * the list of httpVerbs attribute of uriTemplate. In such cases when creating the api in the - * synapse configuration, it doesn't have http methods correctly assigned for the resources. - * Therefore this method takes care of such inconsistency issue. - * - * @param api The actual API model object - */ - private void processHttpVerbs(API api) { - for (URITemplate uriTemplate : api.getUriTemplates()) { - String httpVerbString = uriTemplate.getHTTPVerb(); - if (httpVerbString != null && !httpVerbString.isEmpty()) { - uriTemplate.setHttpVerbs(httpVerbString); - } - } - } + private API getAPI(APIConfig config) { - @Override - public void removeAPI(APIIdentifier id) throws APIManagementException { - if (log.isDebugEnabled()) { - log.debug("Removing API '" + id.getApiName() + "'"); - } - APIProvider provider = APIManagerFactory.getInstance().getAPIProvider(id.getProviderName()); - provider.deleteAPI(id); - if (log.isDebugEnabled()) { - log.debug("API '" + id.getApiName() + "' has been successfully removed"); - } - } + API api = new API(); + api.setName(config.getName()); + api.setDescription(""); - @Override - public void publishAPIs(List apis) throws APIManagementException, FaultGatewaysException { - if (log.isDebugEnabled()) { - log.debug("Publishing a batch of APIs"); + String context = config.getContext(); + context = context.startsWith("/") ? context : ("/" + context); + api.setContext(context); + api.setVersion(config.getVersion()); + api.setProvider(config.getOwner()); + api.setApiDefinition(APIPublisherUtil.getSwaggerDefinition(config)); + api.setWsdlUri(null); + api.setStatus(PUBLISHED_STATUS); + api.responseCaching("DISABLED"); + api.destinationStatsEnabled("false"); + api.isDefaultVersion(true); + List transport = new ArrayList<>(); + transport.add("https"); + transport.add("http"); + api.transport(transport); + api.setTags(Arrays.asList(config.getTags())); + api.addTiersItem(UNLIMITED_TIER); + api.setGatewayEnvironments(API_PUBLISH_ENVIRONMENT); + if (config.isSharedWithAllTenants()) { + api.setSubscriptionAvailability(API.SubscriptionAvailabilityEnum.all_tenants); + api.setVisibility(API.VisibilityEnum.PUBLIC); + } else { + api.setSubscriptionAvailability(API.SubscriptionAvailabilityEnum.current_tenant); + api.setVisibility(API.VisibilityEnum.PRIVATE); } - for (API api : apis) { - try { - this.publishAPI(api); - } catch (APIManagementException e) { - log.error("Error occurred while publishing API '" + api.getId().getApiName() + "'", e); - } - } - if (log.isDebugEnabled()) { - log.debug("End of publishing the batch of APIs"); - } - } + String endpointConfig = "{\"production_endpoints\":{\"url\":\"" + config.getEndpoint() + + "\",\"config\":null},\"implementation_status\":\"managed\",\"endpoint_type\":\"http\"}"; + + api.setEndpointConfig(endpointConfig); + APICorsConfiguration apiCorsConfiguration = new APICorsConfiguration(); + List accessControlAllowOrigins = new ArrayList<>(); + accessControlAllowOrigins.add("*"); + apiCorsConfiguration.setAccessControlAllowOrigins(accessControlAllowOrigins); + + List accessControlAllowHeaders = new ArrayList<>(); + accessControlAllowHeaders.add("authorization"); + accessControlAllowHeaders.add("Access-Control-Allow-Origin"); + accessControlAllowHeaders.add("Content-Type"); + accessControlAllowHeaders.add("SOAPAction"); + apiCorsConfiguration.setAccessControlAllowHeaders(accessControlAllowHeaders); + + List accessControlAllowMethods = new ArrayList<>(); + accessControlAllowMethods.add("GET"); + accessControlAllowMethods.add("PUT"); + accessControlAllowMethods.add("DELETE"); + accessControlAllowMethods.add("POST"); + accessControlAllowMethods.add("PATCH"); + accessControlAllowMethods.add("OPTIONS"); + apiCorsConfiguration.setAccessControlAllowMethods(accessControlAllowMethods); + apiCorsConfiguration.setAccessControlAllowCredentials(false); + apiCorsConfiguration.corsConfigurationEnabled(false); + api.setCorsConfiguration(apiCorsConfiguration); + return api; + } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherStartupHandler.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherStartupHandler.java index df9102e351..928b6d22be 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherStartupHandler.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherStartupHandler.java @@ -21,7 +21,7 @@ package org.wso2.carbon.apimgt.webapp.publisher; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.apimgt.api.model.API; +import org.wso2.carbon.apimgt.webapp.publisher.exception.APIManagerPublisherException; import org.wso2.carbon.apimgt.webapp.publisher.internal.APIPublisherDataHolder; import org.wso2.carbon.core.ServerStartupObserver; @@ -33,8 +33,8 @@ public class APIPublisherStartupHandler implements ServerStartupObserver { private static int retryTime = 2000; private static final int CONNECTION_RETRY_FACTOR = 2; private static final int MAX_RETRY_COUNT = 5; - private static Stack failedAPIsStack = new Stack<>(); - private static Stack currentAPIsStack; + private static Stack failedAPIsStack = new Stack<>(); + private static Stack currentAPIsStack; private APIPublisherService publisher; @@ -64,7 +64,7 @@ public class APIPublisherStartupHandler implements ServerStartupObserver { } catch (InterruptedException te) { //do nothing. } - Stack failedApis; + Stack failedApis; if (!APIPublisherDataHolder.getInstance().getUnpublishedApis().isEmpty()) { publishAPIs(currentAPIsStack, failedAPIsStack); failedApis = failedAPIsStack; @@ -77,8 +77,8 @@ public class APIPublisherStartupHandler implements ServerStartupObserver { StringBuilder error = new StringBuilder(); error.append("Error occurred while publishing API ['"); while (!failedApis.isEmpty()) { - API api = failedApis.pop(); - error.append(api.getId().getApiName() + ","); + APIConfig api = failedApis.pop(); + error.append(api.getName() + ","); } error.append("']"); log.error(error.toString()); @@ -90,12 +90,13 @@ public class APIPublisherStartupHandler implements ServerStartupObserver { t.start(); } - private void publishAPIs(Stack apis, Stack failedStack) { + private void publishAPIs(Stack apis, Stack failedStack) { while (!apis.isEmpty()) { - API api = apis.pop(); + APIConfig api = apis.pop(); try { publisher.publishAPI(api); - } catch (Exception e) { + } catch (APIManagerPublisherException e) { + log.error("failed to publish api.", e); failedStack.push(api); } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java index 8ae3c531c1..839658ec2a 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java @@ -18,22 +18,24 @@ package org.wso2.carbon.apimgt.webapp.publisher; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.reflect.TypeToken; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.apimgt.api.APIManagementException; -import org.wso2.carbon.apimgt.api.APIProvider; -import org.wso2.carbon.apimgt.api.model.*; -import org.wso2.carbon.apimgt.impl.APIConstants; -import org.wso2.carbon.apimgt.impl.utils.APIUtil; +import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.webapp.publisher.config.APIResource; import org.wso2.carbon.apimgt.webapp.publisher.config.APIResourceConfiguration; import org.wso2.carbon.apimgt.webapp.publisher.config.WebappPublisherConfig; +import org.wso2.carbon.apimgt.webapp.publisher.dto.ApiScope; +import org.wso2.carbon.apimgt.webapp.publisher.dto.ApiUriTemplate; import org.wso2.carbon.apimgt.webapp.publisher.lifecycle.util.AnnotationProcessor; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.core.util.Utils; import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.utils.multitenancy.MultitenantUtils; import javax.servlet.ServletContext; import java.util.*; @@ -41,7 +43,6 @@ import java.util.*; public class APIPublisherUtil { public static final String API_VERSION_PARAM = "{version}"; - public static final String API_PUBLISH_ENVIRONMENT = "Production and Sandbox"; private static final Log log = LogFactory.getLog(APIPublisherUtil.class); private static final String DEFAULT_API_VERSION = "1.0.0"; private static final String API_CONFIG_DEFAULT_VERSION = "1.0.0"; @@ -55,101 +56,6 @@ public class APIPublisherUtil { private static final String NON_SECURED_RESOURCES = "nonSecuredEndPoints"; private static final String AUTH_TYPE_NON_SECURED = "None"; - - public static API getAPI(APIConfig config) throws APIManagementException { - - APIProvider provider = config.getProvider(); - String apiVersion = config.getVersion(); - APIIdentifier id = new APIIdentifier(replaceEmailDomain(config.getOwner()), config.getName(), apiVersion); - API api = new API(id); - - api.setApiOwner(config.getOwner()); - String context = config.getContext(); - context = context.startsWith("/") ? context : ("/" + context); - String providerDomain = config.getTenantDomain(); - if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(providerDomain)) { - //Create tenant aware context for API - context = "/t/" + providerDomain + context; - } - - // This is to support the new Pluggable version strategy - // if the context does not contain any {version} segment, we use the default version strategy. - context = checkAndSetVersionParam(context); - api.setContextTemplate(context); - context = updateContextWithVersion(config.getVersion(), context); - api.setContext(context); - - api.setUrl(config.getEndpoint()); - api.addAvailableTiers(provider.getTiers()); - api.setEndpointSecured(false); - api.setStatus(APIStatus.CREATED); - api.setTransports(config.getTransports()); - api.setApiLevelPolicy(config.getPolicy()); - api.setContextTemplate(config.getContextTemplate()); - Set environments = new HashSet<>(); - environments.add(API_PUBLISH_ENVIRONMENT); - api.setEnvironments(environments); - Set tiers = new HashSet<>(); - - tiers.add(new Tier(APIConstants.UNLIMITED_TIER)); - api.addAvailableTiers(tiers); - - if (config.isSharedWithAllTenants()) { - api.setSubscriptionAvailability(APIConstants.SUBSCRIPTION_TO_ALL_TENANTS); - api.setVisibility(APIConstants.API_GLOBAL_VISIBILITY); - } else { - api.setSubscriptionAvailability(APIConstants.SUBSCRIPTION_TO_CURRENT_TENANT); - api.setVisibility(APIConstants.API_PRIVATE_VISIBILITY); - } - api.setResponseCache(APIConstants.DISABLED); - - String endpointConfig = "{\"production_endpoints\":{\"url\":\"" + config.getEndpoint() + - "\",\"config\":null},\"implementation_status\":\"managed\",\"endpoint_type\":\"http\"}"; - - api.setEndpointConfig(endpointConfig); - - if ("".equals(id.getVersion()) || (DEFAULT_API_VERSION.equals(id.getVersion()))) { - api.setAsDefaultVersion(Boolean.TRUE); - api.setAsPublishedDefaultVersion(Boolean.TRUE); - } - if (config.getTags() != null && config.getTags().length > 0) { - Set tags = new HashSet<>(Arrays.asList(config.getTags())); - api.addTags(tags); - } - - // adding scopes to the api - Set uriTemplates = config.getUriTemplates(); - Map apiScopes = new HashMap<>(); - if (uriTemplates != null) { - // this creates distinct scopes list - for (URITemplate template : uriTemplates) { - Scope scope = template.getScope(); - if (scope != null) { - if (apiScopes.get(scope.getKey()) == null) { - apiScopes.put(scope.getKey(), scope); - } - } - } - Set scopes = new HashSet<>(apiScopes.values()); - // set current scopes to API - api.setScopes(scopes); - - // this has to be done because of the use of pass by reference - // where same object reference of scope should be available for both - // api scope and uri template scope - for (Scope scope : scopes) { - for (URITemplate template : uriTemplates) { - if (template.getScope() != null && scope.getKey().equals(template.getScope().getKey())) { - template.setScope(scope); - } - } - } - api.setUriTemplates(uriTemplates); - } - api.setCorsConfiguration(APIUtil.getDefaultCorsConfiguration()); - return api; - } - public static String getServerBaseUrl() { WebappPublisherConfig webappPublisherConfig = WebappPublisherConfig.getInstance(); return Utils.replaceSystemProperty(webappPublisherConfig.getHost()); @@ -159,39 +65,6 @@ public class APIPublisherUtil { return getServerBaseUrl() + context; } - /** - * When an input is having '@',replace it with '-AT-' - * [This is required to persist API data in registry,as registry paths don't allow '@' sign.] - * - * @param input inputString - * @return String modifiedString - */ - private static String replaceEmailDomain(String input) { - if (input != null && input.contains(APIConstants.EMAIL_DOMAIN_SEPARATOR)) { - input = input.replace(APIConstants.EMAIL_DOMAIN_SEPARATOR, APIConstants.EMAIL_DOMAIN_SEPARATOR_REPLACEMENT); - } - return input; - } - - private static String updateContextWithVersion(String version, String context) { - // This condition should not be true for any occasion but we keep it so that there are no loopholes in - // the flow. - context = context.replace(API_VERSION_PARAM, version); - return context; - } - - private static String checkAndSetVersionParam(String context) { - // This is to support the new Pluggable version strategy - // if the context does not contain any {version} segment, we use the default version strategy. - if (!context.contains(API_VERSION_PARAM)) { - if (!context.endsWith("/")) { - context = context + "/"; - } - context = context + API_VERSION_PARAM; - } - return context; - } - /** * Build the API Configuration to be passed to APIM, from a given list of URL templates * @@ -245,11 +118,6 @@ public class APIPublisherUtil { tenantDomain = (tenantDomain != null && !tenantDomain.isEmpty()) ? tenantDomain : MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; apiConfig.setTenantDomain(tenantDomain); - String contextTemplate = context + "/" + APIConstants.VERSION_PLACEHOLDER; - if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) { - contextTemplate = context + "/t/" + tenantDomain + "/" + APIConstants.VERSION_PLACEHOLDER; - } - apiConfig.setContextTemplate(contextTemplate); String endpoint = servletContext.getInitParameter(PARAM_MANAGED_API_ENDPOINT); if (endpoint == null || endpoint.isEmpty()) { @@ -292,17 +160,33 @@ public class APIPublisherUtil { } apiConfig.setSharedWithAllTenants(isSharedWithAllTenants); - Set uriTemplates = new LinkedHashSet<>(); + Set uriTemplates = new LinkedHashSet<>(); for (APIResource apiResource : apiDef.getResources()) { - URITemplate template = new URITemplate(); + ApiUriTemplate template = new ApiUriTemplate(); template.setAuthType(apiResource.getAuthType()); - template.setHTTPVerb(apiResource.getHttpVerb()); + template.setHttpVerb(apiResource.getHttpVerb()); template.setResourceURI(apiResource.getUri()); template.setUriTemplate(apiResource.getUriTemplate()); template.setScope(apiResource.getScope()); uriTemplates.add(template); } apiConfig.setUriTemplates(uriTemplates); + // adding scopes to the api + Map apiScopes = new HashMap<>(); + if (uriTemplates != null) { + // this creates distinct scopes list + for (ApiUriTemplate template : uriTemplates) { + ApiScope scope = template.getScope(); + if (scope != null) { + if (apiScopes.get(scope.getKey()) == null) { + apiScopes.put(scope.getKey(), scope); + } + } + } + Set scopes = new HashSet<>(apiScopes.values()); + // set current scopes to API + apiConfig.setScopes(scopes); + } String policy = servletContext.getInitParameter(PARAM_MANAGED_API_POLICY); if (policy == null || policy.isEmpty()) { @@ -317,6 +201,70 @@ public class APIPublisherUtil { return apiConfig; } + public static String getSwaggerDefinition(APIConfig apiConfig) { + Map httpVerbsMap = new HashMap<>(); + List scopes = new ArrayList<>(); + + for (ApiUriTemplate uriTemplate : apiConfig.getUriTemplates()) { + JsonObject response = new JsonObject(); + response.addProperty("200", ""); + + JsonObject responses = new JsonObject(); + responses.add("responses", response); + JsonObject httpVerbs = httpVerbsMap.get(uriTemplate.getUriTemplate()); + if (httpVerbs == null) { + httpVerbs = new JsonObject(); + } + JsonObject httpVerb = new JsonObject(); + httpVerb.add("responses", response); + + httpVerb.addProperty("x-auth-type", "Application%20%26%20Application%20User"); + httpVerb.addProperty("x-throttling-tier", "Unlimited"); + if (uriTemplate.getScope() != null) { + httpVerb.addProperty("x-scope", uriTemplate.getScope().getKey()); + scopes.add(uriTemplate.getScope()); + } + httpVerbs.add(uriTemplate.getHttpVerb().toLowerCase(), httpVerb); + httpVerbsMap.put(uriTemplate.getUriTemplate(), httpVerbs); + } + + Iterator it = httpVerbsMap.entrySet().iterator(); + JsonObject paths = new JsonObject(); + while (it.hasNext()) { + Map.Entry pair = (Map.Entry) it.next(); + paths.add(pair.getKey(), pair.getValue()); + it.remove(); + } + + JsonObject info = new JsonObject(); + info.addProperty("title", apiConfig.getName()); + info.addProperty("version", apiConfig.getVersion()); + + JsonObject swaggerDefinition = new JsonObject(); + swaggerDefinition.add("paths", paths); + swaggerDefinition.addProperty("swagger", "2.0"); + swaggerDefinition.add("info", info); + + // adding scopes to swagger definition + if (!apiConfig.getScopes().isEmpty()) { + Gson gson = new Gson(); + JsonElement element = gson.toJsonTree(apiConfig.getScopes(), new TypeToken>() { + }.getType()); + if (element != null) { + JsonArray apiScopes = element.getAsJsonArray(); + JsonObject apim = new JsonObject(); + apim.add("x-wso2-scopes", apiScopes); + JsonObject wso2Security = new JsonObject(); + wso2Security.add("apim", apim); + swaggerDefinition.add("x-wso2-security", wso2Security); + } + } + if (log.isDebugEnabled()) { + log.debug("API swagger definition: " + swaggerDefinition.toString()); + } + return swaggerDefinition.toString(); + } + public static void setResourceAuthTypes(ServletContext servletContext, APIConfig apiConfig) { List resourcesList = null; @@ -324,9 +272,9 @@ public class APIPublisherUtil { if(null != nonSecuredResources){ resourcesList = Arrays.asList(nonSecuredResources.split(",")); } - Set templates = apiConfig.getUriTemplates(); + Set templates = apiConfig.getUriTemplates(); if(null != resourcesList) { - for (URITemplate template : templates) { + for (ApiUriTemplate template : templates) { String fullPaath = ""; if( template.getUriTemplate() != AnnotationProcessor.WILD_CARD ) { fullPaath = apiConfig.getContext() + template.getUriTemplate(); diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/config/APIResource.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/config/APIResource.java index 577f4efecb..ff439e68cf 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/config/APIResource.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/config/APIResource.java @@ -18,7 +18,7 @@ package org.wso2.carbon.apimgt.webapp.publisher.config; -import org.wso2.carbon.apimgt.api.model.Scope; +import org.wso2.carbon.apimgt.webapp.publisher.dto.ApiScope; public class APIResource { @@ -28,7 +28,7 @@ public class APIResource { private String UriTemplate; private String consumes; private String produces; - private Scope scope; + private ApiScope scope; public String getAuthType() { return AuthType; @@ -78,11 +78,11 @@ public class APIResource { this.produces = produces; } - public Scope getScope() { + public ApiScope getScope() { return scope; } - public void setScope(Scope scope) { + public void setScope(ApiScope scope) { this.scope = scope; } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/dto/ApiScope.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/dto/ApiScope.java new file mode 100644 index 0000000000..016dbff37f --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/dto/ApiScope.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.webapp.publisher.dto; + +public class ApiScope { + + String key; + String name; + String roles; + String description; + int id; + + public ApiScope() { + } + + public String getKey() { + return this.key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getRoles() { + return this.roles; + } + + public void setRoles(String roles) { + this.roles = roles; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/dto/ApiUriTemplate.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/dto/ApiUriTemplate.java new file mode 100644 index 0000000000..89ef7900cc --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/dto/ApiUriTemplate.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.webapp.publisher.dto; + +/** + * This hold the api uri template information. + */ +public class ApiUriTemplate { + + private String authType; + private String httpVerb; + private String resourceURI; + private String uriTemplate; + private ApiScope scope; + + public ApiUriTemplate() {} + + public String getAuthType() { + return authType; + } + + public void setAuthType(String authType) { + this.authType = authType; + } + + public String getHttpVerb() { + return httpVerb; + } + + public void setHttpVerb(String httpVerb) { + this.httpVerb = httpVerb; + } + + public String getResourceURI() { + return resourceURI; + } + + public void setResourceURI(String resourceURI) { + this.resourceURI = resourceURI; + } + + public String getUriTemplate() { + return uriTemplate; + } + + public void setUriTemplate(String uriTemplate) { + this.uriTemplate = uriTemplate; + } + + public ApiScope getScope() { + return scope; + } + + public void setScope(ApiScope scope) { + this.scope = scope; + } +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/exception/APIManagerPublisherException.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/exception/APIManagerPublisherException.java new file mode 100644 index 0000000000..b98aef3c9a --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/exception/APIManagerPublisherException.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.webapp.publisher.exception; + +/** + * Handles the exceptions related to API management. + */ +public class APIManagerPublisherException extends Exception { + + private static final long serialVersionUID = -8933142342423122660L; + + public APIManagerPublisherException(String msg, Exception nestedEx) { + super(msg, nestedEx); + } + + public APIManagerPublisherException(String message, Throwable cause) { + super(message, cause); + } + + public APIManagerPublisherException(String msg) { + super(msg); + } + + public APIManagerPublisherException() { + super(); + } + + public APIManagerPublisherException(Throwable cause) { + super(cause); + } + +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java index b06bc1a4ca..639c2fe217 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java @@ -18,8 +18,8 @@ */ package org.wso2.carbon.apimgt.webapp.publisher.internal; - -import org.wso2.carbon.apimgt.api.model.API; +import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; +import org.wso2.carbon.apimgt.webapp.publisher.APIConfig; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherService; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.user.core.service.RealmService; @@ -36,7 +36,8 @@ public class APIPublisherDataHolder { private TenantManager tenantManager; private RegistryService registryService; private boolean isServerStarted; - private Stack unpublishedApis = new Stack<>(); + private Stack unpublishedApis = new Stack<>(); + private IntegrationClientService integrationClientService; private static APIPublisherDataHolder thisInstance = new APIPublisherDataHolder(); @@ -108,11 +109,20 @@ public class APIPublisherDataHolder { isServerStarted = serverStarted; } - public Stack getUnpublishedApis() { + public Stack getUnpublishedApis() { return unpublishedApis; } - public void setUnpublishedApis(Stack unpublishedApis) { + public void setUnpublishedApis(Stack unpublishedApis) { this.unpublishedApis = unpublishedApis; } + + public IntegrationClientService getIntegrationClientService() { + return integrationClientService; + } + + public void setIntegrationClientService( + IntegrationClientService integrationClientService) { + this.integrationClientService = integrationClientService; + } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java index 44c2c6d799..dd5736570c 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java @@ -22,7 +22,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService; +import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherService; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherServiceImpl; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherStartupHandler; @@ -30,16 +30,9 @@ import org.wso2.carbon.apimgt.webapp.publisher.config.WebappPublisherConfig; import org.wso2.carbon.core.ServerStartupObserver; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.user.core.service.RealmService; -import org.wso2.carbon.utils.ConfigurationContextService; /** * @scr.component name="org.wso2.carbon.apimgt.webapp.publisher" immediate="true" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" - * cardinality="0..1" - * policy="dynamic" - * bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" * @scr.reference name="user.realmservice.default" * interface="org.wso2.carbon.user.core.service.RealmService" * cardinality="1..1" @@ -52,6 +45,11 @@ import org.wso2.carbon.utils.ConfigurationContextService; * policy="dynamic" * bind="setRegistryService" * unbind="unsetRegistryService" + * interface="org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService" + * cardinality="1..1" + * policy="dynamic" + * bind="setIntegrationClientService" + * unbind="unsetIntegrationClientService" */ public class APIPublisherServiceComponent { @@ -97,28 +95,6 @@ public class APIPublisherServiceComponent { bundleContext.registerService(ServerStartupObserver.class, new APIPublisherStartupHandler(), null); } - protected void setAPIManagerConfigurationService(APIManagerConfigurationService service) { - //do nothing - } - - protected void unsetAPIManagerConfigurationService(APIManagerConfigurationService service) { - //do nothing - } - - protected void setConfigurationContextService(ConfigurationContextService configurationContextService) { - if (log.isDebugEnabled()) { - log.debug("Setting ConfigurationContextService"); - } - APIPublisherDataHolder.getInstance().setConfigurationContextService(configurationContextService); - } - - protected void unsetConfigurationContextService(ConfigurationContextService configurationContextService) { - if (log.isDebugEnabled()) { - log.debug("Un-setting ConfigurationContextService"); - } - APIPublisherDataHolder.getInstance().setConfigurationContextService(null); - } - protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.debug("Setting Realm Service"); @@ -143,4 +119,15 @@ public class APIPublisherServiceComponent { protected void unsetRegistryService(RegistryService registryService) { APIPublisherDataHolder.getInstance().setRegistryService(null); } + + protected void setIntegrationClientService(IntegrationClientService integrationClientService) { + if (integrationClientService != null && log.isDebugEnabled()) { + log.debug("integrationClientService initialized"); + } + APIPublisherDataHolder.getInstance().setIntegrationClientService(integrationClientService); + } + + protected void unsetIntegrationClientService(IntegrationClientService integrationClientService) { + APIPublisherDataHolder.getInstance().setIntegrationClientService(null); + } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java index adf73f0d17..24c73c739d 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java @@ -24,7 +24,6 @@ import org.apache.catalina.LifecycleListener; import org.apache.catalina.core.StandardContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.apimgt.api.model.API; import org.wso2.carbon.apimgt.webapp.publisher.APIConfig; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherService; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherUtil; @@ -77,8 +76,6 @@ public class APIPublisherLifecycleListener implements LifecycleListener { boolean isTenantActive = APIPublisherDataHolder.getInstance(). getTenantManager().isTenantActive(tenantId); if (isTenantActive) { - apiConfig.init(); - API api = APIPublisherUtil.getAPI(apiConfig); boolean isServerStarted = APIPublisherDataHolder.getInstance().isServerStarted(); if (isServerStarted) { APIPublisherService apiPublisherService = @@ -87,13 +84,13 @@ public class APIPublisherLifecycleListener implements LifecycleListener { throw new IllegalStateException( "API Publisher service is not initialized properly"); } - apiPublisherService.publishAPI(api); + apiPublisherService.publishAPI(apiConfig); } else { if (log.isDebugEnabled()) { log.debug("Server has not started yet. Hence adding API '" + - api.getId().getApiName() + "' to the queue"); + apiConfig.getName() + "' to the queue"); } - APIPublisherDataHolder.getInstance().getUnpublishedApis().push(api); + APIPublisherDataHolder.getInstance().getUnpublishedApis().push(apiConfig); } } else { log.error("No tenant [" + apiConfig.getTenantDomain() + "] " + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java index 2c2f21f19c..52dc147790 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java @@ -21,10 +21,10 @@ import io.swagger.annotations.SwaggerDefinition; import org.apache.catalina.core.StandardContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.apimgt.api.model.Scope; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherUtil; import org.wso2.carbon.apimgt.webapp.publisher.config.APIResource; import org.wso2.carbon.apimgt.webapp.publisher.config.APIResourceConfiguration; +import org.wso2.carbon.apimgt.webapp.publisher.dto.ApiScope; import javax.servlet.ServletContext; import javax.ws.rs.Consumes; @@ -96,7 +96,7 @@ public class AnnotationProcessor { private Class apiOperation; private Class scopeClass; private Class scopesClass; - private Map apiScopes; + private Map apiScopes; public AnnotationProcessor(final StandardContext context) { servletContext = context.getServletContext(); @@ -206,20 +206,20 @@ public class AnnotationProcessor { return apiResourceConfigs; } - private Map processAPIScopes(Annotation annotation) throws Throwable { - Map scopes = new HashMap<>(); + private Map processAPIScopes(Annotation annotation) throws Throwable { + Map scopes = new HashMap<>(); InvocationHandler methodHandler = Proxy.getInvocationHandler(annotation); Annotation[] annotatedScopes = (Annotation[]) methodHandler.invoke(annotation, scopesClass .getMethod(ANNOTATIONS_SCOPES, null), null); - Scope scope; + ApiScope scope; String permissions[]; StringBuilder aggregatedPermissions; for(int i=0; ihttp://wso2.org + org.wso2.carbon.apimgt.integration.client org.wso2.carbon.apimgt.webapp.publisher org.wso2.carbon.apimgt.application.extension org.wso2.carbon.apimgt.application.extension.api diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/webapp/WEB-INF/web.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/webapp/WEB-INF/web.xml index 62a814568e..58aa02917c 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/webapp/WEB-INF/web.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/webapp/WEB-INF/web.xml @@ -47,5 +47,9 @@ managed-api-owner admin + + isSharedWithAllTenants + true + diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/webapp/WEB-INF/web.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/webapp/WEB-INF/web.xml index 72020e147e..1d59c04b17 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/webapp/WEB-INF/web.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/webapp/WEB-INF/web.xml @@ -52,6 +52,10 @@ managed-api-owner admin + + isSharedWithAllTenants + true + diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml index 47a667d43b..33947cc973 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml @@ -61,7 +61,7 @@ javax.security.auth.x500, javax.xml.*, javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, - org.apache.commons.codec.binary, + org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", org.bouncycastle.asn1, org.bouncycastle.asn1.x500, org.bouncycastle.asn1.x509, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java index afc03336d5..ad32fc3b98 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java @@ -29,7 +29,6 @@ import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService; -import org.wso2.carbon.device.mgt.common.scope.mgt.ScopeManagementService; import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService; import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager; import org.wso2.carbon.device.mgt.core.search.mgt.SearchManagerService; @@ -262,16 +261,6 @@ public class DeviceMgtAPIUtils { return gadgetDataService; } - public static ScopeManagementService getScopeManagementService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - ScopeManagementService scopeManagementService = - (ScopeManagementService) ctx.getOSGiService(ScopeManagementService.class, null); - if (scopeManagementService == null) { - throw new IllegalStateException("Scope Management Service has not been initialized."); - } - return scopeManagementService; - } - public static int getTenantId(String tenantDomain) throws DeviceManagementException { RealmService realmService = (RealmService) PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(RealmService.class, null); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtUtil.java index 0ffb728f0c..c11fd758c9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtUtil.java @@ -18,7 +18,7 @@ package org.wso2.carbon.device.mgt.jaxrs.util; -import org.wso2.carbon.apimgt.api.model.Scope; +import org.wso2.carbon.device.mgt.core.config.permission.Scope; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorListItem; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.ProfileFeature; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml index 8d96315855..9f2fb4f03c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml @@ -50,7 +50,6 @@ javax.xml.bind.annotation; version="${javax.xml.bind.imp.pkg.version}", com.fasterxml.jackson.annotation;version="${jackson-annotations.version}", - org.wso2.carbon.apimgt.api.model.*;version="${carbon.api.mgt.version.range}", io.swagger.annotations; version="${swagger.annotations.version}"; resolution:=optional @@ -69,10 +68,6 @@ org.wso2.orbit.com.fasterxml.jackson.core jackson-annotations - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.api - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/scope/mgt/ScopeManagementException.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/scope/mgt/ScopeManagementException.java deleted file mode 100644 index ed5082a72c..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/scope/mgt/ScopeManagementException.java +++ /dev/null @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. -* -* 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 org.wso2.carbon.device.mgt.common.scope.mgt; - -/** - * This exception is used to throw when there is an issue in scope management service. - */ -public class ScopeManagementException extends Exception { - - private static final long serialVersionUID = -315127931137779899L; - - private String errorMessage; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public ScopeManagementException(String msg, Exception nestedEx) { - super(msg, nestedEx); - setErrorMessage(msg); - } - - public ScopeManagementException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public ScopeManagementException(String msg) { - super(msg); - setErrorMessage(msg); - } - - public ScopeManagementException() { - super(); - } - - public ScopeManagementException(Throwable cause) { - super(cause); - } -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/scope/mgt/ScopeManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/scope/mgt/ScopeManagementService.java deleted file mode 100644 index 2d60dbd1f0..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/scope/mgt/ScopeManagementService.java +++ /dev/null @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2016 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. -* -* WSO2 Inc. licenses this file to you 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 org.wso2.carbon.device.mgt.common.scope.mgt; - -import java.util.List; -import org.wso2.carbon.apimgt.api.model.Scope; - -/** - * This interface contains the basic operations related to scope management. - */ -public interface ScopeManagementService { - - /** - * This method is used to update the given list of scopes. - * - * @param scopes List of scopes to be updated. - * @throws ScopeManagementException - */ - void updateScopes(List scopes) throws ScopeManagementException; - - /** - * This method is used to update the given list of scopes keys with the role name. - * - * @param scopeKeys List of scopes to be updated. - * @param roleName Role name - * @throws ScopeManagementException - */ - void updateScopes(List scopeKeys, String roleName) throws ScopeManagementException; - - /** - * This method is used to retrieve all the scopes. - * - * @return List of scopes. - * @throws ScopeManagementException - */ - List getAllScopes() throws ScopeManagementException; - - /** - * This method is to retrieve the roles of the given scope - * @param scopeKey key of the scope - * @return List of roles - * @throws ScopeManagementException - */ - String getRolesOfScope(String scopeKey) throws ScopeManagementException; - - /** - * This method is to retrieve the scopes of the given role - * @param roleName key of the scope - * @return List of scopes - * @throws ScopeManagementException - */ - List getScopesOfRole(String roleName) throws ScopeManagementException; - - /** - * This method is used to remove the scopes of a given user role. - * - * @param roleName Role name - * @throws ScopeManagementException - */ - void removeScopes(String roleName) throws ScopeManagementException; - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index cb6ea3bf7f..afbf63738a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -77,7 +77,6 @@ org.wso2.carbon.identity.oauth.stub, org.wso2.carbon.identity.oauth.stub.dto, org.wso2.carbon.ndatasource.core, - org.wso2.carbon.apimgt.impl, org.wso2.carbon.ntask.core.*, org.wso2.carbon.ntask.common, org.apache.catalina, @@ -86,7 +85,8 @@ org.wso2.carbon.email.sender.*, io.swagger.annotations.*;resolution:=optional, org.wso2.carbon, - org.wso2.carbon.base + org.wso2.carbon.base, + org.scannotation.* !org.wso2.carbon.device.mgt.core.internal, @@ -94,7 +94,8 @@ javax.ws.rs-api, - scribe;scope=compile|runtime;inline=false; + scribe;scope=compile|runtime;inline=false, + javassist;inline=false * @@ -124,6 +125,10 @@ org.eclipse.osgi org.eclipse.osgi.services + + org.wso2.orbit.org.scannotation + scannotation + org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.common @@ -203,34 +208,6 @@ org.apache.ws.commons.axiom.wso2 axiom - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.api - - - org.wso2.carbon.identity - org.wso2.carbon.user.mgt.stub - - - org.wso2.carbon.identity - org.wso2.carbon.user.mgt - - - - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.impl - - - org.wso2.carbon.identity - org.wso2.carbon.user.mgt.stub - - - org.wso2.carbon.identity - org.wso2.carbon.user.mgt - - - org.apache.axis2.wso2 axis2 @@ -281,12 +258,6 @@ swagger-annotations provided - - - org.wso2.orbit.org.scannotation - scannotation - - org.wso2.carbon.devicemgt org.wso2.carbon.apimgt.annotations @@ -296,12 +267,14 @@ javax.ws.rs javax.ws.rs-api - javax.ws.rs jsr311-api - + + javassist + javassist + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/AnnotationProcessor.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/AnnotationProcessor.java index 52c59d753f..d6a6a84118 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/AnnotationProcessor.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/AnnotationProcessor.java @@ -19,11 +19,9 @@ package org.wso2.carbon.device.mgt.core.config.permission; import io.swagger.annotations.SwaggerDefinition; -import io.swagger.models.Swagger; import org.apache.catalina.core.StandardContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.apimgt.api.model.Scope; import org.wso2.carbon.device.mgt.common.permission.mgt.Permission; import javax.servlet.ServletContext; @@ -80,7 +78,6 @@ public class AnnotationProcessor { private Class pathClazz; private ClassLoader classLoader; private ServletContext servletContext; - private Swagger swagger; private Class apiClazz; private Class consumesClass; private Class producesClass; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/ExtendedAnnotationDB.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/ExtendedAnnotationDB.java index dbbd97e3a6..c4ba51d1f4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/ExtendedAnnotationDB.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/ExtendedAnnotationDB.java @@ -30,11 +30,11 @@ public class ExtendedAnnotationDB extends AnnotationDB { } public void scanArchives(URL... urls) throws IOException { - URL[] arr$ = urls; - int len$ = urls.length; + URL[] arr = urls; + int len = urls.length; - for(int i$ = 0; i$ < len$; ++i$) { - URL url = arr$[i$]; + for(int i = 0; i < len; ++i) { + URL url = arr[i]; Filter filter = new Filter() { public boolean accepts(String filename) { if(filename.endsWith(".class")) { @@ -60,16 +60,16 @@ public class ExtendedAnnotationDB extends AnnotationDB { } private boolean ignoreScan(String intf) { - String[] arr$; - int len$; - int i$; + String[] arr; + int len; + int i; String ignored; if(this.scanPackages != null) { - arr$ = this.scanPackages; - len$ = arr$.length; + arr = this.scanPackages; + len = arr.length; - for(i$ = 0; i$ < len$; ++i$) { - ignored = arr$[i$]; + for(i = 0; i < len; ++i) { + ignored = arr[i]; if(intf.startsWith(ignored + ".")) { return false; } @@ -77,11 +77,11 @@ public class ExtendedAnnotationDB extends AnnotationDB { return true; } else { - arr$ = this.ignoredPackages; - len$ = arr$.length; + arr = this.ignoredPackages; + len = arr.length; - for(i$ = 0; i$ < len$; ++i$) { - ignored = arr$[i$]; + for(i = 0; i < len; ++i) { + ignored = arr[i]; if(intf.startsWith(ignored + ".")) { return true; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/Scope.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/Scope.java new file mode 100644 index 0000000000..aab33dcccd --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/Scope.java @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* 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 org.wso2.carbon.device.mgt.core.config.permission; + +import java.io.Serializable; + +public class Scope implements Serializable { + String key; + String name; + String roles; + String description; + int id; + + public Scope() { + } + + public String getKey() { + return this.key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getRoles() { + return this.roles; + } + + public void setRoles(String roles) { + this.roles = roles; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } +} + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementDataHolder.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementDataHolder.java index 0ca96ec4d2..7de2928065 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementDataHolder.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementDataHolder.java @@ -18,7 +18,6 @@ package org.wso2.carbon.device.mgt.core.internal; -import org.wso2.carbon.apimgt.impl.APIManagerConfiguration; import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationService; @@ -72,8 +71,6 @@ public class DeviceManagementDataHolder { return this.map; } - private APIManagerConfiguration apiManagerConfiguration; - private DeviceManagementDataHolder() {} public static DeviceManagementDataHolder getInstance() { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java index adbf6cda43..8886d756bf 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java @@ -21,7 +21,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationService; @@ -84,12 +83,6 @@ import java.util.List; * policy="dynamic" * bind="setRegistryService" * unbind="unsetRegistryService" - * @scr.reference name="api.manager.config.service" - * interface="org.wso2.carbon.apimgt.impl.APIManagerConfigurationService" - * cardinality="1..1" - * policy="dynamic" - * bind="setAPIManagerConfigurationService" - * unbind="unsetAPIManagerConfigurationService" * @scr.reference name="org.wso2.carbon.ndatasource" * interface="org.wso2.carbon.ndatasource.core.DataSourceService" * cardinality="1..1" @@ -355,14 +348,6 @@ public class DeviceManagementServiceComponent { DeviceManagementDataHolder.getInstance().setRegistryService(null); } - protected void setAPIManagerConfigurationService(APIManagerConfigurationService service) { - //do nothing - } - - protected void unsetAPIManagerConfigurationService(APIManagerConfigurationService service) { - //do nothing - } - protected void setDataSourceService(DataSourceService dataSourceService) { /* This is to avoid mobile device management component getting initialized before the underlying datasources are registered */ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json index a43bb34bce..a3a81e4446 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json @@ -15,13 +15,14 @@ "oauthProvider": { "appRegistration": { "appType": "webapp", - "clientName": "emm", + "clientName": "iot_ui", "owner": "admin@carbon.super", "dynamicClientAppRegistrationServiceURL": "%https.ip%/dynamic-client-web/register", "apiManagerClientAppRegistrationServiceURL": "https://%iot.gateway.host%:%iot.gateway.https.port%/api-application-registration/register/tenants", - "grantType": "password refresh_token urn:ietf:params:oauth:grant-type:saml2-bearer urn:ietf:params:oauth:grant-type:jwt-bearer", + "grantType": "password refresh_token urn:ietf:params:oauth:grant-type:saml2-carbon urn:ietf:params:oauth:grant-type:jwt-bearer", "tokenScope": "admin", - "callbackUrl": "%https.ip%/api/device-mgt/v1.0" + "callbackUrl": "%https.ip%/api/device-mgt/v1.0", + "samlGrantTypeName": "urn:ietf:carbon:signed:grant-type:saml2-bearer" }, "tokenServiceURL": "https://%iot.gateway.host%:%iot.gateway.https.port%/token" }, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handler-utils.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handler-utils.js index 81cdc1729b..b31febe79a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handler-utils.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handler-utils.js @@ -108,7 +108,8 @@ var utils = function () { var jwtToken = publicMethods.getJwtToken(adminUsername, claims); // register a tenant based client app at API Manager - var applicationName = "webapp_" + tenantDomain; + var applicationName = deviceMgtProps["oauthProvider"]["appRegistration"] + ["clientName"] + "_" + tenantDomain; var requestURL = deviceMgtProps["oauthProvider"]["appRegistration"] ["apiManagerClientAppRegistrationServiceURL"] + "?tenantDomain=" + tenantDomain + "&applicationName=" + applicationName; @@ -303,8 +304,8 @@ var utils = function () { // calling oauth provider token service endpoint var requestURL = deviceMgtProps["oauthProvider"]["tokenServiceURL"]; - var requestPayload = "grant_type=urn:ietf:params:oauth:grant-type:saml2-bearer&" + - "assertion=" + encodeURIComponent(encodedAssertion) + "&scope=" + scopes; + var requestPayload = "grant_type=" + deviceMgtProps["oauthProvider"]["appRegistration"]["samlGrantTypeName"] + + "&" + "assertion=" + encodeURIComponent(encodedAssertion) + "&scope=" + scopes; var xhr = new XMLHttpRequest(); xhr.open("POST", requestURL, false); diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml index 08f1b2c4aa..c9c58b5700 100644 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml @@ -181,11 +181,6 @@ commons-logging provided - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.api - provided - diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml index 2025283410..49ebf9d72e 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml @@ -34,6 +34,10 @@ http://wso2.org + + commons-codec.wso2 + commons-codec + org.wso2.carbon.identity.inbound.auth.oauth2 org.wso2.carbon.identity.oauth @@ -42,10 +46,6 @@ org.wso2.carbon org.wso2.carbon.user.core - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.impl - org.wso2.carbon.apimgt org.wso2.carbon.apimgt.keymgt @@ -54,6 +54,10 @@ com.googlecode.json-simple.wso2 json-simple + + org.wso2.carbon.identity.framework + org.wso2.carbon.user.mgt + @@ -93,31 +97,34 @@ org.wso2.carbon.user.core.tenant, org.json.simple, javax.cache, - org.wso2.carbon.apimgt.api, - org.wso2.carbon.apimgt.impl, - org.wso2.carbon.apimgt.impl.dao, - org.wso2.carbon.apimgt.impl.utils, org.wso2.carbon.identity.core.util, org.wso2.carbon.identity.oauth2.dto, org.wso2.carbon.identity.oauth2.token, - org.apache.oltu.oauth2.common.validators, org.wso2.carbon.utils, org.wso2.carbon.context, org.wso2.carbon.identity.oauth.cache, org.wso2.carbon.identity.oauth.config, org.wso2.carbon.identity.oauth2.dao, org.wso2.carbon.utils.multitenancy, - org.wso2.carbon.identity.oauth2.grant.jwt.*, - org.wso2.carbon.device.mgt.core.*, - org.wso2.carbon.apimgt.keymgt, - org.wso2.carbon.apimgt.keymgt.handlers, - com.google.gson, - org.apache.commons.codec.binary, + org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", org.wso2.carbon.identity.application.authentication.framework.model, - org.apache.oltu.oauth2.common, org.wso2.carbon.base, - org.apache.xerces.impl; resolution:=optional, - org.apache.xerces.util; resolution:=optional + org.apache.commons.collections, + org.apache.commons.lang, + org.joda.time, + org.opensaml.saml2.core, + org.opensaml.security, + org.opensaml.xml.*, + org.w3c.dom, + org.wso2.carbon.identity.application.common.util, + org.wso2.carbon.identity.base, + org.wso2.carbon.identity.oauth2.token.handlers.grant.*, + org.wso2.carbon.identity.oauth2.util, + org.wso2.carbon.idp.mgt, + org.opensaml.common.xml, + org.wso2.carbon.identity.oauth.common, + org.opensaml, + org.wso2.carbon.apimgt.keymgt.issuers diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/OAuthExtUtils.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/OAuthExtUtils.java deleted file mode 100644 index c07041c678..0000000000 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/OAuthExtUtils.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.device.mgt.oauth.extensions; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.apimgt.api.APIManagementException; -import org.wso2.carbon.apimgt.impl.APIConstants; -import org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO; -import org.wso2.carbon.apimgt.impl.utils.APIUtil; -import org.wso2.carbon.device.mgt.oauth.extensions.internal.OAuthExtensionsDataHolder; -import org.wso2.carbon.identity.core.util.IdentityTenantUtil; -import org.wso2.carbon.identity.oauth2.token.OAuthTokenReqMessageContext; -import org.wso2.carbon.user.api.TenantManager; -import org.wso2.carbon.user.api.UserRealm; -import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.user.core.service.RealmService; - -import javax.cache.Caching; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -/** - * This class holds util methods used by OAuth extension bundle. - */ -public class OAuthExtUtils { - - private static final Log log = LogFactory.getLog(OAuthExtUtils.class); - private static final String DEFAULT_SCOPE_NAME = "default"; - private static final String UI_EXECUTE = "ui.execute"; - private static final String REST_API_SCOPE_CACHE = "REST_API_SCOPE_CACHE"; - private static final int START_INDEX = 0; - private static final String DEFAULT_SCOPE_TAG = "device-mgt"; - - /** - * This method is used to get the tenant id when given tenant domain. - * - * @param tenantDomain Tenant domain name. - * @return Returns the tenant id. - */ - public static int getTenantId(String tenantDomain) { - int tenantId = 0; - if (tenantDomain != null) { - try { - TenantManager tenantManager = - OAuthExtensionsDataHolder.getInstance().getRealmService().getTenantManager(); - tenantId = tenantManager.getTenantId(tenantDomain); - } catch (UserStoreException e) { - String errorMsg = "Error when getting the tenant id from the tenant domain : " + - tenantDomain; - log.error(errorMsg, e); - } - } - return tenantId; - } - - /** - * This method is used to set scopes that are authorized to the OAuth token request message context. - * - * @param tokReqMsgCtx OAuth token request message context - * @return Returns true if success. - */ - public static boolean setScopes(OAuthTokenReqMessageContext tokReqMsgCtx) { - String[] requestedScopes = tokReqMsgCtx.getScope(); - String[] defaultScope = new String[]{DEFAULT_SCOPE_NAME}; - - //If no scopes were requested. - if (requestedScopes == null || requestedScopes.length == 0) { - tokReqMsgCtx.setScope(defaultScope); - return true; - } - - String consumerKey = tokReqMsgCtx.getOauth2AccessTokenReqDTO().getClientId(); - List reqScopeList = Arrays.asList(requestedScopes); - Map restAPIScopesOfCurrentTenant; - - try { - - Map appScopes; - ApiMgtDAO apiMgtDAO = ApiMgtDAO.getInstance(); - - //Get all the scopes and permissions against the scopes defined for the APIs subscribed to the application. - appScopes = apiMgtDAO.getScopeRolesOfApplication(consumerKey); - - //Add API Manager rest API scopes set. This list should be loaded at server start up and keep - //in memory and add it to each and every request coming. - String tenantDomain = tokReqMsgCtx.getAuthorizedUser().getTenantDomain(); - restAPIScopesOfCurrentTenant = (Map) Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER) - .getCache(REST_API_SCOPE_CACHE) - .get(tenantDomain); - if (restAPIScopesOfCurrentTenant != null) { - appScopes.putAll(restAPIScopesOfCurrentTenant); - } else { - restAPIScopesOfCurrentTenant = APIUtil. - getRESTAPIScopesFromConfig(APIUtil.getTenantRESTAPIScopesConfig(tenantDomain)); - - //then put cache - appScopes.putAll(restAPIScopesOfCurrentTenant); - Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER) - .getCache(REST_API_SCOPE_CACHE) - .put(tenantDomain, restAPIScopesOfCurrentTenant); - } - //If no scopes can be found in the context of the application - if (appScopes.isEmpty()) { - if (log.isDebugEnabled()) { - log.debug("No scopes defined for the Application " + - tokReqMsgCtx.getOauth2AccessTokenReqDTO().getClientId()); - } - - String[] allowedScopes = getAllowedScopes(reqScopeList); - tokReqMsgCtx.setScope(allowedScopes); - return true; - } - - // check for authorized scopes - List authorizedScopes = getAuthorizedScopes(tokReqMsgCtx, reqScopeList, appScopes); - - if (!authorizedScopes.isEmpty()) { - String[] authScopesArr = authorizedScopes.toArray(new String[authorizedScopes.size()]); - tokReqMsgCtx.setScope(authScopesArr); - } else { - tokReqMsgCtx.setScope(defaultScope); - } - } catch (APIManagementException e) { - log.error("Error while getting scopes of application " + e.getMessage()); - return false; - } - return true; - } - - /** - * Determines if the scope is specified in the white list. - * - * @param scope - The scope key to check - * @return - 'true' if the scope is white listed. 'false' if not. - */ - private static boolean isWhiteListedScope(String scope) { - // load white listed scopes - List scopeSkipList = OAuthExtensionsDataHolder.getInstance().getWhitelistedScopes(); - for (String scopeTobeSkipped : scopeSkipList) { - if (scope.matches(scopeTobeSkipped)) { - return true; - } - } - return false; - } - - /** - * Get the set of default scopes. If a requested scope is matches with the patterns specified in the white list, - * then such scopes will be issued without further validation. If the scope list is empty, - * token will be issued for default scope. - * - * @param requestedScopes - The set of requested scopes - * @return - The subset of scopes that are allowed - */ - private static String[] getAllowedScopes(List requestedScopes) { - List authorizedScopes = new ArrayList<>(); - - //Iterate the requested scopes list. - for (String scope : requestedScopes) { - if (isWhiteListedScope(scope)) { - authorizedScopes.add(scope); - } - } - if (authorizedScopes.isEmpty()) { - authorizedScopes.add(DEFAULT_SCOPE_NAME); - } - return authorizedScopes.toArray(new String[authorizedScopes.size()]); - } - - /** - * This method is used to get the authorized scopes out of requested scopes. It checks requested scopes with app - * scopes whether user has permissions to take actions for the requested scopes. - * - * @param tokReqMsgCtx OAuth token request message context. - * @param reqScopeList Requested scope list. - * @param appScopes App scopes. - * @return Returns a list of scopes. - */ - private static List getAuthorizedScopes(OAuthTokenReqMessageContext tokReqMsgCtx, List reqScopeList, - Map appScopes) { - - boolean status; - List authorizedScopes = new ArrayList<>(); - - int tenantId; - String username = tokReqMsgCtx.getAuthorizedUser().getUserName(); - String tenantDomain = tokReqMsgCtx.getAuthorizedUser().getTenantDomain(); - RealmService realmService = OAuthExtensionsDataHolder.getInstance().getRealmService(); - - try { - tenantId = realmService.getTenantManager().getTenantId(tenantDomain); - - // If tenant Id is not set in the tokenReqContext, deriving it from username. - if (tenantId == 0 || tenantId == -1) { - tenantId = IdentityTenantUtil.getTenantIdOfUser(username); - } - - UserRealm userRealm = OAuthExtensionsDataHolder.getInstance().getRealmService().getTenantUserRealm( - tenantId); - - //Iterate the requested scopes list. - for (String scope : reqScopeList) { - status = false; - - //Get the set of roles associated with the requested scope. - String appPermissions = appScopes.get(scope); - - //If the scope has been defined in the context of the App and if permissions have been defined for - // the scope - if (appPermissions != null && appPermissions.length() != 0) { - List permissions = new ArrayList<>(Arrays.asList(appPermissions.replaceAll(" ", "").split( - ","))); - - //Check if user has at least one of the permission associated with the scope - if (!permissions.isEmpty()) { - for (String permission : permissions) { - if (userRealm != null && userRealm.getAuthorizationManager() != null) { - String userStore = tokReqMsgCtx.getAuthorizedUser().getUserStoreDomain(); - - if (userStore != null) { - status = userRealm.getAuthorizationManager() - .isUserAuthorized(userStore + "/" + username, permission, UI_EXECUTE); - } else { - status = userRealm.getAuthorizationManager() - .isUserAuthorized(username, permission, UI_EXECUTE); - } - if (status) { - break; - } - } - } - if (status) { - authorizedScopes.add(scope); - } - } - } - - //The scope string starts with 'device_'. - else if (appScopes.containsKey(scope) || isWhiteListedScope(scope)) { - authorizedScopes.add(scope); - } - } - } catch (UserStoreException e) { - log.error("Error occurred while initializing user store.", e); - } - return authorizedScopes; - } - - public static String extractUserName(String username) { - if (username == null || username.isEmpty()) { - return null; - } - String trimmedName = username.trim(); - return trimmedName.substring(START_INDEX, trimmedName.lastIndexOf('@')); - } - -} diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/DeviceMgtOAuthCallbackHandler.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/DeviceMgtOAuthCallbackHandler.java deleted file mode 100644 index e621ee4a8b..0000000000 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/DeviceMgtOAuthCallbackHandler.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.device.mgt.oauth.extensions.handlers; - -import org.wso2.carbon.identity.oauth.callback.AbstractOAuthCallbackHandler; -import org.wso2.carbon.identity.oauth.callback.OAuthCallback; -import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; - -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.UnsupportedCallbackException; -import java.io.IOException; - -/** - * This class represents a Custom OAuthCallback Handler implementation. This should be implemented - * if there's any necessity of custom logic to authorize OAuthCallbacks. - */ -public class DeviceMgtOAuthCallbackHandler extends AbstractOAuthCallbackHandler { - - @Override - public boolean canHandle(Callback[] callbacks) throws IdentityOAuth2Exception { - return true; - } - - @Override - public void handle(Callback[] callbacks) - throws IOException, UnsupportedCallbackException { - if (callbacks != null && callbacks.length > 0){ - OAuthCallback oauthCallback = (OAuthCallback) callbacks[0]; - if (OAuthCallback.OAuthCallbackType.ACCESS_DELEGATION_AUTHZ.equals( - oauthCallback.getCallbackType())){ - oauthCallback.setAuthorized(true); - } else if (OAuthCallback.OAuthCallbackType.ACCESS_DELEGATION_TOKEN.equals( - oauthCallback.getCallbackType())){ - oauthCallback.setAuthorized(true); - } else if (OAuthCallback.OAuthCallbackType.SCOPE_VALIDATION_AUTHZ.equals( - oauthCallback.getCallbackType())){ - oauthCallback.setValidScope(true); - } else if (OAuthCallback.OAuthCallbackType.SCOPE_VALIDATION_TOKEN.equals( - oauthCallback.getCallbackType())){ - String[] scopes = oauthCallback.getRequestedScope(); - oauthCallback.setApprovedScope(scopes); - oauthCallback.setValidScope(true); - //Add the necessary logic if we are doing the scope validation upon token issue - } - } - - } -} diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedSAML2BearerGrantHandler.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedSAML2BearerGrantHandler.java new file mode 100644 index 0000000000..0ba3d273fb --- /dev/null +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedSAML2BearerGrantHandler.java @@ -0,0 +1,570 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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 org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.joda.time.DateTime; +import org.opensaml.DefaultBootstrap; +import org.opensaml.common.xml.SAMLConstants; +import org.opensaml.saml2.core.Assertion; +import org.opensaml.saml2.core.Audience; +import org.opensaml.saml2.core.AudienceRestriction; +import org.opensaml.saml2.core.Conditions; +import org.opensaml.saml2.core.SubjectConfirmation; +import org.opensaml.security.SAMLSignatureProfileValidator; +import org.opensaml.xml.ConfigurationException; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.security.x509.X509Credential; +import org.opensaml.xml.signature.SignatureValidator; +import org.opensaml.xml.validation.ValidationException; +import org.w3c.dom.NodeList; +import org.wso2.carbon.apimgt.keymgt.issuers.ScopesIssuingHandler; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser; +import org.wso2.carbon.identity.application.common.model.FederatedAuthenticatorConfig; +import org.wso2.carbon.identity.application.common.model.IdentityProvider; +import org.wso2.carbon.identity.application.common.model.Property; +import org.wso2.carbon.identity.application.common.util.IdentityApplicationConstants; +import org.wso2.carbon.identity.application.common.util.IdentityApplicationManagementUtil; +import org.wso2.carbon.identity.base.IdentityConstants; +import org.wso2.carbon.identity.base.IdentityException; +import org.wso2.carbon.identity.core.util.IdentityUtil; +import org.wso2.carbon.identity.oauth.common.OAuthConstants; +import org.wso2.carbon.identity.oauth.config.OAuthServerConfiguration; +import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; +import org.wso2.carbon.identity.oauth2.model.RequestParameter; +import org.wso2.carbon.identity.oauth2.token.OAuthTokenReqMessageContext; +import org.wso2.carbon.identity.oauth2.token.handlers.grant.AbstractAuthorizationGrantHandler; +import org.wso2.carbon.identity.oauth2.token.handlers.grant.saml.SAML2TokenCallbackHandler; +import org.wso2.carbon.identity.oauth2.util.X509CredentialImpl; +import org.wso2.carbon.idp.mgt.IdentityProviderManagementException; +import org.wso2.carbon.idp.mgt.IdentityProviderManager; +import org.wso2.carbon.utils.multitenancy.MultitenantUtils; + +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * This looks up for idp in supertenant space. + */ +@SuppressWarnings("unused") +public class ExtendedSAML2BearerGrantHandler extends AbstractAuthorizationGrantHandler { + private static Log log = LogFactory.getLog(ExtendedSAML2BearerGrantHandler.class); + SAMLSignatureProfileValidator profileValidator = null; + private static final String ASSERTION_IDENTIFIER = "assertion"; + + @Override + public void init() throws IdentityOAuth2Exception { + + super.init(); + + Thread thread = Thread.currentThread(); + ClassLoader loader = thread.getContextClassLoader(); + thread.setContextClassLoader(this.getClass().getClassLoader()); + + try { + DefaultBootstrap.bootstrap(); + } catch (ConfigurationException e) { + log.error("Error in bootstrapping the OpenSAML2 library", e); + throw new IdentityOAuth2Exception("Error in bootstrapping the OpenSAML2 library"); + } finally { + thread.setContextClassLoader(loader); + } + + profileValidator = new SAMLSignatureProfileValidator(); + } + + @Override + public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) { + return ScopesIssuingHandler.getInstance().setScopes(tokReqMsgCtx); + } + + /** + * We're validating the SAML token that we receive from the request. Through the assertion parameter is the POST + * request. A request format that we handle here looks like, + *

+ * POST /token.oauth2 HTTP/1.1 + * Host: as.example.com + * Content-Type: application/x-www-form-urlencoded + *

+ * grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Asaml2-bearer& + * assertion=PHNhbWxwOl...[omitted for brevity]...ZT4 + * + * @param tokReqMsgCtx Token message request context + * @return true if validation is successful, false otherwise + * @throws org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception + */ + @Override + public boolean validateGrant(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { + RequestParameter[] parameters = tokReqMsgCtx.getOauth2AccessTokenReqDTO().getRequestParameters(); + for (RequestParameter parameter : parameters) { + if (ASSERTION_IDENTIFIER.equals(parameter.getKey())) { + tokReqMsgCtx.getOauth2AccessTokenReqDTO().setAssertion(parameter.getValue()[0]); + } + } + + if(!super.validateGrant(tokReqMsgCtx)){ + return false; + } + + Assertion assertion = null; + IdentityProvider identityProvider = null; + String tokenEndpointAlias = null; + String tenantDomain = tokReqMsgCtx.getOauth2AccessTokenReqDTO().getTenantDomain(); + if (tenantDomain == null || "".equals(tenantDomain)) { + tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; + } + + // Logging the SAML token + if (log.isDebugEnabled() && IdentityUtil.isTokenLoggable(IdentityConstants.IdentityTokens.SAML_ASSERTION)) { + log.debug("Received SAML assertion : " + + new String(Base64.decodeBase64(tokReqMsgCtx.getOauth2AccessTokenReqDTO().getAssertion())) + ); + } + + try { + XMLObject samlObject = IdentityUtil.unmarshall(new String(Base64.decodeBase64( + tokReqMsgCtx.getOauth2AccessTokenReqDTO().getAssertion()))); + // Validating for multiple assertions + NodeList assertionList = samlObject.getDOM().getElementsByTagNameNS(SAMLConstants.SAML20_NS, "Assertion"); + if (assertionList.getLength() > 0) { + log.error("Invalid schema for SAML2 Assertion. Nested assertions detected."); + return false; + } + + if (samlObject instanceof Assertion) { + assertion = (Assertion) samlObject; + } else { + log.error("Only Assertion objects are validated in SAML2Bearer Grant Type"); + return false; + } + } catch (IdentityException e) { + // fault in the saml2 assertion + if(log.isDebugEnabled()){ + log.debug("Error while unmashalling the assertion", e); + } + return false; + } + + if (assertion == null) { + log.debug("Assertion is null, cannot continue"); + return false; + } + + /* + The Assertion MUST contain a element. The subject MAY identify the resource owner for whom + the access token is being requested. For client authentication, the Subject MUST be the "client_id" + of the OAuth client. When using an Assertion as an authorization grant, the Subject SHOULD identify + an authorized accessor for whom the access token is being requested (typically the resource owner, or + an authorized delegate). Additional information identifying the subject/principal of the transaction + MAY be included in an . + */ + if (assertion.getSubject() != null) { + String subjectIdentifier = assertion.getSubject().getNameID().getValue(); + if (StringUtils.isBlank(subjectIdentifier)) { + if (log.isDebugEnabled()){ + log.debug("NameID in Assertion cannot be empty"); + } + return false; + } + AuthenticatedUser user = + AuthenticatedUser.createFederateAuthenticatedUserFromSubjectIdentifier(subjectIdentifier); + user.setUserName(MultitenantUtils.getTenantAwareUsername(subjectIdentifier)); + // we take a tenant domain of the authorized user to be the tenant domain of the OAuth app + user.setTenantDomain(tenantDomain); + tokReqMsgCtx.setAuthorizedUser(user); + tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; + } else { + if (log.isDebugEnabled()) { + log.debug("Cannot find a Subject in the Assertion"); + } + return false; + } + + if (assertion.getIssuer() == null || "".equals(assertion.getIssuer().getValue())) { + if (log.isDebugEnabled()) { + log.debug("Issuer is empty in the SAML assertion"); + } + return false; + } else { + try { + identityProvider = IdentityProviderManager.getInstance(). + getIdPByAuthenticatorPropertyValue("IdPEntityId", + assertion.getIssuer().getValue(), tenantDomain, false); + // IF Federated IDP not found get the resident IDP and check, + // resident IDP entityID == issuer + if (identityProvider != null) { + if (IdentityApplicationConstants.RESIDENT_IDP_RESERVED_NAME.equals( + identityProvider.getIdentityProviderName())) { + identityProvider = IdentityProviderManager.getInstance().getResidentIdP(tenantDomain); + + FederatedAuthenticatorConfig[] fedAuthnConfigs = + identityProvider.getFederatedAuthenticatorConfigs(); + String idpEntityId = null; + + // Get SAML authenticator + FederatedAuthenticatorConfig samlAuthenticatorConfig = + IdentityApplicationManagementUtil.getFederatedAuthenticator(fedAuthnConfigs, + IdentityApplicationConstants.Authenticator.SAML2SSO.NAME); + // Get Entity ID from SAML authenticator + Property samlProperty = IdentityApplicationManagementUtil.getProperty( + samlAuthenticatorConfig.getProperties(), + IdentityApplicationConstants.Authenticator.SAML2SSO.IDP_ENTITY_ID); + if (samlProperty != null) { + idpEntityId = samlProperty.getValue(); + } + + if (idpEntityId == null || !assertion.getIssuer().getValue().equals(idpEntityId)) { + if(log.isDebugEnabled()) { + log.debug("SAML Token Issuer verification failed against resident Identity Provider " + + "in tenant : " + tenantDomain + ". Received : " + + assertion.getIssuer().getValue() + ", Expected : " + idpEntityId); + } + return false; + } + + // Get OpenIDConnect authenticator == OAuth + // authenticator + FederatedAuthenticatorConfig oauthAuthenticatorConfig = + IdentityApplicationManagementUtil.getFederatedAuthenticator(fedAuthnConfigs, + IdentityApplicationConstants.Authenticator.OIDC.NAME); + // Get OAuth token endpoint + Property oauthProperty = IdentityApplicationManagementUtil.getProperty( + oauthAuthenticatorConfig.getProperties(), + IdentityApplicationConstants.Authenticator.OIDC.OAUTH2_TOKEN_URL); + if (oauthProperty != null) { + tokenEndpointAlias = oauthProperty.getValue(); + } + } else { + // Get Alias from Federated IDP + tokenEndpointAlias = identityProvider.getAlias(); + } + } else { + if(log.isDebugEnabled()) { + log.debug("SAML Token Issuer : " + assertion.getIssuer().getValue() + + " not registered as a local Identity Provider in tenant : " + tenantDomain); + } + return false; + } + } catch (IdentityProviderManagementException e) { + throw new IdentityOAuth2Exception("Error while getting an Identity Provider for issuer value : " + + assertion.getIssuer().getValue(), e); + } + } + + /* + The Assertion MUST contain element with an element with an + element containing a URI reference that identifies the authorization server, or the service provider + SAML entity of its controlling domain, as an intended audience. The token endpoint URL of the + authorization server MAY be used as an acceptable value for an element. The authorization + server MUST verify that it is an intended audience for the Assertion. + */ + + if (StringUtils.isBlank(tokenEndpointAlias)) { + if (log.isDebugEnabled()){ + String errorMsg = "Token Endpoint alias has not been configured in the Identity Provider : " + + identityProvider.getIdentityProviderName() + " in tenant : " + tenantDomain; + log.debug(errorMsg); + } + return false; + } + + Conditions conditions = assertion.getConditions(); + if (conditions != null) { + //Set validity period extracted from SAML Assertion + long curTimeInMillis = Calendar.getInstance().getTimeInMillis(); + tokReqMsgCtx.setValidityPeriod(conditions.getNotOnOrAfter().getMillis() - curTimeInMillis); + List audienceRestrictions = conditions.getAudienceRestrictions(); + if (audienceRestrictions != null && !audienceRestrictions.isEmpty()) { + boolean audienceFound = false; + for (AudienceRestriction audienceRestriction : audienceRestrictions) { + if (CollectionUtils.isNotEmpty(audienceRestriction.getAudiences())) { + for (Audience audience : audienceRestriction.getAudiences()) { + if (audience.getAudienceURI().equals(tokenEndpointAlias)) { + audienceFound = true; + break; + } + } + } + if (audienceFound) { + break; + } + } + if (!audienceFound) { + if (log.isDebugEnabled()) { + log.debug("SAML Assertion Audience Restriction validation failed against the Audience : " + + tokenEndpointAlias + " of Identity Provider : " + + identityProvider.getIdentityProviderName() + " in tenant : " + tenantDomain); + } + return false; + } + } else { + if (log.isDebugEnabled()) { + String message = "SAML Assertion doesn't contain AudienceRestrictions"; + log.debug(message); + } + return false; + } + } else { + if (log.isDebugEnabled()) { + String message = "SAML Assertion doesn't contain Conditions"; + log.debug(message); + } + return false; + } + + + /* + The Assertion MUST have an expiry that limits the time window during which it can be used. The expiry + can be expressed either as the NotOnOrAfter attribute of the element or as the NotOnOrAfter + attribute of a suitable element. + */ + + /* + The element MUST contain at least one element that allows the + authorization server to confirm it as a Bearer Assertion. Such a element MUST + have a Method attribute with a value of "urn:oasis:names:tc:SAML:2.0:cm:bearer". The + element MUST contain a element, unless the Assertion + has a suitable NotOnOrAfter attribute on the element, in which case the + element MAY be omitted. When present, the element + MUST have a Recipient attribute with a value indicating the token endpoint URL of the authorization + server (or an acceptable alias). The authorization server MUST verify that the value of the Recipient + attribute matches the token endpoint URL (or an acceptable alias) to which the Assertion was delivered. + The element MUST have a NotOnOrAfter attribute that limits the window during + which the Assertion can be confirmed. The element MAY also contain an Address + attribute limiting the client address from which the Assertion can be delivered. Verification of the + Address is at the discretion of the authorization server. + */ + + DateTime notOnOrAfterFromConditions = null; + Map notOnOrAfterFromAndNotBeforeSubjectConfirmations = new HashMap<>(); + boolean bearerFound = false; + List recipientURLS = new ArrayList<>(); + + if (assertion.getConditions() != null && assertion.getConditions().getNotOnOrAfter() != null) { + notOnOrAfterFromConditions = assertion.getConditions().getNotOnOrAfter(); + } + + DateTime notBeforeConditions = null; + if (assertion.getConditions() != null && assertion.getConditions().getNotBefore() != null) { + notBeforeConditions = assertion.getConditions().getNotBefore(); + } + + List subjectConfirmations = assertion.getSubject().getSubjectConfirmations(); + if (subjectConfirmations != null && !subjectConfirmations.isEmpty()) { + for (SubjectConfirmation s : subjectConfirmations) { + if (s.getMethod() != null) { + if (s.getMethod().equals(OAuthConstants.OAUTH_SAML2_BEARER_METHOD)) { + bearerFound = true; + } + } else { + if (log.isDebugEnabled()){ + log.debug("Cannot find Method attribute in SubjectConfirmation " + s.toString()); + } + return false; + } + + if (s.getSubjectConfirmationData() != null) { + if (s.getSubjectConfirmationData().getRecipient() != null) { + recipientURLS.add(s.getSubjectConfirmationData().getRecipient()); + } + if (s.getSubjectConfirmationData().getNotOnOrAfter() != null || s.getSubjectConfirmationData() + .getNotBefore() != null) { + notOnOrAfterFromAndNotBeforeSubjectConfirmations.put(s.getSubjectConfirmationData().getNotOnOrAfter(), + s.getSubjectConfirmationData().getNotBefore()); + } else { + if (log.isDebugEnabled()){ + log.debug("Cannot find NotOnOrAfter and NotBefore attributes in " + + "SubjectConfirmationData " + + s.getSubjectConfirmationData().toString()); + } + } + } else { + if (s.getSubjectConfirmationData() == null && notOnOrAfterFromConditions == null) { + if (log.isDebugEnabled()){ + log.debug("Neither can find NotOnOrAfter attribute in Conditions nor SubjectConfirmationData" + + "in SubjectConfirmation " + s.toString()); + } + return false; + } + + if (s.getSubjectConfirmationData() == null && notBeforeConditions == null) { + if (log.isDebugEnabled()){ + log.debug("Neither can find NotBefore attribute in Conditions nor SubjectConfirmationData" + + "in SubjectConfirmation " + s.toString()); + } + return false; + } + } + } + } else { + if (log.isDebugEnabled()){ + log.debug("No SubjectConfirmation exist in Assertion"); + } + return false; + } + + if (!bearerFound) { + if (log.isDebugEnabled()){ + log.debug("Failed to find a SubjectConfirmation with a Method attribute having : " + + OAuthConstants.OAUTH_SAML2_BEARER_METHOD); + } + return false; + } + + if (CollectionUtils.isNotEmpty(recipientURLS) && !recipientURLS.contains(tokenEndpointAlias)) { + if (log.isDebugEnabled()){ + log.debug("None of the recipient URLs match against the token endpoint alias : " + tokenEndpointAlias + + " of Identity Provider " + identityProvider.getIdentityProviderName() + " in tenant : " + + tenantDomain); + } + return false; + } + + /* + The authorization server MUST verify that the NotOnOrAfter instant has not passed, subject to allowable + clock skew between systems. An invalid NotOnOrAfter instant on the element invalidates + the entire Assertion. An invalid NotOnOrAfter instant on a element only + invalidates the individual . The authorization server MAY reject Assertions with + a NotOnOrAfter instant that is unreasonably far in the future. The authorization server MAY ensure + that Bearer Assertions are not replayed, by maintaining the set of used ID values for the length of + time for which the Assertion would be considered valid based on the applicable NotOnOrAfter instant. + */ + if (notOnOrAfterFromConditions != null && notOnOrAfterFromConditions.compareTo(new DateTime()) < 1) { + // notOnOrAfter is an expired timestamp + if (log.isDebugEnabled()){ + log.debug("NotOnOrAfter is having an expired timestamp in Conditions element"); + } + return false; + } + + if (notBeforeConditions != null && notBeforeConditions.compareTo(new DateTime()) >= 1) { + // notBefore is an early timestamp + if (log.isDebugEnabled()){ + log.debug("NotBefore is having an early timestamp in Conditions element"); + } + return false; + } + + boolean validSubjectConfirmationDataExists = false; + if (!notOnOrAfterFromAndNotBeforeSubjectConfirmations.isEmpty()) { + for (Map.Entry entry : notOnOrAfterFromAndNotBeforeSubjectConfirmations.entrySet()) { + if (entry.getKey() != null) { + if (entry.getKey().compareTo(new DateTime()) >= 1) { + validSubjectConfirmationDataExists = true; + } + } + if (entry.getValue() != null) { + if (entry.getValue().compareTo(new DateTime()) < 1) { + validSubjectConfirmationDataExists = true; + } + } + } + } + + if (notOnOrAfterFromConditions == null && !validSubjectConfirmationDataExists) { + if (log.isDebugEnabled()){ + log.debug("No valid NotOnOrAfter element found in SubjectConfirmations"); + } + return false; + } + + if (notBeforeConditions == null && !validSubjectConfirmationDataExists) { + if (log.isDebugEnabled()){ + log.debug("No valid NotBefore element found in SubjectConfirmations"); + } + return false; + } + + /* + The Assertion MUST be digitally signed by the issuer and the authorization server MUST verify the + signature. + */ + + try { + profileValidator.validate(assertion.getSignature()); + } catch (ValidationException e) { + // Indicates signature did not conform to SAML Signature profile + log.error("Signature do not confirm to SAML signature profile.", e); + + return false; + } + + X509Certificate x509Certificate = null; + try { + x509Certificate = (X509Certificate) IdentityApplicationManagementUtil + .decodeCertificate(identityProvider.getCertificate()); + } catch (CertificateException e) { + throw new IdentityOAuth2Exception("Error occurred while decoding public certificate of Identity Provider " + + identityProvider.getIdentityProviderName() + " for tenant domain " + tenantDomain, e); + } + + try { + X509Credential x509Credential = new X509CredentialImpl(x509Certificate); + SignatureValidator signatureValidator = new SignatureValidator(x509Credential); + signatureValidator.validate(assertion.getSignature()); + if (log.isDebugEnabled()){ + log.debug("Signature validation successful"); + } + } catch (ValidationException e) { + log.error("Error while validating the signature.", e); + return false; + } + + + /* + The authorization server MUST verify that the Assertion is valid in all other respects per + [OASIS.saml-core-2.0-os], such as (but not limited to) evaluating all content within the Conditions + element including the NotOnOrAfter and NotBefore attributes, rejecting unknown condition types, etc. + + [OASIS.saml-core-2.0-os] - http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf + */ + + + // TODO: Throw the SAML request through the general SAML2 validation routines + + tokReqMsgCtx.setScope(tokReqMsgCtx.getOauth2AccessTokenReqDTO().getScope()); + + // Storing the Assertion. This will be used in OpenID Connect for example + tokReqMsgCtx.addProperty(OAuthConstants.OAUTH_SAML2_ASSERTION, assertion); + + // Invoking extension + SAML2TokenCallbackHandler callback = + OAuthServerConfiguration.getInstance() + .getSAML2TokenCallbackHandler(); + if (callback != null) { + if (log.isDebugEnabled()){ + log.debug("Invoking the SAML2 Token callback handler "); + } + callback.handleSAML2Token(tokReqMsgCtx); + } + + return true; + } + +} diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/internal/OAuthExtensionServiceComponent.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/internal/OAuthExtensionServiceComponent.java index dfcdc2dff2..06ee47fcf6 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/internal/OAuthExtensionServiceComponent.java +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/internal/OAuthExtensionServiceComponent.java @@ -21,16 +21,8 @@ package org.wso2.carbon.device.mgt.oauth.extensions.internal; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.apimgt.api.APIManagementException; -import org.wso2.carbon.apimgt.impl.APIConstants; -import org.wso2.carbon.apimgt.impl.APIManagerConfiguration; import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService; import org.wso2.carbon.user.core.service.RealmService; -import org.wso2.carbon.utils.CarbonUtils; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; /** * @scr.component name="org.wso2.carbon.device.mgt.oauth.extensions" immediate="true" @@ -60,36 +52,6 @@ public class OAuthExtensionServiceComponent { if (log.isDebugEnabled()) { log.debug("Starting OAuthExtensionBundle"); } - try { - - APIManagerConfiguration configuration = new APIManagerConfiguration(); - String filePath = new StringBuilder(). - append(CarbonUtils.getCarbonHome()). - append(File.separator). - append(REPOSITORY). - append(File.separator). - append(CONFIGURATION). - append(File.separator). - append(APIM_CONF_FILE).toString(); - - configuration.load(filePath); - // loading white listed scopes - List whiteList; - - // Read scope whitelist from Configuration. - whiteList = configuration.getProperty(APIConstants.WHITELISTED_SCOPES); - - // If whitelist is null, default scopes will be put. - if (whiteList == null) { - whiteList = new ArrayList(); - whiteList.add(APIConstants.OPEN_ID_SCOPE_NAME); - whiteList.add(APIConstants.DEVICE_SCOPE_PATTERN); - } - - OAuthExtensionsDataHolder.getInstance().setWhitelistedScopes(whiteList); - } catch (APIManagementException e) { - log.error("Error occurred while loading DeviceMgtConfig configurations", e); - } } @SuppressWarnings("unused") diff --git a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml index b048e11da7..e970bbc4f5 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml @@ -70,6 +70,10 @@ org.wso2.carbon.identity.inbound.auth.oauth2 org.wso2.carbon.identity.oauth.stub + + commons-codec.wso2 + commons-codec + @@ -104,7 +108,7 @@ org.apache.axis2.transport.http, org.apache.commons.httpclient, org.apache.commons.logging, - org.apache.commons.codec.binary, + org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", org.osgi.framework, org.osgi.service.component, org.wso2.carbon.core.security, diff --git a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml index 829cc7f862..fd6c2a6244 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml @@ -106,6 +106,10 @@ org.wso2.orbit.org.apache.httpcomponents httpclient + + commons-codec.wso2 + commons-codec + @@ -133,7 +137,6 @@ org.osgi.framework, org.osgi.service.component, - org.wso2.carbon.governance.api.*, org.wso2.carbon.context, org.wso2.carbon.registry.core, org.wso2.carbon.registry.core.exceptions, @@ -141,18 +144,15 @@ org.wso2.carbon.utils, org.apache.commons.logging, org.wso2.carbon.registry.core.*;resolution:=optional, - org.wso2.carbon.registry.common.*;version="${carbon.registry.imp.pkg.version.range}", org.wso2.carbon.registry.indexing.*; version="${carbon.registry.imp.pkg.version.range}", com.nimbusds.jwt.*;version="${nimbus.orbit.version.range}", com.nimbusds.jose.*;version="${nimbus.orbit.version.range}", javax.net.ssl, - org.apache.commons.codec.binary, - org.apache.commons.io, + org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", org.apache.http;version="${httpclient.version.range}", org.apache.http.client;version="${httpclient.version.range}", org.apache.http.message;version="${httpclient.version.range}", org.apache.http.client;version="${httpclient.version.range}", - org.apache.http.impl;version="${httpclient.version.range}", org.apache.http.conn.*;version="${httpclient.version.range}", org.apache.http.util;version="${httpclient.version.range}", org.apache.http.client.entity;version="${httpclient.version.range}", diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml index d622aea23f..65ac2299b2 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml @@ -73,10 +73,6 @@ org.osgi.service.component, org.osgi.framework, org.w3c.dom, - org.wso2.carbon.apimgt.api, - org.wso2.carbon.apimgt.core.authenticate, - org.wso2.carbon.apimgt.core.gateway, - org.wso2.carbon.apimgt.impl.dto, org.wso2.carbon.context, org.wso2.carbon.core.util, org.wso2.carbon.identity.base; version="${carbon.identity.imp.pkg.version}", @@ -94,14 +90,13 @@ javax.servlet.http, javax.xml, org.apache.axis2.transport.http, - org.wso2.carbon.apimgt.impl, org.wso2.carbon.certificate.mgt.core.*, org.wso2.carbon.device.mgt.core.permission.mgt, org.wso2.carbon.device.mgt.common, org.wso2.carbon.device.mgt.common.permission.mgt, org.apache.axis2, org.apache.axis2.client, - org.apache.commons.codec.binary, + org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", org.apache.commons.httpclient, org.wso2.carbon.core.security, org.apache.axis2.context, @@ -146,14 +141,6 @@ org.wso2.tomcat tomcat-servlet-api - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.core - - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.impl - org.wso2.carbon org.wso2.carbon.logging @@ -226,6 +213,10 @@ org.wso2.orbit.org.owasp.encoder encoder + + commons-codec.wso2 + commons-codec + diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/AuthenticationFrameworkUtil.java b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/AuthenticationFrameworkUtil.java index 8a44108ee8..3d768ecff4 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/AuthenticationFrameworkUtil.java +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/AuthenticationFrameworkUtil.java @@ -23,12 +23,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.owasp.encoder.Encode; import org.w3c.dom.Document; -import org.wso2.carbon.apimgt.api.APIManagementException; -import org.wso2.carbon.apimgt.core.authenticate.APITokenValidator; -import org.wso2.carbon.apimgt.impl.APIConstants; -import org.wso2.carbon.apimgt.impl.dto.APIKeyValidationInfoDTO; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.webapp.authenticator.framework.Utils.Utils; import javax.servlet.http.HttpServletResponse; import javax.xml.XMLConstants; @@ -48,33 +42,6 @@ public class AuthenticationFrameworkUtil { handleResponse(request, response, HttpServletResponse.SC_FORBIDDEN, msg); } - public static boolean doAuthenticate( - String context, String version, String accessToken, String requiredAuthenticationLevel, - String clientDomain) throws APIManagementException, AuthenticationException { - - if (APIConstants.AUTH_NO_AUTHENTICATION.equals(requiredAuthenticationLevel)) { - return true; - } - APITokenValidator tokenValidator = new APITokenValidator(); - APIKeyValidationInfoDTO apiKeyValidationDTO = tokenValidator.validateKey(context, version, accessToken, - requiredAuthenticationLevel); - if (apiKeyValidationDTO.isAuthorized()) { - String username = apiKeyValidationDTO.getEndUserName(); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(username); -// try { - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(Utils.getTenantIdOFUser(username)); -// } catch (IdentityException e) { -// throw new AuthenticationException("Error occurred while retrieving the tenant ID of user '" + -// username + "'", e); -// } - return true; - } else { - throw new AuthenticationException(apiKeyValidationDTO.getValidationStatus(), - "Access failure for API: " + context + ", version: " + - version + " with key: " + accessToken); - } - } - public static void handleResponse(Request request, Response response, int statusCode, String payload) { response.setStatus(statusCode); String targetResponseContentType = diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml new file mode 100644 index 0000000000..b0e8bad3c2 --- /dev/null +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml @@ -0,0 +1,122 @@ + + + + + + org.wso2.carbon.devicemgt + apimgt-extensions-feature + 2.0.12-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.apimgt.integration.client.feature + 2.0.12-SNAPSHOT + pom + WSO2 Carbon - APIM Integration Client Feature + http://wso2.org + This feature contains a http client implementation to communicate with WSO2-APIM server + + + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.integration.client + + + + + + + maven-resources-plugin + 2.6 + + + copy-resources + generate-resources + + copy-resources + + + src/main/resources + + + resources + + build.properties + p2.inf + + + + + + + + + org.wso2.maven + carbon-p2-plugin + ${carbon.p2.plugin.version} + + + p2-feature-generation + package + + p2-feature-gen + + + org.wso2.carbon.apimgt.integration.client + ../../../features/etc/feature.properties + + + org.wso2.carbon.p2.category.type:server + org.eclipse.equinox.p2.type.group:false + + + + + io.github.openfeign:feign-jackson:${io.github.openfeign.version} + + + io.github.openfeign:feign-core:${io.github.openfeign.version} + + + io.github.openfeign:feign-gson:${io.github.openfeign.version} + + + org.wso2.carbon.devicemgt:org.wso2.carbon.apimgt.integration.client:${project.version} + + + + org.wso2.carbon.core.server:${carbon.kernel.version} + + + + + + + + + + + 1.5.4 + 4.4.10 + 9.3.1 + + + diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/src/main/resources/build.properties b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/src/main/resources/build.properties new file mode 100644 index 0000000000..9c86577d76 --- /dev/null +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/src/main/resources/build.properties @@ -0,0 +1 @@ +custom = true diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/src/main/resources/conf/apim-integration.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/src/main/resources/conf/apim-integration.xml new file mode 100644 index 0000000000..dfabaf24f5 --- /dev/null +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/src/main/resources/conf/apim-integration.xml @@ -0,0 +1,28 @@ + + + + https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.11/register + https://${iot.gateway.host}:${iot.gateway.https.port}/token + https://${iot.apimpublisher.host}:${iot.apimpublisher.https.port}/api/am/publisher/v0.11 + https://${iot.apimstore.host}:${iot.apimstore.https.port}/api/am/store/v0.11 + admin + admin + \ No newline at end of file diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/src/main/resources/p2.inf b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/src/main/resources/p2.inf new file mode 100644 index 0000000000..3dca52fc59 --- /dev/null +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/src/main/resources/p2.inf @@ -0,0 +1,2 @@ +instructions.configure = \ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.apimgt.integration.client_${feature.version}/conf/apim-integration.xml,target:${installFolder}/../../conf/apim-integration.xml,overwrite:true);\ diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index 109316aae8..67e5ef22d6 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -35,6 +35,7 @@ http://wso2.org + org.wso2.carbon.apimgt.integration.client.feature org.wso2.carbon.apimgt.webapp.publisher.feature org.wso2.carbon.apimgt.application.extension.feature org.wso2.carbon.apimgt.handler.server.feature diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml index 4761eddd39..0db5a7563a 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml @@ -52,6 +52,10 @@ org.wso2.carbon.store org.wso2.store.sso.common + + org.wso2.orbit.org.scannotation + scannotation + @@ -81,7 +85,8 @@ javax.servlet.jsp:javax.servlet.jsp-api org.wso2.carbon.store:org.wso2.store.sso.common:${carbon.store.sso.common.version} - + org.wso2.orbit.org.scannotation:scannotation:${scannotation.version} + diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml index 00e3c751b1..6723d7773a 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml @@ -143,9 +143,7 @@ org.wso2.carbon.core.server:${carbon.kernel.version} - org.wso2.carbon.apimgt.core:${carbon.api.mgt.version} - - org.wso2.carbon.device.mgt.extensions:${carbon.device.mgt.version} + org.wso2.carbon.device.mgt.extensions:${carbon.device.mgt.version} org.wso2.carbon.email.sender:${carbon.device.mgt.version} diff --git a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml index 548a46264a..10b18a43b4 100644 --- a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml @@ -53,10 +53,6 @@ org.wso2.carbon.devicemgt org.wso2.carbon.policy.information.point - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.keymgt.client - org.wso2.carbon.registry org.wso2.carbon.registry.indexing @@ -125,7 +121,6 @@ - org.wso2.carbon.apimgt:org.wso2.carbon.apimgt.keymgt.client:${carbon.api.mgt.version} org.wso2.carbon.registry:org.wso2.carbon.registry.indexing:${carbon.registry.version} diff --git a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml index b0ce835dba..6cd51096a4 100644 --- a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml @@ -40,10 +40,6 @@ org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.core - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.core - @@ -97,9 +93,6 @@ org.wso2.carbon.devicemgt:org.wso2.carbon.webapp.authenticator.framework:${carbon.device.mgt.version} - - org.wso2.carbon.apimgt:org.wso2.carbon.apimgt.core:${carbon.api.mgt.version} - diff --git a/pom.xml b/pom.xml index 33d446bb1b..6abdc06097 100644 --- a/pom.xml +++ b/pom.xml @@ -37,11 +37,11 @@ components/device-mgt components/device-mgt-extensions + components/identity-extensions components/apimgt-extensions components/policy-mgt components/certificate-mgt components/webapp-authenticator-framework - components/identity-extensions components/email-sender features/device-mgt features/apimgt-extensions @@ -120,14 +120,6 @@ org.apache.ws.commons.axiom.wso2 axiom - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.api - - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.impl - org.wso2.carbon.identity org.wso2.carbon.identity.oauth.stub @@ -208,6 +200,11 @@ org.wso2.carbon.apimgt.webapp.publisher ${carbon.device.mgt.version} + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.integration.client + ${carbon.device.mgt.version} + org.wso2.carbon.devicemgt org.wso2.carbon.apimgt.annotations @@ -819,223 +816,11 @@ - - - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.api - ${carbon.api.mgt.version} - - - com.googlecode.json-simple.wso2 - json-simple - - - org.wso2.carbon.identity - org.wso2.carbon.user.mgt.stub - - - org.wso2.carbon.identity - org.wso2.carbon.user.mgt - - - - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.keymgt.client - ${carbon.api.mgt.version} - org.wso2.carbon.apimgt org.wso2.carbon.apimgt.keymgt ${carbon.api.mgt.version} - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.impl - ${carbon.api.mgt.version} - - - org.wso2.carbon.identity - org.wso2.carbon.user.mgt.stub - - - org.wso2.carbon.identity - org.wso2.carbon.user.mgt - - - org.wso2.carbon.mediation - org.wso2.carbon.mediation.initializer - - - org.apache.woden.wso2 - woden - - - org.wso2.carbon - org.wso2.carbon.user.core - - - org.wso2.carbon.governance - org.wso2.carbon.governance.api - - - org.wso2.carbon.registry - org.wso2.carbon.registry.ws.client - - - org.wso2.carbon.identity - org.wso2.carbon.identity.core - - - org.wso2.carbon.identity - org.wso2.carbon.identity.oauth - - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.keymgt.client - - - org.apache.poi - poi-ooxml - - - org.wso2.carbon.mediation - org.wso2.carbon.rest.api.stub - - - org.json.wso2 - json - - - com.h2database.wso2 - h2-database-engine - - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.handlers.security.stub - - - org.wso2.carbon.commons - org.wso2.carbon.user.mgt.stub - - - org.wso2.carbon.commons - org.wso2.carbon.um.ws.api - - - org.wso2.carbon.mediation - org.wso2.carbon.mediation.dependency.mgt - - - com.google.code.gson - gson - - - org.wso2.carbon.mediation - org.wso2.carbon.mediation.registry - - - org.apache.httpcomponents - httpmime - - - org.wso2.carbon.commons - org.wso2.carbon.event.core - - - org.wso2.carbon.mediation - org.wso2.carbon.sequences.stub - - - org.wso2.carbon.mediation - org.wso2.carbon.mediation.security.stub - - - org.wso2.carbon.registry - org.wso2.carbon.registry.indexing - - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.keymgt.stub - - - org.wso2.carbon - org.wso2.carbon.securevault - - - com.googlecode.json-simple.wso2 - json-simple - - - org.apache.bsf - bsf-all - - - org.wso2.carbon.registry - org.wso2.carbon.registry.ws.client - - - javax.servlet - servlet-api - - - xerces - xercesImpl - - - io.swagger - swagger-annotations - - - - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.core - ${carbon.api.mgt.version} - - - org.wso2.carbon.identity - org.wso2.carbon.user.mgt.stub - - - org.wso2.carbon.identity - org.wso2.carbon.user.mgt - - - org.wso2.carbon - org.wso2.carbon.core - - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.keymgt.stub - - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.usage.publisher - - - org.wso2.carbon.apimgt - org.wso2.carbon.apimgt.gateway - - - org.wso2.carbon.commons - org.wso2.carbon.databridge.agent.thrift - - - org.wso2.carbon.multitenancy - org.wso2.carbon.tenant.usage.agent - - - org.wso2.carbon.apimgt - org.wso2.carbon.ganalytics.publisher - - - org.wso2.carbon.apimgt - org.wso2.carbon.throttle.core - - - @@ -1114,11 +899,6 @@ - - org.wso2.carbon.identity - org.wso2.carbon.identity.base - ${carbon.identity.framework.version} - org.wso2.carbon.identity.framework org.wso2.carbon.identity.core @@ -1364,6 +1144,7 @@ ${jackson.version} + org.wso2.carbon.commons org.wso2.carbon.ntask.core @@ -1429,6 +1210,11 @@ neethi ${neethi.version} + + commons-codec + commons-codec + ${commons.codec.verision} + commons-pool.wso2 @@ -1570,14 +1356,6 @@ commons-configuration ${commons-configuration.version} - - - org.wso2.carbon.identity - org.wso2.carbon.user.mgt - ${carbon.identity.framework.version} - provided - - io.swagger swagger-annotations @@ -1628,6 +1406,17 @@ jackson-annotations ${jackson-annotations.version} + + org.wso2.orbit.com.fasterxml.jackson.core + jackson-databind + ${jackson-databind.version} + + + + org.wso2.orbit.joda-time + joda-time + ${joda-time.version} + org.wso2.orbit.org.owasp.encoder encoder @@ -1669,6 +1458,46 @@ org.wso2.store.sso.common ${carbon.store.sso.common.version} + + io.github.openfeign + feign-core + ${io.github.openfeign.version} + + + io.github.openfeign + feign-jaxrs + ${io.github.openfeign.version} + + + io.github.openfeign + feign-gson + ${io.github.openfeign.version} + + + io.github.openfeign + feign-jackson + ${io.github.openfeign.version} + + + io.github.openfeign + feign-slf4j + ${io.github.openfeign.version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + ${oltu.client.version} + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson.datatype.joda.version} + + + javassist + javassist + ${javassist.version} + @@ -1962,6 +1791,7 @@ 4.4.8 1.4.0.wso2v1 + [1.4.0,2.0.0) 2.4.0.wso2v1 2.6.0.wso2v1 [2.6.0,3.0.0) @@ -2012,7 +1842,7 @@ 1.0.3.wso2v1 - + [1.0.3, 2.0.0) 1.5.6.wso2v1 4.3.1.wso2v2 @@ -2047,6 +1877,8 @@ 1.0.2 2.6.1.wso2v1 + 2.6.1.wso2v3 + 2.8.2.wso2v1 1.2.0.wso2v1 5.0.2.Final @@ -2067,6 +1899,15 @@ 1.4.4 + + + 9.3.1 + + 1.0.1 + 2.1.5 + 1.9 + (1.9,2.0] + 3.12.1.GA