org.cloudfoundry.client.lib.domain.CloudOrganization Java Examples
The following examples show how to use
org.cloudfoundry.client.lib.domain.CloudOrganization.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OperationsApiServiceImpl.java From multiapps-controller with Apache License 2.0 | 6 votes |
private Operation addServiceParameters(Operation operation, String spaceGuid, String user) { String processDefinitionKey = operationsHelper.getProcessDefinitionKey(operation); Map<String, Object> parameters = new HashMap<>(operation.getParameters()); CloudControllerClient client = getCloudFoundryClient(spaceGuid); CloudSpace space = client.getSpace(UUID.fromString(spaceGuid)); CloudOrganization organization = space.getOrganization(); parameters.put(Constants.VARIABLE_NAME_SERVICE_ID, processDefinitionKey); parameters.put(Variables.USER.getName(), user); parameters.put(Variables.SPACE_NAME.getName(), space.getName()); parameters.put(Variables.SPACE_GUID.getName(), spaceGuid); parameters.put(Variables.ORGANIZATION_NAME.getName(), organization.getName()); parameters.put(Variables.ORGANIZATION_GUID.getName(), organization.getMetadata() .getGuid() .toString()); String namespace = operation.getNamespace(); if (namespace != null) { parameters.put(Variables.MTA_NAMESPACE.getName(), namespace); parameters.put(Variables.APPLY_NAMESPACE.getName(), true); } return ImmutableOperation.copyOf(operation) .withParameters(parameters); }
Example #2
Source File: CloudSpaceBluemixWizardPage.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
private String[] getOrgs() { ArrayList <String> list = new ArrayList<String>(); for (CloudOrganization org : _orgs) { list.add(org.getName()); } return list.toArray(new String[list.size()]); }
Example #3
Source File: UpdateSubscribersStep.java From multiapps-controller with Apache License 2.0 | 5 votes |
private CloudSpace createDummySpace(CloudTarget cloudTarget) { CloudOrganization org = createDummyOrg(cloudTarget.getOrganizationName()); return ImmutableCloudSpace.builder() .name(cloudTarget.getSpaceName()) .organization(org) .build(); }
Example #4
Source File: AuthorizationCheckerTest.java From multiapps-controller with Apache License 2.0 | 5 votes |
private void setUpMocks(boolean hasPermissions, boolean hasAccess, Exception e) { DefaultOAuth2AccessToken accessToken = new DefaultOAuth2AccessToken("testTokenValue"); accessToken.setScope(new HashSet<>()); CloudOrganization organization = ImmutableCloudOrganization.builder() .name(ORG) .build(); CloudSpace space = ImmutableCloudSpace.builder() .name(SPACE) .organization(organization) .build(); ClientHelper clientHelper = Mockito.mock(ClientHelper.class); if (hasAccess) { when(client.getSpace(ORG, SPACE, false)).thenReturn(space); when(clientHelper.computeTarget(SPACE_ID)).thenReturn(new CloudTarget(ORG, SPACE)); } else { when(clientHelper.computeTarget(SPACE_ID)).thenReturn(null); } when(authorizationChecker.getClientHelper(client)).thenReturn(clientHelper); userInfo = new UserInfo(USER_ID.toString(), USERNAME, accessToken); List<UUID> spaceDevelopersList = new ArrayList<>(); if (hasPermissions) { spaceDevelopersList.add(USER_ID); } if (e == null) { when(client.getSpaceDevelopers(ORG, SPACE)).thenReturn(spaceDevelopersList); when(client.getSpaceDevelopers(UUID.fromString(SPACE_ID))).thenReturn(spaceDevelopersList); } else { when(client.getSpaceDevelopers(ORG, SPACE)).thenThrow(e); when(client.getSpaceDevelopers(UUID.fromString(SPACE_ID))).thenThrow(e); } when(clientProvider.getControllerClient(userInfo.getName())).thenReturn(client); when(applicationConfiguration.getFssCacheUpdateTimeoutMinutes()).thenReturn(ApplicationConfiguration.DEFAULT_SPACE_DEVELOPER_CACHE_TIME_IN_SECONDS); }
Example #5
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
/** * Get organization by given name. * * @param organizationName * @param required * @return CloudOrganization instance */ @Override public CloudOrganization getOrganization(String organizationName, boolean required) { CloudOrganization organization = findOrganization(organizationName); if (organization == null && required) { throw new CloudOperationException(HttpStatus.NOT_FOUND, "Not Found", "Organization " + organizationName + " not found."); } return organization; }
Example #6
Source File: RawCloudOrganization.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
@Override public CloudOrganization derive() { Resource<OrganizationEntity> resource = getResource(); OrganizationEntity entity = resource.getEntity(); return ImmutableCloudOrganization.builder() .metadata(parseResourceMetadata(resource)) .name(entity.getName()) .build(); }
Example #7
Source File: ResilientCloudControllerClient.java From multiapps-controller with Apache License 2.0 | 4 votes |
@Override public CloudOrganization getOrganization(String organizationName) { return executeWithRetry(() -> delegate.getOrganization(organizationName)); }
Example #8
Source File: ResilientCloudControllerClient.java From multiapps-controller with Apache License 2.0 | 4 votes |
@Override public CloudOrganization getOrganization(String organizationName, boolean required) { return executeWithRetry(() -> delegate.getOrganization(organizationName, required)); }
Example #9
Source File: ResilientCloudControllerClient.java From multiapps-controller with Apache License 2.0 | 4 votes |
@Override public List<CloudOrganization> getOrganizations() { return executeWithRetry(delegate::getOrganizations, HttpStatus.NOT_FOUND); }
Example #10
Source File: ClientHelperTest.java From multiapps-controller with Apache License 2.0 | 4 votes |
private CloudOrganization createCloudOrganization(String organizationName) { return ImmutableCloudOrganization.builder() .name(organizationName) .build(); }
Example #11
Source File: LoggingCloudControllerClient.java From multiapps-controller with Apache License 2.0 | 4 votes |
@Override public List<CloudOrganization> getOrganizations() { logger.debug(Messages.GETTING_ORGANIZATIONS); return delegate.getOrganizations(); }
Example #12
Source File: LoggingCloudControllerClient.java From multiapps-controller with Apache License 2.0 | 4 votes |
@Override public CloudOrganization getOrganization(String organizationName, boolean required) { logger.debug(Messages.GETTING_ORGANIZATION_0, organizationName); return delegate.getOrganization(organizationName, required); }
Example #13
Source File: LoggingCloudControllerClient.java From multiapps-controller with Apache License 2.0 | 4 votes |
@Override public CloudOrganization getOrganization(String organizationName) { logger.debug(Messages.GETTING_ORGANIZATION_0, organizationName); return delegate.getOrganization(organizationName); }
Example #14
Source File: RestartSubscribersStep.java From multiapps-controller with Apache License 2.0 | 4 votes |
private CloudControllerClient getClientForApplicationSpace(ProcessContext context, CloudApplication app) { CloudSpace space = app.getSpace(); CloudOrganization organization = space.getOrganization(); return context.getControllerClient(organization.getName(), space.getName()); }
Example #15
Source File: UpdateSubscribersStep.java From multiapps-controller with Apache License 2.0 | 4 votes |
private CloudOrganization createDummyOrg(String orgName) { return ImmutableCloudOrganization.builder() .name(orgName) .build(); }
Example #16
Source File: CloudControllerClientImpl.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
@Override public CloudOrganization getOrganization(String organizationName, boolean required) { return handleExceptions(() -> delegate.getOrganization(organizationName, required)); }
Example #17
Source File: RawCloudOrganizationTest.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
private static CloudOrganization buildExpectedOrganization() { return ImmutableCloudOrganization.builder() .metadata(RawCloudEntityTest.EXPECTED_METADATA) .name(ORGANIZATION_NAME) .build(); }
Example #18
Source File: CloudControllerClientImpl.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
@Override public List<CloudOrganization> getOrganizations() { return handleExceptions(() -> delegate.getOrganizations()); }
Example #19
Source File: CloudControllerClientImpl.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
@Override public CloudOrganization getOrganization(String organizationName) { return handleExceptions(() -> delegate.getOrganization(organizationName)); }
Example #20
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
private UUID getOrganizationGuid(String organizationName, boolean required) { CloudOrganization organization = getOrganization(organizationName, required); return organization != null ? organization.getMetadata() .getGuid() : null; }
Example #21
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
private CloudOrganization findOrganization(String name) { return fetch(() -> getOrganizationResourceByName(name), ImmutableRawCloudOrganization::of); }
Example #22
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
private Mono<? extends Derivable<CloudOrganization>> getOrganizationMono(UUID guid) { return fetchMono(() -> getOrganizationResource(guid), ImmutableRawCloudOrganization::of); }
Example #23
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
@Override public List<CloudOrganization> getOrganizations() { return fetchList(this::getOrganizationResources, ImmutableRawCloudOrganization::of); }
Example #24
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
@Override public CloudOrganization getOrganization(String organizationName) { return getOrganization(organizationName, true); }
Example #25
Source File: RawCloudSpace.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
@Nullable public abstract Derivable<CloudOrganization> getOrganization();
Example #26
Source File: CloudControllerClient.java From cf-java-client-sap with Apache License 2.0 | 2 votes |
/** * Get the organization with the specified name. * * @param organizationName name of organization * @return */ CloudOrganization getOrganization(String organizationName);
Example #27
Source File: CloudControllerClient.java From cf-java-client-sap with Apache License 2.0 | 2 votes |
/** * Get all organizations for the current cloud. This method has poor performance when there are a lot of organizations. * * @return list of organizations */ List<CloudOrganization> getOrganizations();
Example #28
Source File: CloudControllerClient.java From cf-java-client-sap with Apache License 2.0 | 2 votes |
/** * Get the organization with the specified name. * * @param organizationName name of organization * @param required if true, and organization is not found, throw an exception * @return */ CloudOrganization getOrganization(String organizationName, boolean required);
Example #29
Source File: CloudControllerRestClient.java From cf-java-client-sap with Apache License 2.0 | votes |
List<CloudOrganization> getOrganizations();
Example #30
Source File: CloudControllerRestClient.java From cf-java-client-sap with Apache License 2.0 | votes |
CloudOrganization getOrganization(String organizationName, boolean required);