Skip to content

Commit 0684d63

Browse files
feat(api): Updated java-sdk to adopt Code Engine API specification changes
1 parent 745e5cf commit 0684d63

30 files changed

+954
-126
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![Build Status](https://travis-ci.com/IBM/code-engine-java-sdk.svg?branch=main)](https://travis-ci.com/IBM/code-engine-java-sdk)
22
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
33

4-
# IBM Cloud Code Engine Java SDK Version 4.17.0
4+
# IBM Cloud Code Engine Java SDK Version 4.22.1
55

66
Java client library to interact with the [Code Engine API](https://cloud.ibm.com/apidocs/codeengine).
77

@@ -39,7 +39,7 @@ The IBM Cloud Code Engine Java SDK allows developers to programmatically interac
3939

4040
Service Name | Artifact Coordinates
4141
--- | ---
42-
[Code Engine](https://cloud.ibm.com/apidocs/codeengine/codeengine-v2.0.0) | com.ibm.cloud.code-engine:4.17.0
42+
[Code Engine](https://cloud.ibm.com/apidocs/codeengine/codeengine-v2.0.0) | com.ibm.cloud.code-engine:4.22.1
4343

4444
## Prerequisites
4545

@@ -51,7 +51,7 @@ Service Name | Artifact Coordinates
5151

5252
## Installation
5353

54-
The current version of this SDK is: 4.17.0
54+
The current version of this SDK is: 4.22.1
5555

5656
Each service's artifact coordinates are listed in the table above.
5757

@@ -70,14 +70,14 @@ Here are examples for maven and gradle:
7070
<dependency>
7171
<groupId>com.ibm.cloud</groupId>
7272
<artifactId>code-engine</artifactId>
73-
<version>4.17.0</version>
73+
<version>4.22.1</version>
7474
</dependency>
7575
```
7676

7777
### Gradle
7878

7979
```gradle
80-
compile 'com.ibm.cloud:code-engine:4.17.0'
80+
compile 'com.ibm.cloud:code-engine:4.22.1'
8181
```
8282

8383
## Using the SDK

modules/code-engine/src/main/java/com/ibm/cloud/code_engine/code_engine/v2/CodeEngine.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313

1414
/*
15-
* IBM OpenAPI SDK Code Generator Version: 3.94.1-71478489-20240820-161623
15+
* IBM OpenAPI SDK Code Generator Version: 3.99.0-d27cee72-20250129-204831
1616
*/
1717

1818
package com.ibm.cloud.code_engine.code_engine.v2;
@@ -182,7 +182,7 @@ public CodeEngine(String serviceName, Authenticator authenticator) {
182182
* Gets the version.
183183
*
184184
* The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between
185-
* `2021-03-31` and `2025-01-10`.
185+
* `2021-03-31` and `2025-02-20`.
186186
*
187187
* @return the version
188188
*/
@@ -1573,6 +1573,9 @@ public ServiceCall<Build> createBuild(CreateBuildOptions createBuildOptions) {
15731573
contentJson.addProperty("output_image", createBuildOptions.outputImage());
15741574
contentJson.addProperty("output_secret", createBuildOptions.outputSecret());
15751575
contentJson.addProperty("strategy_type", createBuildOptions.strategyType());
1576+
if (createBuildOptions.runBuildParams() != null) {
1577+
contentJson.add("run_build_params", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createBuildOptions.runBuildParams()));
1578+
}
15761579
if (createBuildOptions.sourceContextDir() != null) {
15771580
contentJson.addProperty("source_context_dir", createBuildOptions.sourceContextDir());
15781581
}
@@ -1743,6 +1746,9 @@ public ServiceCall<BuildRun> createBuildRun(CreateBuildRunOptions createBuildRun
17431746
if (createBuildRunOptions.outputSecret() != null) {
17441747
contentJson.addProperty("output_secret", createBuildRunOptions.outputSecret());
17451748
}
1749+
if (createBuildRunOptions.runBuildParams() != null) {
1750+
contentJson.add("run_build_params", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createBuildRunOptions.runBuildParams()));
1751+
}
17461752
if (createBuildRunOptions.serviceAccount() != null) {
17471753
contentJson.addProperty("service_account", createBuildRunOptions.serviceAccount());
17481754
}
@@ -2119,6 +2125,9 @@ public ServiceCall<SecretList> listSecrets(ListSecretsOptions listSecretsOptions
21192125
builder.header(header.getKey(), header.getValue());
21202126
}
21212127
builder.header("Accept", "application/json");
2128+
if (listSecretsOptions.format() != null) {
2129+
builder.query("format", String.valueOf(listSecretsOptions.format()));
2130+
}
21222131
if (listSecretsOptions.limit() != null) {
21232132
builder.query("limit", String.valueOf(listSecretsOptions.limit()));
21242133
}

modules/code-engine/src/main/java/com/ibm/cloud/code_engine/code_engine/v2/model/AppInstance.java

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public interface Status {
5555
protected String region;
5656
@SerializedName("resource_type")
5757
protected String resourceType;
58-
protected Long restarts;
5958
@SerializedName("revision_name")
6059
protected String revisionName;
6160
@SerializedName("scale_cpu_limit")
@@ -65,10 +64,8 @@ public interface Status {
6564
@SerializedName("scale_memory_limit")
6665
protected String scaleMemoryLimit;
6766
protected String status;
68-
@SerializedName("system_container")
69-
protected ContainerStatus systemContainer;
70-
@SerializedName("user_container")
71-
protected ContainerStatus userContainer;
67+
@SerializedName("status_details")
68+
protected AppInstanceStatusDetails statusDetails;
7269

7370
protected AppInstance() { }
7471

@@ -161,17 +158,6 @@ public String getResourceType() {
161158
return resourceType;
162159
}
163160

164-
/**
165-
* Gets the restarts.
166-
*
167-
* The number of restarts of the app instance.
168-
*
169-
* @return the restarts
170-
*/
171-
public Long getRestarts() {
172-
return restarts;
173-
}
174-
175161
/**
176162
* Gets the revisionName.
177163
*
@@ -236,25 +222,14 @@ public String getStatus() {
236222
}
237223

238224
/**
239-
* Gets the systemContainer.
240-
*
241-
* The status of a container.
242-
*
243-
* @return the systemContainer
244-
*/
245-
public ContainerStatus getSystemContainer() {
246-
return systemContainer;
247-
}
248-
249-
/**
250-
* Gets the userContainer.
225+
* Gets the statusDetails.
251226
*
252-
* The status of a container.
227+
* The status of the pod and it's containers.
253228
*
254-
* @return the userContainer
229+
* @return the statusDetails
255230
*/
256-
public ContainerStatus getUserContainer() {
257-
return userContainer;
231+
public AppInstanceStatusDetails getStatusDetails() {
232+
return statusDetails;
258233
}
259234
}
260235

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2025.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.cloud.code_engine.code_engine.v2.model;
15+
16+
import com.google.gson.annotations.SerializedName;
17+
import com.ibm.cloud.sdk.core.service.model.GenericModel;
18+
19+
/**
20+
* The status of the pod and it's containers.
21+
*/
22+
public class AppInstanceStatusDetails extends GenericModel {
23+
24+
protected Long restarts;
25+
@SerializedName("system_container")
26+
protected ContainerStatus systemContainer;
27+
@SerializedName("user_container")
28+
protected ContainerStatus userContainer;
29+
30+
protected AppInstanceStatusDetails() { }
31+
32+
/**
33+
* Gets the restarts.
34+
*
35+
* The number of restarts of the app instance.
36+
*
37+
* @return the restarts
38+
*/
39+
public Long getRestarts() {
40+
return restarts;
41+
}
42+
43+
/**
44+
* Gets the systemContainer.
45+
*
46+
* The status of a container.
47+
*
48+
* @return the systemContainer
49+
*/
50+
public ContainerStatus getSystemContainer() {
51+
return systemContainer;
52+
}
53+
54+
/**
55+
* Gets the userContainer.
56+
*
57+
* The status of a container.
58+
*
59+
* @return the userContainer
60+
*/
61+
public ContainerStatus getUserContainer() {
62+
return userContainer;
63+
}
64+
}
65+

modules/code-engine/src/main/java/com/ibm/cloud/code_engine/code_engine/v2/model/Build.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
package com.ibm.cloud.code_engine.code_engine.v2.model;
1515

16+
import java.util.List;
17+
1618
import com.google.gson.annotations.SerializedName;
1719
import com.ibm.cloud.sdk.core.service.model.GenericModel;
1820

@@ -94,6 +96,8 @@ public interface StrategyType {
9496
protected String region;
9597
@SerializedName("resource_type")
9698
protected String resourceType;
99+
@SerializedName("run_build_params")
100+
protected List<BuildParam> runBuildParams;
97101
@SerializedName("source_context_dir")
98102
protected String sourceContextDir;
99103
@SerializedName("source_revision")
@@ -229,6 +233,18 @@ public String getResourceType() {
229233
return resourceType;
230234
}
231235

236+
/**
237+
* Gets the runBuildParams.
238+
*
239+
* References to config maps and secret keys, or literal values, which are defined by the build owner and are exposed
240+
* as build arguments in Docker files.
241+
*
242+
* @return the runBuildParams
243+
*/
244+
public List<BuildParam> getRunBuildParams() {
245+
return runBuildParams;
246+
}
247+
232248
/**
233249
* Gets the sourceContextDir.
234250
*
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2025.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.cloud.code_engine.code_engine.v2.model;
15+
16+
import com.ibm.cloud.sdk.core.service.model.GenericModel;
17+
18+
/**
19+
* Response model for build params.
20+
*/
21+
public class BuildParam extends GenericModel {
22+
23+
/**
24+
* Specify the type of the build param.
25+
*/
26+
public interface Type {
27+
/** literal. */
28+
String LITERAL = "literal";
29+
/** config_map_key_reference. */
30+
String CONFIG_MAP_KEY_REFERENCE = "config_map_key_reference";
31+
/** secret_key_reference. */
32+
String SECRET_KEY_REFERENCE = "secret_key_reference";
33+
}
34+
35+
protected String key;
36+
protected String name;
37+
protected String reference;
38+
protected String type;
39+
protected String value;
40+
41+
protected BuildParam() { }
42+
43+
/**
44+
* Gets the key.
45+
*
46+
* The key to reference as build param.
47+
*
48+
* @return the key
49+
*/
50+
public String getKey() {
51+
return key;
52+
}
53+
54+
/**
55+
* Gets the name.
56+
*
57+
* The name of the build param.
58+
*
59+
* @return the name
60+
*/
61+
public String getName() {
62+
return name;
63+
}
64+
65+
/**
66+
* Gets the reference.
67+
*
68+
* The name of the secret or config map.
69+
*
70+
* @return the reference
71+
*/
72+
public String getReference() {
73+
return reference;
74+
}
75+
76+
/**
77+
* Gets the type.
78+
*
79+
* Specify the type of the build param.
80+
*
81+
* @return the type
82+
*/
83+
public String getType() {
84+
return type;
85+
}
86+
87+
/**
88+
* Gets the value.
89+
*
90+
* The literal value of the build param.
91+
*
92+
* @return the value
93+
*/
94+
public String getValue() {
95+
return value;
96+
}
97+
}
98+

0 commit comments

Comments
 (0)