org.cloudfoundry.client.lib.domain.CloudDomain Java Examples
The following examples show how to use
org.cloudfoundry.client.lib.domain.CloudDomain.
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: CloudEntityResourceMapper.java From multiapps-controller with Apache License 2.0 | 6 votes |
public CloudRoute mapRouteResource(Map<String, Object> resource) { @SuppressWarnings("unchecked") List<Object> apps = getResourceAttribute(resource, "apps", List.class); String host = getResourceAttribute(resource, "host", String.class); String path = getResourceAttribute(resource, "path", String.class); boolean hasBoundService = getResourceAttribute(resource, "service_instance_guid", String.class) != null; CloudDomain domain = mapDomainResource(getEmbeddedResource(resource, "domain")); return ImmutableCloudRoute.builder() .metadata(getMetadata(resource)) .host(host) .domain(domain) .path(path) .appsUsingRoute(apps.size()) .hasServiceUsingRoute(hasBoundService) .build(); }
Example #2
Source File: AddDomainsStep.java From multiapps-controller with Apache License 2.0 | 6 votes |
@Override protected StepPhase executeStep(ProcessContext context) { List<String> customDomains = context.getVariable(Variables.CUSTOM_DOMAINS); getStepLogger().debug("Custom domains: " + customDomains); if (customDomains.isEmpty()) { return StepPhase.DONE; } getStepLogger().debug(Messages.ADDING_DOMAINS); CloudControllerClient client = context.getControllerClient(); List<CloudDomain> existingDomains = client.getDomains(); List<String> existingDomainNames = getDomainNames(existingDomains); getStepLogger().debug("Existing domains: " + existingDomainNames); addDomains(client, customDomains, existingDomainNames); getStepLogger().debug(Messages.DOMAINS_ADDED); return StepPhase.DONE; }
Example #3
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 6 votes |
/** * Delete routes that do not have any application which is assigned to them. * * @return deleted routes or an empty list if no routes have been found */ @Override public List<CloudRoute> deleteOrphanedRoutes() { List<CloudRoute> orphanRoutes = new ArrayList<>(); for (CloudDomain domain : getDomainsForOrganization()) { orphanRoutes.addAll(fetchOrphanRoutes(domain.getName())); } List<CloudRoute> deletedRoutes = new ArrayList<>(); for (CloudRoute orphanRoute : orphanRoutes) { deleteRoute(orphanRoute.getHost(), orphanRoute.getDomain() .getName(), orphanRoute.getPath()); deletedRoutes.add(orphanRoute); } return deletedRoutes; }
Example #4
Source File: RawV3CloudDomain.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
@Override public CloudDomain derive() { Domain resource = getResource(); return ImmutableCloudDomain.builder() .metadata(parseResourceMetadata(resource)) .name(resource.getName()) .build(); }
Example #5
Source File: AddDomainsStepTest.java From multiapps-controller with Apache License 2.0 | 5 votes |
private List<CloudDomain> getExistingDomainsList() { List<CloudDomain> result = new ArrayList<>(); for (String existingDomain : existingDomains) { result.add(ImmutableCloudDomain.builder() .name(existingDomain) .build()); } return result; }
Example #6
Source File: ApplicationURITest.java From multiapps-controller with Apache License 2.0 | 5 votes |
private static CloudRoute createCloudRoute(String host, CloudDomain domain, String path) { return ImmutableCloudRoute.builder() .host(host) .domain(domain) .path(path) .build(); }
Example #7
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
private Mono<Derivable<CloudRoute>> zipWithAuxiliaryRouteContent(Tuple2<? extends Resource<RouteEntity>, CloudDomain> routeTuple) { UUID routeGuid = getGuid(routeTuple.getT1()); return getRouteMappingResourcesByRouteGuid(routeGuid).collectList() .map(routeMappingResources -> ImmutableRawCloudRoute.builder() .resource(routeTuple.getT1()) .domain(routeTuple.getT2()) .routeMappingResources(routeMappingResources) .build()); }
Example #8
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
@Override public void deleteDomain(String domainName) { assertSpaceProvided("delete domain"); CloudDomain domain = findDomainByName(domainName, true); List<CloudRoute> routes = findRoutes(domain); if (!routes.isEmpty()) { throw new IllegalStateException("Unable to remove domain that is in use --" + " it has " + routes.size() + " routes."); } doDeleteDomain(getGuid(domain)); }
Example #9
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
@Override public void addDomain(String domainName) { assertSpaceProvided("add domain"); CloudDomain domain = findDomainByName(domainName); if (domain == null) { doCreateDomain(domainName); } }
Example #10
Source File: RawCloudPrivateDomain.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
@Override public CloudDomain derive() { Resource<PrivateDomainEntity> resource = getResource(); PrivateDomainEntity entity = resource.getEntity(); return ImmutableCloudDomain.builder() .metadata(parseResourceMetadata(resource)) .name(entity.getName()) .build(); }
Example #11
Source File: RawCloudSharedDomain.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
public CloudDomain derive() { Resource<SharedDomainEntity> resource = getResource(); SharedDomainEntity entity = resource.getEntity(); return ImmutableCloudDomain.builder() .metadata(parseResourceMetadata(resource)) .name(entity.getName()) .build(); }
Example #12
Source File: RawV2CloudDomain.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
@Override public CloudDomain derive() { Resource<DomainEntity> resource = getResource(); DomainEntity entity = resource.getEntity(); return ImmutableCloudDomain.builder() .metadata(parseResourceMetadata(resource)) .name(entity.getName()) .build(); }
Example #13
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
private Map<String, UUID> getDomainGuids() { List<CloudDomain> availableDomains = new ArrayList<>(); availableDomains.addAll(getDomainsForOrganization()); availableDomains.addAll(getSharedDomains()); Map<String, UUID> domains = new HashMap<>(availableDomains.size()); for (CloudDomain availableDomain : availableDomains) { domains.put(availableDomain.getName(), availableDomain.getMetadata() .getGuid()); } return domains; }
Example #14
Source File: CollectSystemParametersStepBaseTest.java From multiapps-controller with Apache License 2.0 | 5 votes |
private CloudDomain mockDefaultDomain() { CloudDomain domain = mock(CloudDomain.class); when(domain.getName()).thenReturn(DEFAULT_DOMAIN); when(domain.getMetadata()).thenReturn(ImmutableCloudMetadata.builder() .guid(DEFAULT_DOMAIN_GUID) .build()); return domain; }
Example #15
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
private CloudDomain findDomainByName(String name, boolean required) { CloudDomain domain = findDomainByName(name); if (domain == null && required) { throw new CloudOperationException(HttpStatus.NOT_FOUND, "Not Found", "Domain " + name + " not found."); } return domain; }
Example #16
Source File: CollectSystemParametersStepBaseTest.java From multiapps-controller with Apache License 2.0 | 5 votes |
protected void prepareClient() { CloudDomain defaultDomain = mockDefaultDomain(); CloudInfo info = mockInfo(); when(client.getDefaultDomain()).thenReturn(defaultDomain); when(client.getCloudInfo()).thenReturn(info); }
Example #17
Source File: LoggingCloudControllerClient.java From multiapps-controller with Apache License 2.0 | 4 votes |
@Override public List<CloudDomain> getDomains() { logger.debug(Messages.GETTING_DOMAINS); return delegate.getDomains(); }
Example #18
Source File: ResilientCloudControllerClient.java From multiapps-controller with Apache License 2.0 | 4 votes |
@Override public CloudDomain getDefaultDomain() { return executeWithRetry(delegate::getDefaultDomain); }
Example #19
Source File: ResilientCloudControllerClient.java From multiapps-controller with Apache License 2.0 | 4 votes |
@Override public List<CloudDomain> getPrivateDomains() { return executeWithRetry(delegate::getPrivateDomains, HttpStatus.NOT_FOUND); }
Example #20
Source File: ResilientCloudControllerClient.java From multiapps-controller with Apache License 2.0 | 4 votes |
@Override public List<CloudDomain> getDomains() { return executeWithRetry(delegate::getDomains, HttpStatus.NOT_FOUND); }
Example #21
Source File: ResilientCloudControllerClient.java From multiapps-controller with Apache License 2.0 | 4 votes |
@Override public List<CloudDomain> getDomainsForOrganization() { return executeWithRetry(delegate::getDomainsForOrganization, HttpStatus.NOT_FOUND); }
Example #22
Source File: RawCloudRouteTest.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
private static CloudDomain buildTestDomain() { return ImmutableCloudDomain.builder() .metadata(RawCloudEntityTest.EXPECTED_METADATA) .name(DOMAIN_NAME) .build(); }
Example #23
Source File: LoggingCloudControllerClient.java From multiapps-controller with Apache License 2.0 | 4 votes |
@Override public CloudDomain getDefaultDomain() { logger.debug(Messages.GETTING_DEFAULT_DOMAIN); return delegate.getDefaultDomain(); }
Example #24
Source File: AddDomainsStep.java From multiapps-controller with Apache License 2.0 | 4 votes |
private List<String> getDomainNames(List<CloudDomain> domains) { return domains.stream() .map(CloudDomain::getName) .collect(Collectors.toList()); }
Example #25
Source File: CloudControllerRestClientImplTest.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
public Map<String, UUID> getDomainsAsMap() { return getDomains().stream() .collect(Collectors.toMap(CloudDomain::getName, domain -> domain.getMetadata() .getGuid())); }
Example #26
Source File: CloudControllerRestClientImplTest.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
public List<CloudDomain> getDomains() { return domains; }
Example #27
Source File: RawV3CloudDomainTest.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
private static CloudDomain buildExpectedDomain() { return ImmutableCloudDomain.builder() .metadata(RawCloudEntityTest.EXPECTED_METADATA_PARSED_FROM_V3_RESOURCE) .name(DOMAIN_NAME) .build(); }
Example #28
Source File: RawV2CloudDomainTest.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
private static CloudDomain buildExpectedDomain() { return ImmutableCloudDomain.builder() .metadata(RawCloudEntityTest.EXPECTED_METADATA) .name(DOMAIN_NAME) .build(); }
Example #29
Source File: RawCloudSharedDomainTest.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
private static CloudDomain buildExpectedDomain() { return ImmutableCloudDomain.builder() .metadata(RawCloudEntityTest.EXPECTED_METADATA) .name(DOMAIN_NAME) .build(); }
Example #30
Source File: CloudControllerClientImpl.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
@Override public CloudDomain getDefaultDomain() { return handleExceptions(() -> delegate.getDefaultDomain()); }