-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the List all Service Bindings for the App V2 operation.
This commit adds the v2 API to List all Service Bindings for an App (GET /v2/apps/:guid/service_bindings). [#107069280]
- Loading branch information
Steve Powell
committed
Nov 26, 2015
1 parent
e1fb879
commit c9d5d3d
Showing
9 changed files
with
412 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...dfoundry-client-spring/src/test/resources/v2/apps/GET_{id}_service_bindings_response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"total_results": 1, | ||
"total_pages": 1, | ||
"prev_url": null, | ||
"next_url": null, | ||
"resources": [ | ||
{ | ||
"metadata": { | ||
"guid": "42eda707-fe4d-4eed-9b39-7cb5e665c226", | ||
"url": "/v2/service_bindings/42eda707-fe4d-4eed-9b39-7cb5e665c226", | ||
"created_at": "2015-07-27T22:43:20Z", | ||
"updated_at": null | ||
}, | ||
"entity": { | ||
"app_guid": "26ddc1de-3eeb-424b-82f3-f7f30a38b610", | ||
"service_instance_guid": "650d0eb7-3b83-414a-82a0-d503d1c8eb5f", | ||
"credentials": { | ||
"creds-key-356": "creds-val-356" | ||
}, | ||
"binding_options": { | ||
|
||
}, | ||
"gateway_data": null, | ||
"gateway_name": "", | ||
"syslog_drain_url": null, | ||
"app_url": "/v2/apps/26ddc1de-3eeb-424b-82f3-f7f30a38b610", | ||
"service_instance_url": "/v2/service_instances/650d0eb7-3b83-414a-82a0-d503d1c8eb5f" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
...lombok/org/cloudfoundry/client/v2/applications/ListApplicationServiceBindingsRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright 2013-2015 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.v2.applications; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.Singular; | ||
import lombok.ToString; | ||
import org.cloudfoundry.client.Validatable; | ||
import org.cloudfoundry.client.ValidationResult; | ||
import org.cloudfoundry.client.v2.FilterParameter; | ||
import org.cloudfoundry.client.v2.PaginatedRequest; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* The request payload for the List all Service Bindings for the App operation | ||
*/ | ||
@Data | ||
@EqualsAndHashCode(callSuper = true) | ||
@ToString(callSuper = true) | ||
public final class ListApplicationServiceBindingsRequest extends PaginatedRequest implements Validatable { | ||
|
||
/** | ||
* The ids of the service instances | ||
* | ||
* @param serviceInstanceIds the ids of the service instances to filter on | ||
* @return the ids of the service instances to filter on | ||
*/ | ||
@Getter(onMethod = @__(@FilterParameter("service_instance_guid"))) | ||
private volatile List<String> serviceInstanceIds; | ||
|
||
/** | ||
* The id of the App | ||
* | ||
* @param id the id of the App | ||
* @return the id of the App | ||
*/ | ||
@Getter(onMethod = @__(@JsonIgnore)) | ||
private volatile String id; | ||
|
||
@Builder | ||
ListApplicationServiceBindingsRequest(OrderDirection orderDirection, | ||
Integer page, | ||
Integer resultsPerPage, | ||
@Singular List<String> serviceInstanceIds, | ||
String id) { | ||
super(orderDirection, page, resultsPerPage); | ||
this.serviceInstanceIds = serviceInstanceIds; | ||
this.id = id; | ||
} | ||
|
||
@Override | ||
public ValidationResult isValid() { | ||
ValidationResult.ValidationResultBuilder builder = ValidationResult.builder(); | ||
|
||
if (this.id == null) { | ||
builder.message("id must be specified"); | ||
} | ||
|
||
return builder.build(); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...ombok/org/cloudfoundry/client/v2/applications/ListApplicationServiceBindingsResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2013-2015 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.v2.applications; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Singular; | ||
import lombok.ToString; | ||
import org.cloudfoundry.client.v2.PaginatedResponse; | ||
import org.cloudfoundry.client.v2.serviceinstances.ServiceBindingResource; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* The response payload for the List all Service Bindings for the App operation | ||
*/ | ||
@Data | ||
@EqualsAndHashCode(callSuper = true) | ||
@ToString(callSuper = true) | ||
public final class ListApplicationServiceBindingsResponse extends PaginatedResponse<ServiceBindingResource> { | ||
|
||
@Builder | ||
ListApplicationServiceBindingsResponse(@JsonProperty("next_url") String nextUrl, | ||
@JsonProperty("prev_url") String previousUrl, | ||
@JsonProperty("resources") @Singular List<ServiceBindingResource> resources, | ||
@JsonProperty("total_pages") Integer totalPages, | ||
@JsonProperty("total_results") Integer totalResults) { | ||
|
||
super(nextUrl, previousUrl, resources, totalPages, totalResults); | ||
} | ||
|
||
|
||
} |
71 changes: 71 additions & 0 deletions
71
...ent/src/main/lombok/org/cloudfoundry/client/v2/serviceinstances/ServiceBindingEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright 2013-2015 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.v2.serviceinstances; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.Singular; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* The entity response payload for the Service Binding resource | ||
*/ | ||
@Data | ||
public final class ServiceBindingEntity { | ||
|
||
private final String applicationId; | ||
|
||
private final String applicationUrl; | ||
|
||
private final Map<String, Object> bindingOptions; | ||
|
||
private final Map<String, Object> credentials; | ||
|
||
private final Map<String, Object> gatewayData; | ||
|
||
private final String gatewayName; | ||
|
||
private final String serviceInstanceId; | ||
|
||
private final String serviceInstanceUrl; | ||
|
||
private final String syslogDrainUrl; | ||
|
||
@Builder | ||
ServiceBindingEntity(@JsonProperty("app_guid") String applicationId, | ||
@JsonProperty("app_url") String applicationUrl, | ||
@JsonProperty("binding_options") @Singular Map<String, Object> bindingOptions, | ||
@JsonProperty("credentials") @Singular Map<String, Object> credentials, | ||
@JsonProperty("gateway_data") Map<String, Object> gatewayData, | ||
@JsonProperty("gateway_name") String gatewayName, | ||
@JsonProperty("service_instance_guid") String serviceInstanceId, | ||
@JsonProperty("service_instance_url") String serviceInstanceUrl, | ||
@JsonProperty("syslog_drain_url") String syslogDrainUrl) { | ||
|
||
this.applicationId = applicationId; | ||
this.applicationUrl = applicationUrl; | ||
this.bindingOptions = bindingOptions; | ||
this.credentials = credentials; | ||
this.gatewayData = gatewayData; | ||
this.gatewayName = gatewayName; | ||
this.serviceInstanceId = serviceInstanceId; | ||
this.serviceInstanceUrl = serviceInstanceUrl; | ||
this.syslogDrainUrl = syslogDrainUrl; | ||
} | ||
} |
Oops, something went wrong.