diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index e7d4e98aec0..5986c48b6d8 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -9,4 +9,4 @@
-
\ No newline at end of file
+
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 f69d24268c9..cea80854622 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
@@ -51,6 +51,7 @@
import org.cloudfoundry.client.v3.applications.ApplicationsV3;
import org.cloudfoundry.client.v3.builds.Builds;
import org.cloudfoundry.client.v3.deployments.DeploymentsV3;
+import org.cloudfoundry.client.v3.domains.DomainsV3;
import org.cloudfoundry.client.v3.droplets.Droplets;
import org.cloudfoundry.client.v3.isolationsegments.IsolationSegments;
import org.cloudfoundry.client.v3.jobs.JobsV3;
@@ -97,6 +98,7 @@
import org.cloudfoundry.reactor.client.v3.applications.ReactorApplicationsV3;
import org.cloudfoundry.reactor.client.v3.builds.ReactorBuilds;
import org.cloudfoundry.reactor.client.v3.deployments.ReactorDeploymentsV3;
+import org.cloudfoundry.reactor.client.v3.domains.ReactorDomainsV3;
import org.cloudfoundry.reactor.client.v3.droplets.ReactorDroplets;
import org.cloudfoundry.reactor.client.v3.isolationsegments.ReactorIsolationSegments;
import org.cloudfoundry.reactor.client.v3.jobs.ReactorJobsV3;
@@ -173,6 +175,12 @@ public Domains domains() {
return new ReactorDomains(getConnectionContext(), getRootV2(), getTokenProvider(), getRequestTags());
}
+ @Override
+ @Value.Derived
+ public DomainsV3 domainsV3() {
+ return new ReactorDomainsV3(getConnectionContext(), getRootV3(), getTokenProvider(), getRequestTags());
+ }
+
@Override
@Value.Derived
public Droplets droplets() {
diff --git a/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/domains/ReactorDomainsV3.java b/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/domains/ReactorDomainsV3.java
new file mode 100644
index 00000000000..a9efbcfeac0
--- /dev/null
+++ b/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/domains/ReactorDomainsV3.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import org.cloudfoundry.client.v3.domains.CreateDomainRequest;
+import org.cloudfoundry.client.v3.domains.CreateDomainResponse;
+import org.cloudfoundry.client.v3.domains.DeleteDomainRequest;
+import org.cloudfoundry.client.v3.domains.DomainsV3;
+import org.cloudfoundry.client.v3.domains.GetDomainRequest;
+import org.cloudfoundry.client.v3.domains.GetDomainResponse;
+import org.cloudfoundry.client.v3.domains.ListDomainsRequest;
+import org.cloudfoundry.client.v3.domains.ListDomainsResponse;
+import org.cloudfoundry.client.v3.domains.ShareDomainRequest;
+import org.cloudfoundry.client.v3.domains.ShareDomainResponse;
+import org.cloudfoundry.client.v3.domains.UnshareDomainRequest;
+import org.cloudfoundry.client.v3.domains.UpdateDomainRequest;
+import org.cloudfoundry.client.v3.domains.UpdateDomainResponse;
+import org.cloudfoundry.reactor.ConnectionContext;
+import org.cloudfoundry.reactor.TokenProvider;
+import org.cloudfoundry.reactor.client.v3.AbstractClientV3Operations;
+import reactor.core.publisher.Mono;
+
+import java.util.Map;
+
+/**
+ * The Reactor-based implementation of {@link DomainsV3}
+ */
+public final class ReactorDomainsV3 extends AbstractClientV3Operations implements DomainsV3 {
+
+ /**
+ * 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 ReactorDomainsV3(ConnectionContext connectionContext, Mono root, TokenProvider tokenProvider, Map requestTags) {
+ super(connectionContext, root, tokenProvider, requestTags);
+ }
+
+ @Override
+ public Mono create(CreateDomainRequest request) {
+ return post(request, CreateDomainResponse.class, builder -> builder.pathSegment("domains"))
+ .checkpoint();
+ }
+
+ @Override
+ public Mono update(UpdateDomainRequest request) {
+ return patch(request, UpdateDomainResponse.class, builder -> builder.pathSegment("domains", request.getDomainId()))
+ .checkpoint();
+ }
+
+ @Override
+ public Mono delete(DeleteDomainRequest request) {
+ return delete(request, builder -> builder.pathSegment("domains", request.getDomainId()))
+ .checkpoint();
+ }
+
+ @Override
+ public Mono get(GetDomainRequest request) {
+ return get(request, GetDomainResponse.class, builder -> builder.pathSegment("domains", request.getDomainId()))
+ .checkpoint();
+ }
+
+ @Override
+ public Mono list(ListDomainsRequest request) {
+ return get(request, ListDomainsResponse.class, builder -> builder.pathSegment("domains"))
+ .checkpoint();
+ }
+
+ @Override
+ public Mono share(ShareDomainRequest request) {
+ return post(request, ShareDomainResponse.class, builder -> builder.pathSegment("domains", request.getDomainId(), "relationships", "shared_organizations"))
+ .checkpoint();
+ }
+
+ @Override
+ public Mono unshare(UnshareDomainRequest request) {
+ return delete(request, Void.class, builder -> builder.pathSegment("domains", request.getDomainId(), "relationships", "shared_organizations", request.getOrganizationId()))
+ .checkpoint();
+ }
+}
diff --git a/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/organizations/ReactorOrganizationsV3.java b/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/organizations/ReactorOrganizationsV3.java
index 48df215d343..65f890d7a71 100644
--- a/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/organizations/ReactorOrganizationsV3.java
+++ b/cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/organizations/ReactorOrganizationsV3.java
@@ -26,6 +26,8 @@
import org.cloudfoundry.client.v3.organizations.GetOrganizationDefaultIsolationSegmentResponse;
import org.cloudfoundry.client.v3.organizations.GetOrganizationRequest;
import org.cloudfoundry.client.v3.organizations.GetOrganizationResponse;
+import org.cloudfoundry.client.v3.organizations.ListOrganizationDomainsRequest;
+import org.cloudfoundry.client.v3.organizations.ListOrganizationDomainsResponse;
import org.cloudfoundry.client.v3.organizations.ListOrganizationsRequest;
import org.cloudfoundry.client.v3.organizations.ListOrganizationsResponse;
import org.cloudfoundry.client.v3.organizations.OrganizationsV3;
@@ -95,6 +97,12 @@ public Mono list(ListOrganizationsRequest request) {
.checkpoint();
}
+ @Override
+ public Mono listDomains(ListOrganizationDomainsRequest request) {
+ return get(request, ListOrganizationDomainsResponse.class, builder -> builder.pathSegment("organizations", request.getOrganizationId(), "domains"))
+ .checkpoint();
+ }
+
@Override
public Mono update(UpdateOrganizationRequest request) {
return patch(request, UpdateOrganizationResponse.class, builder -> builder.pathSegment("organizations", request.getOrganizationId()))
diff --git a/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/ReactorCloudFoundryClientTest.java b/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/ReactorCloudFoundryClientTest.java
index 898c35de2c0..553894935f3 100644
--- a/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/ReactorCloudFoundryClientTest.java
+++ b/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/ReactorCloudFoundryClientTest.java
@@ -60,6 +60,11 @@ public void domains() {
assertThat(this.client.domains()).isNotNull();
}
+ @Test
+ public void domainsV3() {
+ assertThat(this.client.domainsV3()).isNotNull();
+ }
+
@Test
public void droplets() {
assertThat(this.client.droplets()).isNotNull();
diff --git a/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/domains/ReactorDomainsV3Test.java b/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/domains/ReactorDomainsV3Test.java
new file mode 100644
index 00000000000..d7f7ee552b0
--- /dev/null
+++ b/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/domains/ReactorDomainsV3Test.java
@@ -0,0 +1,364 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import org.cloudfoundry.client.v3.Link;
+import org.cloudfoundry.client.v3.Metadata;
+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.domains.CreateDomainRequest;
+import org.cloudfoundry.client.v3.domains.CreateDomainResponse;
+import org.cloudfoundry.client.v3.domains.DeleteDomainRequest;
+import org.cloudfoundry.client.v3.domains.DomainRelationships;
+import org.cloudfoundry.client.v3.domains.DomainResource;
+import org.cloudfoundry.client.v3.domains.GetDomainRequest;
+import org.cloudfoundry.client.v3.domains.GetDomainResponse;
+import org.cloudfoundry.client.v3.domains.ListDomainsRequest;
+import org.cloudfoundry.client.v3.domains.ListDomainsResponse;
+import org.cloudfoundry.client.v3.domains.ShareDomainRequest;
+import org.cloudfoundry.client.v3.domains.ShareDomainResponse;
+import org.cloudfoundry.client.v3.domains.UnshareDomainRequest;
+import org.cloudfoundry.client.v3.domains.UpdateDomainRequest;
+import org.cloudfoundry.client.v3.domains.UpdateDomainResponse;
+import org.cloudfoundry.reactor.InteractionContext;
+import org.cloudfoundry.reactor.TestRequest;
+import org.cloudfoundry.reactor.TestResponse;
+import org.cloudfoundry.reactor.client.AbstractClientApiTest;
+import org.junit.Test;
+import reactor.test.StepVerifier;
+
+import java.time.Duration;
+import java.util.Collections;
+
+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.CREATED;
+import static io.netty.handler.codec.http.HttpResponseStatus.NO_CONTENT;
+import static io.netty.handler.codec.http.HttpResponseStatus.OK;
+
+public final class ReactorDomainsV3Test extends AbstractClientApiTest {
+
+ private final ReactorDomainsV3 domains = new ReactorDomainsV3(CONNECTION_CONTEXT, this.root, TOKEN_PROVIDER, Collections.emptyMap());
+
+ @Test
+ public void create() {
+ mockRequest(InteractionContext.builder()
+ .request(TestRequest.builder()
+ .method(POST).path("/domains")
+ .payload("fixtures/client/v3/domains/POST_request.json")
+ .build())
+ .response(TestResponse.builder()
+ .status(CREATED)
+ .payload("fixtures/client/v3/domains/POST_response.json")
+ .build())
+ .build());
+
+ this.domains
+ .create(CreateDomainRequest.builder()
+ .name("test-domain.com")
+ .internal(false)
+ .build())
+ .as(StepVerifier::create)
+ .expectNext(CreateDomainResponse.builder()
+ .id("3a5d3d89-3f89-4f05-8188-8a2b298c79d5")
+ .name("test-domain.com")
+ .createdAt("2019-03-08T01:06:19Z")
+ .updatedAt("2019-03-08T01:06:19Z")
+ .isInternal(false)
+ .metadata(Metadata.builder()
+ .labels(Collections.emptyMap())
+ .annotations(Collections.emptyMap())
+ .build())
+ .relationships(DomainRelationships.builder()
+ .organization(ToOneRelationship.builder().build())
+ .sharedOrganizations(ToManyRelationship.builder().build())
+ .build())
+ .link("self", Link.builder()
+ .href("https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5")
+ .build())
+ .link("route_reservations", Link.builder()
+ .href("https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/route_reservations")
+ .build())
+ .build())
+ .expectComplete()
+ .verify(Duration.ofSeconds(5));
+ }
+
+ @Test
+ public void delete() {
+ mockRequest(InteractionContext.builder()
+ .request(TestRequest.builder()
+ .method(DELETE).path("/domains/test-domain-id")
+ .build())
+ .response(TestResponse.builder()
+ .status(ACCEPTED)
+ .header("Location", "https://api.example.org/v3/jobs/[guid]")
+ .build())
+ .build());
+
+ this.domains
+ .delete(DeleteDomainRequest.builder()
+ .domainId("test-domain-id")
+ .build())
+ .as(StepVerifier::create)
+ .expectNext("[guid]")
+ .expectComplete()
+ .verify(Duration.ofSeconds(5));
+ }
+
+ @Test
+ public void get() {
+ mockRequest(InteractionContext.builder()
+ .request(TestRequest.builder()
+ .method(GET).path("/domains/test-domain-id")
+ .build())
+ .response(TestResponse.builder()
+ .status(OK)
+ .payload("fixtures/client/v3/domains/GET_{id}_response.json")
+ .build())
+ .build());
+
+ this.domains
+ .get(GetDomainRequest.builder()
+ .domainId("test-domain-id")
+ .build())
+ .as(StepVerifier::create)
+ .expectNext(GetDomainResponse.builder()
+ .id("3a5d3d89-3f89-4f05-8188-8a2b298c79d5")
+ .name("test-domain.com")
+ .createdAt("2019-03-08T01:06:19Z")
+ .updatedAt("2019-03-08T01:06:19Z")
+ .isInternal(false)
+ .metadata(Metadata.builder()
+ .labels(Collections.emptyMap())
+ .annotations(Collections.emptyMap())
+ .build())
+ .relationships(DomainRelationships.builder()
+ .organization(ToOneRelationship.builder()
+ .data(Relationship.builder()
+ .id("3a3f3d89-3f89-4f05-8188-751b298c79d5")
+ .build())
+ .build())
+ .sharedOrganizations(ToManyRelationship.builder()
+ .data(Relationship.builder()
+ .id("404f3d89-3f89-6z72-8188-751b298d88d5")
+ .build())
+ .data(Relationship.builder()
+ .id("416d3d89-3f89-8h67-2189-123b298d3592")
+ .build())
+ .build())
+ .build())
+ .link("self", Link.builder()
+ .href("https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5")
+ .build())
+ .link("organization", Link.builder()
+ .href("https://api.example.org/v3/organizations/3a3f3d89-3f89-4f05-8188-751b298c79d5")
+ .build())
+ .link("route_reservations", Link.builder()
+ .href("https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/route_reservations")
+ .build())
+ .link("shared_organizations", Link.builder()
+ .href("https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/relationships/shared_organizations")
+ .build())
+ .build())
+ .expectComplete()
+ .verify(Duration.ofSeconds(5));
+ }
+
+ @Test
+ public void list() {
+ mockRequest(InteractionContext.builder()
+ .request(TestRequest.builder()
+ .method(GET).path("/domains")
+ .build())
+ .response(TestResponse.builder()
+ .status(OK)
+ .payload("fixtures/client/v3/domains/GET_response.json")
+ .build())
+ .build());
+
+ this.domains
+ .list(ListDomainsRequest.builder()
+ .build())
+ .as(StepVerifier::create)
+ .expectNext(ListDomainsResponse.builder()
+ .pagination(Pagination.builder()
+ .totalResults(3)
+ .totalPages(2)
+ .first(Link.builder()
+ .href("https://api.example.org/v3/domains?page=1&per_page=2")
+ .build())
+ .last(Link.builder()
+ .href("https://api.example.org/v3/domains?page=2&per_page=2")
+ .build())
+ .next(Link.builder()
+ .href("https://api.example.org/v3/domains?page=2&per_page=2")
+ .build())
+ .build())
+ .resource(DomainResource.builder()
+ .id("3a5d3d89-3f89-4f05-8188-8a2b298c79d5")
+ .metadata(Metadata.builder()
+ .annotations(Collections.emptyMap())
+ .labels(Collections.emptyMap())
+ .build())
+ .createdAt("2019-03-08T01:06:19Z")
+ .updatedAt("2019-03-08T01:06:19Z")
+ .name("test-domain.com")
+ .isInternal(false)
+ .relationships(DomainRelationships.builder()
+ .organization(ToOneRelationship.builder().data(null).build())
+ .sharedOrganizations(ToManyRelationship.builder().build())
+ .build())
+ .link("self", Link.builder()
+ .href("https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5")
+ .build())
+ .link("route_reservations", Link.builder()
+ .href("https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/route_reservations")
+ .build())
+ .build())
+ .build())
+ .expectComplete()
+ .verify(Duration.ofSeconds(5));
+ }
+
+ @Test
+ public void update() {
+ mockRequest(InteractionContext.builder()
+ .request(TestRequest.builder()
+ .method(PATCH).path("/domains/test-domain-id")
+ .payload("fixtures/client/v3/domains/PATCH_{id}_request.json")
+ .build())
+ .response(TestResponse.builder()
+ .status(OK)
+ .payload("fixtures/client/v3/domains/PATCH_{id}_response.json")
+ .build())
+ .build());
+
+ this.domains
+ .update(UpdateDomainRequest.builder()
+ .domainId("test-domain-id")
+ .metadata(Metadata.builder()
+ .annotation("note", "detailed information")
+ .label("key", "value")
+ .build())
+ .build())
+ .as(StepVerifier::create)
+ .expectNext(UpdateDomainResponse.builder()
+ .id("3a5d3d89-3f89-4f05-8188-8a2b298c79d5")
+ .name("test-domain.com")
+ .createdAt("2019-03-08T01:06:19Z")
+ .updatedAt("2019-03-08T01:06:19Z")
+ .isInternal(false)
+ .metadata(Metadata.builder()
+ .label("key", "value")
+ .annotation("note", "detailed information")
+ .build())
+ .relationships(DomainRelationships.builder()
+ .organization(ToOneRelationship.builder()
+ .data(Relationship.builder()
+ .id("3a3f3d89-3f89-4f05-8188-751b298c79d5")
+ .build())
+ .build())
+ .sharedOrganizations(ToManyRelationship.builder()
+ .data(Relationship.builder()
+ .id("404f3d89-3f89-6z72-8188-751b298d88d5")
+ .build())
+ .data(Relationship.builder()
+ .id("416d3d89-3f89-8h67-2189-123b298d3592")
+ .build())
+ .build())
+ .build())
+ .link("self", Link.builder()
+ .href("https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5")
+ .build())
+ .link("organization", Link.builder()
+ .href("https://api.example.org/v3/organizations/3a3f3d89-3f89-4f05-8188-751b298c79d5")
+ .build())
+ .link("route_reservations", Link.builder()
+ .href("https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/route_reservations")
+ .build())
+ .link("shared_organizations", Link.builder()
+ .href("https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/relationships/shared_organizations")
+ .build())
+ .build())
+ .expectComplete()
+ .verify(Duration.ofSeconds(5));
+ }
+
+ @Test
+ public void share() {
+ mockRequest(InteractionContext.builder()
+ .request(TestRequest.builder()
+ .method(POST).path("/domains/test-domain-id/relationships/shared_organizations")
+ .payload("fixtures/client/v3/domains/POST_{id}_relationships_shared_organizations_request.json")
+ .build())
+ .response(TestResponse.builder()
+ .status(OK)
+ .payload("fixtures/client/v3/domains/POST_{id}_relationships_shared_organizations_response.json")
+ .build())
+ .build());
+
+ this.domains
+ .share(ShareDomainRequest.builder()
+ .domainId("test-domain-id")
+ .data(Relationship.builder()
+ .id("404f3d89-3f89-6z72-8188-751b298d88d5")
+ .build())
+ .data(Relationship.builder()
+ .id("416d3d89-3f89-8h67-2189-123b298d3592")
+ .build())
+ .build())
+ .as(StepVerifier::create)
+ .expectNext(ShareDomainResponse.builder()
+ .data(Relationship.builder()
+ .id("404f3d89-3f89-6z72-8188-751b298d88d5")
+ .build())
+ .data(Relationship.builder()
+ .id("416d3d89-3f89-8h67-2189-123b298d3592")
+ .build())
+ .build())
+ .expectComplete()
+ .verify(Duration.ofSeconds(5));
+ }
+
+ @Test
+ public void unshare() {
+ mockRequest(InteractionContext.builder()
+ .request(TestRequest.builder()
+ .method(DELETE).path("/domains/test-domain-id/relationships/shared_organizations/test-org-id")
+ .build())
+ .response(TestResponse.builder()
+ .status(NO_CONTENT)
+ .build())
+ .build());
+
+ this.domains
+ .unshare(UnshareDomainRequest.builder()
+ .domainId("test-domain-id")
+ .organizationId("test-org-id")
+ .build())
+ .as(StepVerifier::create)
+ .expectNext()
+ .expectComplete()
+ .verify(Duration.ofSeconds(5));
+ }
+}
diff --git a/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/organizations/ReactorOrganizationsV3Test.java b/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/organizations/ReactorOrganizationsV3Test.java
index fceead48f13..cde7c36c734 100644
--- a/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/organizations/ReactorOrganizationsV3Test.java
+++ b/cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/organizations/ReactorOrganizationsV3Test.java
@@ -20,6 +20,10 @@
import org.cloudfoundry.client.v3.Metadata;
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.domains.DomainRelationships;
+import org.cloudfoundry.client.v3.domains.DomainResource;
import org.cloudfoundry.client.v3.organizations.AssignOrganizationDefaultIsolationSegmentRequest;
import org.cloudfoundry.client.v3.organizations.AssignOrganizationDefaultIsolationSegmentResponse;
import org.cloudfoundry.client.v3.organizations.CreateOrganizationRequest;
@@ -28,6 +32,8 @@
import org.cloudfoundry.client.v3.organizations.GetOrganizationDefaultIsolationSegmentResponse;
import org.cloudfoundry.client.v3.organizations.GetOrganizationRequest;
import org.cloudfoundry.client.v3.organizations.GetOrganizationResponse;
+import org.cloudfoundry.client.v3.organizations.ListOrganizationDomainsRequest;
+import org.cloudfoundry.client.v3.organizations.ListOrganizationDomainsResponse;
import org.cloudfoundry.client.v3.organizations.ListOrganizationsRequest;
import org.cloudfoundry.client.v3.organizations.ListOrganizationsResponse;
import org.cloudfoundry.client.v3.organizations.OrganizationResource;
@@ -241,6 +247,69 @@ public void list() {
.verify(Duration.ofSeconds(5));
}
+ @Test
+ public void listDomains() {
+ mockRequest(InteractionContext.builder()
+ .request(TestRequest.builder()
+ .method(GET).path("/organizations/test-organization-id/domains")
+ .build())
+ .response(TestResponse.builder()
+ .status(OK)
+ .payload("fixtures/client/v3/organizations/GET_{id}_domains_response.json")
+ .build())
+ .build());
+
+ this.organizations
+ .listDomains(ListOrganizationDomainsRequest.builder()
+ .organizationId("test-organization-id")
+ .build())
+ .as(StepVerifier::create)
+ .expectNext(ListOrganizationDomainsResponse.builder()
+ .pagination(Pagination.builder()
+ .totalResults(3)
+ .totalPages(2)
+ .first(Link.builder()
+ .href("https://api.example.org/v3/domains?page=1&per_page=2")
+ .build())
+ .last(Link.builder()
+ .href("https://api.example.org/v3/domains?page=2&per_page=2")
+ .build())
+ .next(Link.builder()
+ .href("https://api.example.org/v3/domains?page=2&per_page=2")
+ .build())
+ .build())
+ .resource(DomainResource.builder()
+ .id("3a5d3d89-3f89-4f05-8188-8a2b298c79d5")
+ .metadata(Metadata.builder()
+ .annotations(Collections.emptyMap())
+ .labels(Collections.emptyMap())
+ .build())
+ .createdAt("2019-03-08T01:06:19Z")
+ .updatedAt("2019-03-08T01:06:19Z")
+ .name("test-domain.com")
+ .isInternal(false)
+ .relationships(DomainRelationships.builder()
+ .organization(ToOneRelationship.builder()
+ .data(Relationship.builder()
+ .id("test-organization-id")
+ .build())
+ .build())
+ .sharedOrganizations(ToManyRelationship.builder().build())
+ .build())
+ .link("self", Link.builder()
+ .href("https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5")
+ .build())
+ .link("organization", Link.builder()
+ .href("https://api.example.org/v3/organizations/test-organization-id")
+ .build())
+ .link("route_reservations", Link.builder()
+ .href("https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/route_reservations")
+ .build())
+ .build())
+ .build())
+ .expectComplete()
+ .verify(Duration.ofSeconds(5));
+ }
@Test
public void update() {
diff --git a/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/GET_response.json b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/GET_response.json
new file mode 100644
index 00000000000..03719e81965
--- /dev/null
+++ b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/GET_response.json
@@ -0,0 +1,45 @@
+{
+ "pagination": {
+ "total_results": 3,
+ "total_pages": 2,
+ "first": {
+ "href": "https://api.example.org/v3/domains?page=1&per_page=2"
+ },
+ "last": {
+ "href": "https://api.example.org/v3/domains?page=2&per_page=2"
+ },
+ "next": {
+ "href": "https://api.example.org/v3/domains?page=2&per_page=2"
+ },
+ "previous": null
+ },
+ "resources": [
+ {
+ "guid": "3a5d3d89-3f89-4f05-8188-8a2b298c79d5",
+ "created_at": "2019-03-08T01:06:19Z",
+ "updated_at": "2019-03-08T01:06:19Z",
+ "name": "test-domain.com",
+ "internal": false,
+ "metadata": {
+ "labels": {},
+ "annotations": {}
+ },
+ "relationships": {
+ "organization": {
+ "data": null
+ },
+ "shared_organizations": {
+ "data": []
+ }
+ },
+ "links": {
+ "self": {
+ "href": "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5"
+ },
+ "route_reservations": {
+ "href": "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/route_reservations"
+ }
+ }
+ }
+ ]
+}
diff --git a/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/GET_{id}_response.json b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/GET_{id}_response.json
new file mode 100644
index 00000000000..18ea51c6156
--- /dev/null
+++ b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/GET_{id}_response.json
@@ -0,0 +1,42 @@
+{
+ "guid": "3a5d3d89-3f89-4f05-8188-8a2b298c79d5",
+ "created_at": "2019-03-08T01:06:19Z",
+ "updated_at": "2019-03-08T01:06:19Z",
+ "name": "test-domain.com",
+ "internal": false,
+ "metadata": {
+ "labels": {},
+ "annotations": {}
+ },
+ "relationships": {
+ "organization": {
+ "data": {
+ "guid": "3a3f3d89-3f89-4f05-8188-751b298c79d5"
+ }
+ },
+ "shared_organizations": {
+ "data": [
+ {
+ "guid": "404f3d89-3f89-6z72-8188-751b298d88d5"
+ },
+ {
+ "guid": "416d3d89-3f89-8h67-2189-123b298d3592"
+ }
+ ]
+ }
+ },
+ "links": {
+ "self": {
+ "href": "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5"
+ },
+ "organization": {
+ "href": "https://api.example.org/v3/organizations/3a3f3d89-3f89-4f05-8188-751b298c79d5"
+ },
+ "route_reservations": {
+ "href": "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/route_reservations"
+ },
+ "shared_organizations": {
+ "href": "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/relationships/shared_organizations"
+ }
+ }
+}
diff --git a/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/PATCH_{id}_request.json b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/PATCH_{id}_request.json
new file mode 100644
index 00000000000..ea6fec54515
--- /dev/null
+++ b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/PATCH_{id}_request.json
@@ -0,0 +1,10 @@
+{
+ "metadata": {
+ "labels": {
+ "key": "value"
+ },
+ "annotations": {
+ "note": "detailed information"
+ }
+ }
+}
diff --git a/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/PATCH_{id}_response.json b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/PATCH_{id}_response.json
new file mode 100644
index 00000000000..d7127c40727
--- /dev/null
+++ b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/PATCH_{id}_response.json
@@ -0,0 +1,46 @@
+{
+ "guid": "3a5d3d89-3f89-4f05-8188-8a2b298c79d5",
+ "created_at": "2019-03-08T01:06:19Z",
+ "updated_at": "2019-03-08T01:06:19Z",
+ "name": "test-domain.com",
+ "internal": false,
+ "metadata": {
+ "labels": {
+ "key": "value"
+ },
+ "annotations": {
+ "note": "detailed information"
+ }
+ },
+ "relationships": {
+ "organization": {
+ "data": {
+ "guid": "3a3f3d89-3f89-4f05-8188-751b298c79d5"
+ }
+ },
+ "shared_organizations": {
+ "data": [
+ {
+ "guid": "404f3d89-3f89-6z72-8188-751b298d88d5"
+ },
+ {
+ "guid": "416d3d89-3f89-8h67-2189-123b298d3592"
+ }
+ ]
+ }
+ },
+ "links": {
+ "self": {
+ "href": "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5"
+ },
+ "organization": {
+ "href": "https://api.example.org/v3/organizations/3a3f3d89-3f89-4f05-8188-751b298c79d5"
+ },
+ "route_reservations": {
+ "href": "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/route_reservations"
+ },
+ "shared_organizations": {
+ "href": "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/relationships/shared_organizations"
+ }
+ }
+}
diff --git a/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/POST_request.json b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/POST_request.json
new file mode 100644
index 00000000000..7e427d3f942
--- /dev/null
+++ b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/POST_request.json
@@ -0,0 +1,4 @@
+{
+ "name": "test-domain.com",
+ "internal": false
+}
diff --git a/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/POST_response.json b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/POST_response.json
new file mode 100644
index 00000000000..8c5c09c809e
--- /dev/null
+++ b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/POST_response.json
@@ -0,0 +1,27 @@
+{
+ "guid": "3a5d3d89-3f89-4f05-8188-8a2b298c79d5",
+ "created_at": "2019-03-08T01:06:19Z",
+ "updated_at": "2019-03-08T01:06:19Z",
+ "name": "test-domain.com",
+ "internal": false,
+ "metadata": {
+ "labels": {},
+ "annotations": {}
+ },
+ "relationships": {
+ "organization": {
+ "data": null
+ },
+ "shared_organizations": {
+ "data": []
+ }
+ },
+ "links": {
+ "self": {
+ "href": "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5"
+ },
+ "route_reservations": {
+ "href": "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/route_reservations"
+ }
+ }
+}
diff --git a/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/POST_{id}_relationships_shared_organizations_request.json b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/POST_{id}_relationships_shared_organizations_request.json
new file mode 100644
index 00000000000..5c8631b7f7d
--- /dev/null
+++ b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/POST_{id}_relationships_shared_organizations_request.json
@@ -0,0 +1,10 @@
+{
+ "data": [
+ {
+ "guid": "404f3d89-3f89-6z72-8188-751b298d88d5"
+ },
+ {
+ "guid": "416d3d89-3f89-8h67-2189-123b298d3592"
+ }
+ ]
+}
diff --git a/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/POST_{id}_relationships_shared_organizations_response.json b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/POST_{id}_relationships_shared_organizations_response.json
new file mode 100644
index 00000000000..5c8631b7f7d
--- /dev/null
+++ b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/domains/POST_{id}_relationships_shared_organizations_response.json
@@ -0,0 +1,10 @@
+{
+ "data": [
+ {
+ "guid": "404f3d89-3f89-6z72-8188-751b298d88d5"
+ },
+ {
+ "guid": "416d3d89-3f89-8h67-2189-123b298d3592"
+ }
+ ]
+}
diff --git a/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/organizations/GET_{id}_domains_response.json b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/organizations/GET_{id}_domains_response.json
new file mode 100644
index 00000000000..757121dff5b
--- /dev/null
+++ b/cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/organizations/GET_{id}_domains_response.json
@@ -0,0 +1,50 @@
+{
+ "pagination": {
+ "total_results": 3,
+ "total_pages": 2,
+ "first": {
+ "href": "https://api.example.org/v3/domains?page=1&per_page=2"
+ },
+ "last": {
+ "href": "https://api.example.org/v3/domains?page=2&per_page=2"
+ },
+ "next": {
+ "href": "https://api.example.org/v3/domains?page=2&per_page=2"
+ },
+ "previous": null
+ },
+ "resources": [
+ {
+ "guid": "3a5d3d89-3f89-4f05-8188-8a2b298c79d5",
+ "created_at": "2019-03-08T01:06:19Z",
+ "updated_at": "2019-03-08T01:06:19Z",
+ "name": "test-domain.com",
+ "internal": false,
+ "metadata": {
+ "labels": {},
+ "annotations": {}
+ },
+ "relationships": {
+ "organization": {
+ "data": {
+ "guid": "test-organization-id"
+ }
+ },
+ "shared_organizations": {
+ "data": []
+ }
+ },
+ "links": {
+ "self": {
+ "href": "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5"
+ },
+ "organization": {
+ "href": "https://api.example.org/v3/organizations/test-organization-id"
+ },
+ "route_reservations": {
+ "href": "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/route_reservations"
+ }
+ }
+ }
+ ]
+}
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 9989e630a55..25c02d2befc 100644
--- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/CloudFoundryClient.java
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/CloudFoundryClient.java
@@ -50,6 +50,7 @@
import org.cloudfoundry.client.v3.applications.ApplicationsV3;
import org.cloudfoundry.client.v3.builds.Builds;
import org.cloudfoundry.client.v3.deployments.DeploymentsV3;
+import org.cloudfoundry.client.v3.domains.DomainsV3;
import org.cloudfoundry.client.v3.droplets.Droplets;
import org.cloudfoundry.client.v3.isolationsegments.IsolationSegments;
import org.cloudfoundry.client.v3.jobs.JobsV3;
@@ -111,6 +112,11 @@ public interface CloudFoundryClient {
*/
Domains domains();
+ /**
+ * Main entry point to the Cloud Foundry Domains V3 Client API
+ */
+ DomainsV3 domainsV3();
+
/**
* Main entry point to the Cloud Foundry Droplets Client API
*/
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/Domain.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/Domain.java
index 966a5e8cffd..4e5e0a6bd96 100644
--- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/Domain.java
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/Domain.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2019 the original author or authors.
+ * Copyright 2013-2020 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.
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/DomainsV3.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/DomainsV3.java
new file mode 100644
index 00000000000..604c3ecfa55
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/DomainsV3.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import reactor.core.publisher.Mono;
+
+/**
+ * Main entry point to the Cloud Foundry Domains V3 Client API
+ */
+public interface DomainsV3 {
+
+ /**
+ * Makes the Create a domain request
+ *
+ * @param request the Create a Domain request
+ * @return the response from the Create a Domain request
+ */
+ Mono create(CreateDomainRequest request);
+
+ /**
+ * Makes Delete a Particular Domain request
+ *
+ * @param request the Delete a Particular Domain request
+ * @return the response from the Delete a Particular Domain request
+ */
+ Mono delete(DeleteDomainRequest request);
+
+ /**
+ * Makes Get Domain request
+ *
+ * @param request The Get Domain request
+ * @return the response from the Get Domain request
+ */
+ Mono get(GetDomainRequest request);
+
+ /**
+ * Makes List all Domains request
+ *
+ * @param request the List all Domains request
+ * @return the response from the List all Domains request
+ */
+ Mono list(ListDomainsRequest request);
+
+ /**
+ * Makes Unshare a Domain request
+ *
+ * @param request The Unshare a Domain request
+ * @return the response from the Unshare a Domain request
+ */
+ Mono unshare(UnshareDomainRequest request);
+
+ /**
+ * Makes the Create a domain request
+ *
+ * @param request the Update a Domain request
+ * @return the response from the Update a Domain request
+ */
+ Mono update(UpdateDomainRequest request);
+
+ /**
+ * Makes Share a Domain request
+ *
+ * @param request The Share a Domain request
+ * @return the response from the Share a Domain request
+ */
+ Mono share(ShareDomainRequest request);
+
+}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_CreateDomainRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_CreateDomainRequest.java
new file mode 100644
index 00000000000..a9596532547
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_CreateDomainRequest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import org.cloudfoundry.Nullable;
+import org.cloudfoundry.client.v3.Metadata;
+import org.immutables.value.Value;
+
+/**
+ * The request payload for the Create a Domain operation
+ */
+@JsonSerialize
+@Value.Immutable
+abstract class _CreateDomainRequest {
+
+ /**
+ * Whether this is an internal domain
+ */
+ @JsonProperty("internal")
+ @Nullable
+ abstract Boolean getInternal();
+
+ /**
+ * The metadata
+ */
+ @JsonProperty("metadata")
+ @Nullable
+ abstract Metadata getMetadata();
+
+ /**
+ * The name
+ */
+ @JsonProperty("name")
+ abstract String getName();
+
+ /**
+ * The relationships
+ */
+ @JsonProperty("relationships")
+ @Nullable
+ abstract DomainRelationships getRelationships();
+
+}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_CreateDomainResponse.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_CreateDomainResponse.java
new file mode 100644
index 00000000000..24c36b5dc8e
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_CreateDomainResponse.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.immutables.value.Value;
+
+/**
+ * The response payload for the Create a Domain operation
+ */
+@JsonDeserialize
+@Value.Immutable
+abstract class _CreateDomainResponse extends Domain {
+
+}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_DeleteDomainRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_DeleteDomainRequest.java
new file mode 100644
index 00000000000..fccedf72fcd
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_DeleteDomainRequest.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.immutables.value.Value;
+
+/**
+ * The request payload for the Delete a Particular Domain operation
+ */
+@Value.Immutable
+abstract class _DeleteDomainRequest {
+
+ /**
+ * The domain id
+ */
+ @JsonIgnore
+ abstract String getDomainId();
+
+}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_DomainRelationships.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_DomainRelationships.java
index 7e9b88ba2c0..d6b08333ff4 100644
--- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_DomainRelationships.java
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_DomainRelationships.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2019 the original author or authors.
+ * Copyright 2013-2020 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.
@@ -18,6 +18,7 @@
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;
@@ -38,6 +39,7 @@ abstract class _DomainRelationships {
* to the organization the domain is scoped to.
*/
@JsonProperty("shared_organizations")
+ @Nullable
abstract ToManyRelationship getSharedOrganizations();
}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_DomainResource.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_DomainResource.java
new file mode 100644
index 00000000000..c81eb619676
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_DomainResource.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.immutables.value.Value;
+
+/**
+ * The response payload for the Domain resource
+ */
+@JsonDeserialize
+@Value.Immutable
+abstract class _DomainResource extends Domain {
+
+}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_GetDomainRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_GetDomainRequest.java
new file mode 100644
index 00000000000..8c1940a9c6a
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_GetDomainRequest.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import org.immutables.value.Value;
+
+/**
+ * The request payload for the Get Domain operation
+ */
+@JsonSerialize
+@Value.Immutable
+abstract class _GetDomainRequest {
+
+ /**
+ * The domain id
+ */
+ abstract String getDomainId();
+
+}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_GetDomainResponse.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_GetDomainResponse.java
new file mode 100644
index 00000000000..d6f7781faaf
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_GetDomainResponse.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.immutables.value.Value;
+
+/**
+ * The response payload for the Get Domain operation
+ */
+@JsonDeserialize
+@Value.Immutable
+abstract class _GetDomainResponse extends Domain {
+
+}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_ListDomainsRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_ListDomainsRequest.java
new file mode 100644
index 00000000000..5bee1214e4a
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_ListDomainsRequest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+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 Domains operation
+ */
+@Value.Immutable
+abstract class _ListDomainsRequest extends PaginatedRequest {
+
+ /**
+ * The ids
+ */
+ @FilterParameter("guids")
+ @Nullable
+ abstract List getDomainIds();
+
+ /**
+ * The metadata query
+ */
+ @FilterParameter("label_selector")
+ @Nullable
+ abstract String getLabelSelector();
+
+ /**
+ * The names
+ */
+ @FilterParameter("names")
+ @Nullable
+ abstract List getNames();
+
+ /**
+ * The owning organization ids
+ */
+ @FilterParameter("organization_guids")
+ @Nullable
+ abstract List getOwningOrganizationIds();
+
+}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_ListDomainsResponse.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_ListDomainsResponse.java
new file mode 100644
index 00000000000..19a551bd155
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_ListDomainsResponse.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+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 Domains operation
+ */
+@JsonDeserialize
+@Value.Immutable
+abstract class _ListDomainsResponse extends PaginatedResponse {
+
+}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_ShareDomainRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_ShareDomainRequest.java
new file mode 100644
index 00000000000..3926a752623
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_ShareDomainRequest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import org.cloudfoundry.client.v3.Relationship;
+import org.immutables.value.Value;
+
+import java.util.List;
+
+/**
+ * The request payload for the Share Domain operation.
+ */
+@JsonSerialize
+@Value.Immutable
+abstract class _ShareDomainRequest {
+
+ /**
+ * The organizations the domain is shared to
+ */
+ @JsonProperty("data")
+ abstract List getData();
+
+ /**
+ * The domain id
+ */
+ @JsonIgnore
+ abstract String getDomainId();
+
+}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_ShareDomainResponse.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_ShareDomainResponse.java
new file mode 100644
index 00000000000..1d9ee006880
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_ShareDomainResponse.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.cloudfoundry.AllowNulls;
+import org.cloudfoundry.Nullable;
+import org.cloudfoundry.client.v3.Link;
+import org.cloudfoundry.client.v3.Relationship;
+import org.immutables.value.Value;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The response payload for the Share Domain operation
+ */
+@JsonDeserialize
+@Value.Immutable
+abstract class _ShareDomainResponse {
+
+ /**
+ * The data
+ */
+ @JsonProperty("data")
+ @Nullable
+ abstract List getData();
+
+}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_UnshareDomainRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_UnshareDomainRequest.java
new file mode 100644
index 00000000000..c1420f40089
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_UnshareDomainRequest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.immutables.value.Value;
+
+/**
+ * The request payload for the Unshare Domain operation.
+ */
+@Value.Immutable
+abstract class _UnshareDomainRequest {
+
+ /**
+ * The domain id
+ */
+ @JsonIgnore
+ abstract String getDomainId();
+
+ /**
+ * The organization id
+ */
+ @JsonIgnore
+ abstract String getOrganizationId();
+
+}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_UpdateDomainRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_UpdateDomainRequest.java
new file mode 100644
index 00000000000..74e44d19cc8
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_UpdateDomainRequest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+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.cloudfoundry.client.v3.Metadata;
+import org.immutables.value.Value;
+
+/**
+ * The request payload for the Update a Domain operation
+ */
+@JsonSerialize
+@Value.Immutable
+abstract class _UpdateDomainRequest {
+
+ /**
+ * The id
+ */
+ @JsonIgnore
+ abstract String getDomainId();
+
+ /**
+ * The metadata
+ */
+ @JsonProperty("metadata")
+ @Nullable
+ abstract Metadata getMetadata();
+
+}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_UpdateDomainResponse.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_UpdateDomainResponse.java
new file mode 100644
index 00000000000..53cd2062126
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_UpdateDomainResponse.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.immutables.value.Value;
+
+/**
+ * The response payload for the Update a Domain operation
+ */
+@JsonDeserialize
+@Value.Immutable
+abstract class _UpdateDomainResponse extends Domain {
+
+}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/organizations/OrganizationsV3.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/organizations/OrganizationsV3.java
index 6d694311f6b..0d013117f72 100644
--- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/organizations/OrganizationsV3.java
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/organizations/OrganizationsV3.java
@@ -71,6 +71,14 @@ public interface OrganizationsV3 {
*/
Mono list(ListOrganizationsRequest request);
+ /**
+ * Makes List Organization Domains request
+ *
+ * @param request the List Organization Domains request
+ * @return the response from the List Organization Domains request
+ */
+ Mono listDomains(ListOrganizationDomainsRequest request);
+
/**
* Makes the Update an Organization request
*
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/organizations/_ListOrganizationDomainsRequest.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/organizations/_ListOrganizationDomainsRequest.java
new file mode 100644
index 00000000000..a26773f9e1a
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/organizations/_ListOrganizationDomainsRequest.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2013-2020 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.organizations;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+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 Organization Domains operation
+ */
+@Value.Immutable
+abstract class _ListOrganizationDomainsRequest extends PaginatedRequest {
+
+ /**
+ * The domain ids to filter by
+ */
+ @FilterParameter("guids")
+ @Nullable
+ abstract List getDomainIds();
+
+ /**
+ * The metadata query
+ */
+ @FilterParameter("label_selector")
+ @Nullable
+ abstract String getLabelSelector();
+
+ /**
+ * The names
+ */
+ @FilterParameter("names")
+ @Nullable
+ abstract List getNames();
+
+ /**
+ * The organization id
+ */
+ @JsonIgnore
+ abstract String getOrganizationId();
+
+ /**
+ * The owning organization ids
+ */
+ @FilterParameter("organization_guids")
+ @Nullable
+ abstract List getOwningOrganizationIds();
+
+}
diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/organizations/_ListOrganizationDomainsResponse.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/organizations/_ListOrganizationDomainsResponse.java
new file mode 100644
index 00000000000..7f42015c8e8
--- /dev/null
+++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/organizations/_ListOrganizationDomainsResponse.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2013-2020 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.organizations;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.cloudfoundry.client.v3.PaginatedResponse;
+import org.cloudfoundry.client.v3.domains.DomainResource;
+import org.immutables.value.Value;
+
+/**
+ * The response payload for the List Organization Domains operation
+ */
+@JsonDeserialize
+@Value.Immutable
+abstract class _ListOrganizationDomainsResponse extends PaginatedResponse {
+
+}
diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/CreateDomainRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/CreateDomainRequestTest.java
new file mode 100644
index 00000000000..18638a41665
--- /dev/null
+++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/CreateDomainRequestTest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import org.cloudfoundry.client.v3.Relationship;
+import org.cloudfoundry.client.v3.ToManyRelationship;
+import org.cloudfoundry.client.v3.ToOneRelationship;
+import org.junit.Test;
+
+public final class CreateDomainRequestTest {
+
+ @Test(expected = IllegalStateException.class)
+ public void noName() {
+ CreateDomainRequest.builder()
+ .build();
+ }
+
+ @Test
+ public void valid() {
+ CreateDomainRequest.builder()
+ .name("test-domain-name")
+ .internal(true)
+ .relationships(DomainRelationships.builder()
+ .organization(ToOneRelationship.builder()
+ .data(Relationship.builder()
+ .id("test-org-id")
+ .build())
+ .build())
+ .sharedOrganizations(ToManyRelationship.builder()
+ .data(Relationship.builder()
+ .id("shared-org-id-1")
+ .build())
+ .data(Relationship.builder()
+ .id("shared-org-id-2")
+ .build())
+ .build())
+ .build())
+ .build();
+ }
+
+}
diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/DeleteDomainRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/DeleteDomainRequestTest.java
new file mode 100644
index 00000000000..a3668acd99e
--- /dev/null
+++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/DeleteDomainRequestTest.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import org.junit.Test;
+
+public final class DeleteDomainRequestTest {
+
+ @Test(expected = IllegalStateException.class)
+ public void noDomainId() {
+ DeleteDomainRequest.builder()
+ .build();
+ }
+
+ @Test
+ public void valid() {
+ DeleteDomainRequest.builder()
+ .domainId("test-domain-id")
+ .build();
+ }
+
+}
diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/GetDomainRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/GetDomainRequestTest.java
new file mode 100644
index 00000000000..3bc4e950ca5
--- /dev/null
+++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/GetDomainRequestTest.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import org.junit.Test;
+
+public final class GetDomainRequestTest {
+
+ @Test(expected = IllegalStateException.class)
+ public void noDomainId() {
+ GetDomainRequest.builder()
+ .build();
+ }
+
+ @Test
+ public void valid() {
+ GetDomainRequest.builder()
+ .domainId("test-domain-id")
+ .build();
+ }
+
+}
diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/ListDomainsRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/ListDomainsRequestTest.java
new file mode 100644
index 00000000000..5f25246a3d7
--- /dev/null
+++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/ListDomainsRequestTest.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import org.junit.Test;
+
+public final class ListDomainsRequestTest {
+
+ @Test
+ public void valid() {
+ ListDomainsRequest.builder()
+ .build();
+ }
+
+}
diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/ShareDomainRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/ShareDomainRequestTest.java
new file mode 100644
index 00000000000..f587dc57694
--- /dev/null
+++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/ShareDomainRequestTest.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import org.cloudfoundry.client.v3.Relationship;
+import org.junit.Test;
+
+public final class ShareDomainRequestTest {
+
+ @Test(expected = IllegalStateException.class)
+ public void emptyRelationship() {
+ ShareDomainRequest.builder()
+ .domainId("test-domain-id")
+ .data(Relationship.builder().build())
+ .build();
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void noDomainId() {
+ ShareDomainRequest.builder()
+ .data(Relationship.builder()
+ .id("shared-organization-id")
+ .build())
+ .build();
+ }
+
+ @Test
+ public void valid() {
+ ShareDomainRequest.builder()
+ .domainId("test-domain-id")
+ .data(Relationship.builder()
+ .id("shared-organization-id")
+ .build())
+ .build();
+ }
+
+}
diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/UnshareDomainRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/UnshareDomainRequestTest.java
new file mode 100644
index 00000000000..6da02ea492b
--- /dev/null
+++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/UnshareDomainRequestTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import org.junit.Test;
+
+public final class UnshareDomainRequestTest {
+
+ @Test(expected = IllegalStateException.class)
+ public void noDomainId() {
+ UnshareDomainRequest.builder()
+ .organizationId("test-org-id")
+ .build();
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void noOrganizationId() {
+ UnshareDomainRequest.builder()
+ .domainId("test-domain-id")
+ .build();
+ }
+
+ @Test
+ public void valid() {
+ UnshareDomainRequest.builder()
+ .domainId("test-domain-id")
+ .organizationId("test-org-id")
+ .build();
+ }
+
+}
diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/UpdateDomainRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/UpdateDomainRequestTest.java
new file mode 100644
index 00000000000..c5d61a6ed4b
--- /dev/null
+++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/domains/UpdateDomainRequestTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2013-2020 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.domains;
+
+import org.cloudfoundry.client.v3.Metadata;
+import org.junit.Test;
+
+public final class UpdateDomainRequestTest {
+
+ @Test(expected = IllegalStateException.class)
+ public void noDomainId() {
+ UpdateDomainRequest.builder()
+ .build();
+ }
+
+ @Test
+ public void valid() {
+ UpdateDomainRequest.builder()
+ .domainId("test-domain-id")
+ .metadata(Metadata.builder()
+ .label("test-label-key", "test-label-value")
+ .build())
+ .build();
+ }
+
+}
diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/organizations/ListOrganizationDomainsRequestTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/organizations/ListOrganizationDomainsRequestTest.java
new file mode 100644
index 00000000000..4ff34fe9c53
--- /dev/null
+++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/organizations/ListOrganizationDomainsRequestTest.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2013-2020 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.organizations;
+
+import org.junit.Test;
+
+public final class ListOrganizationDomainsRequestTest {
+
+ @Test(expected = IllegalStateException.class)
+ public void noOrganizationId() {
+ ListOrganizationDomainsRequest.builder()
+ .build();
+ }
+
+ @Test
+ public void valid() {
+ ListOrganizationDomainsRequest.builder()
+ .organizationId("test-organization-id")
+ .build();
+ }
+
+}
diff --git a/integration-test/src/test/java/org/cloudfoundry/client/v3/DomainsTest.java b/integration-test/src/test/java/org/cloudfoundry/client/v3/DomainsTest.java
new file mode 100644
index 00000000000..5d626b98a57
--- /dev/null
+++ b/integration-test/src/test/java/org/cloudfoundry/client/v3/DomainsTest.java
@@ -0,0 +1,370 @@
+/*
+ * Copyright 2013-2020 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 org.cloudfoundry.AbstractIntegrationTest;
+import org.cloudfoundry.CloudFoundryVersion;
+import org.cloudfoundry.IfCloudFoundryVersion;
+import org.cloudfoundry.client.CloudFoundryClient;
+import org.cloudfoundry.client.v3.domains.CreateDomainRequest;
+import org.cloudfoundry.client.v3.domains.CreateDomainResponse;
+import org.cloudfoundry.client.v3.domains.DeleteDomainRequest;
+import org.cloudfoundry.client.v3.domains.Domain;
+import org.cloudfoundry.client.v3.domains.DomainRelationships;
+import org.cloudfoundry.client.v3.domains.DomainResource;
+import org.cloudfoundry.client.v3.domains.GetDomainRequest;
+import org.cloudfoundry.client.v3.domains.GetDomainResponse;
+import org.cloudfoundry.client.v3.domains.ListDomainsRequest;
+import org.cloudfoundry.client.v3.domains.ShareDomainRequest;
+import org.cloudfoundry.client.v3.domains.ShareDomainResponse;
+import org.cloudfoundry.client.v3.domains.UnshareDomainRequest;
+import org.cloudfoundry.client.v3.domains.UpdateDomainRequest;
+import org.cloudfoundry.client.v3.organizations.CreateOrganizationRequest;
+import org.cloudfoundry.client.v3.organizations.CreateOrganizationResponse;
+import org.cloudfoundry.client.v3.organizations.ListOrganizationDomainsRequest;
+import org.cloudfoundry.util.PaginationUtils;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+import reactor.test.StepVerifier;
+
+import java.time.Duration;
+import java.util.function.Consumer;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.cloudfoundry.util.tuple.TupleUtils.consumer;
+import static org.cloudfoundry.util.tuple.TupleUtils.function;
+
+@IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.PCF_1_12)
+public final class DomainsTest extends AbstractIntegrationTest {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(DomainsTest.class);
+
+ @Autowired
+ private CloudFoundryClient cloudFoundryClient;
+
+ @Autowired
+ private Mono organizationId;
+
+ @Test
+ public void create() {
+ String domainName = this.nameFactory.getDomainName();
+
+ requestCreateDomain(this.cloudFoundryClient, domainName)
+ .as(StepVerifier::create)
+ .consumeNextWith(globalDomainNameEquality(domainName))
+ .expectComplete()
+ .verify(Duration.ofMinutes(5));
+ }
+
+ @Test
+ public void createForAnOrganization() {
+ String domainName = this.nameFactory.getDomainName();
+
+ this.organizationId
+ .flatMap(organizationId -> Mono.zip(
+ requestCreateDomain(this.cloudFoundryClient, organizationId, domainName),
+ Mono.just(organizationId)
+ ))
+ .as(StepVerifier::create)
+ .consumeNextWith(consumer((response, organizationId) -> {
+ assertThat(response.getName()).isEqualTo(domainName);
+ assertThat(response.getRelationships().getOrganization().getData().getId()).isEqualTo(organizationId);
+ assertThat(response.getRelationships().getSharedOrganizations().getData()).isEmpty();
+ }))
+ .expectComplete()
+ .verify(Duration.ofMinutes(5));
+ }
+
+ @Test
+ public void delete() {
+ String domainName = this.nameFactory.getDomainName();
+
+ createDomainId(this.cloudFoundryClient, domainName)
+ .delayUntil(domainId -> requestDeleteDomain(this.cloudFoundryClient, domainId))
+ .flatMap(domainId -> requestGetDomain(this.cloudFoundryClient, domainId))
+ .as(StepVerifier::create)
+ .consumeErrorWith(t -> assertThat(t).isInstanceOf(ClientV3Exception.class).hasMessageMatching("CF-DomainNotFound\\([0-9]+\\): The domain could not be found: .*"))
+ .verify(Duration.ofMinutes(5));
+ }
+
+ @Test
+ public void get() {
+ String domainName = this.nameFactory.getDomainName();
+
+ createDomainId(this.cloudFoundryClient, domainName)
+ .flatMap(domainId -> requestGetDomain(this.cloudFoundryClient, domainId))
+ .as(StepVerifier::create)
+ .consumeNextWith(globalDomainNameEquality(domainName))
+ .expectComplete()
+ .verify(Duration.ofMinutes(5));
+ }
+
+ @Test
+ public void list() {
+ String domainName = this.nameFactory.getDomainName();
+
+ createDomainId(this.cloudFoundryClient, domainName)
+ .flatMap(domainId -> requestListDomains(this.cloudFoundryClient)
+ .filter(resource -> domainId.equals(resource.getId()))
+ .single()
+ )
+ .as(StepVerifier::create)
+ .consumeNextWith(globalDomainNameEquality(domainName))
+ .expectComplete()
+ .verify(Duration.ofMinutes(5));
+ }
+
+ @Test
+ public void listFilterByName() {
+ String domainName = this.nameFactory.getDomainName();
+
+ createDomainId(this.cloudFoundryClient, domainName)
+ .flatMap(domainId -> requestListDomains(this.cloudFoundryClient, domainName)
+ .filter(resource -> domainId.equals(resource.getId()))
+ .single()
+ )
+ .as(StepVerifier::create)
+ .consumeNextWith(globalDomainNameEquality(domainName))
+ .expectComplete()
+ .verify(Duration.ofMinutes(5));
+ }
+
+ @Test
+ public void listFilterByOwningOrganizationId() {
+ String domainName = this.nameFactory.getDomainName();
+
+ this.organizationId
+ .flatMap(organizationId -> Mono.zip(
+ Mono.just(organizationId),
+ createDomainId(this.cloudFoundryClient, domainName, organizationId)
+ ))
+ .flatMap(function((organizationId, domainId) -> Mono.zip(
+ requestListDomainsByOwningOrganization(this.cloudFoundryClient, organizationId)
+ .filter(resource -> domainId.equals(resource.getId()))
+ .single(),
+ Mono.just(organizationId)
+ )))
+ .as(StepVerifier::create)
+ .consumeNextWith(consumer((response, organizationId) -> {
+ assertThat(response.getName()).isEqualTo(domainName);
+ assertThat(response.getRelationships().getOrganization().getData().getId()).isEqualTo(organizationId);
+ assertThat(response.getRelationships().getSharedOrganizations().getData()).isEmpty();
+ }))
+ .expectComplete()
+ .verify(Duration.ofMinutes(5));
+ }
+
+ @Test
+ public void share() {
+ String domainName = this.nameFactory.getDomainName();
+ String organizationName = this.nameFactory.getOrganizationName();
+
+ this.organizationId
+ .flatMap(organizationId -> Mono.zip(
+ Mono.just(organizationId),
+ createDomainId(this.cloudFoundryClient, domainName, organizationId),
+ createOrganizationId(this.cloudFoundryClient, organizationName)
+ ))
+ .delayUntil(function((organizationId, domainId, newOrganizationId) ->
+ requestShareDomain(this.cloudFoundryClient, domainId, newOrganizationId)))
+ .flatMap(function((organizationId, domainId, newOrganizationId) -> Mono.zip(
+ requestListDomainsForOrganization(this.cloudFoundryClient, organizationId)
+ .filter(resource -> domainId.equals(resource.getId()))
+ .single(),
+ Mono.just(organizationId),
+ Mono.just(newOrganizationId)
+ )))
+ .as(StepVerifier::create)
+ .consumeNextWith(consumer((response, organizationId, newOrganizationId) -> {
+ assertThat(response.getName()).isEqualTo(domainName);
+ assertThat(response.getRelationships().getOrganization().getData().getId()).isEqualTo(organizationId);
+ assertThat(response.getRelationships().getSharedOrganizations().getData().get(0).getId()).isEqualTo(newOrganizationId);
+ }))
+ .expectComplete()
+ .verify(Duration.ofMinutes(5));
+ }
+
+ @Test
+ public void unshare() {
+ String domainName = this.nameFactory.getDomainName();
+ String organizationName = this.nameFactory.getOrganizationName();
+
+ this.organizationId
+ .flatMap(organizationId -> Mono.zip(
+ Mono.just(organizationId),
+ createDomainId(this.cloudFoundryClient, domainName, organizationId),
+ createOrganizationId(this.cloudFoundryClient, organizationName)
+ ))
+ .doOnSuccess(T -> LOGGER.info("OrganizationId: {}, domainId: {}, newOrganizationId: {}", T.getT1(), T.getT2(), T.getT3()))
+ .delayUntil(function((organizationId, domainId, newOrganizationId) ->
+ requestShareDomain(this.cloudFoundryClient, domainId, newOrganizationId)))
+ .delayUntil(function((organizationId, domainId, newOrganizationId) ->
+ requestUnshareDomain(this.cloudFoundryClient, domainId, newOrganizationId)))
+ .flatMapMany(function((organizationId, domainId, newOrganizationId) ->
+ requestListDomainsForOrganization(this.cloudFoundryClient, newOrganizationId)
+ .filter(resource -> domainId.equals(resource.getId()))
+ ))
+ .as(StepVerifier::create)
+ .expectNextCount(0)
+ .expectComplete()
+ .verify(Duration.ofMinutes(5));
+ }
+
+ @Test
+ public void update() {
+ String domainName = this.nameFactory.getDomainName();
+
+ createDomainId(this.cloudFoundryClient, domainName)
+ .flatMap(domainId -> this.cloudFoundryClient.domainsV3()
+ .update(UpdateDomainRequest.builder()
+ .domainId(domainId)
+ .metadata(Metadata.builder()
+ .annotation("annotationKey", "annotationValue")
+ .label("labelKey", "labelValue")
+ .build())
+ .build()))
+ .thenMany(requestListDomains(this.cloudFoundryClient, domainName))
+ .map(DomainResource::getMetadata)
+ .as(StepVerifier::create)
+ .consumeNextWith(metadata -> {
+ assertThat(metadata.getAnnotations().get("annotationKey")).isEqualTo("annotationValue");
+ assertThat(metadata.getLabels().get("labelKey")).isEqualTo("labelValue");
+ })
+ .expectComplete()
+ .verify(Duration.ofMinutes(5));
+ }
+
+ private static Mono createDomainId(CloudFoundryClient cloudFoundryClient, String domainName) {
+ return requestCreateDomain(cloudFoundryClient, domainName)
+ .map(CreateDomainResponse::getId);
+ }
+
+ private static Mono createDomainId(CloudFoundryClient cloudFoundryClient, String domainName, String organizationId) {
+ return requestCreateDomain(cloudFoundryClient, organizationId, domainName)
+ .map(CreateDomainResponse::getId);
+ }
+
+ private static Mono createOrganizationId(CloudFoundryClient cloudFoundryClient, String organizationName) {
+ return cloudFoundryClient.organizationsV3()
+ .create(CreateOrganizationRequest.builder()
+ .name(organizationName)
+ .build())
+ .map(CreateOrganizationResponse::getId);
+ }
+
+ private static Consumer globalDomainNameEquality(String domainName) {
+ return response -> {
+ assertThat(response.getName()).isEqualTo(domainName);
+ assertThat(response.getRelationships().getOrganization().getData()).isNull();
+ assertThat(response.getRelationships().getSharedOrganizations().getData()).isEmpty();
+ };
+ }
+
+ private static Mono requestCreateDomain(CloudFoundryClient cloudFoundryClient, String domainName) {
+ return cloudFoundryClient.domainsV3()
+ .create(CreateDomainRequest.builder()
+ .name(domainName)
+ .internal(false)
+ .build());
+ }
+
+ private static Mono requestCreateDomain(CloudFoundryClient cloudFoundryClient, String organizationId, String domainName) {
+ return cloudFoundryClient.domainsV3()
+ .create(CreateDomainRequest.builder()
+ .name(domainName)
+ .relationships(DomainRelationships.builder()
+ .organization(ToOneRelationship.builder()
+ .data(Relationship.builder()
+ .id(organizationId)
+ .build())
+ .build())
+ .build())
+ .build());
+ }
+
+ private static Mono requestDeleteDomain(CloudFoundryClient cloudFoundryClient, String domainId) {
+ return cloudFoundryClient.domainsV3()
+ .delete(DeleteDomainRequest.builder()
+ .domainId(domainId)
+ .build());
+ }
+
+ private static Mono requestGetDomain(CloudFoundryClient cloudFoundryClient, String domainId) {
+ return cloudFoundryClient.domainsV3()
+ .get(GetDomainRequest.builder()
+ .domainId(domainId)
+ .build());
+ }
+
+ private static Flux requestListDomains(CloudFoundryClient cloudFoundryClient, String domainName) {
+ return PaginationUtils
+ .requestClientV3Resources(page -> cloudFoundryClient.domainsV3()
+ .list(ListDomainsRequest.builder()
+ .name(domainName)
+ .page(page)
+ .build()));
+ }
+
+ private static Flux requestListDomains(CloudFoundryClient cloudFoundryClient) {
+ return PaginationUtils
+ .requestClientV3Resources(page -> cloudFoundryClient.domainsV3()
+ .list(ListDomainsRequest.builder()
+ .page(page)
+ .build()));
+ }
+
+ private static Flux requestListDomainsByOwningOrganization(CloudFoundryClient cloudFoundryClient, String organizationId) {
+ return PaginationUtils
+ .requestClientV3Resources(page -> cloudFoundryClient.domainsV3()
+ .list(ListDomainsRequest.builder()
+ .owningOrganizationId(organizationId)
+ .page(page)
+ .build()));
+ }
+
+ private static Flux requestListDomainsForOrganization(CloudFoundryClient cloudFoundryClient, String organizationId) {
+ return PaginationUtils
+ .requestClientV3Resources(page -> cloudFoundryClient.organizationsV3()
+ .listDomains(ListOrganizationDomainsRequest.builder()
+ .organizationId(organizationId)
+ .page(page)
+ .build()));
+ }
+
+ private static Mono requestShareDomain(CloudFoundryClient cloudFoundryClient, String domainId, String organizationId) {
+ return cloudFoundryClient.domainsV3()
+ .share(ShareDomainRequest.builder()
+ .domainId(domainId)
+ .data(Relationship.builder()
+ .id(organizationId)
+ .build())
+ .build());
+ }
+
+ private static Mono requestUnshareDomain(CloudFoundryClient cloudFoundryClient, String domainId, String organizationId) {
+ return cloudFoundryClient.domainsV3()
+ .unshare(UnshareDomainRequest.builder()
+ .domainId(domainId)
+ .organizationId(organizationId)
+ .build());
+ }
+
+}
diff --git a/integration-test/src/test/java/org/cloudfoundry/client/v3/OrganizationsTest.java b/integration-test/src/test/java/org/cloudfoundry/client/v3/OrganizationsTest.java
index c8b86433fb2..f83dbbad2eb 100644
--- a/integration-test/src/test/java/org/cloudfoundry/client/v3/OrganizationsTest.java
+++ b/integration-test/src/test/java/org/cloudfoundry/client/v3/OrganizationsTest.java
@@ -20,6 +20,9 @@
import org.cloudfoundry.CloudFoundryVersion;
import org.cloudfoundry.IfCloudFoundryVersion;
import org.cloudfoundry.client.CloudFoundryClient;
+import org.cloudfoundry.client.v3.domains.CreateDomainRequest;
+import org.cloudfoundry.client.v3.domains.CreateDomainResponse;
+import org.cloudfoundry.client.v3.domains.DomainRelationships;
import org.cloudfoundry.client.v3.isolationsegments.AddIsolationSegmentOrganizationEntitlementRequest;
import org.cloudfoundry.client.v3.isolationsegments.AddIsolationSegmentOrganizationEntitlementResponse;
import org.cloudfoundry.client.v3.isolationsegments.CreateIsolationSegmentRequest;
@@ -33,6 +36,7 @@
import org.cloudfoundry.client.v3.organizations.GetOrganizationDefaultIsolationSegmentRequest;
import org.cloudfoundry.client.v3.organizations.GetOrganizationRequest;
import org.cloudfoundry.client.v3.organizations.GetOrganizationResponse;
+import org.cloudfoundry.client.v3.organizations.ListOrganizationDomainsRequest;
import org.cloudfoundry.client.v3.organizations.ListOrganizationsRequest;
import org.cloudfoundry.client.v3.organizations.OrganizationResource;
import org.cloudfoundry.client.v3.organizations.UpdateOrganizationRequest;
@@ -127,6 +131,7 @@ public void getDefaultDomain() {
.consumeNextWith(name -> assertThat(name).contains("apps.", ".springapps.io"))
.expectComplete()
.verify(Duration.ofMinutes(5));
+
}
@Test
@@ -169,6 +174,94 @@ public void list() {
.verify(Duration.ofMinutes(5));
}
+ @Test
+ public void listDomains() {
+ String domainName = this.nameFactory.getDomainName();
+ String organizationName = this.nameFactory.getOrganizationName();
+
+ createOrganizationId(this.cloudFoundryClient, organizationName)
+ .delayUntil(organizationId -> requestCreateDomain(this.cloudFoundryClient, organizationId, domainName))
+ .flatMapMany(organizationId -> PaginationUtils.requestClientV3Resources(page -> this.cloudFoundryClient.organizationsV3()
+ .listDomains(ListOrganizationDomainsRequest.builder()
+ .organizationId(organizationId)
+ .page(page)
+ .build())))
+ .filter(resource -> domainName.equals(resource.getName()))
+ .as(StepVerifier::create)
+ .consumeNextWith(resource -> assertThat(resource.getName()).isEqualTo(domainName))
+ .expectComplete()
+ .verify(Duration.ofMinutes(5));
+ }
+
+ @Test
+ public void listDomainsFilterByOwningOrganizationIds() {
+ String domainName = this.nameFactory.getDomainName();
+ String globalDomainName = this.nameFactory.getDomainName();
+ String organizationName = this.nameFactory.getOrganizationName();
+
+ createOrganizationId(this.cloudFoundryClient, organizationName)
+ .delayUntil(organizationId -> Mono.when(
+ requestCreateDomain(this.cloudFoundryClient, organizationId, domainName),
+ requestCreateDomain(this.cloudFoundryClient, globalDomainName)))
+ .flatMapMany(organizationId -> PaginationUtils.requestClientV3Resources(page -> this.cloudFoundryClient.organizationsV3()
+ .listDomains(ListOrganizationDomainsRequest.builder()
+ .organizationId(organizationId)
+ .owningOrganizationId(organizationId)
+ .page(page)
+ .build())))
+ .filter(resource -> domainName.equals(resource.getName()) || globalDomainName.equals(resource.getName()))
+ .as(StepVerifier::create)
+ .consumeNextWith(resource -> assertThat(resource.getName()).isEqualTo(domainName))
+ .expectComplete()
+ .verify(Duration.ofMinutes(5));
+ }
+
+ @Test
+ public void listDomainsReturningGlobalDomains() {
+ String globalDomainName = this.nameFactory.getDomainName();
+ String organizationName = this.nameFactory.getOrganizationName();
+
+ createOrganizationId(this.cloudFoundryClient, organizationName)
+ .delayUntil(organizationId -> requestCreateDomain(this.cloudFoundryClient, globalDomainName))
+ .flatMapMany(organizationId -> PaginationUtils.requestClientV3Resources(page -> this.cloudFoundryClient.organizationsV3()
+ .listDomains(ListOrganizationDomainsRequest.builder()
+ .organizationId(organizationId)
+ .page(page)
+ .build())))
+ .filter(resource -> globalDomainName.equals(resource.getName()))
+ .as(StepVerifier::create)
+ .consumeNextWith(resource -> assertThat(resource.getName()).isEqualTo(globalDomainName))
+ .expectComplete()
+ .verify(Duration.ofMinutes(5));
+ }
+
+ @Test
+ public void listDomainsReturningSharedDomains() {
+ String domainName = this.nameFactory.getDomainName();
+ String domainNameAnother = this.nameFactory.getDomainName();
+ String organizationName = this.nameFactory.getOrganizationName();
+ String organizationNameAnother = this.nameFactory.getOrganizationName();
+
+ Mono.zip(
+ createOrganizationId(this.cloudFoundryClient, organizationName),
+ createOrganizationId(this.cloudFoundryClient, organizationNameAnother))
+ .flatMap(function((organizationId, anotherOrganizationId) -> Mono
+ .when(
+ requestCreateDomain(this.cloudFoundryClient, organizationId, domainName),
+ requestCreateDomain(this.cloudFoundryClient, anotherOrganizationId, domainNameAnother))
+ .thenReturn(organizationId)))
+ .flatMapMany(organizationId -> PaginationUtils.requestClientV3Resources(page -> this.cloudFoundryClient.organizationsV3()
+ .listDomains(ListOrganizationDomainsRequest.builder()
+ .organizationId(organizationId)
+ .page(page)
+ .build())))
+ .filter(resource -> domainName.equals(resource.getName()) || domainNameAnother.equals(resource.getName()))
+ .as(StepVerifier::create)
+ .consumeNextWith(resource -> assertThat(resource.getName()).isEqualTo(domainName))
+ .expectComplete()
+ .verify(Duration.ofMinutes(5));
+ }
+
@Test
public void listFilterByName() {
String organizationName = this.nameFactory.getOrganizationName();
@@ -268,4 +361,27 @@ private static Flux requestListOrganizations(CloudFoundryC
.build()));
}
+ private static Mono requestCreateDomain(CloudFoundryClient cloudFoundryClient, String organizationId, String domainName) {
+ return cloudFoundryClient.domainsV3()
+ .create(CreateDomainRequest.builder()
+ .name(domainName)
+ .relationships(DomainRelationships.builder()
+ .organization(ToOneRelationship.builder()
+ .data(Relationship.builder()
+ .id(organizationId)
+ .build())
+ .build())
+ .build())
+ .internal(false)
+ .build());
+ }
+
+ private static Mono requestCreateDomain(CloudFoundryClient cloudFoundryClient, String domainName) {
+ return cloudFoundryClient.domainsV3()
+ .create(CreateDomainRequest.builder()
+ .name(domainName)
+ .internal(false)
+ .build());
+ }
+
}