From f501b361443f93f22a93eec6507b31e0a37cd64a Mon Sep 17 00:00:00 2001 From: "Merchant, Saifuddin A" Date: Mon, 1 Dec 2025 16:20:51 -0700 Subject: [PATCH 1/5] Implement the Space Quota version 3 API --- .../client/_ReactorCloudFoundryClient.java | 21 +- .../ReactorSpaceQuotaDefinitionsV3.java | 108 ++++++ .../ReactorSpaceQuotaDefinitionsV3Test.java | 334 ++++++++++++++++++ .../client/v3/space_quotas/GET_response.json | 98 +++++ .../v3/space_quotas/GET_{id}_response.json | 43 +++ .../v3/space_quotas/PATCH_{id}_request.json | 2 + .../v3/space_quotas/PATCH_{id}_response.json | 43 +++ .../client/v3/space_quotas/POST_request.json | 17 + .../client/v3/space_quotas/POST_response.json | 43 +++ .../client/CloudFoundryClient.java | 6 + .../SpaceQuotaDefinition.java | 61 ++++ .../SpaceQuotaDefinitionsV3.java | 69 ++++ .../v3/spacequotadefinitions/_Apps.java | 70 ++++ .../_CreateSpaceQuotaDefinitionRequest.java | 64 ++++ .../_CreateSpaceQuotaDefinitionResponse.java | 29 ++ .../_DeleteSpaceQuotaDefinitionRequest.java | 34 ++ .../_GetSpaceQuotaDefinitionRequest.java | 34 ++ .../_GetSpaceQuotaDefinitionResponse.java | 29 ++ .../_ListSpaceQuotaDefinitionsRequest.java | 59 ++++ .../_ListSpaceQuotaDefinitionsResponse.java | 30 ++ .../v3/spacequotadefinitions/_Routes.java | 49 +++ .../v3/spacequotadefinitions/_Services.java | 53 +++ .../_SpaceQuotaDefinitionRelationships.java | 47 +++ .../_SpaceQuotaDefinitionResource.java | 30 ++ .../_UpdateSpaceQuotaDefinitionRequest.java | 65 ++++ .../_UpdateSpaceQuotaDefinitionResponse.java | 29 ++ ...CreateSpaceQuotaDefinitionRequestTest.java | 59 ++++ ...DeleteSpaceQuotaDefinitionRequestTest.java | 36 ++ .../GetSpaceQuotaDefinitionRequestTest.java | 36 ++ .../ListSpaceQuotaDefinitionsRequestTest.java | 27 ++ ...UpdateSpaceQuotaDefinitionRequestTest.java | 36 ++ .../client/v3/SpaceQuotaDefinitionsTest.java | 278 +++++++++++++++ 32 files changed, 1933 insertions(+), 6 deletions(-) create mode 100644 cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/spacequotadefinition/ReactorSpaceQuotaDefinitionsV3.java create mode 100644 cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/spacequotadefinition/ReactorSpaceQuotaDefinitionsV3Test.java create mode 100644 cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/GET_response.json create mode 100644 cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/GET_{id}_response.json create mode 100644 cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/PATCH_{id}_request.json create mode 100644 cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/PATCH_{id}_response.json create mode 100644 cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/POST_request.json create mode 100644 cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/POST_response.json create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceQuotaDefinition.java create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceQuotaDefinitionsV3.java create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Apps.java create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_CreateSpaceQuotaDefinitionRequest.java create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_CreateSpaceQuotaDefinitionResponse.java create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_DeleteSpaceQuotaDefinitionRequest.java create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_GetSpaceQuotaDefinitionRequest.java create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_GetSpaceQuotaDefinitionResponse.java create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_ListSpaceQuotaDefinitionsRequest.java create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_ListSpaceQuotaDefinitionsResponse.java create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Routes.java create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Services.java create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_SpaceQuotaDefinitionRelationships.java create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_SpaceQuotaDefinitionResource.java create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_UpdateSpaceQuotaDefinitionRequest.java create mode 100644 cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_UpdateSpaceQuotaDefinitionResponse.java create mode 100644 cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/CreateSpaceQuotaDefinitionRequestTest.java create mode 100644 cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/DeleteSpaceQuotaDefinitionRequestTest.java create mode 100644 cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/GetSpaceQuotaDefinitionRequestTest.java create mode 100644 cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/ListSpaceQuotaDefinitionsRequestTest.java create mode 100644 cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/UpdateSpaceQuotaDefinitionRequestTest.java create mode 100644 integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotaDefinitionsTest.java diff --git a/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/_ReactorCloudFoundryClient.java b/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/_ReactorCloudFoundryClient.java index 7e43bd58202..c5aaf9197b7 100644 --- a/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/_ReactorCloudFoundryClient.java +++ b/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/_ReactorCloudFoundryClient.java @@ -16,6 +16,7 @@ package org.cloudfoundry.reactor.client; +import jakarta.annotation.PostConstruct; import org.cloudfoundry.client.CloudFoundryClient; import org.cloudfoundry.client.v2.applications.ApplicationsV2; import org.cloudfoundry.client.v2.applicationusageevents.ApplicationUsageEvents; @@ -34,8 +35,6 @@ import org.cloudfoundry.client.v2.routemappings.RouteMappings; import org.cloudfoundry.client.v2.routes.Routes; import org.cloudfoundry.client.v2.securitygroups.SecurityGroups; -import org.cloudfoundry.client.v3.organizationquotadefinitions.OrganizationQuotaDefinitionsV3; -import org.cloudfoundry.client.v3.securitygroups.SecurityGroupsV3; import org.cloudfoundry.client.v2.servicebindings.ServiceBindingsV2; import org.cloudfoundry.client.v2.servicebrokers.ServiceBrokers; import org.cloudfoundry.client.v2.serviceinstances.ServiceInstances; @@ -60,17 +59,20 @@ import org.cloudfoundry.client.v3.droplets.Droplets; import org.cloudfoundry.client.v3.isolationsegments.IsolationSegments; import org.cloudfoundry.client.v3.jobs.JobsV3; +import org.cloudfoundry.client.v3.organizationquotadefinitions.OrganizationQuotaDefinitionsV3; import org.cloudfoundry.client.v3.organizations.OrganizationsV3; import org.cloudfoundry.client.v3.packages.Packages; import org.cloudfoundry.client.v3.processes.Processes; import org.cloudfoundry.client.v3.resourcematch.ResourceMatchV3; import org.cloudfoundry.client.v3.roles.RolesV3; import org.cloudfoundry.client.v3.routes.RoutesV3; -import org.cloudfoundry.client.v3.serviceinstances.ServiceInstancesV3; +import org.cloudfoundry.client.v3.securitygroups.SecurityGroupsV3; import org.cloudfoundry.client.v3.servicebindings.ServiceBindingsV3; import org.cloudfoundry.client.v3.servicebrokers.ServiceBrokersV3; +import org.cloudfoundry.client.v3.serviceinstances.ServiceInstancesV3; import org.cloudfoundry.client.v3.serviceofferings.ServiceOfferingsV3; import org.cloudfoundry.client.v3.serviceplans.ServicePlansV3; +import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionsV3; import org.cloudfoundry.client.v3.spaces.SpacesV3; import org.cloudfoundry.client.v3.stacks.StacksV3; import org.cloudfoundry.client.v3.tasks.Tasks; @@ -93,8 +95,6 @@ import org.cloudfoundry.reactor.client.v2.routemappings.ReactorRouteMappings; import org.cloudfoundry.reactor.client.v2.routes.ReactorRoutes; import org.cloudfoundry.reactor.client.v2.securitygroups.ReactorSecurityGroups; -import org.cloudfoundry.reactor.client.v3.organizationquotadefinitions.ReactorOrganizationQuotaDefinitionsV3; -import org.cloudfoundry.reactor.client.v3.securitygroups.ReactorSecurityGroupsV3; import org.cloudfoundry.reactor.client.v2.servicebindings.ReactorServiceBindingsV2; import org.cloudfoundry.reactor.client.v2.servicebrokers.ReactorServiceBrokers; import org.cloudfoundry.reactor.client.v2.serviceinstances.ReactorServiceInstances; @@ -119,24 +119,26 @@ import org.cloudfoundry.reactor.client.v3.droplets.ReactorDroplets; import org.cloudfoundry.reactor.client.v3.isolationsegments.ReactorIsolationSegments; import org.cloudfoundry.reactor.client.v3.jobs.ReactorJobsV3; +import org.cloudfoundry.reactor.client.v3.organizationquotadefinitions.ReactorOrganizationQuotaDefinitionsV3; import org.cloudfoundry.reactor.client.v3.organizations.ReactorOrganizationsV3; import org.cloudfoundry.reactor.client.v3.packages.ReactorPackages; import org.cloudfoundry.reactor.client.v3.processes.ReactorProcesses; import org.cloudfoundry.reactor.client.v3.resourcematch.ReactorResourceMatchV3; import org.cloudfoundry.reactor.client.v3.roles.ReactorRolesV3; import org.cloudfoundry.reactor.client.v3.routes.ReactorRoutesV3; +import org.cloudfoundry.reactor.client.v3.securitygroups.ReactorSecurityGroupsV3; import org.cloudfoundry.reactor.client.v3.servicebindings.ReactorServiceBindingsV3; import org.cloudfoundry.reactor.client.v3.servicebrokers.ReactorServiceBrokersV3; import org.cloudfoundry.reactor.client.v3.serviceinstances.ReactorServiceInstancesV3; import org.cloudfoundry.reactor.client.v3.serviceofferings.ReactorServiceOfferingsV3; import org.cloudfoundry.reactor.client.v3.serviceplans.ReactorServicePlansV3; +import org.cloudfoundry.reactor.client.v3.spacequotadefinition.ReactorSpaceQuotaDefinitionsV3; import org.cloudfoundry.reactor.client.v3.spaces.ReactorSpacesV3; import org.cloudfoundry.reactor.client.v3.stacks.ReactorStacksV3; import org.cloudfoundry.reactor.client.v3.tasks.ReactorTasks; import org.immutables.value.Value; import reactor.core.publisher.Mono; -import jakarta.annotation.PostConstruct; import java.util.Collections; import java.util.Map; @@ -457,6 +459,13 @@ public SpaceQuotaDefinitions spaceQuotaDefinitions() { getRequestTags()); } + @Override + @Value.Derived + public SpaceQuotaDefinitionsV3 spaceQuotaDefinitionsV3() { + return new ReactorSpaceQuotaDefinitionsV3(getConnectionContext(), getRootV3(), getTokenProvider(), + getRequestTags()); + } + @Override @Value.Derived public Spaces spaces() { diff --git a/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/spacequotadefinition/ReactorSpaceQuotaDefinitionsV3.java b/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/spacequotadefinition/ReactorSpaceQuotaDefinitionsV3.java new file mode 100644 index 00000000000..ffd4f119977 --- /dev/null +++ b/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/spacequotadefinition/ReactorSpaceQuotaDefinitionsV3.java @@ -0,0 +1,108 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.reactor.client.v3.spacequotadefinition; + +import java.util.Map; +import org.cloudfoundry.client.v3.spacequotadefinitions.CreateSpaceQuotaDefinitionRequest; +import org.cloudfoundry.client.v3.spacequotadefinitions.CreateSpaceQuotaDefinitionResponse; +import org.cloudfoundry.client.v3.spacequotadefinitions.DeleteSpaceQuotaDefinitionRequest; +import org.cloudfoundry.client.v3.spacequotadefinitions.GetSpaceQuotaDefinitionRequest; +import org.cloudfoundry.client.v3.spacequotadefinitions.GetSpaceQuotaDefinitionResponse; +import org.cloudfoundry.client.v3.spacequotadefinitions.ListSpaceQuotaDefinitionsRequest; +import org.cloudfoundry.client.v3.spacequotadefinitions.ListSpaceQuotaDefinitionsResponse; +import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionsV3; +import org.cloudfoundry.client.v3.spacequotadefinitions.UpdateSpaceQuotaDefinitionRequest; +import org.cloudfoundry.client.v3.spacequotadefinitions.UpdateSpaceQuotaDefinitionResponse; +import org.cloudfoundry.reactor.ConnectionContext; +import org.cloudfoundry.reactor.TokenProvider; +import org.cloudfoundry.reactor.client.v3.AbstractClientV3Operations; +import reactor.core.publisher.Mono; + +/** + * The Reactor-based implementation of {@link ReactorSpaceQuotaDefinitionsV3} + */ +public class ReactorSpaceQuotaDefinitionsV3 extends AbstractClientV3Operations + implements SpaceQuotaDefinitionsV3 { + + /** + * Creates an instance + * + * @param connectionContext the {@link ConnectionContext} to use when communicating with the server + * @param root the root URI of the server. Typically, something like {@code https://api.run.pivotal.io}. + * @param tokenProvider the {@link TokenProvider} to use when communicating with the server + * @param requestTags map with custom http headers which will be added to web request + */ + public ReactorSpaceQuotaDefinitionsV3( + ConnectionContext connectionContext, + Mono root, + TokenProvider tokenProvider, + Map requestTags) { + super(connectionContext, root, tokenProvider, requestTags); + } + + @Override + public Mono create( + CreateSpaceQuotaDefinitionRequest request) { + return post( + request, + CreateSpaceQuotaDefinitionResponse.class, + builder -> builder.pathSegment("space_quotas")) + .checkpoint(); + } + + @Override + public Mono get(GetSpaceQuotaDefinitionRequest request) { + return get( + request, + GetSpaceQuotaDefinitionResponse.class, + builder -> + builder.pathSegment( + "space_quotas", request.getSpaceQuotaDefinitionId())) + .checkpoint(); + } + + @Override + public Mono list(ListSpaceQuotaDefinitionsRequest request) { + return get( + request, + ListSpaceQuotaDefinitionsResponse.class, + builder -> builder.pathSegment("space_quotas")) + .checkpoint(); + } + + @Override + public Mono update( + UpdateSpaceQuotaDefinitionRequest request) { + return patch( + request, + UpdateSpaceQuotaDefinitionResponse.class, + builder -> + builder.pathSegment( + "space_quotas", request.getSpaceQuotaDefinitionId())) + .checkpoint(); + } + + @Override + public Mono delete(DeleteSpaceQuotaDefinitionRequest request) { + return delete( + request, + builder -> + builder.pathSegment( + "space_quotas", request.getSpaceQuotaDefinitionId())) + .checkpoint(); + } +} diff --git a/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/spacequotadefinition/ReactorSpaceQuotaDefinitionsV3Test.java b/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/spacequotadefinition/ReactorSpaceQuotaDefinitionsV3Test.java new file mode 100644 index 00000000000..79f1a8b68f2 --- /dev/null +++ b/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/spacequotadefinition/ReactorSpaceQuotaDefinitionsV3Test.java @@ -0,0 +1,334 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.reactor.client.v3.spacequotadefinition; + +import static io.netty.handler.codec.http.HttpMethod.DELETE; +import static io.netty.handler.codec.http.HttpMethod.GET; +import static io.netty.handler.codec.http.HttpMethod.PATCH; +import static io.netty.handler.codec.http.HttpMethod.POST; +import static io.netty.handler.codec.http.HttpResponseStatus.ACCEPTED; +import static io.netty.handler.codec.http.HttpResponseStatus.OK; + +import java.time.Duration; +import java.util.Collections; +import org.cloudfoundry.client.v3.Link; +import org.cloudfoundry.client.v3.Pagination; +import org.cloudfoundry.client.v3.Relationship; +import org.cloudfoundry.client.v3.ToManyRelationship; +import org.cloudfoundry.client.v3.ToOneRelationship; +import org.cloudfoundry.client.v3.spacequotadefinitions.Apps; +import org.cloudfoundry.client.v3.spacequotadefinitions.CreateSpaceQuotaDefinitionRequest; +import org.cloudfoundry.client.v3.spacequotadefinitions.CreateSpaceQuotaDefinitionResponse; +import org.cloudfoundry.client.v3.spacequotadefinitions.DeleteSpaceQuotaDefinitionRequest; +import org.cloudfoundry.client.v3.spacequotadefinitions.GetSpaceQuotaDefinitionRequest; +import org.cloudfoundry.client.v3.spacequotadefinitions.GetSpaceQuotaDefinitionResponse; +import org.cloudfoundry.client.v3.spacequotadefinitions.ListSpaceQuotaDefinitionsRequest; +import org.cloudfoundry.client.v3.spacequotadefinitions.ListSpaceQuotaDefinitionsResponse; +import org.cloudfoundry.client.v3.spacequotadefinitions.Routes; +import org.cloudfoundry.client.v3.spacequotadefinitions.Services; +import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionRelationships; +import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionResource; +import org.cloudfoundry.client.v3.spacequotadefinitions.UpdateSpaceQuotaDefinitionRequest; +import org.cloudfoundry.client.v3.spacequotadefinitions.UpdateSpaceQuotaDefinitionResponse; +import org.cloudfoundry.reactor.InteractionContext; +import org.cloudfoundry.reactor.TestRequest; +import org.cloudfoundry.reactor.TestResponse; +import org.cloudfoundry.reactor.client.AbstractClientApiTest; +import org.jetbrains.annotations.NotNull; +import org.junit.jupiter.api.Test; +import reactor.test.StepVerifier; + +class ReactorSpaceQuotaDefinitionsV3Test extends AbstractClientApiTest { + + public static final String EXPECTED_SPACE_QUOTA_ID_1 = "f919ef8a-e333-472a-8172-baaf2c30d301"; + + private final ReactorSpaceQuotaDefinitionsV3 spaceQuotaDefinitionsV3 = + new ReactorSpaceQuotaDefinitionsV3( + CONNECTION_CONTEXT, this.root, TOKEN_PROVIDER, Collections.emptyMap()); + + @Test + void create() { + mockRequest( + InteractionContext.builder() + .request( + TestRequest.builder() + .method(POST) + .path("/space_quotas") + .payload( + "fixtures/client/v3/space_quotas/POST_request.json") + .build()) + .response( + TestResponse.builder() + .status(OK) + .payload( + "fixtures/client/v3/space_quotas/POST_response.json") + .build()) + .build()); + + SpaceQuotaDefinitionRelationships relationships = + SpaceQuotaDefinitionRelationships.builder() + .organization( + ToOneRelationship.builder() + .data( + Relationship.builder() + .id("9b370018-c38e-44c9-86d6-155c76801104") + .build()) + .build()) + .spaces( + ToManyRelationship.builder() + .data( + Collections.singletonList( + Relationship.builder() + .id( + "dcfd6a55-62b9-496e-a26f-0064cec076bf") + .build())) + .build()) + .build(); + this.spaceQuotaDefinitionsV3 + .create( + CreateSpaceQuotaDefinitionRequest.builder() + .name("my-quota") + .relationships(relationships) + .build()) + .as(StepVerifier::create) + .expectNext( + CreateSpaceQuotaDefinitionResponse.builder() + .from(expectedSpaceQuotaDefinitionResource1()) + .build()) + .expectComplete() + .verify(Duration.ofSeconds(5)); + } + + @Test + void delete() { + mockRequest( + InteractionContext.builder() + .request( + TestRequest.builder() + .method(DELETE) + .path("/space_quotas/test-space-quota-id") + .build()) + .response( + TestResponse.builder() + .status(ACCEPTED) + .header( + "Location", + "https://api.example.org/v3/jobs/test-job-id") + .build()) + .build()); + + this.spaceQuotaDefinitionsV3 + .delete( + DeleteSpaceQuotaDefinitionRequest.builder() + .spaceQuotaDefinitionId("test-space-quota-id") + .build()) + .as(StepVerifier::create) + .expectNext("test-job-id") + .expectComplete() + .verify(Duration.ofSeconds(5)); + } + + @Test + void get() { + mockRequest( + InteractionContext.builder() + .request( + TestRequest.builder() + .method(GET) + .path("/space_quotas/" + EXPECTED_SPACE_QUOTA_ID_1) + .build()) + .response( + TestResponse.builder() + .status(OK) + .payload( + "fixtures/client/v3/space_quotas/GET_{id}_response.json") + .build()) + .build()); + + this.spaceQuotaDefinitionsV3 + .get( + GetSpaceQuotaDefinitionRequest.builder() + .spaceQuotaDefinitionId(EXPECTED_SPACE_QUOTA_ID_1) + .build()) + .as(StepVerifier::create) + .expectNext( + GetSpaceQuotaDefinitionResponse.builder() + .from(expectedSpaceQuotaDefinitionResource1()) + .build()) + .expectComplete() + .verify(Duration.ofSeconds(5)); + } + + @Test + void list() { + mockRequest( + InteractionContext.builder() + .request(TestRequest.builder().method(GET).path("/space_quotas").build()) + .response( + TestResponse.builder() + .status(OK) + .payload( + "fixtures/client/v3/space_quotas/GET_response.json") + .build()) + .build()); + + this.spaceQuotaDefinitionsV3 + .list(ListSpaceQuotaDefinitionsRequest.builder().build()) + .as(StepVerifier::create) + .expectNext( + ListSpaceQuotaDefinitionsResponse.builder() + .pagination( + Pagination.builder() + .totalResults(2) + .totalPages(1) + .first( + Link.builder() + .href( + "https://api.example.org/v3/space_quotas?page=1&per_page=50") + .build()) + .last( + Link.builder() + .href( + "https://api.example.org/v3/space_quotas?page=1&per_page=50") + .build()) + .build()) + .resource( + SpaceQuotaDefinitionResource.builder() + .from(expectedSpaceQuotaDefinitionResource1()) + .build()) + .resource( + SpaceQuotaDefinitionResource.builder() + .from(expectedSpaceQuotaDefinitionResource2()) + .build()) + .build()) + .expectComplete() + .verify(Duration.ofSeconds(5)); + } + + @Test + void update() { + mockRequest( + InteractionContext.builder() + .request( + TestRequest.builder() + .method(PATCH) + .path("/space_quotas/" + EXPECTED_SPACE_QUOTA_ID_1) + .payload( + "fixtures/client/v3/space_quotas/PATCH_{id}_request.json") + .build()) + .response( + TestResponse.builder() + .status(OK) + .payload( + "fixtures/client/v3/space_quotas/PATCH_{id}_response.json") + .build()) + .build()); + + this.spaceQuotaDefinitionsV3 + .update( + UpdateSpaceQuotaDefinitionRequest.builder() + .spaceQuotaDefinitionId(EXPECTED_SPACE_QUOTA_ID_1) + .build()) + .as(StepVerifier::create) + .expectNext( + UpdateSpaceQuotaDefinitionResponse.builder() + .from(expectedSpaceQuotaDefinitionResource1()) + .build()) + .expectComplete() + .verify(Duration.ofSeconds(5)); + } + + @NotNull + private static SpaceQuotaDefinitionResource expectedSpaceQuotaDefinitionResource1() { + return buildSpaceQuotaDefinitionResource( + EXPECTED_SPACE_QUOTA_ID_1, + "my-quota", + "9b370018-c38e-44c9-86d6-155c76801104", + "dcfd6a55-62b9-496e-a26f-0064cec076bf"); + } + + private static SpaceQuotaDefinitionResource expectedSpaceQuotaDefinitionResource2() { + return buildSpaceQuotaDefinitionResource( + "bb49bf20-ad98-4729-93ae-38fbc564b630", + "my-quota-2", + "9b370018-c38e-44c9-86d6-155c76801104", + null); + } + + @NotNull + private static SpaceQuotaDefinitionResource buildSpaceQuotaDefinitionResource( + String id, String name, String relatedOrganizationId, String relatedSpaceId) { + + Apps apps = + Apps.builder() + .totalMemoryInMb(5120) + .perProcessMemoryInMb(1024) + .totalInstances(10) + .perAppTasks(5) + .build(); + Services services = + Services.builder() + .isPaidServicesAllowed(true) + .totalServiceInstances(10) + .totalServiceKeys(20) + .build(); + Routes routes = Routes.builder().totalRoutes(8).totalReservedPorts(4).build(); + + ToOneRelationship organizationRelationship = + ToOneRelationship.builder() + .data(Relationship.builder().id(relatedOrganizationId).build()) + .build(); + ToManyRelationship spaceRelationships = + ToManyRelationship.builder().data(Collections.emptyList()).build(); + if (relatedSpaceId != null) { + spaceRelationships = + ToManyRelationship.builder() + .data( + Collections.singletonList( + Relationship.builder().id(relatedSpaceId).build())) + .build(); + } + SpaceQuotaDefinitionRelationships relationships = + SpaceQuotaDefinitionRelationships.builder() + .organization(organizationRelationship) + .spaces(spaceRelationships) + .build(); + + return SpaceQuotaDefinitionResource.builder() + .createdAt("2016-05-04T17:00:41Z") + .id(id) + .link( + "self", + Link.builder() + .href("https://api.example.org/v3/space_quotas/" + id) + .build()) + .link( + "organization", + Link.builder() + .href( + "https://api.example.org/v3/organizations/" + + relatedOrganizationId) + .build()) + .name(name) + .updatedAt("2016-05-04T18:00:41Z") + .apps(apps) + .services(services) + .routes(routes) + .relationships(relationships) + .build(); + } +} diff --git a/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/GET_response.json b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/GET_response.json new file mode 100644 index 00000000000..c695fa74b70 --- /dev/null +++ b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/GET_response.json @@ -0,0 +1,98 @@ +{ + "pagination": { + "total_results": 2, + "total_pages": 1, + "first": { + "href": "https://api.example.org/v3/space_quotas?page=1&per_page=50" + }, + "last": { + "href": "https://api.example.org/v3/space_quotas?page=1&per_page=50" + }, + "next": null, + "previous": null + }, + "resources": [ + { + "guid": "f919ef8a-e333-472a-8172-baaf2c30d301", + "created_at": "2016-05-04T17:00:41Z", + "updated_at": "2016-05-04T18:00:41Z", + "name": "my-quota", + "apps": { + "total_memory_in_mb": 5120, + "per_process_memory_in_mb": 1024, + "total_instances": 10, + "per_app_tasks": 5 + }, + "services": { + "paid_services_allowed": true, + "total_service_instances": 10, + "total_service_keys": 20 + }, + "routes": { + "total_routes": 8, + "total_reserved_ports": 4 + }, + "relationships": { + "organization": { + "data": { + "guid": "9b370018-c38e-44c9-86d6-155c76801104" + } + }, + "spaces": { + "data": [ + { + "guid": "dcfd6a55-62b9-496e-a26f-0064cec076bf" + } + ] + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/space_quotas/f919ef8a-e333-472a-8172-baaf2c30d301" + }, + "organization": { + "href": "https://api.example.org/v3/organizations/9b370018-c38e-44c9-86d6-155c76801104" + } + } + }, + { + "guid": "bb49bf20-ad98-4729-93ae-38fbc564b630", + "created_at": "2016-05-04T17:00:41Z", + "updated_at": "2016-05-04T18:00:41Z", + "name": "my-quota-2", + "apps": { + "total_memory_in_mb": 5120, + "per_process_memory_in_mb": 1024, + "total_instances": 10, + "per_app_tasks": 5 + }, + "services": { + "paid_services_allowed": true, + "total_service_instances": 10, + "total_service_keys": 20 + }, + "routes": { + "total_routes": 8, + "total_reserved_ports": 4 + }, + "relationships": { + "organization": { + "data": { + "guid": "9b370018-c38e-44c9-86d6-155c76801104" + } + }, + "spaces": { + "data": [] + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/space_quotas/bb49bf20-ad98-4729-93ae-38fbc564b630" + }, + "organization": { + "href": "https://api.example.org/v3/organizations/9b370018-c38e-44c9-86d6-155c76801104" + } + } + } + ] +} \ No newline at end of file diff --git a/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/GET_{id}_response.json b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/GET_{id}_response.json new file mode 100644 index 00000000000..c90b41bbd2e --- /dev/null +++ b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/GET_{id}_response.json @@ -0,0 +1,43 @@ +{ + "guid": "f919ef8a-e333-472a-8172-baaf2c30d301", + "created_at": "2016-05-04T17:00:41Z", + "updated_at": "2016-05-04T18:00:41Z", + "name": "my-quota", + "apps": { + "total_memory_in_mb": 5120, + "per_process_memory_in_mb": 1024, + "total_instances": 10, + "per_app_tasks": 5 + }, + "services": { + "paid_services_allowed": true, + "total_service_instances": 10, + "total_service_keys": 20 + }, + "routes": { + "total_routes": 8, + "total_reserved_ports": 4 + }, + "relationships": { + "organization": { + "data": { + "guid": "9b370018-c38e-44c9-86d6-155c76801104" + } + }, + "spaces": { + "data": [ + { + "guid": "dcfd6a55-62b9-496e-a26f-0064cec076bf" + } + ] + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/space_quotas/f919ef8a-e333-472a-8172-baaf2c30d301" + }, + "organization": { + "href": "https://api.example.org/v3/organizations/9b370018-c38e-44c9-86d6-155c76801104" + } + } +} \ No newline at end of file diff --git a/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/PATCH_{id}_request.json b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/PATCH_{id}_request.json new file mode 100644 index 00000000000..7a73a41bfdf --- /dev/null +++ b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/PATCH_{id}_request.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/PATCH_{id}_response.json b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/PATCH_{id}_response.json new file mode 100644 index 00000000000..c90b41bbd2e --- /dev/null +++ b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/PATCH_{id}_response.json @@ -0,0 +1,43 @@ +{ + "guid": "f919ef8a-e333-472a-8172-baaf2c30d301", + "created_at": "2016-05-04T17:00:41Z", + "updated_at": "2016-05-04T18:00:41Z", + "name": "my-quota", + "apps": { + "total_memory_in_mb": 5120, + "per_process_memory_in_mb": 1024, + "total_instances": 10, + "per_app_tasks": 5 + }, + "services": { + "paid_services_allowed": true, + "total_service_instances": 10, + "total_service_keys": 20 + }, + "routes": { + "total_routes": 8, + "total_reserved_ports": 4 + }, + "relationships": { + "organization": { + "data": { + "guid": "9b370018-c38e-44c9-86d6-155c76801104" + } + }, + "spaces": { + "data": [ + { + "guid": "dcfd6a55-62b9-496e-a26f-0064cec076bf" + } + ] + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/space_quotas/f919ef8a-e333-472a-8172-baaf2c30d301" + }, + "organization": { + "href": "https://api.example.org/v3/organizations/9b370018-c38e-44c9-86d6-155c76801104" + } + } +} \ No newline at end of file diff --git a/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/POST_request.json b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/POST_request.json new file mode 100644 index 00000000000..59745ba5ea6 --- /dev/null +++ b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/POST_request.json @@ -0,0 +1,17 @@ +{ + "name": "my-quota", + "relationships": { + "organization": { + "data": { + "guid": "9b370018-c38e-44c9-86d6-155c76801104" + } + }, + "spaces": { + "data": [ + { + "guid": "dcfd6a55-62b9-496e-a26f-0064cec076bf" + } + ] + } + } +} \ No newline at end of file diff --git a/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/POST_response.json b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/POST_response.json new file mode 100644 index 00000000000..883b8ef4636 --- /dev/null +++ b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/space_quotas/POST_response.json @@ -0,0 +1,43 @@ +{ + "guid": "f919ef8a-e333-472a-8172-baaf2c30d301", + "created_at": "2016-05-04T17:00:41Z", + "updated_at": "2016-05-04T18:00:41Z", + "name": "my-quota", + "apps": { + "total_memory_in_mb": 5120, + "per_process_memory_in_mb": 1024, + "total_instances": 10, + "per_app_tasks": 5 + }, + "services": { + "paid_services_allowed": true, + "total_service_instances": 10, + "total_service_keys": 20 + }, + "routes": { + "total_routes": 8, + "total_reserved_ports": 4 + }, + "relationships": { + "organization": { + "data": { + "guid": "9b370018-c38e-44c9-86d6-155c76801104" + } + }, + "spaces": { + "data": [ + { + "guid": "dcfd6a55-62b9-496e-a26f-0064cec076bf" + } + ] + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/space_quotas/f919ef8a-e333-472a-8172-baaf2c30d301" + }, + "organization": { + "href": "https://api.example.org/v3/organizations/9b370018-c38e-44c9-86d6-155c76801104" + } + } +} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/CloudFoundryClient.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/CloudFoundryClient.java index d5339f35124..b5bedb84d38 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/CloudFoundryClient.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/CloudFoundryClient.java @@ -70,6 +70,7 @@ import org.cloudfoundry.client.v3.serviceinstances.ServiceInstancesV3; import org.cloudfoundry.client.v3.serviceofferings.ServiceOfferingsV3; import org.cloudfoundry.client.v3.serviceplans.ServicePlansV3; +import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionsV3; import org.cloudfoundry.client.v3.spaces.SpacesV3; import org.cloudfoundry.client.v3.stacks.StacksV3; import org.cloudfoundry.client.v3.tasks.Tasks; @@ -334,6 +335,11 @@ public interface CloudFoundryClient { */ SpaceQuotaDefinitions spaceQuotaDefinitions(); + /** + * Main entry point to the Cloud Foundry Space Definitions V3 Client API + */ + SpaceQuotaDefinitionsV3 spaceQuotaDefinitionsV3(); + /** * Main entry point to the Cloud Foundry Spaces V2 Client API */ diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceQuotaDefinition.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceQuotaDefinition.java new file mode 100644 index 00000000000..c0d27d8dd67 --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceQuotaDefinition.java @@ -0,0 +1,61 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.cloudfoundry.Nullable; +import org.cloudfoundry.client.v3.Resource; + +/** + * Base class for responses that are space quota definitions + */ +public abstract class SpaceQuotaDefinition extends Resource { + + /** + * Name of the quota + */ + @JsonProperty("name") + abstract String getName(); + + /** + * Quotas that affect applications and application sub-resources + */ + @JsonProperty("apps") + @Nullable + abstract Apps getApps(); + + /** + * Quotas that affect services + */ + @JsonProperty("services") + @Nullable + abstract Services getServices(); + + /** + * Quotas that affect routes + */ + @JsonProperty("routes") + @Nullable + abstract Routes getRoutes(); + + /** + * A relationship to the space where the quota is applied + * A space quota must have a relationship to an organization + */ + @JsonProperty("relationships") + abstract SpaceQuotaDefinitionRelationships getRelationships(); +} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceQuotaDefinitionsV3.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceQuotaDefinitionsV3.java new file mode 100644 index 00000000000..b97326da11f --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceQuotaDefinitionsV3.java @@ -0,0 +1,69 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import reactor.core.publisher.Mono; + +/** + * Main entry point to the Cloud Foundry Space Quota Definitions Client API + */ +public interface SpaceQuotaDefinitionsV3 { + + /** + * Makes the Create Space Quota + * request + * + * @param request the Create Space Quota Definition request + * @return the response from the Create Space Quota Definition request + */ + Mono create(CreateSpaceQuotaDefinitionRequest request); + + /** + * Makes the Get Space Quota + * request + * + * @param request the Get Space Quota Definition request + * @return the response from the Get Space Quota request + */ + Mono get(GetSpaceQuotaDefinitionRequest request); + + /** + * Makes the List all Space Quota Definitions + * request + * + * @param request the List all Space Quota Definitions request + * @return the response from the Space all Organization Quota Definitions request + */ + Mono list(ListSpaceQuotaDefinitionsRequest request); + + /** Makes the Update Space Quota Definition + * request + * + * @param request the Update Space Quota Definition request + * @return the response from the Update Space Quota Definition request + */ + Mono update(UpdateSpaceQuotaDefinitionRequest request); + + /** + * Makes the Delete Space Quota Definition + * request + * + * @param request the Delete Space Quota Definition request + * @return the response from the Space Organization Quota Definition request + */ + Mono delete(DeleteSpaceQuotaDefinitionRequest request); +} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Apps.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Apps.java new file mode 100644 index 00000000000..732afd6ae22 --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Apps.java @@ -0,0 +1,70 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.cloudfoundry.Nullable; +import org.immutables.value.Value; + +/** + * Quotas that affect applications and application sub-resources + */ +@JsonDeserialize +@Value.Immutable +abstract class _Apps { + + /** + * Maximum memory for a single process or task + * @return the maximum memory for a single process or task + */ + @JsonProperty("per_process_memory_in_mb") + @Nullable + abstract Integer getPerProcessMemoryInMb(); + + /** + * Total memory allowed for all the started processes and running tasks in a space + * @return the total memory allowed for all the started processes and running tasks in a space + */ + @JsonProperty("total_memory_in_mb") + @Nullable + abstract Integer getTotalMemoryInMb(); + + /** + * Total instances of all the started processes allowed in a space + * @return the total instances of all the started processes allowed in a space + */ + @JsonProperty("total_instances") + @Nullable + abstract Integer getTotalInstances(); + + /** + * Total log rate limit allowed for all the started processes and running tasks in a space + */ + @JsonProperty("log_rate_limit_in_bytes_per_second") + @Nullable + abstract Integer getLogRateLimitInBytesPerSecond(); + + /** + * Maximum number of running tasks in a space + * @return the maximum number of running tasks in a space + */ + @JsonProperty("per_app_tasks") + @Nullable + abstract Integer getPerAppTasks(); + +} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_CreateSpaceQuotaDefinitionRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_CreateSpaceQuotaDefinitionRequest.java new file mode 100644 index 00000000000..e8d2fd207e2 --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_CreateSpaceQuotaDefinitionRequest.java @@ -0,0 +1,64 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import org.cloudfoundry.Nullable; +import org.immutables.value.Value; + +/** + * The request payload to creates a new space quota + */ +@JsonSerialize +@Value.Immutable +abstract class _CreateSpaceQuotaDefinitionRequest { + + /** + * Name of the quota + */ + @JsonProperty("name") + abstract String getName(); + + /** + * A relationship to the organizations and spaces where the quota is applied + */ + @JsonProperty("relationships") + abstract SpaceQuotaDefinitionRelationships getRelationships(); + + /** + * Quotas that affect applications and application sub-resources + */ + @JsonProperty("apps") + @Nullable + abstract Apps getApps(); + + /** + * Quotas that affect services + */ + @JsonProperty("services") + @Nullable + abstract Services getServices(); + + /** + * Quotas that affect routes + */ + @JsonProperty("routes") + @Nullable + abstract Routes getRoutes(); + +} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_CreateSpaceQuotaDefinitionResponse.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_CreateSpaceQuotaDefinitionResponse.java new file mode 100644 index 00000000000..678390a6f36 --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_CreateSpaceQuotaDefinitionResponse.java @@ -0,0 +1,29 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.immutables.value.Value; + +/** + * The response payload for the Create an Space Quota Definition operation + */ +@JsonDeserialize +@Value.Immutable +abstract class _CreateSpaceQuotaDefinitionResponse extends SpaceQuotaDefinition { + +} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_DeleteSpaceQuotaDefinitionRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_DeleteSpaceQuotaDefinitionRequest.java new file mode 100644 index 00000000000..d41e4fb0c89 --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_DeleteSpaceQuotaDefinitionRequest.java @@ -0,0 +1,34 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.immutables.value.Value; + +/** + * The request payload for the Delete an Space Quota Definition operation + */ +@Value.Immutable +abstract class _DeleteSpaceQuotaDefinitionRequest { + + /** + * The quota definition id + */ + @JsonIgnore + abstract String getSpaceQuotaDefinitionId(); + +} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_GetSpaceQuotaDefinitionRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_GetSpaceQuotaDefinitionRequest.java new file mode 100644 index 00000000000..d73bfa7d987 --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_GetSpaceQuotaDefinitionRequest.java @@ -0,0 +1,34 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.immutables.value.Value; + +/** + * The request payload for the Retrieve a Particular Space Quota Definition operation + */ +@Value.Immutable +abstract class _GetSpaceQuotaDefinitionRequest { + + /** + * The quota definition id + */ + @JsonIgnore + abstract String getSpaceQuotaDefinitionId(); + +} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_GetSpaceQuotaDefinitionResponse.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_GetSpaceQuotaDefinitionResponse.java new file mode 100644 index 00000000000..8aa7f7dc94c --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_GetSpaceQuotaDefinitionResponse.java @@ -0,0 +1,29 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.immutables.value.Value; + +/** + * The response payload for the Retrieve a Particular Space Quota Definition operation + */ +@JsonDeserialize +@Value.Immutable +abstract class _GetSpaceQuotaDefinitionResponse extends SpaceQuotaDefinition { + +} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_ListSpaceQuotaDefinitionsRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_ListSpaceQuotaDefinitionsRequest.java new file mode 100644 index 00000000000..99a075bdc37 --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_ListSpaceQuotaDefinitionsRequest.java @@ -0,0 +1,59 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import org.cloudfoundry.Nullable; +import org.cloudfoundry.client.v3.FilterParameter; +import org.cloudfoundry.client.v3.PaginatedRequest; +import org.immutables.value.Value; + +import java.util.List; + +/** + * The request payload for the List all Space Quota Definitions operation + */ +@Value.Immutable +abstract class _ListSpaceQuotaDefinitionsRequest extends PaginatedRequest { + + /** + * Comma-delimited list of space quota guids to filter by + */ + @FilterParameter("guids") + @Nullable + abstract List getGuids(); + + /** + * Comma-delimited list of space quota names to filter by + */ + @FilterParameter("names") + @Nullable + abstract List getNames(); + + /** + * Comma-delimited list of organization guids to filter by + */ + @FilterParameter("organization_guids") + @Nullable + abstract List getOrganizationGuids(); + + /** + * Comma-delimited list of space guids to filter by + */ + @FilterParameter("space_guids") + @Nullable + abstract List getSpaceGuids(); +} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_ListSpaceQuotaDefinitionsResponse.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_ListSpaceQuotaDefinitionsResponse.java new file mode 100644 index 00000000000..bfc64840b65 --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_ListSpaceQuotaDefinitionsResponse.java @@ -0,0 +1,30 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.cloudfoundry.client.v3.PaginatedResponse; +import org.immutables.value.Value; + +/** + * The response payload for the List all Space Quota Definitions operation + */ +@JsonDeserialize +@Value.Immutable +abstract class _ListSpaceQuotaDefinitionsResponse extends PaginatedResponse { + +} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Routes.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Routes.java new file mode 100644 index 00000000000..5c69e2fba4d --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Routes.java @@ -0,0 +1,49 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.cloudfoundry.Nullable; +import org.immutables.value.Value; + +/** + * Quotas that affect routes + */ +@JsonDeserialize +@Value.Immutable +abstract class _Routes { + + /** + * Total number of routes allowed in a space + * + * @return the total number of routes allowed in a space + */ + @JsonProperty("total_routes") + @Nullable + abstract Integer getTotalRoutes(); + + /** + * Total number of ports that are reservable by routes in a space + * + * @return the total number of reserved ports allowed in a space + */ + @JsonProperty("total_reserved_ports") + @Nullable + abstract Integer getTotalReservedPorts(); + +} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Services.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Services.java new file mode 100644 index 00000000000..813e248e332 --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Services.java @@ -0,0 +1,53 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.cloudfoundry.Nullable; +import org.immutables.value.Value; + +/** + * Quotas that affect services + */ +@JsonDeserialize +@Value.Immutable +abstract class _Services { + + /** + * Specifies whether instances of paid service plans can be created + * @return true if instances of paid service plans can be created, false otherwise + */ + @JsonProperty("paid_services_allowed") + abstract boolean isPaidServicesAllowed(); + + /** + * Total number of service instances allowed in a space + * @return the total number of service instances allowed in a space + */ + @JsonProperty("total_service_instances") + @Nullable + abstract Integer getTotalServiceInstances(); + + /** + * Total number of service keys allowed in a space + * @return the total number of service keys allowed in a space + */ + @JsonProperty("total_service_keys") + @Nullable + abstract Integer getTotalServiceKeys(); +} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_SpaceQuotaDefinitionRelationships.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_SpaceQuotaDefinitionRelationships.java new file mode 100644 index 00000000000..9400adcba28 --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_SpaceQuotaDefinitionRelationships.java @@ -0,0 +1,47 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.cloudfoundry.Nullable; +import org.cloudfoundry.client.v3.ToManyRelationship; +import org.cloudfoundry.client.v3.ToOneRelationship; +import org.immutables.value.Value; + +/** + * The relationships for the SpaceQuotaDefinition entity + */ + +@Value.Immutable +@JsonDeserialize +abstract class _SpaceQuotaDefinitionRelationships { + + /** + * A relationship to the organization where the quota belongs + */ + @JsonProperty("organization") + abstract ToOneRelationship getOrganization(); + + /** + * A relationship to the spaces where the quota is applied + */ + @JsonProperty("spaces") + @Nullable + abstract ToManyRelationship getSpaces(); + +} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_SpaceQuotaDefinitionResource.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_SpaceQuotaDefinitionResource.java new file mode 100644 index 00000000000..4a9e5fb228f --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_SpaceQuotaDefinitionResource.java @@ -0,0 +1,30 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.immutables.value.Value; + +/** + * Base class for resources that contain Space Quota Definitions + */ +@JsonDeserialize +@Value.Immutable +abstract class _SpaceQuotaDefinitionResource extends SpaceQuotaDefinition { + +} + diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_UpdateSpaceQuotaDefinitionRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_UpdateSpaceQuotaDefinitionRequest.java new file mode 100644 index 00000000000..ec10a0786b2 --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_UpdateSpaceQuotaDefinitionRequest.java @@ -0,0 +1,65 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import org.cloudfoundry.Nullable; +import org.immutables.value.Value; + +/** + * The request payload to update an space quota definition + */ +@JsonSerialize +@Value.Immutable +abstract class _UpdateSpaceQuotaDefinitionRequest { + + /** + * The space quota definition id + */ + @JsonIgnore + abstract String getSpaceQuotaDefinitionId(); + + /** + * Name of the quota + */ + @JsonProperty("name") + @Nullable + abstract String getName(); + + /** + * Quotas that affect applications and application sub-resources + */ + @JsonProperty("apps") + @Nullable + abstract Apps getApps(); + + /** + * Quotas that affect services + */ + @JsonProperty("services") + @Nullable + abstract Services getServices(); + + /** + * Quotas that affect routes + */ + @JsonProperty("routes") + @Nullable + abstract Routes getRoutes(); +} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_UpdateSpaceQuotaDefinitionResponse.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_UpdateSpaceQuotaDefinitionResponse.java new file mode 100644 index 00000000000..e1df4f8b859 --- /dev/null +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_UpdateSpaceQuotaDefinitionResponse.java @@ -0,0 +1,29 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.immutables.value.Value; + +/** + * The response payload for the Update an Space Quota Definition operation + */ +@JsonDeserialize +@Value.Immutable +abstract class _UpdateSpaceQuotaDefinitionResponse extends SpaceQuotaDefinition { + +} diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/CreateSpaceQuotaDefinitionRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/CreateSpaceQuotaDefinitionRequestTest.java new file mode 100644 index 00000000000..d2d10b68ea3 --- /dev/null +++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/CreateSpaceQuotaDefinitionRequestTest.java @@ -0,0 +1,59 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +import java.util.UUID; +import org.cloudfoundry.client.v3.Relationship; +import org.cloudfoundry.client.v3.ToOneRelationship; +import org.junit.jupiter.api.Test; + +final class CreateSpaceQuotaDefinitionRequestTest { + + @Test + void noName() { + assertThrows( + IllegalStateException.class, + () -> CreateSpaceQuotaDefinitionRequest.builder().build()); + } + + @Test + void noOrganizationsRelationship() { + assertThrows( + IllegalStateException.class, + () -> CreateSpaceQuotaDefinitionRequest.builder().name("test-quota").build()); + } + + @Test + void valid() { + + String organizationGuid = UUID.randomUUID().toString(); + ToOneRelationship organizationsRelationship = + ToOneRelationship.builder() + .data(Relationship.builder().id(organizationGuid).build()) + .build(); + SpaceQuotaDefinitionRelationships relationships = + SpaceQuotaDefinitionRelationships.builder() + .organization(organizationsRelationship) + .build(); + CreateSpaceQuotaDefinitionRequest.builder() + .name("test-quota") + .relationships(relationships) + .build(); + } +} diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/DeleteSpaceQuotaDefinitionRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/DeleteSpaceQuotaDefinitionRequestTest.java new file mode 100644 index 00000000000..f38f48ad696 --- /dev/null +++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/DeleteSpaceQuotaDefinitionRequestTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; + +final class DeleteSpaceQuotaDefinitionRequestTest { + + @Test + void noSpaceQuotaDefinitionId() { + assertThrows( + IllegalStateException.class, + () -> DeleteSpaceQuotaDefinitionRequest.builder().build()); + } + + @Test + void valid() { + DeleteSpaceQuotaDefinitionRequest.builder().spaceQuotaDefinitionId("test-id").build(); + } +} diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/GetSpaceQuotaDefinitionRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/GetSpaceQuotaDefinitionRequestTest.java new file mode 100644 index 00000000000..5141b92ef46 --- /dev/null +++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/GetSpaceQuotaDefinitionRequestTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; + +final class GetSpaceQuotaDefinitionRequestTest { + + @Test + void noSpaceQuotaDefinitionId() { + assertThrows( + IllegalStateException.class, + () -> GetSpaceQuotaDefinitionRequest.builder().build()); + } + + @Test + void valid() { + GetSpaceQuotaDefinitionRequest.builder().spaceQuotaDefinitionId("test-id").build(); + } +} diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/ListSpaceQuotaDefinitionsRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/ListSpaceQuotaDefinitionsRequestTest.java new file mode 100644 index 00000000000..8f0e0f4f8c8 --- /dev/null +++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/ListSpaceQuotaDefinitionsRequestTest.java @@ -0,0 +1,27 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import org.junit.jupiter.api.Test; + +public class ListSpaceQuotaDefinitionsRequestTest { + + @Test + void valid() { + ListSpaceQuotaDefinitionsRequest.builder().build(); + } +} diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/UpdateSpaceQuotaDefinitionRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/UpdateSpaceQuotaDefinitionRequestTest.java new file mode 100644 index 00000000000..d5ea3e7c084 --- /dev/null +++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/UpdateSpaceQuotaDefinitionRequestTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3.spacequotadefinitions; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; + +final class UpdateSpaceQuotaDefinitionRequestTest { + + @Test + void noSpaceQuotaDefinitionId() { + assertThrows( + IllegalStateException.class, + () -> UpdateSpaceQuotaDefinitionRequest.builder().build()); + } + + @Test + void valid() { + UpdateSpaceQuotaDefinitionRequest.builder().spaceQuotaDefinitionId("test-id").build(); + } +} diff --git a/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotaDefinitionsTest.java b/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotaDefinitionsTest.java new file mode 100644 index 00000000000..7b69f77f24a --- /dev/null +++ b/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotaDefinitionsTest.java @@ -0,0 +1,278 @@ +/* + * Copyright 2013-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cloudfoundry.client.v3; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.time.Duration; +import org.cloudfoundry.AbstractIntegrationTest; +import org.cloudfoundry.CloudFoundryVersion; +import org.cloudfoundry.IfCloudFoundryVersion; +import org.cloudfoundry.client.CloudFoundryClient; +import org.cloudfoundry.client.v3.organizations.CreateOrganizationRequest; +import org.cloudfoundry.client.v3.organizations.Organization; +import org.cloudfoundry.client.v3.spacequotadefinitions.Apps; +import org.cloudfoundry.client.v3.spacequotadefinitions.CreateSpaceQuotaDefinitionRequest; +import org.cloudfoundry.client.v3.spacequotadefinitions.CreateSpaceQuotaDefinitionResponse; +import org.cloudfoundry.client.v3.spacequotadefinitions.DeleteSpaceQuotaDefinitionRequest; +import org.cloudfoundry.client.v3.spacequotadefinitions.GetSpaceQuotaDefinitionRequest; +import org.cloudfoundry.client.v3.spacequotadefinitions.GetSpaceQuotaDefinitionResponse; +import org.cloudfoundry.client.v3.spacequotadefinitions.ListSpaceQuotaDefinitionsRequest; +import org.cloudfoundry.client.v3.spacequotadefinitions.Routes; +import org.cloudfoundry.client.v3.spacequotadefinitions.Services; +import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionRelationships; +import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionResource; +import org.cloudfoundry.client.v3.spacequotadefinitions.UpdateSpaceQuotaDefinitionRequest; +import org.cloudfoundry.util.JobUtils; +import org.cloudfoundry.util.PaginationUtils; +import org.jetbrains.annotations.NotNull; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +@IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.PCF_2_8) +public final class SpaceQuotaDefinitionsTest extends AbstractIntegrationTest { + + @Autowired private CloudFoundryClient cloudFoundryClient; + + private String organizationId; + + @BeforeEach + public void createOrganization() { + String orgName = this.nameFactory.getOrganizationName(); + organizationId = createOrganization(this.cloudFoundryClient, orgName).getId(); + } + + @Test + public void create() { + String spaceQuotaName = this.nameFactory.getQuotaDefinitionName(); + SpaceQuotaDefinitionRelationships spaceQuotaDefinitionRelationships = + createSpaceQuotaDefinitionRelationships(organizationId); + + Apps spaceQuotaAppLimits = + Apps.builder() + .perProcessMemoryInMb(1024) + .totalMemoryInMb(2048) + .logRateLimitInBytesPerSecond(0) + .build(); + Services spaceQuotaServiceLimits = + Services.builder().isPaidServicesAllowed(false).totalServiceInstances(10).build(); + Routes spaceQuotaRouteLimits = Routes.builder().totalRoutes(10).build(); + + this.cloudFoundryClient + .spaceQuotaDefinitionsV3() + .create( + CreateSpaceQuotaDefinitionRequest.builder() + .name(spaceQuotaName) + .apps(spaceQuotaAppLimits) + .services(spaceQuotaServiceLimits) + .routes(spaceQuotaRouteLimits) + .relationships(spaceQuotaDefinitionRelationships) + .build()) + .thenMany(requestListSpaceQuotas(this.cloudFoundryClient, spaceQuotaName)) + .single() + .as(StepVerifier::create) + .assertNext( + spaceQuotaDefinitionResource -> { + assertThat(spaceQuotaDefinitionResource).isNotNull(); + assertThat(spaceQuotaDefinitionResource.getId()).isNotNull(); + assertThat(spaceQuotaDefinitionResource.getName()) + .isEqualTo(spaceQuotaName); + assertThat(spaceQuotaDefinitionResource.getApps()) + .isEqualTo(spaceQuotaAppLimits); + assertThat(spaceQuotaDefinitionResource.getServices()) + .isEqualTo(spaceQuotaServiceLimits); + assertThat(spaceQuotaDefinitionResource.getRoutes()) + .isEqualTo(spaceQuotaRouteLimits); + }) + .expectComplete() + .verify(Duration.ofMinutes(5)); + } + + @Test + public void get() { + String spaceQuotaName = this.nameFactory.getQuotaDefinitionName(); + + createSpaceQuotaId(this.cloudFoundryClient, spaceQuotaName, organizationId) + .flatMap( + spaceQuotaId -> + this.cloudFoundryClient + .spaceQuotaDefinitionsV3() + .get( + GetSpaceQuotaDefinitionRequest.builder() + .spaceQuotaDefinitionId(spaceQuotaId) + .build())) + .map(GetSpaceQuotaDefinitionResponse::getName) + .as(StepVerifier::create) + .expectNext(spaceQuotaName) + .expectComplete() + .verify(Duration.ofMinutes(5)); + } + + @Test + public void list() { + String spaceQuotaName = this.nameFactory.getQuotaDefinitionName(); + + createSpaceQuota(this.cloudFoundryClient, spaceQuotaName, organizationId) + .thenMany( + PaginationUtils.requestClientV3Resources( + page -> + this.cloudFoundryClient + .spaceQuotaDefinitionsV3() + .list( + ListSpaceQuotaDefinitionsRequest.builder() + .page(page) + .build()))) + .filter(resource -> spaceQuotaName.equals(resource.getName())) + .as(StepVerifier::create) + .expectNextCount(1) + .expectComplete() + .verify(Duration.ofMinutes(5)); + } + + @Test + public void update() { + String spaceQuotaName = this.nameFactory.getQuotaDefinitionName(); + int totalMemoryLimit = 64 * 1024; // 64 GB + + createSpaceQuotaId(this.cloudFoundryClient, spaceQuotaName, organizationId) + .flatMap( + spaceQuotaId -> + this.cloudFoundryClient + .spaceQuotaDefinitionsV3() + .update( + UpdateSpaceQuotaDefinitionRequest.builder() + .spaceQuotaDefinitionId(spaceQuotaId) + .apps( + Apps.builder() + .totalMemoryInMb( + totalMemoryLimit) + .build()) + .routes( + Routes.builder() + .totalRoutes(100) + .build()) + .services( + Services.builder() + .isPaidServicesAllowed(true) + .totalServiceInstances(100) + .build()) + .build())) + .thenMany(requestListSpaceQuotas(this.cloudFoundryClient, spaceQuotaName)) + .as(StepVerifier::create) + .consumeNextWith( + organizationQuotaDefinitionResource -> { + assertThat( + organizationQuotaDefinitionResource + .getApps() + .getTotalMemoryInMb()) + .isEqualTo(totalMemoryLimit); + assertThat( + organizationQuotaDefinitionResource + .getRoutes() + .getTotalRoutes()) + .isEqualTo(100); + assertThat( + organizationQuotaDefinitionResource + .getServices() + .getTotalServiceInstances()) + .isEqualTo(100); + }) + .expectComplete() + .verify(Duration.ofMinutes(5)); + } + + @Test + public void delete() { + String spaceQuotaName = this.nameFactory.getQuotaDefinitionName(); + + createSpaceQuotaId(this.cloudFoundryClient, spaceQuotaName, organizationId) + .flatMap( + spaceQuotaId -> + this.cloudFoundryClient + .spaceQuotaDefinitionsV3() + .delete( + DeleteSpaceQuotaDefinitionRequest.builder() + .spaceQuotaDefinitionId(spaceQuotaId) + .build()) + .flatMap( + job -> + JobUtils.waitForCompletion( + this.cloudFoundryClient, + Duration.ofMinutes(5), + job))) + .thenMany(requestListSpaceQuotas(this.cloudFoundryClient, spaceQuotaName)) + .as(StepVerifier::create) + .expectComplete() + .verify(Duration.ofMinutes(5)); + } + + private static Organization createOrganization( + CloudFoundryClient cloudFoundryClient, String orgName) { + return cloudFoundryClient + .organizationsV3() + .create(CreateOrganizationRequest.builder().name(orgName).build()) + .block(Duration.ofMinutes(5)); + } + + @NotNull + private static SpaceQuotaDefinitionRelationships createSpaceQuotaDefinitionRelationships( + String orgGuid) { + ToOneRelationship organizationRelationship = + ToOneRelationship.builder() + .data(Relationship.builder().id(orgGuid).build()) + .build(); + return SpaceQuotaDefinitionRelationships.builder() + .organization(organizationRelationship) + .build(); + } + + private static Mono createSpaceQuotaId( + CloudFoundryClient cloudFoundryClient, String spaceQuotaName, String orgGuid) { + return createSpaceQuota(cloudFoundryClient, spaceQuotaName, orgGuid) + .map(CreateSpaceQuotaDefinitionResponse::getId); + } + + private static Mono createSpaceQuota( + CloudFoundryClient cloudFoundryClient, String spaceQuotaName, String orgGuid) { + SpaceQuotaDefinitionRelationships spaceQuotaDefinitionRelationships = + createSpaceQuotaDefinitionRelationships(orgGuid); + return cloudFoundryClient + .spaceQuotaDefinitionsV3() + .create( + CreateSpaceQuotaDefinitionRequest.builder() + .name(spaceQuotaName) + .relationships(spaceQuotaDefinitionRelationships) + .build()); + } + + private static Flux requestListSpaceQuotas( + CloudFoundryClient cloudFoundryClient, String spaceName) { + return PaginationUtils.requestClientV3Resources( + page -> + cloudFoundryClient + .spaceQuotaDefinitionsV3() + .list( + ListSpaceQuotaDefinitionsRequest.builder() + .name(spaceName) + .page(page) + .build())); + } +} From 525237001c1f10d0d907666fde05007b30ef0a0f Mon Sep 17 00:00:00 2001 From: "Merchant, Saifuddin A" Date: Tue, 2 Dec 2025 11:50:57 -0700 Subject: [PATCH 2/5] Added test case for create space quota having a space relationship --- .../client/v3/SpaceQuotaDefinitionsTest.java | 110 ++++++++++++++++-- 1 file changed, 101 insertions(+), 9 deletions(-) diff --git a/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotaDefinitionsTest.java b/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotaDefinitionsTest.java index 7b69f77f24a..719ecd05c55 100644 --- a/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotaDefinitionsTest.java +++ b/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotaDefinitionsTest.java @@ -37,6 +37,9 @@ import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionRelationships; import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionResource; import org.cloudfoundry.client.v3.spacequotadefinitions.UpdateSpaceQuotaDefinitionRequest; +import org.cloudfoundry.client.v3.spaces.CreateSpaceRequest; +import org.cloudfoundry.client.v3.spaces.Space; +import org.cloudfoundry.client.v3.spaces.SpaceRelationships; import org.cloudfoundry.util.JobUtils; import org.cloudfoundry.util.PaginationUtils; import org.jetbrains.annotations.NotNull; @@ -53,11 +56,15 @@ public final class SpaceQuotaDefinitionsTest extends AbstractIntegrationTest { @Autowired private CloudFoundryClient cloudFoundryClient; private String organizationId; + private String spaceId; @BeforeEach public void createOrganization() { String orgName = this.nameFactory.getOrganizationName(); + String spaceName = this.nameFactory.getSpaceName(); + organizationId = createOrganization(this.cloudFoundryClient, orgName).getId(); + spaceId = createSpace(this.cloudFoundryClient, organizationId, spaceName).getId(); } @Test @@ -106,6 +113,59 @@ public void create() { .verify(Duration.ofMinutes(5)); } + @Test + public void createWithSpaceRelationship() { + String spaceQuotaName = this.nameFactory.getQuotaDefinitionName(); + SpaceQuotaDefinitionRelationships spaceQuotaDefinitionRelationships = + createSpaceQuotaDefinitionRelationships(organizationId, spaceId); + + Apps spaceQuotaAppLimits = + Apps.builder() + .perProcessMemoryInMb(1024) + .totalMemoryInMb(2048) + .logRateLimitInBytesPerSecond(0) + .build(); + Services spaceQuotaServiceLimits = + Services.builder().isPaidServicesAllowed(false).totalServiceInstances(10).build(); + Routes spaceQuotaRouteLimits = Routes.builder().totalRoutes(10).build(); + + this.cloudFoundryClient + .spaceQuotaDefinitionsV3() + .create( + CreateSpaceQuotaDefinitionRequest.builder() + .name(spaceQuotaName) + .apps(spaceQuotaAppLimits) + .services(spaceQuotaServiceLimits) + .routes(spaceQuotaRouteLimits) + .relationships(spaceQuotaDefinitionRelationships) + .build()) + .thenMany(requestListSpaceQuotas(this.cloudFoundryClient, spaceQuotaName)) + .single() + .as(StepVerifier::create) + .assertNext( + spaceQuotaDefinitionResource -> { + assertThat(spaceQuotaDefinitionResource).isNotNull(); + assertThat(spaceQuotaDefinitionResource.getId()).isNotNull(); + assertThat(spaceQuotaDefinitionResource.getName()) + .isEqualTo(spaceQuotaName); + assertThat(spaceQuotaDefinitionResource.getApps()) + .isEqualTo(spaceQuotaAppLimits); + assertThat(spaceQuotaDefinitionResource.getServices()) + .isEqualTo(spaceQuotaServiceLimits); + assertThat(spaceQuotaDefinitionResource.getRoutes()) + .isEqualTo(spaceQuotaRouteLimits); + assertThat(spaceQuotaDefinitionResource.getRelationships()).isNotNull(); + assertThat(spaceQuotaDefinitionResource.getRelationships().getOrganization()).isNotNull(); + assertThat(spaceQuotaDefinitionResource.getRelationships().getSpaces()).isNotNull(); + assertThat(spaceQuotaDefinitionResource.getRelationships().getOrganization().getData().getId()) + .isEqualTo(organizationId); + assertThat(spaceQuotaDefinitionResource.getRelationships().getSpaces().getData().getFirst().getId()) + .isEqualTo(spaceId); + }) + .expectComplete() + .verify(Duration.ofMinutes(5)); + } + @Test public void get() { String spaceQuotaName = this.nameFactory.getQuotaDefinitionName(); @@ -180,19 +240,19 @@ public void update() { .consumeNextWith( organizationQuotaDefinitionResource -> { assertThat( - organizationQuotaDefinitionResource - .getApps() - .getTotalMemoryInMb()) + organizationQuotaDefinitionResource + .getApps() + .getTotalMemoryInMb()) .isEqualTo(totalMemoryLimit); assertThat( - organizationQuotaDefinitionResource - .getRoutes() - .getTotalRoutes()) + organizationQuotaDefinitionResource + .getRoutes() + .getTotalRoutes()) .isEqualTo(100); assertThat( - organizationQuotaDefinitionResource - .getServices() - .getTotalServiceInstances()) + organizationQuotaDefinitionResource + .getServices() + .getTotalServiceInstances()) .isEqualTo(100); }) .expectComplete() @@ -232,6 +292,22 @@ private static Organization createOrganization( .block(Duration.ofMinutes(5)); } + private static Space createSpace( + CloudFoundryClient cloudFoundryClient, String orgGuid, String spaceName) { + ToOneRelationship organizationRelationship = + ToOneRelationship.builder() + .data(Relationship.builder().id(orgGuid).build()) + .build(); + SpaceRelationships spaceRelationships = + SpaceRelationships.builder() + .organization(organizationRelationship) + .build(); + return cloudFoundryClient + .spacesV3() + .create(CreateSpaceRequest.builder().name(spaceName).relationships(spaceRelationships).build()) + .block(Duration.ofMinutes(5)); + } + @NotNull private static SpaceQuotaDefinitionRelationships createSpaceQuotaDefinitionRelationships( String orgGuid) { @@ -244,6 +320,22 @@ private static SpaceQuotaDefinitionRelationships createSpaceQuotaDefinitionRelat .build(); } + @NotNull + private static SpaceQuotaDefinitionRelationships createSpaceQuotaDefinitionRelationships( + String orgGuid, String spaceGuid) { + ToOneRelationship organizationRelationship = + ToOneRelationship.builder() + .data(Relationship.builder().id(orgGuid).build()) + .build(); + ToManyRelationship spaceRelationships = ToManyRelationship.builder() + .data(Relationship.builder().id(spaceGuid).build()) + .build(); + return SpaceQuotaDefinitionRelationships.builder() + .organization(organizationRelationship) + .spaces(spaceRelationships) + .build(); + } + private static Mono createSpaceQuotaId( CloudFoundryClient cloudFoundryClient, String spaceQuotaName, String orgGuid) { return createSpaceQuota(cloudFoundryClient, spaceQuotaName, orgGuid) From 1d603991a6f13caf7c9f868245ec65b5b58c8551 Mon Sep 17 00:00:00 2001 From: "Merchant, Saifuddin A" Date: Tue, 2 Dec 2025 15:49:30 -0700 Subject: [PATCH 3/5] Moved package, class name, variable from SpaceDefinitionQuota to SpaceQuota naming pattern --- .../client/_ReactorCloudFoundryClient.java | 8 +- .../ReactorSpaceQuotasV3.java} | 51 +++---- .../ReactorSpaceQuotasV3Test.java} | 92 +++++------- .../client/CloudFoundryClient.java | 6 +- .../SpaceQuota.java} | 8 +- .../SpaceQuotasV3.java} | 40 ++--- .../_Apps.java | 2 +- .../_CreateSpaceQuotaRequest.java} | 8 +- .../_CreateSpaceQuotaResponse.java} | 6 +- .../_DeleteSpaceQuotaRequest.java} | 10 +- .../_GetSpaceQuotaRequest.java} | 10 +- .../_GetSpaceQuotaResponse.java} | 6 +- .../_ListSpaceQuotasRequest.java} | 6 +- .../_ListSpaceQuotasResponse.java} | 6 +- .../_Routes.java | 2 +- .../_Services.java | 2 +- .../_SpaceQuotaRelationships.java} | 6 +- .../_SpaceQuotaResource.java} | 6 +- .../_UpdateSpaceQuotaRequest.java} | 10 +- .../_UpdateSpaceQuotaResponse.java} | 6 +- .../CreateSpaceQuotaRequestTest.java} | 14 +- .../DeleteSpaceQuotaRequestTest.java} | 10 +- .../GetSpaceQuotaRequestTest.java} | 10 +- .../ListSpaceQuotasRequestTest.java} | 6 +- .../UpdateSpaceQuotaRequestTest.java} | 10 +- ...initionsTest.java => SpaceQuotasTest.java} | 141 +++++++++--------- 26 files changed, 230 insertions(+), 252 deletions(-) rename cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/{spacequotadefinition/ReactorSpaceQuotaDefinitionsV3.java => spacequotas/ReactorSpaceQuotasV3.java} (56%) rename cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/{spacequotadefinition/ReactorSpaceQuotaDefinitionsV3Test.java => spacequotas/ReactorSpaceQuotasV3Test.java} (77%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions/SpaceQuotaDefinition.java => spacequotas/SpaceQuota.java} (85%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions/SpaceQuotaDefinitionsV3.java => spacequotas/SpaceQuotasV3.java} (54%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions => spacequotas}/_Apps.java (97%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions/_CreateSpaceQuotaDefinitionRequest.java => spacequotas/_CreateSpaceQuotaRequest.java} (86%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions/_CreateSpaceQuotaDefinitionResponse.java => spacequotas/_CreateSpaceQuotaResponse.java} (78%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions/_DeleteSpaceQuotaDefinitionRequest.java => spacequotas/_DeleteSpaceQuotaRequest.java} (74%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions/_GetSpaceQuotaDefinitionRequest.java => spacequotas/_GetSpaceQuotaRequest.java} (80%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions/_GetSpaceQuotaDefinitionResponse.java => spacequotas/_GetSpaceQuotaResponse.java} (83%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions/_ListSpaceQuotaDefinitionsRequest.java => spacequotas/_ListSpaceQuotasRequest.java} (87%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions/_ListSpaceQuotaDefinitionsResponse.java => spacequotas/_ListSpaceQuotasResponse.java} (77%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions => spacequotas}/_Routes.java (96%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions => spacequotas}/_Services.java (96%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions/_SpaceQuotaDefinitionRelationships.java => spacequotas/_SpaceQuotaRelationships.java} (88%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions/_SpaceQuotaDefinitionResource.java => spacequotas/_SpaceQuotaResource.java} (79%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions/_UpdateSpaceQuotaDefinitionRequest.java => spacequotas/_UpdateSpaceQuotaRequest.java} (85%) rename cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/{spacequotadefinitions/_UpdateSpaceQuotaDefinitionResponse.java => spacequotas/_UpdateSpaceQuotaResponse.java} (78%) rename cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/{spacequotadefinitions/CreateSpaceQuotaDefinitionRequestTest.java => spacequotas/CreateSpaceQuotaRequestTest.java} (78%) rename cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/{spacequotadefinitions/GetSpaceQuotaDefinitionRequestTest.java => spacequotas/DeleteSpaceQuotaRequestTest.java} (73%) rename cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/{spacequotadefinitions/UpdateSpaceQuotaDefinitionRequestTest.java => spacequotas/GetSpaceQuotaRequestTest.java} (72%) rename cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/{spacequotadefinitions/ListSpaceQuotaDefinitionsRequestTest.java => spacequotas/ListSpaceQuotasRequestTest.java} (80%) rename cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/{spacequotadefinitions/DeleteSpaceQuotaDefinitionRequestTest.java => spacequotas/UpdateSpaceQuotaRequestTest.java} (72%) rename integration-test/src/test/java/org/cloudfoundry/client/v3/{SpaceQuotaDefinitionsTest.java => SpaceQuotasTest.java} (71%) diff --git a/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/_ReactorCloudFoundryClient.java b/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/_ReactorCloudFoundryClient.java index c5aaf9197b7..769e278aade 100644 --- a/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/_ReactorCloudFoundryClient.java +++ b/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/_ReactorCloudFoundryClient.java @@ -72,7 +72,7 @@ import org.cloudfoundry.client.v3.serviceinstances.ServiceInstancesV3; import org.cloudfoundry.client.v3.serviceofferings.ServiceOfferingsV3; import org.cloudfoundry.client.v3.serviceplans.ServicePlansV3; -import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionsV3; +import org.cloudfoundry.client.v3.spacequotas.SpaceQuotasV3; import org.cloudfoundry.client.v3.spaces.SpacesV3; import org.cloudfoundry.client.v3.stacks.StacksV3; import org.cloudfoundry.client.v3.tasks.Tasks; @@ -132,7 +132,7 @@ import org.cloudfoundry.reactor.client.v3.serviceinstances.ReactorServiceInstancesV3; import org.cloudfoundry.reactor.client.v3.serviceofferings.ReactorServiceOfferingsV3; import org.cloudfoundry.reactor.client.v3.serviceplans.ReactorServicePlansV3; -import org.cloudfoundry.reactor.client.v3.spacequotadefinition.ReactorSpaceQuotaDefinitionsV3; +import org.cloudfoundry.reactor.client.v3.spacequotas.ReactorSpaceQuotasV3; import org.cloudfoundry.reactor.client.v3.spaces.ReactorSpacesV3; import org.cloudfoundry.reactor.client.v3.stacks.ReactorStacksV3; import org.cloudfoundry.reactor.client.v3.tasks.ReactorTasks; @@ -461,8 +461,8 @@ public SpaceQuotaDefinitions spaceQuotaDefinitions() { @Override @Value.Derived - public SpaceQuotaDefinitionsV3 spaceQuotaDefinitionsV3() { - return new ReactorSpaceQuotaDefinitionsV3(getConnectionContext(), getRootV3(), getTokenProvider(), + public SpaceQuotasV3 spaceQuotasV3() { + return new ReactorSpaceQuotasV3(getConnectionContext(), getRootV3(), getTokenProvider(), getRequestTags()); } diff --git a/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/spacequotadefinition/ReactorSpaceQuotaDefinitionsV3.java b/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/spacequotas/ReactorSpaceQuotasV3.java similarity index 56% rename from cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/spacequotadefinition/ReactorSpaceQuotaDefinitionsV3.java rename to cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/spacequotas/ReactorSpaceQuotasV3.java index ffd4f119977..246646a3296 100644 --- a/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/spacequotadefinition/ReactorSpaceQuotaDefinitionsV3.java +++ b/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/spacequotas/ReactorSpaceQuotasV3.java @@ -14,29 +14,22 @@ * limitations under the License. */ -package org.cloudfoundry.reactor.client.v3.spacequotadefinition; +package org.cloudfoundry.reactor.client.v3.spacequotas; import java.util.Map; -import org.cloudfoundry.client.v3.spacequotadefinitions.CreateSpaceQuotaDefinitionRequest; -import org.cloudfoundry.client.v3.spacequotadefinitions.CreateSpaceQuotaDefinitionResponse; -import org.cloudfoundry.client.v3.spacequotadefinitions.DeleteSpaceQuotaDefinitionRequest; -import org.cloudfoundry.client.v3.spacequotadefinitions.GetSpaceQuotaDefinitionRequest; -import org.cloudfoundry.client.v3.spacequotadefinitions.GetSpaceQuotaDefinitionResponse; -import org.cloudfoundry.client.v3.spacequotadefinitions.ListSpaceQuotaDefinitionsRequest; -import org.cloudfoundry.client.v3.spacequotadefinitions.ListSpaceQuotaDefinitionsResponse; -import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionsV3; -import org.cloudfoundry.client.v3.spacequotadefinitions.UpdateSpaceQuotaDefinitionRequest; -import org.cloudfoundry.client.v3.spacequotadefinitions.UpdateSpaceQuotaDefinitionResponse; + +import org.cloudfoundry.client.v3.spacequotas.*; +import org.cloudfoundry.client.v3.spacequotas.CreateSpaceQuotaResponse; import org.cloudfoundry.reactor.ConnectionContext; import org.cloudfoundry.reactor.TokenProvider; import org.cloudfoundry.reactor.client.v3.AbstractClientV3Operations; import reactor.core.publisher.Mono; /** - * The Reactor-based implementation of {@link ReactorSpaceQuotaDefinitionsV3} + * The Reactor-based implementation of {@link ReactorSpaceQuotasV3} */ -public class ReactorSpaceQuotaDefinitionsV3 extends AbstractClientV3Operations - implements SpaceQuotaDefinitionsV3 { +public class ReactorSpaceQuotasV3 extends AbstractClientV3Operations + implements SpaceQuotasV3 { /** * Creates an instance @@ -46,7 +39,7 @@ public class ReactorSpaceQuotaDefinitionsV3 extends AbstractClientV3Operations * @param tokenProvider the {@link TokenProvider} to use when communicating with the server * @param requestTags map with custom http headers which will be added to web request */ - public ReactorSpaceQuotaDefinitionsV3( + public ReactorSpaceQuotasV3( ConnectionContext connectionContext, Mono root, TokenProvider tokenProvider, @@ -55,54 +48,54 @@ public ReactorSpaceQuotaDefinitionsV3( } @Override - public Mono create( - CreateSpaceQuotaDefinitionRequest request) { + public Mono create( + CreateSpaceQuotaRequest request) { return post( request, - CreateSpaceQuotaDefinitionResponse.class, + CreateSpaceQuotaResponse.class, builder -> builder.pathSegment("space_quotas")) .checkpoint(); } @Override - public Mono get(GetSpaceQuotaDefinitionRequest request) { + public Mono get(GetSpaceQuotaRequest request) { return get( request, - GetSpaceQuotaDefinitionResponse.class, + GetSpaceQuotaResponse.class, builder -> builder.pathSegment( - "space_quotas", request.getSpaceQuotaDefinitionId())) + "space_quotas", request.getSpaceQuotaId())) .checkpoint(); } @Override - public Mono list(ListSpaceQuotaDefinitionsRequest request) { + public Mono list(ListSpaceQuotasRequest request) { return get( request, - ListSpaceQuotaDefinitionsResponse.class, + ListSpaceQuotasResponse.class, builder -> builder.pathSegment("space_quotas")) .checkpoint(); } @Override - public Mono update( - UpdateSpaceQuotaDefinitionRequest request) { + public Mono update( + UpdateSpaceQuotaRequest request) { return patch( request, - UpdateSpaceQuotaDefinitionResponse.class, + UpdateSpaceQuotaResponse.class, builder -> builder.pathSegment( - "space_quotas", request.getSpaceQuotaDefinitionId())) + "space_quotas", request.getSpaceQuotaId())) .checkpoint(); } @Override - public Mono delete(DeleteSpaceQuotaDefinitionRequest request) { + public Mono delete(DeleteSpaceQuotaRequest request) { return delete( request, builder -> builder.pathSegment( - "space_quotas", request.getSpaceQuotaDefinitionId())) + "space_quotas", request.getSpaceQuotaId())) .checkpoint(); } } diff --git a/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/spacequotadefinition/ReactorSpaceQuotaDefinitionsV3Test.java b/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/spacequotas/ReactorSpaceQuotasV3Test.java similarity index 77% rename from cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/spacequotadefinition/ReactorSpaceQuotaDefinitionsV3Test.java rename to cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/spacequotas/ReactorSpaceQuotasV3Test.java index 79f1a8b68f2..1911d200e8e 100644 --- a/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/spacequotadefinition/ReactorSpaceQuotaDefinitionsV3Test.java +++ b/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/spacequotas/ReactorSpaceQuotasV3Test.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.cloudfoundry.reactor.client.v3.spacequotadefinition; +package org.cloudfoundry.reactor.client.v3.spacequotas; import static io.netty.handler.codec.http.HttpMethod.DELETE; import static io.netty.handler.codec.http.HttpMethod.GET; @@ -30,20 +30,8 @@ import org.cloudfoundry.client.v3.Relationship; import org.cloudfoundry.client.v3.ToManyRelationship; import org.cloudfoundry.client.v3.ToOneRelationship; -import org.cloudfoundry.client.v3.spacequotadefinitions.Apps; -import org.cloudfoundry.client.v3.spacequotadefinitions.CreateSpaceQuotaDefinitionRequest; -import org.cloudfoundry.client.v3.spacequotadefinitions.CreateSpaceQuotaDefinitionResponse; -import org.cloudfoundry.client.v3.spacequotadefinitions.DeleteSpaceQuotaDefinitionRequest; -import org.cloudfoundry.client.v3.spacequotadefinitions.GetSpaceQuotaDefinitionRequest; -import org.cloudfoundry.client.v3.spacequotadefinitions.GetSpaceQuotaDefinitionResponse; -import org.cloudfoundry.client.v3.spacequotadefinitions.ListSpaceQuotaDefinitionsRequest; -import org.cloudfoundry.client.v3.spacequotadefinitions.ListSpaceQuotaDefinitionsResponse; -import org.cloudfoundry.client.v3.spacequotadefinitions.Routes; -import org.cloudfoundry.client.v3.spacequotadefinitions.Services; -import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionRelationships; -import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionResource; -import org.cloudfoundry.client.v3.spacequotadefinitions.UpdateSpaceQuotaDefinitionRequest; -import org.cloudfoundry.client.v3.spacequotadefinitions.UpdateSpaceQuotaDefinitionResponse; +import org.cloudfoundry.client.v3.spacequotas.*; +import org.cloudfoundry.client.v3.spacequotas.SpaceQuotaResource; import org.cloudfoundry.reactor.InteractionContext; import org.cloudfoundry.reactor.TestRequest; import org.cloudfoundry.reactor.TestResponse; @@ -52,12 +40,12 @@ import org.junit.jupiter.api.Test; import reactor.test.StepVerifier; -class ReactorSpaceQuotaDefinitionsV3Test extends AbstractClientApiTest { +class ReactorSpaceQuotasV3Test extends AbstractClientApiTest { public static final String EXPECTED_SPACE_QUOTA_ID_1 = "f919ef8a-e333-472a-8172-baaf2c30d301"; - private final ReactorSpaceQuotaDefinitionsV3 spaceQuotaDefinitionsV3 = - new ReactorSpaceQuotaDefinitionsV3( + private final ReactorSpaceQuotasV3 spaceQuotasV3 = + new ReactorSpaceQuotasV3( CONNECTION_CONTEXT, this.root, TOKEN_PROVIDER, Collections.emptyMap()); @Test @@ -79,8 +67,8 @@ void create() { .build()) .build()); - SpaceQuotaDefinitionRelationships relationships = - SpaceQuotaDefinitionRelationships.builder() + SpaceQuotaRelationships relationships = + SpaceQuotaRelationships.builder() .organization( ToOneRelationship.builder() .data( @@ -98,16 +86,16 @@ void create() { .build())) .build()) .build(); - this.spaceQuotaDefinitionsV3 + this.spaceQuotasV3 .create( - CreateSpaceQuotaDefinitionRequest.builder() + CreateSpaceQuotaRequest.builder() .name("my-quota") .relationships(relationships) .build()) .as(StepVerifier::create) .expectNext( - CreateSpaceQuotaDefinitionResponse.builder() - .from(expectedSpaceQuotaDefinitionResource1()) + CreateSpaceQuotaResponse.builder() + .from(expectedSpaceQuotaResource1()) .build()) .expectComplete() .verify(Duration.ofSeconds(5)); @@ -131,10 +119,10 @@ void delete() { .build()) .build()); - this.spaceQuotaDefinitionsV3 + this.spaceQuotasV3 .delete( - DeleteSpaceQuotaDefinitionRequest.builder() - .spaceQuotaDefinitionId("test-space-quota-id") + DeleteSpaceQuotaRequest.builder() + .spaceQuotaId("test-space-quota-id") .build()) .as(StepVerifier::create) .expectNext("test-job-id") @@ -159,15 +147,15 @@ void get() { .build()) .build()); - this.spaceQuotaDefinitionsV3 + this.spaceQuotasV3 .get( - GetSpaceQuotaDefinitionRequest.builder() - .spaceQuotaDefinitionId(EXPECTED_SPACE_QUOTA_ID_1) + GetSpaceQuotaRequest.builder() + .spaceQuotaId(EXPECTED_SPACE_QUOTA_ID_1) .build()) .as(StepVerifier::create) .expectNext( - GetSpaceQuotaDefinitionResponse.builder() - .from(expectedSpaceQuotaDefinitionResource1()) + GetSpaceQuotaResponse.builder() + .from(expectedSpaceQuotaResource1()) .build()) .expectComplete() .verify(Duration.ofSeconds(5)); @@ -186,11 +174,11 @@ void list() { .build()) .build()); - this.spaceQuotaDefinitionsV3 - .list(ListSpaceQuotaDefinitionsRequest.builder().build()) + this.spaceQuotasV3 + .list(ListSpaceQuotasRequest.builder().build()) .as(StepVerifier::create) .expectNext( - ListSpaceQuotaDefinitionsResponse.builder() + ListSpaceQuotasResponse.builder() .pagination( Pagination.builder() .totalResults(2) @@ -207,12 +195,12 @@ void list() { .build()) .build()) .resource( - SpaceQuotaDefinitionResource.builder() - .from(expectedSpaceQuotaDefinitionResource1()) + SpaceQuotaResource.builder() + .from(expectedSpaceQuotaResource1()) .build()) .resource( - SpaceQuotaDefinitionResource.builder() - .from(expectedSpaceQuotaDefinitionResource2()) + SpaceQuotaResource.builder() + .from(expectedSpaceQuotaResource2()) .build()) .build()) .expectComplete() @@ -238,31 +226,31 @@ void update() { .build()) .build()); - this.spaceQuotaDefinitionsV3 + this.spaceQuotasV3 .update( - UpdateSpaceQuotaDefinitionRequest.builder() - .spaceQuotaDefinitionId(EXPECTED_SPACE_QUOTA_ID_1) + UpdateSpaceQuotaRequest.builder() + .spaceQuotaId(EXPECTED_SPACE_QUOTA_ID_1) .build()) .as(StepVerifier::create) .expectNext( - UpdateSpaceQuotaDefinitionResponse.builder() - .from(expectedSpaceQuotaDefinitionResource1()) + UpdateSpaceQuotaResponse.builder() + .from(expectedSpaceQuotaResource1()) .build()) .expectComplete() .verify(Duration.ofSeconds(5)); } @NotNull - private static SpaceQuotaDefinitionResource expectedSpaceQuotaDefinitionResource1() { - return buildSpaceQuotaDefinitionResource( + private static SpaceQuotaResource expectedSpaceQuotaResource1() { + return buildSpaceQuotaResource( EXPECTED_SPACE_QUOTA_ID_1, "my-quota", "9b370018-c38e-44c9-86d6-155c76801104", "dcfd6a55-62b9-496e-a26f-0064cec076bf"); } - private static SpaceQuotaDefinitionResource expectedSpaceQuotaDefinitionResource2() { - return buildSpaceQuotaDefinitionResource( + private static SpaceQuotaResource expectedSpaceQuotaResource2() { + return buildSpaceQuotaResource( "bb49bf20-ad98-4729-93ae-38fbc564b630", "my-quota-2", "9b370018-c38e-44c9-86d6-155c76801104", @@ -270,7 +258,7 @@ private static SpaceQuotaDefinitionResource expectedSpaceQuotaDefinitionResource } @NotNull - private static SpaceQuotaDefinitionResource buildSpaceQuotaDefinitionResource( + private static SpaceQuotaResource buildSpaceQuotaResource( String id, String name, String relatedOrganizationId, String relatedSpaceId) { Apps apps = @@ -302,13 +290,13 @@ private static SpaceQuotaDefinitionResource buildSpaceQuotaDefinitionResource( Relationship.builder().id(relatedSpaceId).build())) .build(); } - SpaceQuotaDefinitionRelationships relationships = - SpaceQuotaDefinitionRelationships.builder() + SpaceQuotaRelationships relationships = + SpaceQuotaRelationships.builder() .organization(organizationRelationship) .spaces(spaceRelationships) .build(); - return SpaceQuotaDefinitionResource.builder() + return SpaceQuotaResource.builder() .createdAt("2016-05-04T17:00:41Z") .id(id) .link( diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/CloudFoundryClient.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/CloudFoundryClient.java index b5bedb84d38..d7b9b7612fd 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/CloudFoundryClient.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/CloudFoundryClient.java @@ -70,7 +70,7 @@ import org.cloudfoundry.client.v3.serviceinstances.ServiceInstancesV3; import org.cloudfoundry.client.v3.serviceofferings.ServiceOfferingsV3; import org.cloudfoundry.client.v3.serviceplans.ServicePlansV3; -import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionsV3; +import org.cloudfoundry.client.v3.spacequotas.SpaceQuotasV3; import org.cloudfoundry.client.v3.spaces.SpacesV3; import org.cloudfoundry.client.v3.stacks.StacksV3; import org.cloudfoundry.client.v3.tasks.Tasks; @@ -336,9 +336,9 @@ public interface CloudFoundryClient { SpaceQuotaDefinitions spaceQuotaDefinitions(); /** - * Main entry point to the Cloud Foundry Space Definitions V3 Client API + * Main entry point to the Cloud Foundry Space V3 Client API */ - SpaceQuotaDefinitionsV3 spaceQuotaDefinitionsV3(); + SpaceQuotasV3 spaceQuotasV3(); /** * Main entry point to the Cloud Foundry Spaces V2 Client API diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceQuotaDefinition.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/SpaceQuota.java similarity index 85% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceQuotaDefinition.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/SpaceQuota.java index c0d27d8dd67..4125369e1f8 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceQuotaDefinition.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/SpaceQuota.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import com.fasterxml.jackson.annotation.JsonProperty; import org.cloudfoundry.Nullable; import org.cloudfoundry.client.v3.Resource; /** - * Base class for responses that are space quota definitions + * Base class for responses that are Space Quotas */ -public abstract class SpaceQuotaDefinition extends Resource { +public abstract class SpaceQuota extends Resource { /** * Name of the quota @@ -57,5 +57,5 @@ public abstract class SpaceQuotaDefinition extends Resource { * A space quota must have a relationship to an organization */ @JsonProperty("relationships") - abstract SpaceQuotaDefinitionRelationships getRelationships(); + abstract SpaceQuotaRelationships getRelationships(); } diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceQuotaDefinitionsV3.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/SpaceQuotasV3.java similarity index 54% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceQuotaDefinitionsV3.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/SpaceQuotasV3.java index b97326da11f..8d0ebe48b9d 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceQuotaDefinitionsV3.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/SpaceQuotasV3.java @@ -14,56 +14,56 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import reactor.core.publisher.Mono; /** - * Main entry point to the Cloud Foundry Space Quota Definitions Client API + * Main entry point to the Cloud Foundry Space Quota Client API */ -public interface SpaceQuotaDefinitionsV3 { +public interface SpaceQuotasV3 { /** * Makes the Create Space Quota * request * - * @param request the Create Space Quota Definition request - * @return the response from the Create Space Quota Definition request + * @param request the Create Space Quota request + * @return the response from the Create Space Quota request */ - Mono create(CreateSpaceQuotaDefinitionRequest request); + Mono create(CreateSpaceQuotaRequest request); /** * Makes the Get Space Quota * request * - * @param request the Get Space Quota Definition request + * @param request the Get Space Quota request * @return the response from the Get Space Quota request */ - Mono get(GetSpaceQuotaDefinitionRequest request); + Mono get(GetSpaceQuotaRequest request); /** - * Makes the List all Space Quota Definitions + * Makes the List all Space Quota * request * - * @param request the List all Space Quota Definitions request - * @return the response from the Space all Organization Quota Definitions request + * @param request the List all Space Quotas request + * @return the response from the Space all Organization Quotas request */ - Mono list(ListSpaceQuotaDefinitionsRequest request); + Mono list(ListSpaceQuotasRequest request); - /** Makes the Update Space Quota Definition + /** Makes the Update Space Quota * request * - * @param request the Update Space Quota Definition request - * @return the response from the Update Space Quota Definition request + * @param request the Update Space Quota request + * @return the response from the Update Space Quota request */ - Mono update(UpdateSpaceQuotaDefinitionRequest request); + Mono update(UpdateSpaceQuotaRequest request); /** - * Makes the Delete Space Quota Definition + * Makes the Delete Space Quota * request * - * @param request the Delete Space Quota Definition request - * @return the response from the Space Organization Quota Definition request + * @param request the Delete Space Quota request + * @return the response from the Space Organization Quota request */ - Mono delete(DeleteSpaceQuotaDefinitionRequest request); + Mono delete(DeleteSpaceQuotaRequest request); } diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Apps.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_Apps.java similarity index 97% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Apps.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_Apps.java index 732afd6ae22..0b61bd3df81 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Apps.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_Apps.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_CreateSpaceQuotaDefinitionRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_CreateSpaceQuotaRequest.java similarity index 86% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_CreateSpaceQuotaDefinitionRequest.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_CreateSpaceQuotaRequest.java index e8d2fd207e2..6c54d0e583d 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_CreateSpaceQuotaDefinitionRequest.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_CreateSpaceQuotaRequest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @@ -22,11 +22,11 @@ import org.immutables.value.Value; /** - * The request payload to creates a new space quota + * The request payload to Create a new Space Quota */ @JsonSerialize @Value.Immutable -abstract class _CreateSpaceQuotaDefinitionRequest { +abstract class _CreateSpaceQuotaRequest { /** * Name of the quota @@ -38,7 +38,7 @@ abstract class _CreateSpaceQuotaDefinitionRequest { * A relationship to the organizations and spaces where the quota is applied */ @JsonProperty("relationships") - abstract SpaceQuotaDefinitionRelationships getRelationships(); + abstract SpaceQuotaRelationships getRelationships(); /** * Quotas that affect applications and application sub-resources diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_CreateSpaceQuotaDefinitionResponse.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_CreateSpaceQuotaResponse.java similarity index 78% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_CreateSpaceQuotaDefinitionResponse.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_CreateSpaceQuotaResponse.java index 678390a6f36..daaa0ca8ff5 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_CreateSpaceQuotaDefinitionResponse.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_CreateSpaceQuotaResponse.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import org.immutables.value.Value; /** - * The response payload for the Create an Space Quota Definition operation + * The response payload for the Create a Space Quota */ @JsonDeserialize @Value.Immutable -abstract class _CreateSpaceQuotaDefinitionResponse extends SpaceQuotaDefinition { +abstract class _CreateSpaceQuotaResponse extends SpaceQuota { } diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_DeleteSpaceQuotaDefinitionRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_DeleteSpaceQuotaRequest.java similarity index 74% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_DeleteSpaceQuotaDefinitionRequest.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_DeleteSpaceQuotaRequest.java index d41e4fb0c89..0ee5210677d 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_DeleteSpaceQuotaDefinitionRequest.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_DeleteSpaceQuotaRequest.java @@ -14,21 +14,21 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import com.fasterxml.jackson.annotation.JsonIgnore; import org.immutables.value.Value; /** - * The request payload for the Delete an Space Quota Definition operation + * The request payload for the Delete a Space Quota */ @Value.Immutable -abstract class _DeleteSpaceQuotaDefinitionRequest { +abstract class _DeleteSpaceQuotaRequest { /** - * The quota definition id + * The space quota id */ @JsonIgnore - abstract String getSpaceQuotaDefinitionId(); + abstract String getSpaceQuotaId(); } diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_GetSpaceQuotaDefinitionRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_GetSpaceQuotaRequest.java similarity index 80% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_GetSpaceQuotaDefinitionRequest.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_GetSpaceQuotaRequest.java index d73bfa7d987..80dfe3e2d01 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_GetSpaceQuotaDefinitionRequest.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_GetSpaceQuotaRequest.java @@ -14,21 +14,21 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import com.fasterxml.jackson.annotation.JsonIgnore; import org.immutables.value.Value; /** - * The request payload for the Retrieve a Particular Space Quota Definition operation + * The request payload for the Retrieve a Particular Space Quota */ @Value.Immutable -abstract class _GetSpaceQuotaDefinitionRequest { +abstract class _GetSpaceQuotaRequest { /** - * The quota definition id + * The space quota id */ @JsonIgnore - abstract String getSpaceQuotaDefinitionId(); + abstract String getSpaceQuotaId(); } diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_GetSpaceQuotaDefinitionResponse.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_GetSpaceQuotaResponse.java similarity index 83% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_GetSpaceQuotaDefinitionResponse.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_GetSpaceQuotaResponse.java index 8aa7f7dc94c..03b9cb677ca 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_GetSpaceQuotaDefinitionResponse.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_GetSpaceQuotaResponse.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import org.immutables.value.Value; /** - * The response payload for the Retrieve a Particular Space Quota Definition operation + * The response payload for the Retrieve a Particular Space Quota */ @JsonDeserialize @Value.Immutable -abstract class _GetSpaceQuotaDefinitionResponse extends SpaceQuotaDefinition { +abstract class _GetSpaceQuotaResponse extends SpaceQuota { } diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_ListSpaceQuotaDefinitionsRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_ListSpaceQuotasRequest.java similarity index 87% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_ListSpaceQuotaDefinitionsRequest.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_ListSpaceQuotasRequest.java index 99a075bdc37..f2728981b90 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_ListSpaceQuotaDefinitionsRequest.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_ListSpaceQuotasRequest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import org.cloudfoundry.Nullable; import org.cloudfoundry.client.v3.FilterParameter; @@ -24,10 +24,10 @@ import java.util.List; /** - * The request payload for the List all Space Quota Definitions operation + * The request payload for the List all Space Quotas */ @Value.Immutable -abstract class _ListSpaceQuotaDefinitionsRequest extends PaginatedRequest { +abstract class _ListSpaceQuotasRequest extends PaginatedRequest { /** * Comma-delimited list of space quota guids to filter by diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_ListSpaceQuotaDefinitionsResponse.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_ListSpaceQuotasResponse.java similarity index 77% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_ListSpaceQuotaDefinitionsResponse.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_ListSpaceQuotasResponse.java index bfc64840b65..428078e538a 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_ListSpaceQuotaDefinitionsResponse.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_ListSpaceQuotasResponse.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import org.cloudfoundry.client.v3.PaginatedResponse; import org.immutables.value.Value; /** - * The response payload for the List all Space Quota Definitions operation + * The response payload for the List all Space Quotas */ @JsonDeserialize @Value.Immutable -abstract class _ListSpaceQuotaDefinitionsResponse extends PaginatedResponse { +abstract class _ListSpaceQuotasResponse extends PaginatedResponse { } diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Routes.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_Routes.java similarity index 96% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Routes.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_Routes.java index 5c69e2fba4d..03451f2d18e 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Routes.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_Routes.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Services.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_Services.java similarity index 96% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Services.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_Services.java index 813e248e332..311e51b86a2 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_Services.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_Services.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_SpaceQuotaDefinitionRelationships.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_SpaceQuotaRelationships.java similarity index 88% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_SpaceQuotaDefinitionRelationships.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_SpaceQuotaRelationships.java index 9400adcba28..2f1fd6d5958 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_SpaceQuotaDefinitionRelationships.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_SpaceQuotaRelationships.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -24,12 +24,12 @@ import org.immutables.value.Value; /** - * The relationships for the SpaceQuotaDefinition entity + * The relationships for the Space Quota entity */ @Value.Immutable @JsonDeserialize -abstract class _SpaceQuotaDefinitionRelationships { +abstract class _SpaceQuotaRelationships { /** * A relationship to the organization where the quota belongs diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_SpaceQuotaDefinitionResource.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_SpaceQuotaResource.java similarity index 79% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_SpaceQuotaDefinitionResource.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_SpaceQuotaResource.java index 4a9e5fb228f..54f13c8a7ba 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_SpaceQuotaDefinitionResource.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_SpaceQuotaResource.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import org.immutables.value.Value; /** - * Base class for resources that contain Space Quota Definitions + * Base class for resources that contain Space Quota */ @JsonDeserialize @Value.Immutable -abstract class _SpaceQuotaDefinitionResource extends SpaceQuotaDefinition { +abstract class _SpaceQuotaResource extends SpaceQuota { } diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_UpdateSpaceQuotaDefinitionRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_UpdateSpaceQuotaRequest.java similarity index 85% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_UpdateSpaceQuotaDefinitionRequest.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_UpdateSpaceQuotaRequest.java index ec10a0786b2..73728bf8b66 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_UpdateSpaceQuotaDefinitionRequest.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_UpdateSpaceQuotaRequest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -23,17 +23,17 @@ import org.immutables.value.Value; /** - * The request payload to update an space quota definition + * The request payload to update a Space Quota */ @JsonSerialize @Value.Immutable -abstract class _UpdateSpaceQuotaDefinitionRequest { +abstract class _UpdateSpaceQuotaRequest { /** - * The space quota definition id + * The space quota id */ @JsonIgnore - abstract String getSpaceQuotaDefinitionId(); + abstract String getSpaceQuotaId(); /** * Name of the quota diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_UpdateSpaceQuotaDefinitionResponse.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_UpdateSpaceQuotaResponse.java similarity index 78% rename from cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_UpdateSpaceQuotaDefinitionResponse.java rename to cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_UpdateSpaceQuotaResponse.java index e1df4f8b859..e16a1d077d8 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/_UpdateSpaceQuotaDefinitionResponse.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotas/_UpdateSpaceQuotaResponse.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import org.immutables.value.Value; /** - * The response payload for the Update an Space Quota Definition operation + * The response payload for the Update a Space Quota */ @JsonDeserialize @Value.Immutable -abstract class _UpdateSpaceQuotaDefinitionResponse extends SpaceQuotaDefinition { +abstract class _UpdateSpaceQuotaResponse extends SpaceQuota { } diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/CreateSpaceQuotaDefinitionRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/CreateSpaceQuotaRequestTest.java similarity index 78% rename from cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/CreateSpaceQuotaDefinitionRequestTest.java rename to cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/CreateSpaceQuotaRequestTest.java index d2d10b68ea3..a25b3c4e790 100644 --- a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/CreateSpaceQuotaDefinitionRequestTest.java +++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/CreateSpaceQuotaRequestTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -23,20 +23,20 @@ import org.cloudfoundry.client.v3.ToOneRelationship; import org.junit.jupiter.api.Test; -final class CreateSpaceQuotaDefinitionRequestTest { +final class CreateSpaceQuotaRequestTest { @Test void noName() { assertThrows( IllegalStateException.class, - () -> CreateSpaceQuotaDefinitionRequest.builder().build()); + () -> CreateSpaceQuotaRequest.builder().build()); } @Test void noOrganizationsRelationship() { assertThrows( IllegalStateException.class, - () -> CreateSpaceQuotaDefinitionRequest.builder().name("test-quota").build()); + () -> CreateSpaceQuotaRequest.builder().name("test-quota").build()); } @Test @@ -47,11 +47,11 @@ void valid() { ToOneRelationship.builder() .data(Relationship.builder().id(organizationGuid).build()) .build(); - SpaceQuotaDefinitionRelationships relationships = - SpaceQuotaDefinitionRelationships.builder() + SpaceQuotaRelationships relationships = + SpaceQuotaRelationships.builder() .organization(organizationsRelationship) .build(); - CreateSpaceQuotaDefinitionRequest.builder() + CreateSpaceQuotaRequest.builder() .name("test-quota") .relationships(relationships) .build(); diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/GetSpaceQuotaDefinitionRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/DeleteSpaceQuotaRequestTest.java similarity index 73% rename from cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/GetSpaceQuotaDefinitionRequestTest.java rename to cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/DeleteSpaceQuotaRequestTest.java index 5141b92ef46..82fb116ff1e 100644 --- a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/GetSpaceQuotaDefinitionRequestTest.java +++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/DeleteSpaceQuotaRequestTest.java @@ -14,23 +14,23 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import static org.junit.jupiter.api.Assertions.assertThrows; import org.junit.jupiter.api.Test; -final class GetSpaceQuotaDefinitionRequestTest { +final class DeleteSpaceQuotaRequestTest { @Test - void noSpaceQuotaDefinitionId() { + void noSpaceQuotaId() { assertThrows( IllegalStateException.class, - () -> GetSpaceQuotaDefinitionRequest.builder().build()); + () -> DeleteSpaceQuotaRequest.builder().build()); } @Test void valid() { - GetSpaceQuotaDefinitionRequest.builder().spaceQuotaDefinitionId("test-id").build(); + DeleteSpaceQuotaRequest.builder().spaceQuotaId("test-id").build(); } } diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/UpdateSpaceQuotaDefinitionRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/GetSpaceQuotaRequestTest.java similarity index 72% rename from cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/UpdateSpaceQuotaDefinitionRequestTest.java rename to cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/GetSpaceQuotaRequestTest.java index d5ea3e7c084..12db6ca0bb7 100644 --- a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/UpdateSpaceQuotaDefinitionRequestTest.java +++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/GetSpaceQuotaRequestTest.java @@ -14,23 +14,23 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import static org.junit.jupiter.api.Assertions.assertThrows; import org.junit.jupiter.api.Test; -final class UpdateSpaceQuotaDefinitionRequestTest { +final class GetSpaceQuotaRequestTest { @Test - void noSpaceQuotaDefinitionId() { + void noSpaceQuotaId() { assertThrows( IllegalStateException.class, - () -> UpdateSpaceQuotaDefinitionRequest.builder().build()); + () -> GetSpaceQuotaRequest.builder().build()); } @Test void valid() { - UpdateSpaceQuotaDefinitionRequest.builder().spaceQuotaDefinitionId("test-id").build(); + GetSpaceQuotaRequest.builder().spaceQuotaId("test-id").build(); } } diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/ListSpaceQuotaDefinitionsRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/ListSpaceQuotasRequestTest.java similarity index 80% rename from cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/ListSpaceQuotaDefinitionsRequestTest.java rename to cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/ListSpaceQuotasRequestTest.java index 8f0e0f4f8c8..699c0451d51 100644 --- a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/ListSpaceQuotaDefinitionsRequestTest.java +++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/ListSpaceQuotasRequestTest.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import org.junit.jupiter.api.Test; -public class ListSpaceQuotaDefinitionsRequestTest { +public class ListSpaceQuotasRequestTest { @Test void valid() { - ListSpaceQuotaDefinitionsRequest.builder().build(); + ListSpaceQuotasRequest.builder().build(); } } diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/DeleteSpaceQuotaDefinitionRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/UpdateSpaceQuotaRequestTest.java similarity index 72% rename from cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/DeleteSpaceQuotaDefinitionRequestTest.java rename to cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/UpdateSpaceQuotaRequestTest.java index f38f48ad696..28667a1e59f 100644 --- a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/DeleteSpaceQuotaDefinitionRequestTest.java +++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/UpdateSpaceQuotaRequestTest.java @@ -14,23 +14,23 @@ * limitations under the License. */ -package org.cloudfoundry.client.v3.spacequotadefinitions; +package org.cloudfoundry.client.v3.spacequotas; import static org.junit.jupiter.api.Assertions.assertThrows; import org.junit.jupiter.api.Test; -final class DeleteSpaceQuotaDefinitionRequestTest { +final class UpdateSpaceQuotaRequestTest { @Test - void noSpaceQuotaDefinitionId() { + void noSpaceQuotaId() { assertThrows( IllegalStateException.class, - () -> DeleteSpaceQuotaDefinitionRequest.builder().build()); + () -> UpdateSpaceQuotaRequest.builder().build()); } @Test void valid() { - DeleteSpaceQuotaDefinitionRequest.builder().spaceQuotaDefinitionId("test-id").build(); + UpdateSpaceQuotaRequest.builder().spaceQuotaId("test-id").build(); } } diff --git a/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotaDefinitionsTest.java b/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotasTest.java similarity index 71% rename from integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotaDefinitionsTest.java rename to integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotasTest.java index 719ecd05c55..2d89e7da0e5 100644 --- a/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotaDefinitionsTest.java +++ b/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotasTest.java @@ -25,18 +25,15 @@ import org.cloudfoundry.client.CloudFoundryClient; import org.cloudfoundry.client.v3.organizations.CreateOrganizationRequest; import org.cloudfoundry.client.v3.organizations.Organization; -import org.cloudfoundry.client.v3.spacequotadefinitions.Apps; -import org.cloudfoundry.client.v3.spacequotadefinitions.CreateSpaceQuotaDefinitionRequest; -import org.cloudfoundry.client.v3.spacequotadefinitions.CreateSpaceQuotaDefinitionResponse; -import org.cloudfoundry.client.v3.spacequotadefinitions.DeleteSpaceQuotaDefinitionRequest; -import org.cloudfoundry.client.v3.spacequotadefinitions.GetSpaceQuotaDefinitionRequest; -import org.cloudfoundry.client.v3.spacequotadefinitions.GetSpaceQuotaDefinitionResponse; -import org.cloudfoundry.client.v3.spacequotadefinitions.ListSpaceQuotaDefinitionsRequest; -import org.cloudfoundry.client.v3.spacequotadefinitions.Routes; -import org.cloudfoundry.client.v3.spacequotadefinitions.Services; -import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionRelationships; -import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionResource; -import org.cloudfoundry.client.v3.spacequotadefinitions.UpdateSpaceQuotaDefinitionRequest; +import org.cloudfoundry.client.v3.spacequotas.*; +import org.cloudfoundry.client.v3.spacequotas.CreateSpaceQuotaResponse; +import org.cloudfoundry.client.v3.spacequotas.DeleteSpaceQuotaRequest; +import org.cloudfoundry.client.v3.spacequotas.GetSpaceQuotaRequest; +import org.cloudfoundry.client.v3.spacequotas.GetSpaceQuotaResponse; +import org.cloudfoundry.client.v3.spacequotas.ListSpaceQuotasRequest; +import org.cloudfoundry.client.v3.spacequotas.SpaceQuotaRelationships; +import org.cloudfoundry.client.v3.spacequotas.SpaceQuotaResource; +import org.cloudfoundry.client.v3.spacequotas.UpdateSpaceQuotaRequest; import org.cloudfoundry.client.v3.spaces.CreateSpaceRequest; import org.cloudfoundry.client.v3.spaces.Space; import org.cloudfoundry.client.v3.spaces.SpaceRelationships; @@ -51,7 +48,7 @@ import reactor.test.StepVerifier; @IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.PCF_2_8) -public final class SpaceQuotaDefinitionsTest extends AbstractIntegrationTest { +public final class SpaceQuotasTest extends AbstractIntegrationTest { @Autowired private CloudFoundryClient cloudFoundryClient; @@ -70,8 +67,8 @@ public void createOrganization() { @Test public void create() { String spaceQuotaName = this.nameFactory.getQuotaDefinitionName(); - SpaceQuotaDefinitionRelationships spaceQuotaDefinitionRelationships = - createSpaceQuotaDefinitionRelationships(organizationId); + SpaceQuotaRelationships spaceQuotaRelationships = + createSpaceQuotaRelationships(organizationId); Apps spaceQuotaAppLimits = Apps.builder() @@ -84,29 +81,29 @@ public void create() { Routes spaceQuotaRouteLimits = Routes.builder().totalRoutes(10).build(); this.cloudFoundryClient - .spaceQuotaDefinitionsV3() + .spaceQuotasV3() .create( - CreateSpaceQuotaDefinitionRequest.builder() + CreateSpaceQuotaRequest.builder() .name(spaceQuotaName) .apps(spaceQuotaAppLimits) .services(spaceQuotaServiceLimits) .routes(spaceQuotaRouteLimits) - .relationships(spaceQuotaDefinitionRelationships) + .relationships(spaceQuotaRelationships) .build()) .thenMany(requestListSpaceQuotas(this.cloudFoundryClient, spaceQuotaName)) .single() .as(StepVerifier::create) .assertNext( - spaceQuotaDefinitionResource -> { - assertThat(spaceQuotaDefinitionResource).isNotNull(); - assertThat(spaceQuotaDefinitionResource.getId()).isNotNull(); - assertThat(spaceQuotaDefinitionResource.getName()) + spaceQuotaResource -> { + assertThat(spaceQuotaResource).isNotNull(); + assertThat(spaceQuotaResource.getId()).isNotNull(); + assertThat(spaceQuotaResource.getName()) .isEqualTo(spaceQuotaName); - assertThat(spaceQuotaDefinitionResource.getApps()) + assertThat(spaceQuotaResource.getApps()) .isEqualTo(spaceQuotaAppLimits); - assertThat(spaceQuotaDefinitionResource.getServices()) + assertThat(spaceQuotaResource.getServices()) .isEqualTo(spaceQuotaServiceLimits); - assertThat(spaceQuotaDefinitionResource.getRoutes()) + assertThat(spaceQuotaResource.getRoutes()) .isEqualTo(spaceQuotaRouteLimits); }) .expectComplete() @@ -116,8 +113,8 @@ public void create() { @Test public void createWithSpaceRelationship() { String spaceQuotaName = this.nameFactory.getQuotaDefinitionName(); - SpaceQuotaDefinitionRelationships spaceQuotaDefinitionRelationships = - createSpaceQuotaDefinitionRelationships(organizationId, spaceId); + SpaceQuotaRelationships spaceQuotaRelationships = + createSpaceQuotaRelationships(organizationId, spaceId); Apps spaceQuotaAppLimits = Apps.builder() @@ -130,36 +127,36 @@ public void createWithSpaceRelationship() { Routes spaceQuotaRouteLimits = Routes.builder().totalRoutes(10).build(); this.cloudFoundryClient - .spaceQuotaDefinitionsV3() + .spaceQuotasV3() .create( - CreateSpaceQuotaDefinitionRequest.builder() + CreateSpaceQuotaRequest.builder() .name(spaceQuotaName) .apps(spaceQuotaAppLimits) .services(spaceQuotaServiceLimits) .routes(spaceQuotaRouteLimits) - .relationships(spaceQuotaDefinitionRelationships) + .relationships(spaceQuotaRelationships) .build()) .thenMany(requestListSpaceQuotas(this.cloudFoundryClient, spaceQuotaName)) .single() .as(StepVerifier::create) .assertNext( - spaceQuotaDefinitionResource -> { - assertThat(spaceQuotaDefinitionResource).isNotNull(); - assertThat(spaceQuotaDefinitionResource.getId()).isNotNull(); - assertThat(spaceQuotaDefinitionResource.getName()) + spaceQuotaResource -> { + assertThat(spaceQuotaResource).isNotNull(); + assertThat(spaceQuotaResource.getId()).isNotNull(); + assertThat(spaceQuotaResource.getName()) .isEqualTo(spaceQuotaName); - assertThat(spaceQuotaDefinitionResource.getApps()) + assertThat(spaceQuotaResource.getApps()) .isEqualTo(spaceQuotaAppLimits); - assertThat(spaceQuotaDefinitionResource.getServices()) + assertThat(spaceQuotaResource.getServices()) .isEqualTo(spaceQuotaServiceLimits); - assertThat(spaceQuotaDefinitionResource.getRoutes()) + assertThat(spaceQuotaResource.getRoutes()) .isEqualTo(spaceQuotaRouteLimits); - assertThat(spaceQuotaDefinitionResource.getRelationships()).isNotNull(); - assertThat(spaceQuotaDefinitionResource.getRelationships().getOrganization()).isNotNull(); - assertThat(spaceQuotaDefinitionResource.getRelationships().getSpaces()).isNotNull(); - assertThat(spaceQuotaDefinitionResource.getRelationships().getOrganization().getData().getId()) + assertThat(spaceQuotaResource.getRelationships()).isNotNull(); + assertThat(spaceQuotaResource.getRelationships().getOrganization()).isNotNull(); + assertThat(spaceQuotaResource.getRelationships().getSpaces()).isNotNull(); + assertThat(spaceQuotaResource.getRelationships().getOrganization().getData().getId()) .isEqualTo(organizationId); - assertThat(spaceQuotaDefinitionResource.getRelationships().getSpaces().getData().getFirst().getId()) + assertThat(spaceQuotaResource.getRelationships().getSpaces().getData().getFirst().getId()) .isEqualTo(spaceId); }) .expectComplete() @@ -174,12 +171,12 @@ public void get() { .flatMap( spaceQuotaId -> this.cloudFoundryClient - .spaceQuotaDefinitionsV3() + .spaceQuotasV3() .get( - GetSpaceQuotaDefinitionRequest.builder() - .spaceQuotaDefinitionId(spaceQuotaId) + GetSpaceQuotaRequest.builder() + .spaceQuotaId(spaceQuotaId) .build())) - .map(GetSpaceQuotaDefinitionResponse::getName) + .map(GetSpaceQuotaResponse::getName) .as(StepVerifier::create) .expectNext(spaceQuotaName) .expectComplete() @@ -195,9 +192,9 @@ public void list() { PaginationUtils.requestClientV3Resources( page -> this.cloudFoundryClient - .spaceQuotaDefinitionsV3() + .spaceQuotasV3() .list( - ListSpaceQuotaDefinitionsRequest.builder() + ListSpaceQuotasRequest.builder() .page(page) .build()))) .filter(resource -> spaceQuotaName.equals(resource.getName())) @@ -216,10 +213,10 @@ public void update() { .flatMap( spaceQuotaId -> this.cloudFoundryClient - .spaceQuotaDefinitionsV3() + .spaceQuotasV3() .update( - UpdateSpaceQuotaDefinitionRequest.builder() - .spaceQuotaDefinitionId(spaceQuotaId) + UpdateSpaceQuotaRequest.builder() + .spaceQuotaId(spaceQuotaId) .apps( Apps.builder() .totalMemoryInMb( @@ -238,19 +235,19 @@ public void update() { .thenMany(requestListSpaceQuotas(this.cloudFoundryClient, spaceQuotaName)) .as(StepVerifier::create) .consumeNextWith( - organizationQuotaDefinitionResource -> { + organizationQuotaResource -> { assertThat( - organizationQuotaDefinitionResource + organizationQuotaResource .getApps() .getTotalMemoryInMb()) .isEqualTo(totalMemoryLimit); assertThat( - organizationQuotaDefinitionResource + organizationQuotaResource .getRoutes() .getTotalRoutes()) .isEqualTo(100); assertThat( - organizationQuotaDefinitionResource + organizationQuotaResource .getServices() .getTotalServiceInstances()) .isEqualTo(100); @@ -267,10 +264,10 @@ public void delete() { .flatMap( spaceQuotaId -> this.cloudFoundryClient - .spaceQuotaDefinitionsV3() + .spaceQuotasV3() .delete( - DeleteSpaceQuotaDefinitionRequest.builder() - .spaceQuotaDefinitionId(spaceQuotaId) + DeleteSpaceQuotaRequest.builder() + .spaceQuotaId(spaceQuotaId) .build()) .flatMap( job -> @@ -309,19 +306,19 @@ private static Space createSpace( } @NotNull - private static SpaceQuotaDefinitionRelationships createSpaceQuotaDefinitionRelationships( + private static SpaceQuotaRelationships createSpaceQuotaRelationships( String orgGuid) { ToOneRelationship organizationRelationship = ToOneRelationship.builder() .data(Relationship.builder().id(orgGuid).build()) .build(); - return SpaceQuotaDefinitionRelationships.builder() + return SpaceQuotaRelationships.builder() .organization(organizationRelationship) .build(); } @NotNull - private static SpaceQuotaDefinitionRelationships createSpaceQuotaDefinitionRelationships( + private static SpaceQuotaRelationships createSpaceQuotaRelationships( String orgGuid, String spaceGuid) { ToOneRelationship organizationRelationship = ToOneRelationship.builder() @@ -330,7 +327,7 @@ private static SpaceQuotaDefinitionRelationships createSpaceQuotaDefinitionRelat ToManyRelationship spaceRelationships = ToManyRelationship.builder() .data(Relationship.builder().id(spaceGuid).build()) .build(); - return SpaceQuotaDefinitionRelationships.builder() + return SpaceQuotaRelationships.builder() .organization(organizationRelationship) .spaces(spaceRelationships) .build(); @@ -339,30 +336,30 @@ private static SpaceQuotaDefinitionRelationships createSpaceQuotaDefinitionRelat private static Mono createSpaceQuotaId( CloudFoundryClient cloudFoundryClient, String spaceQuotaName, String orgGuid) { return createSpaceQuota(cloudFoundryClient, spaceQuotaName, orgGuid) - .map(CreateSpaceQuotaDefinitionResponse::getId); + .map(CreateSpaceQuotaResponse::getId); } - private static Mono createSpaceQuota( + private static Mono createSpaceQuota( CloudFoundryClient cloudFoundryClient, String spaceQuotaName, String orgGuid) { - SpaceQuotaDefinitionRelationships spaceQuotaDefinitionRelationships = - createSpaceQuotaDefinitionRelationships(orgGuid); + SpaceQuotaRelationships spaceQuotaRelationships = + createSpaceQuotaRelationships(orgGuid); return cloudFoundryClient - .spaceQuotaDefinitionsV3() + .spaceQuotasV3() .create( - CreateSpaceQuotaDefinitionRequest.builder() + CreateSpaceQuotaRequest.builder() .name(spaceQuotaName) - .relationships(spaceQuotaDefinitionRelationships) + .relationships(spaceQuotaRelationships) .build()); } - private static Flux requestListSpaceQuotas( + private static Flux requestListSpaceQuotas( CloudFoundryClient cloudFoundryClient, String spaceName) { return PaginationUtils.requestClientV3Resources( page -> cloudFoundryClient - .spaceQuotaDefinitionsV3() + .spaceQuotasV3() .list( - ListSpaceQuotaDefinitionsRequest.builder() + ListSpaceQuotasRequest.builder() .name(spaceName) .page(page) .build())); From 8a24fd2cf0bce22ac629c90232314c1202cf6631 Mon Sep 17 00:00:00 2001 From: "Merchant, Saifuddin A" Date: Tue, 2 Dec 2025 16:38:15 -0700 Subject: [PATCH 4/5] Fix spotless formatting issues --- .../v3/spacequotas/ReactorSpaceQuotasV3.java | 22 ++---- .../spacequotas/ReactorSpaceQuotasV3Test.java | 9 +-- .../CreateSpaceQuotaRequestTest.java | 13 +--- .../DeleteSpaceQuotaRequestTest.java | 4 +- .../spacequotas/GetSpaceQuotaRequestTest.java | 4 +- .../UpdateSpaceQuotaRequestTest.java | 4 +- .../client/v3/SpaceQuotasTest.java | 76 ++++++++++--------- 7 files changed, 53 insertions(+), 79 deletions(-) diff --git a/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/spacequotas/ReactorSpaceQuotasV3.java b/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/spacequotas/ReactorSpaceQuotasV3.java index 246646a3296..efbcc826769 100644 --- a/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/spacequotas/ReactorSpaceQuotasV3.java +++ b/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/spacequotas/ReactorSpaceQuotasV3.java @@ -17,7 +17,6 @@ package org.cloudfoundry.reactor.client.v3.spacequotas; import java.util.Map; - import org.cloudfoundry.client.v3.spacequotas.*; import org.cloudfoundry.client.v3.spacequotas.CreateSpaceQuotaResponse; import org.cloudfoundry.reactor.ConnectionContext; @@ -28,8 +27,7 @@ /** * The Reactor-based implementation of {@link ReactorSpaceQuotasV3} */ -public class ReactorSpaceQuotasV3 extends AbstractClientV3Operations - implements SpaceQuotasV3 { +public class ReactorSpaceQuotasV3 extends AbstractClientV3Operations implements SpaceQuotasV3 { /** * Creates an instance @@ -48,8 +46,7 @@ public ReactorSpaceQuotasV3( } @Override - public Mono create( - CreateSpaceQuotaRequest request) { + public Mono create(CreateSpaceQuotaRequest request) { return post( request, CreateSpaceQuotaResponse.class, @@ -62,9 +59,7 @@ public Mono get(GetSpaceQuotaRequest request) { return get( request, GetSpaceQuotaResponse.class, - builder -> - builder.pathSegment( - "space_quotas", request.getSpaceQuotaId())) + builder -> builder.pathSegment("space_quotas", request.getSpaceQuotaId())) .checkpoint(); } @@ -78,14 +73,11 @@ public Mono list(ListSpaceQuotasRequest request) { } @Override - public Mono update( - UpdateSpaceQuotaRequest request) { + public Mono update(UpdateSpaceQuotaRequest request) { return patch( request, UpdateSpaceQuotaResponse.class, - builder -> - builder.pathSegment( - "space_quotas", request.getSpaceQuotaId())) + builder -> builder.pathSegment("space_quotas", request.getSpaceQuotaId())) .checkpoint(); } @@ -93,9 +85,7 @@ public Mono update( public Mono delete(DeleteSpaceQuotaRequest request) { return delete( request, - builder -> - builder.pathSegment( - "space_quotas", request.getSpaceQuotaId())) + builder -> builder.pathSegment("space_quotas", request.getSpaceQuotaId())) .checkpoint(); } } diff --git a/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/spacequotas/ReactorSpaceQuotasV3Test.java b/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/spacequotas/ReactorSpaceQuotasV3Test.java index 1911d200e8e..957f8a21bdf 100644 --- a/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/spacequotas/ReactorSpaceQuotasV3Test.java +++ b/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/spacequotas/ReactorSpaceQuotasV3Test.java @@ -148,15 +148,10 @@ void get() { .build()); this.spaceQuotasV3 - .get( - GetSpaceQuotaRequest.builder() - .spaceQuotaId(EXPECTED_SPACE_QUOTA_ID_1) - .build()) + .get(GetSpaceQuotaRequest.builder().spaceQuotaId(EXPECTED_SPACE_QUOTA_ID_1).build()) .as(StepVerifier::create) .expectNext( - GetSpaceQuotaResponse.builder() - .from(expectedSpaceQuotaResource1()) - .build()) + GetSpaceQuotaResponse.builder().from(expectedSpaceQuotaResource1()).build()) .expectComplete() .verify(Duration.ofSeconds(5)); } diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/CreateSpaceQuotaRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/CreateSpaceQuotaRequestTest.java index a25b3c4e790..be290c5957e 100644 --- a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/CreateSpaceQuotaRequestTest.java +++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/CreateSpaceQuotaRequestTest.java @@ -27,9 +27,7 @@ final class CreateSpaceQuotaRequestTest { @Test void noName() { - assertThrows( - IllegalStateException.class, - () -> CreateSpaceQuotaRequest.builder().build()); + assertThrows(IllegalStateException.class, () -> CreateSpaceQuotaRequest.builder().build()); } @Test @@ -48,12 +46,7 @@ void valid() { .data(Relationship.builder().id(organizationGuid).build()) .build(); SpaceQuotaRelationships relationships = - SpaceQuotaRelationships.builder() - .organization(organizationsRelationship) - .build(); - CreateSpaceQuotaRequest.builder() - .name("test-quota") - .relationships(relationships) - .build(); + SpaceQuotaRelationships.builder().organization(organizationsRelationship).build(); + CreateSpaceQuotaRequest.builder().name("test-quota").relationships(relationships).build(); } } diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/DeleteSpaceQuotaRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/DeleteSpaceQuotaRequestTest.java index 82fb116ff1e..8216851d0c2 100644 --- a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/DeleteSpaceQuotaRequestTest.java +++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/DeleteSpaceQuotaRequestTest.java @@ -24,9 +24,7 @@ final class DeleteSpaceQuotaRequestTest { @Test void noSpaceQuotaId() { - assertThrows( - IllegalStateException.class, - () -> DeleteSpaceQuotaRequest.builder().build()); + assertThrows(IllegalStateException.class, () -> DeleteSpaceQuotaRequest.builder().build()); } @Test diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/GetSpaceQuotaRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/GetSpaceQuotaRequestTest.java index 12db6ca0bb7..befab21151b 100644 --- a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/GetSpaceQuotaRequestTest.java +++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/GetSpaceQuotaRequestTest.java @@ -24,9 +24,7 @@ final class GetSpaceQuotaRequestTest { @Test void noSpaceQuotaId() { - assertThrows( - IllegalStateException.class, - () -> GetSpaceQuotaRequest.builder().build()); + assertThrows(IllegalStateException.class, () -> GetSpaceQuotaRequest.builder().build()); } @Test diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/UpdateSpaceQuotaRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/UpdateSpaceQuotaRequestTest.java index 28667a1e59f..1b9b833f236 100644 --- a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/UpdateSpaceQuotaRequestTest.java +++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotas/UpdateSpaceQuotaRequestTest.java @@ -24,9 +24,7 @@ final class UpdateSpaceQuotaRequestTest { @Test void noSpaceQuotaId() { - assertThrows( - IllegalStateException.class, - () -> UpdateSpaceQuotaRequest.builder().build()); + assertThrows(IllegalStateException.class, () -> UpdateSpaceQuotaRequest.builder().build()); } @Test diff --git a/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotasTest.java b/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotasTest.java index 2d89e7da0e5..5d572152e7e 100644 --- a/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotasTest.java +++ b/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotasTest.java @@ -97,10 +97,8 @@ public void create() { spaceQuotaResource -> { assertThat(spaceQuotaResource).isNotNull(); assertThat(spaceQuotaResource.getId()).isNotNull(); - assertThat(spaceQuotaResource.getName()) - .isEqualTo(spaceQuotaName); - assertThat(spaceQuotaResource.getApps()) - .isEqualTo(spaceQuotaAppLimits); + assertThat(spaceQuotaResource.getName()).isEqualTo(spaceQuotaName); + assertThat(spaceQuotaResource.getApps()).isEqualTo(spaceQuotaAppLimits); assertThat(spaceQuotaResource.getServices()) .isEqualTo(spaceQuotaServiceLimits); assertThat(spaceQuotaResource.getRoutes()) @@ -143,20 +141,31 @@ public void createWithSpaceRelationship() { spaceQuotaResource -> { assertThat(spaceQuotaResource).isNotNull(); assertThat(spaceQuotaResource.getId()).isNotNull(); - assertThat(spaceQuotaResource.getName()) - .isEqualTo(spaceQuotaName); - assertThat(spaceQuotaResource.getApps()) - .isEqualTo(spaceQuotaAppLimits); + assertThat(spaceQuotaResource.getName()).isEqualTo(spaceQuotaName); + assertThat(spaceQuotaResource.getApps()).isEqualTo(spaceQuotaAppLimits); assertThat(spaceQuotaResource.getServices()) .isEqualTo(spaceQuotaServiceLimits); assertThat(spaceQuotaResource.getRoutes()) .isEqualTo(spaceQuotaRouteLimits); assertThat(spaceQuotaResource.getRelationships()).isNotNull(); - assertThat(spaceQuotaResource.getRelationships().getOrganization()).isNotNull(); - assertThat(spaceQuotaResource.getRelationships().getSpaces()).isNotNull(); - assertThat(spaceQuotaResource.getRelationships().getOrganization().getData().getId()) + assertThat(spaceQuotaResource.getRelationships().getOrganization()) + .isNotNull(); + assertThat(spaceQuotaResource.getRelationships().getSpaces()) + .isNotNull(); + assertThat( + spaceQuotaResource + .getRelationships() + .getOrganization() + .getData() + .getId()) .isEqualTo(organizationId); - assertThat(spaceQuotaResource.getRelationships().getSpaces().getData().getFirst().getId()) + assertThat( + spaceQuotaResource + .getRelationships() + .getSpaces() + .getData() + .getFirst() + .getId()) .isEqualTo(spaceId); }) .expectComplete() @@ -236,20 +245,14 @@ public void update() { .as(StepVerifier::create) .consumeNextWith( organizationQuotaResource -> { - assertThat( - organizationQuotaResource - .getApps() - .getTotalMemoryInMb()) + assertThat(organizationQuotaResource.getApps().getTotalMemoryInMb()) .isEqualTo(totalMemoryLimit); - assertThat( - organizationQuotaResource - .getRoutes() - .getTotalRoutes()) + assertThat(organizationQuotaResource.getRoutes().getTotalRoutes()) .isEqualTo(100); assertThat( - organizationQuotaResource - .getServices() - .getTotalServiceInstances()) + organizationQuotaResource + .getServices() + .getTotalServiceInstances()) .isEqualTo(100); }) .expectComplete() @@ -296,25 +299,24 @@ private static Space createSpace( .data(Relationship.builder().id(orgGuid).build()) .build(); SpaceRelationships spaceRelationships = - SpaceRelationships.builder() - .organization(organizationRelationship) - .build(); + SpaceRelationships.builder().organization(organizationRelationship).build(); return cloudFoundryClient .spacesV3() - .create(CreateSpaceRequest.builder().name(spaceName).relationships(spaceRelationships).build()) + .create( + CreateSpaceRequest.builder() + .name(spaceName) + .relationships(spaceRelationships) + .build()) .block(Duration.ofMinutes(5)); } @NotNull - private static SpaceQuotaRelationships createSpaceQuotaRelationships( - String orgGuid) { + private static SpaceQuotaRelationships createSpaceQuotaRelationships(String orgGuid) { ToOneRelationship organizationRelationship = ToOneRelationship.builder() .data(Relationship.builder().id(orgGuid).build()) .build(); - return SpaceQuotaRelationships.builder() - .organization(organizationRelationship) - .build(); + return SpaceQuotaRelationships.builder().organization(organizationRelationship).build(); } @NotNull @@ -324,9 +326,10 @@ private static SpaceQuotaRelationships createSpaceQuotaRelationships( ToOneRelationship.builder() .data(Relationship.builder().id(orgGuid).build()) .build(); - ToManyRelationship spaceRelationships = ToManyRelationship.builder() - .data(Relationship.builder().id(spaceGuid).build()) - .build(); + ToManyRelationship spaceRelationships = + ToManyRelationship.builder() + .data(Relationship.builder().id(spaceGuid).build()) + .build(); return SpaceQuotaRelationships.builder() .organization(organizationRelationship) .spaces(spaceRelationships) @@ -341,8 +344,7 @@ private static Mono createSpaceQuotaId( private static Mono createSpaceQuota( CloudFoundryClient cloudFoundryClient, String spaceQuotaName, String orgGuid) { - SpaceQuotaRelationships spaceQuotaRelationships = - createSpaceQuotaRelationships(orgGuid); + SpaceQuotaRelationships spaceQuotaRelationships = createSpaceQuotaRelationships(orgGuid); return cloudFoundryClient .spaceQuotasV3() .create( From 2858dd0cc0d84836305b5c3bd08c394fb3484eb8 Mon Sep 17 00:00:00 2001 From: "Merchant, Saifuddin A" Date: Tue, 2 Dec 2025 16:54:21 -0700 Subject: [PATCH 5/5] Fix for java 8, getFirst is replaced with get(0) --- .../test/java/org/cloudfoundry/client/v3/SpaceQuotasTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotasTest.java b/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotasTest.java index 5d572152e7e..e66f27ead7d 100644 --- a/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotasTest.java +++ b/integration-test/src/test/java/org/cloudfoundry/client/v3/SpaceQuotasTest.java @@ -164,7 +164,7 @@ public void createWithSpaceRelationship() { .getRelationships() .getSpaces() .getData() - .getFirst() + .get(0) .getId()) .isEqualTo(spaceId); })