Skip to content

Commit 55bc4bc

Browse files
author
axway
committed
Merge branch 'develop'
2 parents 72cb083 + 76da3e5 commit 55bc4bc

File tree

23 files changed

+828
-277
lines changed

23 files changed

+828
-277
lines changed

.github/workflows/integration-test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ name: APIM CLI Integration Tests
33
on: [push]
44

55
env:
6-
CASSANDRA_DOCKER_IMAGE: cassandra:4.1.6
7-
APIM_DOCKER_IMAGE: docker.repository.axway.com/apigateway-docker-prod/7.7/gateway:7.7.0.20240830-4-BN0145-ubi9
8-
CACHE_FILE_APIM: api-manager_7_7_20240830.cache.tar
9-
CACHE_FILE_CASSANDRA: cassandra_4_1_6.cache.tar
10-
FED_FILE: swagger-promote-7.7-20240830.fed
6+
CASSANDRA_DOCKER_IMAGE: cassandra:4.1.9
7+
APIM_DOCKER_IMAGE: docker.repository.axway.com/apigateway-docker-prod/7.7/gateway:7.7.0.20250228-3-BN0214-ubi9
8+
CACHE_FILE_APIM: api-manager_7_7_20250228.cache.tar
9+
CACHE_FILE_CASSANDRA: cassandra_4_1_9.cache.tar
10+
FED_FILE: swagger-promote-7.7-20250228.fed
1111
LOG_LEVEL: debug
1212

1313
jobs:

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

77

