Skip to content

Commit 0493ef8

Browse files
committed
Add Gateway Intefaces
1 parent 1b0fc9a commit 0493ef8

File tree

4 files changed

+267
-0
lines changed

4 files changed

+267
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2025, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
3+
*
4+
* WSO2 LLC. licenses this file to you under the Apache License,
5+
* Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an
13+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
* KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations
16+
* under the License.
17+
*/
18+
19+
package org.wso2.carbon.apimgt.api.model;
20+
21+
import java.util.List;
22+
23+
public class GatewayAPIValidationResult {
24+
boolean isValid;
25+
List<String> errors;
26+
27+
public boolean isValid() {
28+
return isValid;
29+
}
30+
31+
public void setValid(boolean valid) {
32+
isValid = valid;
33+
}
34+
35+
public List<String> getErrors() {
36+
return errors;
37+
}
38+
39+
public void setErrors(List<String> errors) {
40+
this.errors = errors;
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (c) 2025, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
3+
*
4+
* WSO2 LLC. licenses this file to you under the Apache License,
5+
* Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an
13+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
* KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations
16+
* under the License.
17+
*/
18+
19+
package org.wso2.carbon.apimgt.api.model;
20+
21+
import java.util.List;
22+
23+
/**
24+
* This Interface providing functionality to register Gateway Agent Related Configurations
25+
*/
26+
public interface GatewayAgentConfiguration {
27+
28+
/**
29+
* This method returns the Gateway Deployer implementation class name
30+
*
31+
* @return gateway deployer implementation class name
32+
*/
33+
String getImplementation();
34+
35+
/**
36+
* Get vendor type of the external gateway
37+
*
38+
* @return String vendor name
39+
*/
40+
String getType();
41+
42+
/**
43+
* This method returns the Configurations related to external gateway
44+
*
45+
* @return List<ConfigurationDto> connectionConfigurations
46+
*/
47+
List<ConfigurationDto> getConnectionConfigurations();
48+
49+
/**
50+
* This method returns the Gateway Feature Catalog
51+
*
52+
* @return String Gateway Feature Catalog
53+
*/
54+
GatewayFeatureCatalog getGatewayFeatureCatalog();
55+
56+
/**
57+
* This method returns the default hostname template of the external gateway
58+
*
59+
* @return String default hostname template
60+
*/
61+
public String getDefaultHostnameTemplate();
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Copyright (c) 2025, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
3+
*
4+
* WSO2 LLC. licenses this file to you under the Apache License,
5+
* Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an
13+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
* KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations
16+
* under the License.
17+
*/
18+
19+
package org.wso2.carbon.apimgt.api.model;
20+
21+
import java.util.HashMap;
22+
import java.util.Map;
23+
24+
/**
25+
* Stores configurations specific for a gateway implementation.
26+
*/
27+
public class GatewayConfiguration {
28+
private String name;
29+
private String type;
30+
private String tenantDomain;
31+
private Map<String, Object> configuration = new HashMap<>();
32+
33+
public void addParameter(String name, Object value) {
34+
35+
configuration.put(name, value);
36+
}
37+
38+
public Object getParameter(String name) {
39+
40+
return configuration.get(name);
41+
}
42+
43+
public void setConfiguration(Map<String, Object> configuration) {
44+
45+
this.configuration = configuration;
46+
}
47+
48+
public Map<String, Object> getConfiguration() {
49+
50+
return configuration;
51+
}
52+
53+
public String getName() {
54+
55+
return name;
56+
}
57+
58+
public void setName(String name) {
59+
60+
this.name = name;
61+
}
62+
63+
public String getType() {
64+
65+
return type;
66+
}
67+
68+
public void setType(String type) {
69+
70+
this.type = type;
71+
}
72+
73+
public String getTenantDomain() {
74+
75+
return tenantDomain;
76+
}
77+
78+
public void setTenantDomain(String tenantDomain) {
79+
80+
this.tenantDomain = tenantDomain;
81+
}
82+
83+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* Copyright (c) 2025, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
3+
*
4+
* WSO2 LLC. licenses this file to you under the Apache License,
5+
* Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an
13+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
* KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations
16+
* under the License.
17+
*/
18+
19+
package org.wso2.carbon.apimgt.api.model;
20+
21+
import org.wso2.carbon.apimgt.api.APIManagementException;
22+
23+
24+
/**
25+
* This Interface is providing functionality of external gateway specific core operations.
26+
* You can implement deploy/undeploy API methods by implementing this interface.
27+
*/
28+
public interface GatewayDeployer {
29+
30+
/**
31+
* Initialize the external gateway deployer
32+
*
33+
* @throws APIManagementException if error occurs when initializing the external gateway deployer
34+
*/
35+
void init(GatewayConfiguration configuration) throws APIManagementException;
36+
37+
/**
38+
* This method returns the type of Gateway
39+
* @return gateway type
40+
*/
41+
String getType();
42+
43+
/**
44+
* Deploy API artifact to provided environment in the external gateway
45+
*
46+
* @param api API to be deployed into in the external gateway
47+
* @param externalReference reference artifact
48+
* @throws APIManagementException if error occurs when deploying APIs to in the external gateway
49+
*/
50+
String deploy(API api, String externalReference) throws APIManagementException;
51+
52+
/**
53+
* Undeploy API artifact from provided environment
54+
*
55+
* @param externalReference reference artifact
56+
* @throws APIManagementException if error occurs when un-deploying APIs from external gateway
57+
*/
58+
boolean undeploy(String externalReference) throws APIManagementException;
59+
60+
/**
61+
* This method returns the validation result of a given API with the external gateway
62+
*
63+
* @return List<String> validation result
64+
*/
65+
GatewayAPIValidationResult validateApi(API api) throws APIManagementException;
66+
67+
/**
68+
* This method returns the resolved API execution URL by replacing all placeholders appropriately
69+
*
70+
* @return String api execution url
71+
*/
72+
String getAPIExecutionURL(String externalReference) throws APIManagementException;
73+
74+
/**
75+
* This method returns refined API by manipulating the API object according to the external gateway requirements
76+
*
77+
* @return API api object
78+
*/
79+
void transformAPI(API api) throws APIManagementException;
80+
}

0 commit comments

Comments
 (0)