@Override public String toString() { return getName() + " (" + (owner != null ? owner.getName() : "-") + ")"; } }
protected void setValues() { orgIDtoSpaces = new HashMap<String, List<CloudSpace>>(); orgIDtoOrg = new HashMap<String, CloudOrganization>(); // Parse the orgs and restructure the spaces per org for quick lookup, // as the original list of spaces is flat and does // not convey the org -> spaces structure. for (CloudSpace clSpace : originalSpaces) { CloudOrganization org = clSpace.getOrganization(); List<CloudSpace> spaces = orgIDtoSpaces.get(org.getName()); if (spaces == null) { spaces = new ArrayList<CloudSpace>(); orgIDtoSpaces.put(org.getName(), spaces); orgIDtoOrg.put(org.getName(), org); } spaces.add(clSpace); } }
@Override public String toString() { return getName() + " (" + (owner != null ? owner.getName() : "-") + ")"; } }
private boolean isSameSpace(CloudSpace space, String orgName, String spaceName) { CloudOrganization org = space.getOrganization(); if (orgName != null && !org.getName() .equals(orgName)) { return false; } return spaceName == null || space.getName() .equals(spaceName); }
private CloudSpace validateSpaceAndOrg(String spaceName, String orgName, CloudControllerClientImpl client) { List<CloudSpace> spaces = client.getSpaces(); for (CloudSpace space : spaces) { if (space.getName().equals(spaceName)) { CloudOrganization org = space.getOrganization(); if (orgName == null || org.getName().equals(orgName)) { return space; } } } throw new IllegalArgumentException("No matching organization and space found for org: " + orgName + " space: " + spaceName); }
private List<ConfigurationSubscription> getConfigurationEntries(List<CloudSpace> clientSpaces, CloudControllerClient client) { return clientSpaces.stream() .map(clientSpace -> configurationSubscriptionsDao.findAll(null, null, computeSpaceId(client, clientSpace.getOrganization() .getName(), clientSpace.getName()), null)) .flatMap(List::stream) .collect(Collectors.toList()); }
private CloudSpace validateSpaceAndOrg(String spaceName, String orgName, CloudControllerRestClientImpl client) { List<CloudSpace> spaces = client.getSpaces(); for (CloudSpace space : spaces) { if (space.getName() .equals(spaceName)) { CloudOrganization org = space.getOrganization(); if (orgName == null || org.getName() .equals(orgName)) { return space; } } } throw new IllegalArgumentException("No matching organization and space found for org: " + orgName + " space: " + "" + spaceName); }
public CloudFoundrySpace(CloudSpace space) { this(space.getOrganization().getName(), space.getName()); this.space = space; }
private void addServiceParameters(Operation operation, String spaceGuid) { String processDefinitionKey = operationsHelper.getProcessDefinitionKey(operation); Map<String, Object> parameters = operation.getParameters(); CloudControllerClient client = getCloudFoundryClient(spaceGuid); CloudSpace space = new CFOptimizedSpaceGetter().getSpace(client, spaceGuid); parameters.put(Constants.VARIABLE_NAME_SPACE_ID, spaceGuid); parameters.put(Constants.VARIABLE_NAME_SERVICE_ID, processDefinitionKey); parameters.put(com.sap.cloud.lm.sl.cf.process.Constants.VAR_ORG, space.getOrganization() .getName()); parameters.put(com.sap.cloud.lm.sl.cf.process.Constants.VAR_SPACE, space.getName()); }
private CloudTarget getCloudTarget(CloudSpace cloudSpace) { return new CloudTarget(cloudSpace.getOrganization() .getName(), cloudSpace.getName()); }
private CloudControllerClient getClientForApplicationSpace(ExecutionWrapper execution, CloudApplication app) { CloudSpace space = app.getSpace(); CloudOrganization organization = space.getOrganization(); return execution.getControllerClient(organization.getName(), space.getName()); }
public Pair<String, String> computeOrgAndSpace(String spaceId) { CloudSpace space = attemptToFindSpace(spaceId); if (space != null) { return new Pair<>(space.getOrganization() .getName(), space.getName()); } return null; }
private CloudControllerClient getClientForApplicationSpace(ExecutionWrapper execution, CloudApplication app) { CloudSpace space = app.getSpace(); CloudOrganization organization = space.getOrganization(); return execution.getControllerClient(organization.getName(), space.getName()); }
protected Pair<CloudControllerClient, TokenProvider> createClient(CloudCredentials credentials, String spaceId) { CloudControllerRestClientFactory factory = new CloudControllerRestClientFactory(null, configuration.shouldSkipSslValidation()); CloudSpace sessionSpace = getSessionSpace(credentials, spaceId); addTaggingInterceptor(factory.getRestTemplate(), sessionSpace.getOrganization() .getName(), sessionSpace.getName()); OauthClient oauthClient = createOauthClient(factory.getRestTemplate()); CloudControllerRestClient controllerClient = factory.newCloudController(configuration.getControllerUrl(), credentials, sessionSpace, oauthClient); return new Pair<>(new ResilientCloudControllerClient(controllerClient), new CloudFoundryTokenProvider(oauthClient)); }