Skip to content

Commit d0876ee

Browse files
adding model, interface and implementation for UpdateSpaceQuotaDefinition
1 parent ce92dab commit d0876ee

File tree

6 files changed

+157
-2
lines changed

6 files changed

+157
-2
lines changed

cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/spacequotadefinition/ReactorSpaceQuotaDefinitionsV3.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import org.cloudfoundry.client.v3.spacequotadefinitions.ListSpaceQuotaDefinitionsRequest;
2424
import org.cloudfoundry.client.v3.spacequotadefinitions.ListSpaceQuotaDefinitionsResponse;
2525
import org.cloudfoundry.client.v3.spacequotadefinitions.SpaceQuotaDefinitionsV3;
26+
import org.cloudfoundry.client.v3.spacequotadefinitions.UpdateSpaceQuotaDefinitionRequest;
27+
import org.cloudfoundry.client.v3.spacequotadefinitions.UpdateSpaceQuotaDefinitionResponse;
2628
import org.cloudfoundry.reactor.ConnectionContext;
2729
import org.cloudfoundry.reactor.TokenProvider;
2830
import org.cloudfoundry.reactor.client.v3.AbstractClientV3Operations;
@@ -80,4 +82,14 @@ public Mono<ListSpaceQuotaDefinitionsResponse> list(ListSpaceQuotaDefinitionsReq
8082
.checkpoint();
8183
}
8284

85+
@Override
86+
public Mono<UpdateSpaceQuotaDefinitionResponse> update(UpdateSpaceQuotaDefinitionRequest request) {
87+
return patch(
88+
request,
89+
UpdateSpaceQuotaDefinitionResponse.class,
90+
builder ->
91+
builder.pathSegment("space_quotas", request.getSpaceQuotaDefinitionId()))
92+
.checkpoint();
93+
}
94+
8395
}

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceQuotaDefinitionsV3.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,22 @@ Mono<GetSpaceQuotaDefinitionResponse> get(
4444
GetSpaceQuotaDefinitionRequest request);
4545

4646
/**
47-
* Makes the <a href="https://v3-apidocs.cloudfoundry.org/version/3.201.0/#list-space-quotas">List all Space Quota Definitions request</a>
47+
* Makes the <a href="https://v3-apidocs.cloudfoundry.org/version/3.201.0/#list-space-quotas">List all Space Quota Definitions</a>
48+
* request
4849
*
4950
* @param request the List all Space Quota Definitions request
5051
* @return the response from the Space all Organization Quota Definitions request
5152
*/
5253
Mono<ListSpaceQuotaDefinitionsResponse> list(
5354
ListSpaceQuotaDefinitionsRequest request);
5455

56+
/** Makes the <a href="https://v3-apidocs.cloudfoundry.org/version/3.123.0/index.html#update-a-space-quota">Update Space Quota Definition</a>
57+
* request
58+
*
59+
* @param request the Update Space Quota Definition request
60+
* @return the response from the Update Space Quota Definition request
61+
*/
62+
Mono<UpdateSpaceQuotaDefinitionResponse> update(
63+
UpdateSpaceQuotaDefinitionRequest request);
64+
5565
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Copyright 2013-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.cloudfoundry.client.v3.spacequotadefinitions;
18+
19+
import com.fasterxml.jackson.annotation.JsonIgnore;
20+
import com.fasterxml.jackson.annotation.JsonProperty;
21+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
22+
import org.cloudfoundry.Nullable;
23+
import org.cloudfoundry.client.v3.organizationquotadefinitions.Apps;
24+
import org.cloudfoundry.client.v3.organizationquotadefinitions.Routes;
25+
import org.cloudfoundry.client.v3.organizationquotadefinitions.Services;
26+
import org.immutables.value.Value;
27+
28+
/**
29+
* The request payload to update an space quota definition
30+
*/
31+
@JsonSerialize
32+
@Value.Immutable
33+
abstract class _UpdateSpaceQuotaDefinitionRequest {
34+
35+
/**
36+
* The space quota definition id
37+
*/
38+
@JsonIgnore
39+
abstract String getSpaceQuotaDefinitionId();
40+
41+
/**
42+
* Name of the quota
43+
*/
44+
@JsonProperty("name")
45+
@Nullable
46+
abstract String getName();
47+
48+
/**
49+
* Quotas that affect applications and application sub-resources
50+
*/
51+
@JsonProperty("apps")
52+
@Nullable
53+
abstract Apps getApps();
54+
55+
/**
56+
* Quotas that affect services
57+
*/
58+
@JsonProperty("services")
59+
@Nullable
60+
abstract Services getServices();
61+
62+
/**
63+
* Quotas that affect routes
64+
*/
65+
@JsonProperty("routes")
66+
@Nullable
67+
abstract Routes getRoutes();
68+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2013-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.cloudfoundry.client.v3.spacequotadefinitions;
18+
19+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
20+
import org.immutables.value.Value;
21+
22+
/**
23+
* The response payload for the Update an Space Quota Definition operation
24+
*/
25+
@JsonDeserialize
26+
@Value.Immutable
27+
abstract class _UpdateSpaceQuotaDefinitionResponse extends SpaceQuotaDefinition {
28+
29+
}

cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/SpaceOrganizationQuotaDefinitionRequestTest.java renamed to cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/spacequotadefinitions/CreateSpaceQuotaDefinitionRequestTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import static org.junit.jupiter.api.Assertions.assertThrows;
2626

27-
final class SpaceOrganizationQuotaDefinitionRequestTest {
27+
final class CreateSpaceQuotaDefinitionRequestTest {
2828

2929
@Test
3030
void noName() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2013-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.cloudfoundry.client.v3.spacequotadefinitions;
18+
19+
import org.junit.jupiter.api.Test;
20+
21+
import static org.junit.jupiter.api.Assertions.assertThrows;
22+
23+
final class UpdateSpaceQuotaDefinitionRequestTest {
24+
25+
@Test
26+
void noSpaceQuotaDefinitionId() {
27+
assertThrows(
28+
IllegalStateException.class,
29+
() -> UpdateSpaceQuotaDefinitionRequest.builder().build());
30+
}
31+
32+
@Test
33+
void valid() {
34+
UpdateSpaceQuotaDefinitionRequest.builder().spaceQuotaDefinitionId("test-id").build();
35+
}
36+
}

0 commit comments

Comments
 (0)