private static Mono<Void> requestDeleteRoute( CloudFoundryClient cloudFoundryClient, String routeId) { return cloudFoundryClient .routes() .delete(DeleteRouteRequest.builder().routeId(routeId).build()) .after(); }
private static void requestOrganization( CloudFoundryClient cloudFoundryClient, String organizationId) { when(cloudFoundryClient .organizations() .get(GetOrganizationRequest.builder().organizationId(organizationId).build())) .thenReturn(Mono.just(fill(GetOrganizationResponse.builder(), "organization-").build())); }
private static Flux<PrivateDomainResource> requestListPrivateDomains( CloudFoundryClient cloudFoundryClient, String domain) { return PaginationUtils.requestClientV2Resources( page -> cloudFoundryClient .privateDomains() .list(ListPrivateDomainsRequest.builder().name(domain).page(page).build())); }
private static Flux<SharedDomainResource> requestListSharedDomains( CloudFoundryClient cloudFoundryClient) { return PaginationUtils.requestClientV2Resources( page -> cloudFoundryClient .sharedDomains() .list(ListSharedDomainsRequest.builder().page(page).build())); }
private static Flux<OrganizationResource> requestOrganizations( CloudFoundryClient cloudFoundryClient, String organization) { return PaginationUtils.requestClientV2Resources( page -> cloudFoundryClient .organizations() .list(ListOrganizationsRequest.builder().name(organization).page(page).build())); }
private static Mono<CreateSharedDomainResponse> requestCreateSharedDomain( CloudFoundryClient cloudFoundryClient, String domain) { return cloudFoundryClient .sharedDomains() .create( org.cloudfoundry.client.v2.shareddomains.CreateSharedDomainRequest.builder() .name(domain) .build()); }
private static Mono<Void> requestDeleteApplication( CloudFoundryClient cloudFoundryClient, String applicationId) { return cloudFoundryClient .applicationsV2() .delete( org.cloudfoundry.client.v2.applications.DeleteApplicationRequest.builder() .applicationId(applicationId) .build()); }
private static Mono<CreatePrivateDomainResponse> requestCreateDomain( CloudFoundryClient cloudFoundryClient, String domain, String organizationId) { return cloudFoundryClient .privateDomains() .create( CreatePrivateDomainRequest.builder() .name(domain) .owningOrganizationId(organizationId) .build()); }
private static void requestSpaceDomains(CloudFoundryClient cloudFoundryClient, String spaceId) { when(cloudFoundryClient .spaces() .listDomains(fillPage(ListSpaceDomainsRequest.builder()).spaceId(spaceId).build())) .thenReturn( Mono.just( fillPage(ListSpaceDomainsResponse.builder()) .resource(fill(DomainResource.builder(), "domain-").build()) .build())); }
private static void requestSpaces(CloudFoundryClient cloudFoundryClient, String organizationId) { when(cloudFoundryClient .spaces() .list(fillPage(ListSpacesRequest.builder()).organizationId(organizationId).build())) .thenReturn( Mono.just( fillPage(ListSpacesResponse.builder()) .resource(fill(SpaceResource.builder(), "space-").build()) .build())); }
private static Mono<Void> requestRemoveOrganizationPrivateDomainRequest( CloudFoundryClient cloudFoundryClient, String domainId, String organizationId) { return cloudFoundryClient .organizations() .removePrivateDomain( RemoveOrganizationPrivateDomainRequest.builder() .organizationId(organizationId) .privateDomainId(domainId) .build()); }
private static Mono<AssociateOrganizationPrivateDomainResponse> requestAssociateOrganizationPrivateDomainRequest( CloudFoundryClient cloudFoundryClient, String domainId, String organizationId) { return cloudFoundryClient .organizations() .associatePrivateDomain( AssociateOrganizationPrivateDomainRequest.builder() .organizationId(organizationId) .privateDomainId(domainId) .build()); }
private static void requestSpaceSecurityGroups( CloudFoundryClient cloudFoundryClient, String spaceId) { when(cloudFoundryClient .spaces() .listSecurityGroups( fillPage(ListSpaceSecurityGroupsRequest.builder()).spaceId(spaceId).build())) .thenReturn( Mono.just( fillPage(ListSpaceSecurityGroupsResponse.builder()) .resource(fill(SecurityGroupResource.builder(), "security-group-").build()) .build())); }
private static void requestSpaceQuotaDefinition( CloudFoundryClient cloudFoundryClient, String spaceQuotaDefinitionId) { when(cloudFoundryClient .spaceQuotaDefinitions() .get( fill(GetSpaceQuotaDefinitionRequest.builder()) .spaceQuotaDefinitionId(spaceQuotaDefinitionId) .build())) .thenReturn( Mono.just( fill(GetSpaceQuotaDefinitionResponse.builder(), "space-quota-definition-") .build())); }
private static Mono<AbstractApplicationResource> requestUpdateApplicationState( CloudFoundryClient cloudFoundryClient, String applicationId, String state) { return cloudFoundryClient .applicationsV2() .update( UpdateApplicationRequest.builder().applicationId(applicationId).state(state).build()) .map( new Function<UpdateApplicationResponse, AbstractApplicationResource>() { @Override public AbstractApplicationResource apply(UpdateApplicationResponse x) { return x; } }); }
private static void requestSpaceApplications( CloudFoundryClient cloudFoundryClient, String spaceId) { when(cloudFoundryClient .spaces() .listApplications( fillPage(ListSpaceApplicationsRequest.builder(), "application-") .diego(null) .spaceId(spaceId) .build())) .thenReturn( Mono.just( fillPage(ListSpaceApplicationsResponse.builder()) .resource(fill(ApplicationResource.builder(), "application-").build()) .build())); }
private static Mono<AbstractApplicationResource> requestUpdateApplicationScale( CloudFoundryClient cloudFoundryClient, String applicationId, Integer disk, Integer instances, Integer memory) { return cloudFoundryClient .applicationsV2() .update( UpdateApplicationRequest.builder() .applicationId(applicationId) .diskQuota(disk) .instances(instances) .memory(memory) .build()) .map( new Function<UpdateApplicationResponse, AbstractApplicationResource>() { @Override public AbstractApplicationResource apply(UpdateApplicationResponse x) { return x; } }); }
private static Mono<GetStackResponse> requestStack( CloudFoundryClient cloudFoundryClient, String stackId) { return cloudFoundryClient.stacks().get(GetStackRequest.builder().stackId(stackId).build()); }
private static Mono<ApplicationStatisticsResponse> requestApplicationStats( CloudFoundryClient cloudFoundryClient, String applicationId) { return cloudFoundryClient .applicationsV2() .statistics(ApplicationStatisticsRequest.builder().applicationId(applicationId).build()); }
private static Mono<SummaryApplicationResponse> requestApplicationSummary( CloudFoundryClient cloudFoundryClient, String applicationId) { return cloudFoundryClient .applicationsV2() .summary(SummaryApplicationRequest.builder().applicationId(applicationId).build()); }
private static Mono<GetSpaceSummaryResponse> requestSpaceSummary( CloudFoundryClient cloudFoundryClient, String spaceId) { return cloudFoundryClient .spaces() .getSummary(GetSpaceSummaryRequest.builder().spaceId(spaceId).build()); }
private static Mono<UpdateApplicationResponse> requestUpdateApplicationRename( CloudFoundryClient cloudFoundryClient, String applicationId, final String name) { return cloudFoundryClient .applicationsV2() .update(UpdateApplicationRequest.builder().applicationId(applicationId).name(name).build()); }