Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import org.cloudfoundry.client.v3.organizations.AssignOrganizationDefaultIsolationSegmentResponse;
import org.cloudfoundry.client.v3.organizations.CreateOrganizationRequest;
import org.cloudfoundry.client.v3.organizations.CreateOrganizationResponse;
import org.cloudfoundry.client.v3.organizations.GetOrganizationDefaultDomainRequest;
import org.cloudfoundry.client.v3.organizations.GetOrganizationDefaultDomainResponse;
import org.cloudfoundry.client.v3.organizations.GetOrganizationDefaultIsolationSegmentRequest;
import org.cloudfoundry.client.v3.organizations.GetOrganizationDefaultIsolationSegmentResponse;
import org.cloudfoundry.client.v3.organizations.GetOrganizationRequest;
Expand Down Expand Up @@ -85,4 +87,10 @@ public Mono<ListOrganizationsResponse> list(ListOrganizationsRequest request) {
.checkpoint();
}

@Override
public Mono<GetOrganizationDefaultDomainResponse> getDefaultDomain(GetOrganizationDefaultDomainRequest request) {
return get(request, GetOrganizationDefaultDomainResponse.class, builder -> builder.pathSegment("organizations", request.getOrganizationId(), "domains", "default"))
.checkpoint();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

import org.cloudfoundry.Nullable;
import org.immutables.value.Value;

/**
Expand All @@ -30,6 +32,7 @@ abstract class _ToOneRelationship {
/**
* The relationship data
*/
@Nullable
@JsonProperty("data")
abstract Relationship getData();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright 2013-2019 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.Metadata;
import org.cloudfoundry.client.v3.Resource;

import com.fasterxml.jackson.annotation.JsonProperty;

public abstract class Domain extends Resource {

/**
* The name of the domain.
* Must be between 3 ~ 253 characters and follow <a href="https://tools.ietf.org/html/rfc1035">RFC 1035</a>.
*/
@JsonProperty("name")
public abstract String getName();

/**
* Metadata applied to the domain.
*/
@JsonProperty("metadata")
@Nullable
public abstract Metadata getMetadata();

/**
* Whether the domain is used for internal (container-to-container) traffic.
*/
@JsonProperty("internal")
public abstract boolean isInternal();

/**
* Relationships of the domain.
*/
@JsonProperty("relationships")
public abstract DomainRelationships getRelationships();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2013-2019 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.ToManyRelationship;
import org.cloudfoundry.client.v3.ToOneRelationship;
import org.immutables.value.Value;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

@JsonDeserialize
@Value.Immutable
abstract class _DomainRelationships {

/**
* The organization the domain is scoped to. If set, the domain will only be available in that organization.
* Otherwise, the domain will be globally available.
*/
@JsonProperty("organization")
abstract ToOneRelationship getOrganization();

/**
* Organizations the domain is shared with. If set, the domain will be available in these organizations in addition
* to the organization the domain is scoped to.
*/
@JsonProperty("shared_organizations")
abstract ToManyRelationship getSharedOrganizations();

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,12 @@ public interface OrganizationsV3 {
*/
Mono<ListOrganizationsResponse> list(ListOrganizationsRequest request);

/**
* Makes the <a href="https://v3-apidocs.cloudfoundry.org/version/3.76.0/index.html#get-default-domain">List Organizations</a> request
*
* @param request the List Organizations request
* @return the response from the List Organizations request
*/
Mono<GetOrganizationDefaultDomainResponse> getDefaultDomain(GetOrganizationDefaultDomainRequest request);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2013-2019 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.immutables.value.Value;

import com.fasterxml.jackson.annotation.JsonIgnore;

@Value.Immutable
abstract class _GetOrganizationDefaultDomainRequest {

/**
* The organization id
*/
@JsonIgnore
abstract String getOrganizationId();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright 2013-2019 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.cloudfoundry.client.v3.domains.Domain;
import org.immutables.value.Value;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

@JsonDeserialize
@Value.Immutable
abstract class _GetOrganizationDefaultDomainResponse extends Domain {

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

public final class ToOneRelationshipTest {

@Test(expected = IllegalStateException.class)
@Test
public void noData() {
ToOneRelationship.builder()
.build();
Expand Down