diff --git a/modules/distribution/product/src/main/conf/deployment.toml b/modules/distribution/product/src/main/conf/deployment.toml index 303b25af79..f8f02848bb 100755 --- a/modules/distribution/product/src/main/conf/deployment.toml +++ b/modules/distribution/product/src/main/conf/deployment.toml @@ -52,6 +52,7 @@ key_password = "wso2carbon" [[apim.gateway.environment]] name = "Default" type = "hybrid" +gateway_type = "Regular" provider = "wso2" display_in_api_console = true description = "This is a hybrid gateway that handles both production and sandbox token traffic." diff --git a/modules/distribution/product/src/main/resources/conf/deployment-templates/control-plane.toml b/modules/distribution/product/src/main/resources/conf/deployment-templates/control-plane.toml index ad324ae07a..f7b9025c99 100755 --- a/modules/distribution/product/src/main/resources/conf/deployment-templates/control-plane.toml +++ b/modules/distribution/product/src/main/resources/conf/deployment-templates/control-plane.toml @@ -49,6 +49,7 @@ key_password = "wso2carbon" [[apim.gateway.environment]] name = "Default" type = "hybrid" +gateway_type = "Regular" provider = "wso2" display_in_api_console = true description = "This is a hybrid gateway that handles both production and sandbox token traffic." diff --git a/modules/integration/tests-common/clients/admin/.openapi-generator/admin-api.yaml.sha256 b/modules/integration/tests-common/clients/admin/.openapi-generator/admin-api.yaml.sha256 index 26c6a59b60..ed2bd5a963 100644 --- a/modules/integration/tests-common/clients/admin/.openapi-generator/admin-api.yaml.sha256 +++ b/modules/integration/tests-common/clients/admin/.openapi-generator/admin-api.yaml.sha256 @@ -1 +1 @@ -913b0f99d03f27dee037609be7975aca8be768047cea3b7c8598dd11a5a89a6a \ No newline at end of file +79b51370beba8f507666fe239fea0c86a211fc9f1f8dbf97264d13f09f0c147a \ No newline at end of file diff --git a/modules/integration/tests-common/clients/admin/api/openapi.yaml b/modules/integration/tests-common/clients/admin/api/openapi.yaml index c763656859..954e4215ec 100644 --- a/modules/integration/tests-common/clients/admin/api/openapi.yaml +++ b/modules/integration/tests-common/clients/admin/api/openapi.yaml @@ -7962,6 +7962,18 @@ components: - type title: Throttle Limit type: object + BurstLimit: + properties: + rateLimitCount: + description: Burst control request count + example: 10 + type: integer + rateLimitTimeUnit: + description: Burst control time unit + example: min + type: string + title: Burst Limit object + type: object MonetizationInfo: properties: monetizationPlan: @@ -8346,6 +8358,7 @@ components: endpointURI: default - protocol: default endpointURI: default + gatewayType: Regular isReadOnly: false provider: wso2 displayName: US Region @@ -8393,6 +8406,10 @@ components: provider: example: wso2 type: string + gatewayType: + default: Regular + example: Regular + type: string isReadOnly: example: false readOnly: true @@ -8424,6 +8441,7 @@ components: endpointURI: default - protocol: default endpointURI: default + gatewayType: Regular isReadOnly: false provider: wso2 displayName: US Region @@ -8453,6 +8471,7 @@ components: endpointURI: default - protocol: default endpointURI: default + gatewayType: Regular isReadOnly: false provider: wso2 displayName: US Region @@ -8786,6 +8805,9 @@ components: mask: true defaultScopesClaim: scope type: default + gatewayTypes: + - gatewayTypes + - gatewayTypes scopes: - scopes - scopes @@ -8794,6 +8816,10 @@ components: items: type: string type: array + gatewayTypes: + items: + type: string + type: array keyManagerConfiguration: items: $ref: '#/components/schemas/Settings_keyManagerConfiguration' @@ -8884,6 +8910,11 @@ components: tokenEndpoint: https://localhost:9444/oauth2/token consumerKeyClaim: azp scopesClaim: scp + permissions: + permissionType: ALLOW + roles: + - Internal/subscriber + - Internal/subscriber alias: https://localhost:9443/oauth2/token id: 01234567-0123-0123-0123-012345678901 userInfoEndpoint: https://localhost:9444/oauth2/userinfo?schema=openid @@ -8946,6 +8977,11 @@ components: tokenEndpoint: https://localhost:9444/oauth2/token consumerKeyClaim: azp scopesClaim: scp + permissions: + permissionType: ALLOW + roles: + - Internal/subscriber + - Internal/subscriber alias: https://localhost:9443/oauth2/token id: 01234567-0123-0123-0123-012345678901 userInfoEndpoint: https://localhost:9444/oauth2/userinfo?schema=openid @@ -9104,6 +9140,8 @@ components: Password: admin properties: {} type: object + permissions: + $ref: '#/components/schemas/KeyManager_permissions' tokenType: default: DIRECT description: The type of the tokens to be used (exchanged or without exchanged). @@ -9628,6 +9666,8 @@ components: properties: defaultLimit: $ref: '#/components/schemas/ThrottleLimit' + burstLimit: + $ref: '#/components/schemas/BurstLimit' required: - defaultLimit SubscriptionThrottlePolicy_allOf: @@ -9783,6 +9823,26 @@ components: type: string value: type: string + KeyManager_permissions: + example: + permissionType: ALLOW + roles: + - Internal/subscriber + - Internal/subscriber + properties: + permissionType: + default: PUBLIC + enum: + - PUBLIC + - ALLOW + - DENY + example: ALLOW + type: string + roles: + items: + example: Internal/subscriber + type: string + type: array securitySchemes: OAuth2Security: flows: diff --git a/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/EnvironmentDTO.java b/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/EnvironmentDTO.java index cbdf0e0c78..63557a7f42 100644 --- a/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/EnvironmentDTO.java +++ b/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/EnvironmentDTO.java @@ -54,6 +54,10 @@ public class EnvironmentDTO { @SerializedName(SERIALIZED_NAME_PROVIDER) private String provider; + public static final String SERIALIZED_NAME_GATEWAY_TYPE = "gatewayType"; + @SerializedName(SERIALIZED_NAME_GATEWAY_TYPE) + private String gatewayType = "Regular"; + public static final String SERIALIZED_NAME_IS_READ_ONLY = "isReadOnly"; @SerializedName(SERIALIZED_NAME_IS_READ_ONLY) private Boolean isReadOnly; @@ -185,6 +189,29 @@ public void setProvider(String provider) { } + public EnvironmentDTO gatewayType(String gatewayType) { + + this.gatewayType = gatewayType; + return this; + } + + /** + * Get gatewayType + * @return gatewayType + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Regular", value = "") + + public String getGatewayType() { + return gatewayType; + } + + + public void setGatewayType(String gatewayType) { + this.gatewayType = gatewayType; + } + + public EnvironmentDTO isReadOnly(Boolean isReadOnly) { this.isReadOnly = isReadOnly; @@ -290,6 +317,7 @@ public boolean equals(Object o) { Objects.equals(this.displayName, environment.displayName) && Objects.equals(this.description, environment.description) && Objects.equals(this.provider, environment.provider) && + Objects.equals(this.gatewayType, environment.gatewayType) && Objects.equals(this.isReadOnly, environment.isReadOnly) && Objects.equals(this.vhosts, environment.vhosts) && Objects.equals(this.endpointURIs, environment.endpointURIs) && @@ -298,7 +326,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(id, name, displayName, description, provider, isReadOnly, vhosts, endpointURIs, additionalProperties); + return Objects.hash(id, name, displayName, description, provider, gatewayType, isReadOnly, vhosts, endpointURIs, additionalProperties); } @@ -311,6 +339,7 @@ public String toString() { sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" gatewayType: ").append(toIndentedString(gatewayType)).append("\n"); sb.append(" isReadOnly: ").append(toIndentedString(isReadOnly)).append("\n"); sb.append(" vhosts: ").append(toIndentedString(vhosts)).append("\n"); sb.append(" endpointURIs: ").append(toIndentedString(endpointURIs)).append("\n"); diff --git a/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/SettingsDTO.java b/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/SettingsDTO.java index 0c7fb404f5..2f28a6bd70 100644 --- a/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/SettingsDTO.java +++ b/modules/integration/tests-common/clients/admin/src/gen/java/org/wso2/am/integration/clients/admin/api/dto/SettingsDTO.java @@ -36,6 +36,10 @@ public class SettingsDTO { @SerializedName(SERIALIZED_NAME_SCOPES) private List scopes = null; + public static final String SERIALIZED_NAME_GATEWAY_TYPES = "gatewayTypes"; + @SerializedName(SERIALIZED_NAME_GATEWAY_TYPES) + private List gatewayTypes = null; + public static final String SERIALIZED_NAME_KEY_MANAGER_CONFIGURATION = "keyManagerConfiguration"; @SerializedName(SERIALIZED_NAME_KEY_MANAGER_CONFIGURATION) private List keyManagerConfiguration = null; @@ -68,6 +72,29 @@ public void setScopes(List scopes) { } + public SettingsDTO gatewayTypes(List gatewayTypes) { + + this.gatewayTypes = gatewayTypes; + return this; + } + + /** + * Get gatewayTypes + * @return gatewayTypes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getGatewayTypes() { + return gatewayTypes; + } + + + public void setGatewayTypes(List gatewayTypes) { + this.gatewayTypes = gatewayTypes; + } + + public SettingsDTO keyManagerConfiguration(List keyManagerConfiguration) { this.keyManagerConfiguration = keyManagerConfiguration; @@ -124,13 +151,14 @@ public boolean equals(Object o) { } SettingsDTO settings = (SettingsDTO) o; return Objects.equals(this.scopes, settings.scopes) && + Objects.equals(this.gatewayTypes, settings.gatewayTypes) && Objects.equals(this.keyManagerConfiguration, settings.keyManagerConfiguration) && Objects.equals(this.analyticsEnabled, settings.analyticsEnabled); } @Override public int hashCode() { - return Objects.hash(scopes, keyManagerConfiguration, analyticsEnabled); + return Objects.hash(scopes, gatewayTypes, keyManagerConfiguration, analyticsEnabled); } @@ -139,6 +167,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SettingsDTO {\n"); sb.append(" scopes: ").append(toIndentedString(scopes)).append("\n"); + sb.append(" gatewayTypes: ").append(toIndentedString(gatewayTypes)).append("\n"); sb.append(" keyManagerConfiguration: ").append(toIndentedString(keyManagerConfiguration)).append("\n"); sb.append(" analyticsEnabled: ").append(toIndentedString(analyticsEnabled)).append("\n"); sb.append("}"); diff --git a/modules/integration/tests-common/clients/admin/src/main/resources/admin-api.yaml b/modules/integration/tests-common/clients/admin/src/main/resources/admin-api.yaml index 4cab2802f0..77ea2604cd 100644 --- a/modules/integration/tests-common/clients/admin/src/main/resources/admin-api.yaml +++ b/modules/integration/tests-common/clients/admin/src/main/resources/admin-api.yaml @@ -5153,6 +5153,10 @@ components: provider: type: string example: wso2 + gatewayType: + type: string + example: Regular + default: Regular isReadOnly: type: boolean readOnly: true @@ -5384,6 +5388,10 @@ components: type: array items: type: string + gatewayTypes: + type: array + items: + type: string keyManagerConfiguration: type: array items: diff --git a/modules/integration/tests-common/clients/publisher/.openapi-generator/publisher-api.yaml.sha256 b/modules/integration/tests-common/clients/publisher/.openapi-generator/publisher-api.yaml.sha256 index c1342177fa..0e346abaa5 100644 --- a/modules/integration/tests-common/clients/publisher/.openapi-generator/publisher-api.yaml.sha256 +++ b/modules/integration/tests-common/clients/publisher/.openapi-generator/publisher-api.yaml.sha256 @@ -1 +1 @@ -391b6c495dd81ff0bce5c843cc2eee5079b934390ab6a51a0241e883cb34d575 \ No newline at end of file +51e2f49c8ea45de5a84d917d28a455ab2094d705fe7c9a8f4a6aaa1fdfc80b7f \ No newline at end of file diff --git a/modules/integration/tests-common/clients/publisher/api/openapi.yaml b/modules/integration/tests-common/clients/publisher/api/openapi.yaml index 57e97008bd..ac93a19ed6 100644 --- a/modules/integration/tests-common/clients/publisher/api/openapi.yaml +++ b/modules/integration/tests-common/clients/publisher/api/openapi.yaml @@ -16718,6 +16718,7 @@ components: responseCachingEnabled: true type: HTTP enableSchemaValidation: false + gatewayType: wso2/synapse context: pizza createdTime: createdTime id: 01234567-0123-0123-0123-012345678901 @@ -17314,6 +17315,13 @@ components: example: wso2 title: field to identify gateway vendor type: string + gatewayType: + default: wso2/synapse + description: The gateway type selected for the API policies. Accepts one + of the following. wso2/synapse, wso2/apk. + example: wso2/synapse + title: Field to identify gateway type. + type: string asyncTransportProtocols: description: | Supported transports for the async API (http and/or https). @@ -20421,6 +20429,9 @@ components: websubHttpsPort: 8021 httpsPort: 443 crossTenantSubscriptionEnabled: false + gatewayTypes: + - Regular + - APK defaultSubscriptionPolicy: defaultSubscriptionPolicy securityAuditProperties: '{}' scopes: @@ -20439,6 +20450,13 @@ components: items: $ref: '#/components/schemas/Environment' type: array + gatewayTypes: + example: + - Regular + - APK + items: + type: string + type: array scopes: example: - apim:api_create diff --git a/modules/integration/tests-common/clients/publisher/docs/APIDTO.md b/modules/integration/tests-common/clients/publisher/docs/APIDTO.md index a3a8119b18..076922e1ee 100644 --- a/modules/integration/tests-common/clients/publisher/docs/APIDTO.md +++ b/modules/integration/tests-common/clients/publisher/docs/APIDTO.md @@ -63,6 +63,7 @@ Name | Type | Description | Notes **serviceInfo** | [**APIServiceInfoDTO**](APIServiceInfoDTO.md) | | [optional] **advertiseInfo** | [**AdvertiseInfoDTO**](AdvertiseInfoDTO.md) | | [optional] **gatewayVendor** | **String** | | [optional] +**gatewayType** | **String** | The gateway type selected for the API policies. Accepts one of the following. wso2/synapse, wso2/apk. | [optional] **asyncTransportProtocols** | **List<String>** | Supported transports for the async API (http and/or https). | [optional] diff --git a/modules/integration/tests-common/clients/publisher/docs/SettingsDTO.md b/modules/integration/tests-common/clients/publisher/docs/SettingsDTO.md index a8fd7d8d63..e032466235 100644 --- a/modules/integration/tests-common/clients/publisher/docs/SettingsDTO.md +++ b/modules/integration/tests-common/clients/publisher/docs/SettingsDTO.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **devportalUrl** | **String** | The Developer Portal URL | [optional] **environment** | [**List<EnvironmentDTO>**](EnvironmentDTO.md) | | [optional] +**gatewayTypes** | **List<String>** | | [optional] **scopes** | **List<String>** | | [optional] **monetizationAttributes** | [**List<MonetizationAttributeDTO>**](MonetizationAttributeDTO.md) | | [optional] **securityAuditProperties** | [**Object**](.md) | | [optional] diff --git a/modules/integration/tests-common/clients/publisher/src/gen/java/org/wso2/am/integration/clients/publisher/api/v1/dto/APIDTO.java b/modules/integration/tests-common/clients/publisher/src/gen/java/org/wso2/am/integration/clients/publisher/api/v1/dto/APIDTO.java index 2ccfa175ca..6047437d7f 100644 --- a/modules/integration/tests-common/clients/publisher/src/gen/java/org/wso2/am/integration/clients/publisher/api/v1/dto/APIDTO.java +++ b/modules/integration/tests-common/clients/publisher/src/gen/java/org/wso2/am/integration/clients/publisher/api/v1/dto/APIDTO.java @@ -578,6 +578,10 @@ public EndpointImplementationTypeEnum read(final JsonReader jsonReader) throws I @SerializedName(SERIALIZED_NAME_GATEWAY_VENDOR) private String gatewayVendor; + public static final String SERIALIZED_NAME_GATEWAY_TYPE = "gatewayType"; + @SerializedName(SERIALIZED_NAME_GATEWAY_TYPE) + private String gatewayType = "wso2/synapse"; + public static final String SERIALIZED_NAME_ASYNC_TRANSPORT_PROTOCOLS = "asyncTransportProtocols"; @SerializedName(SERIALIZED_NAME_ASYNC_TRANSPORT_PROTOCOLS) private List asyncTransportProtocols = null; @@ -1891,6 +1895,29 @@ public void setGatewayVendor(String gatewayVendor) { } + public APIDTO gatewayType(String gatewayType) { + + this.gatewayType = gatewayType; + return this; + } + + /** + * The gateway type selected for the API policies. Accepts one of the following. wso2/synapse, wso2/apk. + * @return gatewayType + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "wso2/synapse", value = "The gateway type selected for the API policies. Accepts one of the following. wso2/synapse, wso2/apk.") + + public String getGatewayType() { + return gatewayType; + } + + + public void setGatewayType(String gatewayType) { + this.gatewayType = gatewayType; + } + + public APIDTO asyncTransportProtocols(List asyncTransportProtocols) { this.asyncTransportProtocols = asyncTransportProtocols; @@ -1980,12 +2007,13 @@ public boolean equals(Object o) { Objects.equals(this.serviceInfo, API.serviceInfo) && Objects.equals(this.advertiseInfo, API.advertiseInfo) && Objects.equals(this.gatewayVendor, API.gatewayVendor) && + Objects.equals(this.gatewayType, API.gatewayType) && Objects.equals(this.asyncTransportProtocols, API.asyncTransportProtocols); } @Override public int hashCode() { - return Objects.hash(id, name, description, context, version, provider, lifeCycleStatus, wsdlInfo, wsdlUrl, responseCachingEnabled, cacheTimeout, hasThumbnail, isDefaultVersion, isRevision, revisionedApiId, revisionId, enableSchemaValidation, enableSubscriberVerification, type, audience, transport, tags, policies, apiThrottlingPolicy, authorizationHeader, apiKeyHeader, securityScheme, maxTps, visibility, visibleRoles, visibleTenants, mediationPolicies, apiPolicies, subscriptionAvailability, subscriptionAvailableTenants, additionalProperties, additionalPropertiesMap, monetization, accessControl, accessControlRoles, businessInformation, corsConfiguration, websubSubscriptionConfiguration, workflowStatus, createdTime, lastUpdatedTimestamp, lastUpdatedTime, endpointConfig, endpointImplementationType, scopes, operations, threatProtectionPolicies, categories, keyManagers, serviceInfo, advertiseInfo, gatewayVendor, asyncTransportProtocols); + return Objects.hash(id, name, description, context, version, provider, lifeCycleStatus, wsdlInfo, wsdlUrl, responseCachingEnabled, cacheTimeout, hasThumbnail, isDefaultVersion, isRevision, revisionedApiId, revisionId, enableSchemaValidation, enableSubscriberVerification, type, audience, transport, tags, policies, apiThrottlingPolicy, authorizationHeader, apiKeyHeader, securityScheme, maxTps, visibility, visibleRoles, visibleTenants, mediationPolicies, apiPolicies, subscriptionAvailability, subscriptionAvailableTenants, additionalProperties, additionalPropertiesMap, monetization, accessControl, accessControlRoles, businessInformation, corsConfiguration, websubSubscriptionConfiguration, workflowStatus, createdTime, lastUpdatedTimestamp, lastUpdatedTime, endpointConfig, endpointImplementationType, scopes, operations, threatProtectionPolicies, categories, keyManagers, serviceInfo, advertiseInfo, gatewayVendor, gatewayType, asyncTransportProtocols); } @@ -2050,6 +2078,7 @@ public String toString() { sb.append(" serviceInfo: ").append(toIndentedString(serviceInfo)).append("\n"); sb.append(" advertiseInfo: ").append(toIndentedString(advertiseInfo)).append("\n"); sb.append(" gatewayVendor: ").append(toIndentedString(gatewayVendor)).append("\n"); + sb.append(" gatewayType: ").append(toIndentedString(gatewayType)).append("\n"); sb.append(" asyncTransportProtocols: ").append(toIndentedString(asyncTransportProtocols)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/modules/integration/tests-common/clients/publisher/src/gen/java/org/wso2/am/integration/clients/publisher/api/v1/dto/SettingsDTO.java b/modules/integration/tests-common/clients/publisher/src/gen/java/org/wso2/am/integration/clients/publisher/api/v1/dto/SettingsDTO.java index 13feeaebb1..3837f03ef4 100644 --- a/modules/integration/tests-common/clients/publisher/src/gen/java/org/wso2/am/integration/clients/publisher/api/v1/dto/SettingsDTO.java +++ b/modules/integration/tests-common/clients/publisher/src/gen/java/org/wso2/am/integration/clients/publisher/api/v1/dto/SettingsDTO.java @@ -41,6 +41,10 @@ public class SettingsDTO { @SerializedName(SERIALIZED_NAME_ENVIRONMENT) private List environment = null; + public static final String SERIALIZED_NAME_GATEWAY_TYPES = "gatewayTypes"; + @SerializedName(SERIALIZED_NAME_GATEWAY_TYPES) + private List gatewayTypes = null; + public static final String SERIALIZED_NAME_SCOPES = "scopes"; @SerializedName(SERIALIZED_NAME_SCOPES) private List scopes = null; @@ -124,6 +128,29 @@ public void setEnvironment(List environment) { } + public SettingsDTO gatewayTypes(List gatewayTypes) { + + this.gatewayTypes = gatewayTypes; + return this; + } + + /** + * Get gatewayTypes + * @return gatewayTypes + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "[\"Regular\",\"APK\"]", value = "") + + public List getGatewayTypes() { + return gatewayTypes; + } + + + public void setGatewayTypes(List gatewayTypes) { + this.gatewayTypes = gatewayTypes; + } + + public SettingsDTO scopes(List scopes) { this.scopes = scopes; @@ -342,6 +369,7 @@ public boolean equals(Object o) { SettingsDTO settings = (SettingsDTO) o; return Objects.equals(this.devportalUrl, settings.devportalUrl) && Objects.equals(this.environment, settings.environment) && + Objects.equals(this.gatewayTypes, settings.gatewayTypes) && Objects.equals(this.scopes, settings.scopes) && Objects.equals(this.monetizationAttributes, settings.monetizationAttributes) && Objects.equals(this.securityAuditProperties, settings.securityAuditProperties) && @@ -355,7 +383,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(devportalUrl, environment, scopes, monetizationAttributes, securityAuditProperties, externalStoresEnabled, docVisibilityEnabled, crossTenantSubscriptionEnabled, defaultAdvancePolicy, defaultSubscriptionPolicy, authorizationHeader); + return Objects.hash(devportalUrl, environment, gatewayTypes, scopes, monetizationAttributes, securityAuditProperties, externalStoresEnabled, docVisibilityEnabled, crossTenantSubscriptionEnabled, defaultAdvancePolicy, defaultSubscriptionPolicy, authorizationHeader); } @@ -365,6 +393,7 @@ public String toString() { sb.append("class SettingsDTO {\n"); sb.append(" devportalUrl: ").append(toIndentedString(devportalUrl)).append("\n"); sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); + sb.append(" gatewayTypes: ").append(toIndentedString(gatewayTypes)).append("\n"); sb.append(" scopes: ").append(toIndentedString(scopes)).append("\n"); sb.append(" monetizationAttributes: ").append(toIndentedString(monetizationAttributes)).append("\n"); sb.append(" securityAuditProperties: ").append(toIndentedString(securityAuditProperties)).append("\n"); diff --git a/modules/integration/tests-common/clients/publisher/src/main/resources/publisher-api.yaml b/modules/integration/tests-common/clients/publisher/src/main/resources/publisher-api.yaml index e1fde0a44c..783da3744e 100644 --- a/modules/integration/tests-common/clients/publisher/src/main/resources/publisher-api.yaml +++ b/modules/integration/tests-common/clients/publisher/src/main/resources/publisher-api.yaml @@ -9386,6 +9386,13 @@ components: type: string example: wso2 + gatewayType: + title: Field to identify gateway type. + type: string + description: The gateway type selected for the API policies. Accepts one of the + following. wso2/synapse, wso2/apk. + example: wso2/synapse + default: wso2/synapse asyncTransportProtocols: type: array description: | @@ -11762,6 +11769,13 @@ components: type: array items: $ref: '#/components/schemas/Environment' + gatewayTypes: + type: array + example: + - Regular + - APK + items: + type: string scopes: type: array example: diff --git a/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/impl/DtoFactory.java b/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/impl/DtoFactory.java index 9f34f434e1..71685be9ee 100644 --- a/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/impl/DtoFactory.java +++ b/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/impl/DtoFactory.java @@ -435,14 +435,15 @@ public static LabelDTO createLabelDTO(String name, String description, List vhosts) { + provider, boolean isReadOnly, List vhosts, String gatewayType) { return new EnvironmentDTO() .name(name) .displayName(displayName) .description(description) .provider(provider) .isReadOnly(isReadOnly) - .vhosts(vhosts); + .vhosts(vhosts) + .gatewayType(gatewayType); } /** diff --git a/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/impl/RestAPIPublisherImpl.java b/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/impl/RestAPIPublisherImpl.java index 3627d8926b..f5cff0eb03 100644 --- a/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/impl/RestAPIPublisherImpl.java +++ b/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/impl/RestAPIPublisherImpl.java @@ -336,6 +336,9 @@ public APIDTO addAPI(APIRequest apiRequest, String osVersion) throws ApiExceptio body.setTransport(transports); body.isDefaultVersion(false); body.setCacheTimeout(100); + if (apiRequest.getGatewayType() != null) { + body.setGatewayType(apiRequest.getGatewayType()); + } if (apiRequest.getOperationsDTOS() != null) { body.setOperations(apiRequest.getOperationsDTOS()); } else { diff --git a/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/utils/bean/APIRequest.java b/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/utils/bean/APIRequest.java index 3655e27c28..a9b82ea73b 100644 --- a/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/utils/bean/APIRequest.java +++ b/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/utils/bean/APIRequest.java @@ -84,6 +84,15 @@ public class APIRequest extends AbstractRequest { private List apiCategories; private List keyManagers; private String subscriptionAvailability; + private String gatewayType; + + public String getGatewayType() { + return gatewayType; + } + + public void setGatewayType(String gatewayType) { + this.gatewayType = gatewayType; + } public List getVisibleTenants() { diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/api/APICreationTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/api/APICreationTestCase.java index 1a5fc0e4ab..ea416f595e 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/api/APICreationTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/api/APICreationTestCase.java @@ -18,6 +18,8 @@ package org.wso2.am.integration.tests.api; +import org.codehaus.plexus.util.StringUtils; +import org.json.JSONObject; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; @@ -35,10 +37,14 @@ import java.util.Arrays; import java.util.List; +import static org.testng.Assert.assertTrue; + public class APICreationTestCase extends APIManagerLifecycleBaseTest { private final String API_END_POINT_POSTFIX_URL = "jaxrs_basic/services/customers/customerservice/"; private String apiEndpointUrl; private String apiId; + private String apiIdAPK; + private String apiIdSynapse; @Factory(dataProvider = "userModeDataProvider") public APICreationTestCase(TestUserMode userMode) { @@ -84,6 +90,48 @@ public void testCreateAndDeployApiWithMutualSSLEnabled() throws Exception { Assert.assertNotNull(revisionUUID); } + @Test(groups = {"wso2.am"}, description = "Test deployment of API with Mutual SSL enabled") + public void testCreateAndDeployApiWithGatewayType() throws Exception { + // Create API with gateway type APK + APIRequest apiRequest; + apiRequest = new APIRequest("APKGatewayAPI1", "apkgateway", new URL(apiEndpointUrl)); + apiRequest.setVersion(API_VERSION_1_0_0); + apiRequest.setTier(APIMIntegrationConstants.API_TIER.UNLIMITED); + apiRequest.setProvider(user.getUserName()); + apiRequest.setGatewayType("wso2/apk"); + HttpResponse apiResponse = restAPIPublisher.addAPI(apiRequest); + apiIdAPK = apiResponse.getData(); + String revisionUUID = createAPIRevisionAndDeployUsingRest(apiIdAPK, restAPIPublisher); + Assert.assertNotNull(revisionUUID); + + // Verify the API in API Publisher + HttpResponse apiDto = restAPIPublisher.getAPI(apiIdAPK); + assertTrue(StringUtils.isNotEmpty(apiDto.getData()), + "Added Api is not available in APi Publisher. API ID " + apiId); + JSONObject apiResponseData = new JSONObject(apiDto.getData()); + String addedGatewayType = apiResponseData.getString("gatewayType"); + Assert.assertEquals(addedGatewayType, "wso2/apk", "Gateway type is not set as expected"); + + // Create API with gateway type Synapse + apiRequest = new APIRequest("SynapseGatewayAPI1", "synapsegateway", new URL(apiEndpointUrl)); + apiRequest.setVersion(API_VERSION_1_0_0); + apiRequest.setTier(APIMIntegrationConstants.API_TIER.UNLIMITED); + apiRequest.setProvider(user.getUserName()); + apiRequest.setGatewayType("wso2/synapse"); + apiResponse = restAPIPublisher.addAPI(apiRequest); + apiIdSynapse = apiResponse.getData(); + revisionUUID = createAPIRevisionAndDeployUsingRest(apiIdSynapse, restAPIPublisher); + Assert.assertNotNull(revisionUUID); + + // Verify the API in API Publisher + apiDto = restAPIPublisher.getAPI(apiIdSynapse); + assertTrue(StringUtils.isNotEmpty(apiDto.getData()), + "Added Api is not available in APi Publisher. API ID " + apiId); + apiResponseData = new JSONObject(apiDto.getData()); + addedGatewayType = apiResponseData.getString("gatewayType"); + Assert.assertEquals(addedGatewayType, "wso2/synapse", "Gateway type is not set as expected"); + } + @AfterClass(alwaysRun = true) public void cleanUpArtifacts() throws Exception { diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/restapi/admin/EnvironmentTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/restapi/admin/EnvironmentTestCase.java index c9769b94e9..a6a8eea37f 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/restapi/admin/EnvironmentTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/restapi/admin/EnvironmentTestCase.java @@ -100,7 +100,7 @@ public void testAddGatewayEnvironmentWithoutVHost() throws Exception { String provider = Constants.WSO2_GATEWAY_ENVIRONMENT; List vHostDTOList = new ArrayList<>(); environmentDTO = DtoFactory.createEnvironmentDTO(name, displayName, description, provider, - false, vHostDTOList); + false, vHostDTOList, null); //Add the environment try { @@ -123,7 +123,7 @@ public void testAddingGatewayEnvironmentNameWithSpecialCharacters() throws Excep vHostDTOList.add(DtoFactory.createVhostDTO("foods.com", "zfoods", 8280, 8243, 9099, 8099)); environmentDTO = DtoFactory.createEnvironmentDTO(name, displayName, description, provider, - false, vHostDTOList); + false, vHostDTOList, null); //Add the environment try { restAPIAdmin.addEnvironment(environmentDTO); @@ -144,7 +144,7 @@ public void testAddingGatewayEnvironmentWithoutDisplayName() throws Exception { vHostDTOList.add(DtoFactory.createVhostDTO("foods.com", "zfoods", 8280, 8243, 9099, 8099)); environmentDTO = DtoFactory.createEnvironmentDTO(name, displayName, description, provider, - false, vHostDTOList); + false, vHostDTOList, null); //Able to add the environment successfully ApiResponse addedEnvironments = restAPIAdmin.addEnvironment(environmentDTO); @@ -155,8 +155,34 @@ public void testAddingGatewayEnvironmentWithoutDisplayName() throws Exception { Assert.assertNotNull(environmentId, "The environment ID cannot be null or empty"); } - @Test(groups = {"wso2.am"}, description = "Test adding gateway environment with multiple Vhosts with same hostname", + @Test(groups = {"wso2.am"}, description = "Test adding gateway environment with Gateway Type configured", dependsOnMethods = "testAddingGatewayEnvironmentWithoutDisplayName") + public void testAddingGatewayEnvironmentWithGatewayType() throws Exception { + //Create the environment DTO + String name = "asia-region-gateway-type"; + String displayName = "Asia Region"; + String description = "Gateway environment deployed in Asia region"; + String provider = Constants.WSO2_GATEWAY_ENVIRONMENT; + String gatewayType = "APK"; + List vHostDTOList = new ArrayList<>(); + vHostDTOList.add(DtoFactory.createVhostDTO("foods.com", "zfoods", + 8280, 8243, null, null)); + environmentDTO = DtoFactory.createEnvironmentDTO(name, displayName, description, provider, + false, vHostDTOList, gatewayType); + //Able to add the environment successfully + ApiResponse addedEnvironments = restAPIAdmin.addEnvironment(environmentDTO); + + //Assert the status code and environment ID + Assert.assertEquals(addedEnvironments.getStatusCode(), HttpStatus.SC_CREATED); + EnvironmentDTO addedEnvironmentDTO = addedEnvironments.getData(); + String environmentId = addedEnvironmentDTO.getId(); + Assert.assertNotNull(environmentId, "The environment ID cannot be null or empty"); + String addedGatewayType = addedEnvironmentDTO.getGatewayType(); + Assert.assertEquals(addedGatewayType, gatewayType, "The added gateway type is not matching with the expected"); + } + + @Test(groups = {"wso2.am"}, description = "Test adding gateway environment with multiple Vhosts with same hostname", + dependsOnMethods = "testAddingGatewayEnvironmentWithGatewayType") public void testAddingGatewayEnvironmentWithMultipleVhostsWithSameHostName() throws Exception { //Create the environment DTO String name = "asia-region"; @@ -169,7 +195,7 @@ public void testAddingGatewayEnvironmentWithMultipleVhostsWithSameHostName() thr vHostDTOList.add(DtoFactory.createVhostDTO("foods.com", "zfoods", 8280, 8243, 9099, 8099)); environmentDTO = DtoFactory.createEnvironmentDTO(name, displayName, description, provider, - false, vHostDTOList); + false, vHostDTOList, null); //Add the environment try { restAPIAdmin.addEnvironment(environmentDTO); @@ -190,7 +216,7 @@ public void testAddingGatewayEnvironmentWithVhostsHavingSpecialCharacters() thro vHostDTOList.add(DtoFactory.createVhostDTO("foods.com#$%?", "zfoods", 8280, 8243, 9099, 8099)); environmentDTO = DtoFactory.createEnvironmentDTO(name, displayName, description, provider, - false, vHostDTOList); + false, vHostDTOList, null); //Add the environment try { restAPIAdmin.addEnvironment(environmentDTO); @@ -211,7 +237,7 @@ public void testAddGatewayEnvironmentSingleVHost() throws Exception { vHostDTOList.add(DtoFactory.createVhostDTO("foods.com", "zfoods", 8280, 8243, 9099, 8099)); environmentDTO = DtoFactory.createEnvironmentDTO(name, displayName, description, provider, - false, vHostDTOList); + false, vHostDTOList, null); //Add the environment ApiResponse addedEnvironments = restAPIAdmin.addEnvironment(environmentDTO); @@ -250,7 +276,7 @@ public void testAddGatewayEnvironmentMultipleVHosts() throws Exception { List vHostDTOList = new ArrayList<>(); vHostDTOList.add(DtoFactory.createVhostDTO("us.mg.wso2.com", "", 80, 443, 9099, 8099)); vHostDTOList.add(DtoFactory.createVhostDTO("foods.com", "zfoods", 8280, 8243, 9099, 8099)); - environmentDTO = DtoFactory.createEnvironmentDTO(name, displayName, description, provider, false, vHostDTOList); + environmentDTO = DtoFactory.createEnvironmentDTO(name, displayName, description, provider, false, vHostDTOList, null); //Add the environment ApiResponse addedEnvironments = restAPIAdmin.addEnvironment(environmentDTO); @@ -454,7 +480,7 @@ private EnvironmentDTO getConfiguredGatewayEnvironment() { "This is a hybrid gateway that handles both production and sandbox token traffic.", Constants.WSO2_GATEWAY_ENVIRONMENT, true, - Collections.singletonList(vhostDTO) + Collections.singletonList(vhostDTO), "Regular" ); configuredEnv.setId(Constants.GATEWAY_ENVIRONMENT); return configuredEnv;