Skip to content

Commit feadaec

Browse files
authored
Forward merge 5.x.x into main (#1355)
Forward merge 5.x.x into main
2 parents a8f7c09 + 4658d06 commit feadaec

21 files changed

Lines changed: 296 additions & 87 deletions

File tree

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,59 @@ The `cf-java-client` project is a Java language binding for interacting with a C
1717
## Versions
1818
The Cloud Foundry Java Client has two active versions. The `5.x` line is compatible with Spring Boot `2.4.x - 2.6.x` just to manage its dependencies, while the `4.x` line uses Spring Boot `2.3.x`.
1919

20+
## Deprecations
21+
22+
### `DopplerClient.recentLogs()` — Recent Logs via Doppler
23+
24+
> [!WARNING]
25+
> **Deprecated since cf-java-client `5.17.x`**
26+
>
27+
> The `DopplerClient.recentLogs()` endpoint (and the related `RecentLogsRequest` / `LogMessage` types from the `org.cloudfoundry.doppler` package) are **deprecated** and will be removed in a future release.
28+
>
29+
> This API relies on the [Loggregator][loggregator] Doppler/Traffic Controller endpoint `/apps/{id}/recentlogs`, which was removed in **Loggregator ≥ 107.0**.
30+
> The affected platform versions are:
31+
>
32+
> | Platform | Last version with Doppler recent-logs support |
33+
> | -------- | --------------------------------------------- |
34+
> | CF Deployment (CFD) | `< 24.3` |
35+
> | Tanzu Application Service (TAS) | `< 4.0` |
36+
>
37+
> **Migration:** Replace any call to `DopplerClient.recentLogs()` with [`LogCacheClient.read()`][log-cache-api] (available via `org.cloudfoundry.logcache.v1.LogCacheClient`).
38+
>
39+
> ```java
40+
> // Before (deprecated)
41+
> dopplerClient.recentLogs(RecentLogsRequest.builder()
42+
> .applicationId(appId)
43+
> .build());
44+
>
45+
> // After
46+
> logCacheClient.read(ReadRequest.builder()
47+
> .sourceId(appId)
48+
> .envelopeTypes(EnvelopeType.LOG)
49+
> .build());
50+
> ```
51+
>
52+
> The return type and envelope objects differ between the two APIs:
53+
>
54+
> | | Doppler (`org.cloudfoundry.doppler`) | Log Cache (`org.cloudfoundry.logcache.v1`) |
55+
> |---|---|---|
56+
> | **Return type** | `Flux<Envelope>` | `Mono<ReadResponse>` → unpack via `response.getEnvelopes().getBatch()` |
57+
> | **Log access** | `envelope.getLogMessage()` → `LogMessage` | `envelope.getLog()` → `Log` |
58+
> | **Message text** | `logMessage.getMessage()` | `log.getPayloadAsText()` |
59+
> | **Message type** | `MessageType.OUT` / `ERR` | `LogType.OUT` / `ERR` |
60+
> | **Source metadata** | `logMessage.getSourceType()`, `.getSourceInstance()` | `envelope.getTags().get("source_type")`, `envelope.getInstanceId()` |
61+
>
62+
> See the [`org.cloudfoundry.doppler`][doppler-pkg] and [`org.cloudfoundry.logcache.v1`][logcache-pkg] Javadoc for full type details.
63+
64+
[doppler-pkg]: https://javadoc.io/doc/org.cloudfoundry/cloudfoundry-client/latest/org/cloudfoundry/doppler/package-summary.html
65+
[logcache-pkg]: https://javadoc.io/doc/org.cloudfoundry/cloudfoundry-client/latest/org/cloudfoundry/logcache/v1/package-summary.html
66+
67+
> [!NOTE]
68+
> **Operations API users:** `Applications.logs(ApplicationLogsRequest)` now uses Log Cache under the hood for recent logs (the default). No migration is needed at the Operations layer.
69+
70+
[loggregator]: https://github.com/cloudfoundry/loggregator
71+
[log-cache-api]: https://github.com/cloudfoundry/log-cache
72+
2073
## Dependencies
2174
Most projects will need two dependencies; the Operations API and an implementation of the Client API. For Maven, the dependencies would be defined like this:
2275
@@ -76,6 +129,9 @@ Both the `cloudfoundry-operations` and `cloudfoundry-client` projects follow a [
76129

77130
### `CloudFoundryClient`, `DopplerClient`, `UaaClient` Builders
78131

132+
> [!NOTE]
133+
> **`DopplerClient` — partial deprecation:** The `recentLogs()` method on `DopplerClient` is deprecated and only works against Loggregator \< 107.0 (CFD \< 24.3 / TAS \< 4.0). See the [Deprecations](#deprecations) section above for the migration path to `LogCacheClient`.
134+
79135
The lowest-level building blocks of the API are `ConnectionContext` and `TokenProvider`. These types are intended to be shared between instances of the clients, and come with out of the box implementations. To instantiate them, you configure them with builders:
80136

81137
```java

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/uaa/clients/ReactorClientsTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import static io.netty.handler.codec.http.HttpResponseStatus.OK;
2525
import static org.cloudfoundry.uaa.tokens.GrantType.AUTHORIZATION_CODE;
2626
import static org.cloudfoundry.uaa.tokens.GrantType.CLIENT_CREDENTIALS;
27+
import static org.cloudfoundry.uaa.tokens.GrantType.JWT_BEARER;
2728
import static org.cloudfoundry.uaa.tokens.GrantType.REFRESH_TOKEN;
2829

2930
import java.time.Duration;
@@ -620,6 +621,7 @@ void get() {
620621
.allowedProviders("uaa", "ldap", "my-saml-provider")
621622
.authorities("clients.read", "clients.write")
622623
.authorizedGrantType(CLIENT_CREDENTIALS)
624+
.authorizedGrantType(JWT_BEARER)
623625
.autoApprove("true")
624626
.clientId("4Z3t1r")
625627
.lastModified(1468364445592L)

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/uaa/identityzones/ReactorIdentityZonesTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,8 @@ void list() {
832832
+ " /passcode)")
833833
.build())
834834
.ldapDiscoveryEnabled(false)
835+
.defaultIdentityProvider(
836+
"test-identity-provider")
835837
.accountChooserEnabled(false)
836838
.build())
837839
.name("The Twiglet Zone")

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/uaa/serverinformation/ReactorServerInformationTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ void getInfo() {
151151
.showLoginLinks(true)
152152
.timestamp("2017-09-08T23:11:58+0000")
153153
.zoneName("uaa")
154+
.defaultIdpName("test-idp-name")
154155
.build())
155156
.expectComplete()
156157
.verify(Duration.ofSeconds(5));

cloudfoundry-client-reactor/src/test/resources/fixtures/uaa/clients/GET_{id}_response.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"none"
99
],
1010
"authorized_grant_types": [
11-
"client_credentials"
11+
"client_credentials",
12+
"urn:ietf:params:oauth:grant-type:jwt-bearer"
1213
],
1314
"redirect_uri": [
1415
"http*://ant.path.wildcard/**/passback/*",

cloudfoundry-client-reactor/src/test/resources/fixtures/uaa/identity-zones/GET_response.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"text": "One Time Code (Get on at /passcode)"
9898
}
9999
],
100+
"defaultIdentityProvider": "test-identity-provider",
100101
"idpDiscoveryEnabled": false,
101102
"accountChooserEnabled": false
102103
},

cloudfoundry-client-reactor/src/test/resources/fixtures/uaa/info/GET_response.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@
3030
"One Time Code ( Get one at http://localhost:8080/uaa/passcode )"
3131
]
3232
},
33-
"timestamp": "2017-09-08T23:11:58+0000"
33+
"timestamp": "2017-09-08T23:11:58+0000",
34+
"defaultIdpName": "test-idp-name"
3435
}

cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/DopplerClient.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,15 @@ public interface DopplerClient {
4242
/**
4343
* Makes the <a href="https://github.com/cloudfoundry/loggregator/tree/develop/src/trafficcontroller#endpoints">Recent Logs</a> request
4444
*
45+
* @deprecated Use {@link org.cloudfoundry.logcache.v1.LogCacheClient#read(org.cloudfoundry.logcache.v1.ReadRequest)} instead.
46+
* Only works with {@code Loggregator < 107.0}, shipped in {@code CFD < 24.3} and {@code TAS < 4.0}.
4547
* @param request the Recent Logs request
46-
* @return the events from the recent logs
48+
* @return a flux of events from the recent logs
49+
* @see <a href="https://github.com/cloudfoundry/loggregator">Loggregator</a>
50+
* @see <a href="https://github.com/cloudfoundry/log-cache">Log Cache</a>
51+
* @see org.cloudfoundry.logcache.v1.LogCacheClient#read(org.cloudfoundry.logcache.v1.ReadRequest)
4752
*/
53+
@Deprecated
4854
Flux<Envelope> recentLogs(RecentLogsRequest request);
4955

5056
/**

cloudfoundry-client/src/main/java/org/cloudfoundry/uaa/identityzones/_IdentityZoneConfiguration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ abstract class _IdentityZoneConfiguration {
6565
@Nullable
6666
abstract CorsPolicy getCorsPolicy();
6767

68+
/**
69+
* The default identity provider for this zone
70+
*/
71+
@JsonProperty("defaultIdentityProvider")
72+
@Nullable
73+
abstract String getDefaultIdentityProvider();
74+
6875
/**
6976
* The issuer of this zone
7077
*/

cloudfoundry-client/src/main/java/org/cloudfoundry/uaa/serverinformation/_GetInfoResponse.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,12 @@ abstract class _GetInfoResponse {
9393
@Nullable
9494
abstract String getZoneName();
9595

96+
/**
97+
* The default identity provider name
98+
*/
99+
@JsonProperty("defaultIdpName")
100+
@Nullable
101+
abstract String getDefaultIdpName();
102+
103+
96104
}

0 commit comments

Comments
 (0)