8+
# [1.14.11] 2025-08-25
9+
10+
### Fixed
11+
- Exporting multiple APIs with the same path overwrites configuration files in the same target directory (See issue [#534](https://github.com/Axway-API-Management-Plus/apim-cli/issues/545))
12+
- apim api get doesn't give the list of APIs (See issue [#534](https://github.com/Axway-API-Management-Plus/apim-cli/issues/543))
13+
14+
### Added
15+
- Full export API in JSON file (See issue [#534](https://github.com/Axway-API-Management-Plus/apim-cli/issues/559))
16+
- Support may 2025 APIM release (See issue [#534](https://github.com/Axway-API-Management-Plus/apim-cli/issues/562))
17+
- Support OpenAPI 3.1.x (See issue [#534](https://github.com/Axway-API-Management-Plus/apim-cli/issues/537))
18+
819
# [1.14.11] 2025-02-26
920

1021
### Fixed

modules/apim-adapter/src/main/java/com/axway/apim/adapter/APIManagerAdapter.java

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
import com.axway.apim.adapter.client.apps.APIMgrAppsAdapter;
55
import com.axway.apim.adapter.custom.properties.APIManagerCustomPropertiesAdapter;
66
import com.axway.apim.adapter.user.APIManagerUserAdapter;
7-
import com.axway.apim.api.model.CaCert;
8-
import com.axway.apim.api.model.Config;
9-
import com.axway.apim.api.model.Image;
10-
import com.axway.apim.api.model.User;
7+
import com.axway.apim.api.model.*;
118
import com.axway.apim.api.model.apps.ClientApplication;
129
import com.axway.apim.lib.APIMCLICacheManager;
1310
import com.axway.apim.lib.CoreParameters;
@@ -232,19 +229,42 @@ public void loginToAPIManager() throws AppException {
232229
}
233230
User user = getCurrentUser();
234231
String role = getHigherRole(user);
235-
if (role.equals(ADMIN)) {
236-
hasAdminAccount = true;
237-
// Also register this client as an Admin-Client
238-
} else if (role.equals(OADMIN)) {
239-
usingOrgAdmin = true;
240-
}
232+
assignRoles(role);
241233
} catch (IOException | URISyntaxException e) {
242234
throw new AppException("Can't login to API-Manager", ErrorCode.API_MANAGER_COMMUNICATION, e);
243235
} catch (InterruptedException e) {
244236
Thread.currentThread().interrupt();
245237
}
246238
}
247239

240+
public void assignRoles(String role) {
241+
if (role.equals(ADMIN)) {
242+
hasAdminAccount = true;
243+
// Also register this client as an Admin-Client
244+
} else if (role.equals(OADMIN)) {
245+
usingOrgAdmin = true;
246+
}
247+
}
248+
249+
public void switchOrgAndRole(User user, String targetOrgName) {
250+
Map<String, String> organizationsIdToName = user.getOrgs2Name();
251+
if (organizationsIdToName == null)
252+
return;
253+
254+
for (Map.Entry<String,String> entry : organizationsIdToName.entrySet()) {
255+
String orgName = entry.getValue();
256+
if (orgName.equals(targetOrgName)) {
257+
String role = user.getOrgs2Role().get(entry.getKey());
258+
// Reset roles
259+
hasAdminAccount = false;
260+
usingOrgAdmin = false;
261+
// Assign roles
262+
assignRoles(role);
263+
}
264+
}
265+
266+
}
267+
248268
public String getHigherRole(User user) {
249269
String role = user.getRole();
250270
Map<String, String> organizations2Role = user.getOrgs2Role();

modules/apim-adapter/src/main/java/com/axway/apim/adapter/apis/APIFilter.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public enum FILTER_OP {
6767
private List<String> customProperties;
6868
private boolean deprecated;
6969
private boolean retired;
70+
private String organizationId; // To support multi org
7071

7172
private METHOD_TRANSLATION translateMethodMode = METHOD_TRANSLATION.NONE;
7273

@@ -923,4 +924,14 @@ private static boolean isPolicyUsed(API api, String policyName) {
923924
}
924925
return false;
925926
}
927+
928+
public String getOrganizationId() {
929+
return organizationId;
930+
}
931+
932+
public void setOrganizationId(String organizationId) {
933+
this.organizationId = organizationId;
934+
if (organizationId == null) return;
935+
filters.add(new BasicNameValuePair("organizationId", organizationId));
936+
}
926937
}

modules/apim-adapter/src/main/java/com/axway/apim/adapter/apis/APIManagerAPIAdapter.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.axway.apim.api.specification.APISpecification.APISpecType;
1414
import com.axway.apim.api.specification.APISpecificationFactory;
1515
import com.axway.apim.lib.CoreParameters;
16+
import com.axway.apim.lib.EnvironmentProperties;
1617
import com.axway.apim.lib.error.AppException;
1718
import com.axway.apim.lib.error.ErrorCode;
1819
import com.axway.apim.lib.utils.Constants;
@@ -104,8 +105,9 @@ public List<API> getAPIs(APIFilter filter, boolean logProgress) throws AppExcept
104105
addImageFromAPIM(api, filter.isIncludeImage());
105106
addRemoteHost(api, filter.isIncludeRemoteHost());
106107
addMethods(api, filter.isIncludeMethods());
107-
if (logProgress && apis.size() > 5)
108+
if (logProgress && apis.size() > 5 && !EnvironmentProperties.PRINT_CONFIG_CONSOLE) {
108109
Utils.progressPercentage(i, apis.size(), "Loading details of " + apis.size() + " APIs");
110+
}
109111
}
110112
Utils.addCustomPropertiesForEntity(apis, this.apiManagerResponse.get(filter), filter);
111113
if (logProgress && apis.size() > 5) Console.print("\n");
@@ -223,6 +225,7 @@ public String getVersion(APIFilter apiFilter) {
223225
}
224226

225227
private List<API> filterAPIs(APIFilter filter) throws IOException {
228+
LOG.debug("Filtering APIs based on filter path: {}", filter);
226229
List<API> apis = mapper.readValue(this.apiManagerResponse.get(filter), new TypeReference<>() {
227230
});
228231
apis.removeIf(filter::filter);
@@ -616,16 +619,16 @@ public String[] getSerializeAllExcept() throws AppException {
616619
} else {
617620
serializeAllExcept = new String[]{"queryStringPassThrough", "apiDefinition", "certFile", "useForInbound", "useForOutbound", "organization", "applications", "image", "clientOrganizations", "applicationQuota", "systemQuota", "backendBasepath", "remoteHost"};
618621
}
619-
LOG.debug("serializeAllExcept={}", Arrays.asList(serializeAllExcept));
622+
LOG.debug("serializeAllExcept={}", Arrays.asList(serializeAllExcept));
620623
return serializeAllExcept;
621624
}
622625

623626
private boolean isAPIManagerVersionGreaterThan7720220530(String apiManagerVersion) {
624627
try {
625628
apiManagerVersion = apiManagerVersion.replace("7.7.", "");
626-
LOG.debug("apiManagerVersion for conversion: {}",apiManagerVersion);
629+
LOG.debug("apiManagerVersion for conversion: {}", apiManagerVersion);
627630
return (Integer.parseInt(apiManagerVersion) >= 20220530);
628-
} catch (NumberFormatException nfe){
631+
} catch (NumberFormatException nfe) {
629632
LOG.warn("Failed to convert API Manager version to integer: {}, returning false", apiManagerVersion);
630633
return false;
631634
}

0 commit comments

Comments
 (0)