Skip to content

Commit 015ba72

Browse files
feat(api): Updated java-sdk to adopt Code Engine API specification changes
1 parent d3dc0bd commit 015ba72

31 files changed

+2782
-36
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.10.0
4+
# IBM Cloud Code Engine Java SDK Version 4.12.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.10.0
42+
[Code Engine](https://cloud.ibm.com/apidocs/codeengine/codeengine-v2.0.0) | com.ibm.cloud.code-engine:4.12.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.10.0
54+
The current version of this SDK is: 4.12.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.10.0</version>
73+
<version>4.12.1</version>
7474
</dependency>
7575
```
7676

7777
### Gradle
7878

7979
```gradle
80-
compile 'com.ibm.cloud:code-engine:4.10.0'
80+
compile 'com.ibm.cloud:code-engine:4.12.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: 150 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
package com.ibm.cloud.code_engine.code_engine.v2;
1919

2020
import com.google.gson.JsonObject;
21+
import com.ibm.cloud.code_engine.code_engine.v2.model.AllowedOutboundDestination;
22+
import com.ibm.cloud.code_engine.code_engine.v2.model.AllowedOutboundDestinationList;
2123
import com.ibm.cloud.code_engine.code_engine.v2.model.App;
2224
import com.ibm.cloud.code_engine.code_engine.v2.model.AppInstanceList;
2325
import com.ibm.cloud.code_engine.code_engine.v2.model.AppList;
@@ -31,6 +33,7 @@
3133
import com.ibm.cloud.code_engine.code_engine.v2.model.BuildRunList;
3234
import com.ibm.cloud.code_engine.code_engine.v2.model.ConfigMap;
3335
import com.ibm.cloud.code_engine.code_engine.v2.model.ConfigMapList;
36+
import com.ibm.cloud.code_engine.code_engine.v2.model.CreateAllowedOutboundDestinationOptions;
3437
import com.ibm.cloud.code_engine.code_engine.v2.model.CreateAppOptions;
3538
import com.ibm.cloud.code_engine.code_engine.v2.model.CreateBindingOptions;
3639
import com.ibm.cloud.code_engine.code_engine.v2.model.CreateBuildOptions;
@@ -42,6 +45,7 @@
4245
import com.ibm.cloud.code_engine.code_engine.v2.model.CreateJobRunOptions;
4346
import com.ibm.cloud.code_engine.code_engine.v2.model.CreateProjectOptions;
4447
import com.ibm.cloud.code_engine.code_engine.v2.model.CreateSecretOptions;
48+
import com.ibm.cloud.code_engine.code_engine.v2.model.DeleteAllowedOutboundDestinationOptions;
4549
import com.ibm.cloud.code_engine.code_engine.v2.model.DeleteAppOptions;
4650
import com.ibm.cloud.code_engine.code_engine.v2.model.DeleteAppRevisionOptions;
4751
import com.ibm.cloud.code_engine.code_engine.v2.model.DeleteBindingOptions;
@@ -59,6 +63,7 @@
5963
import com.ibm.cloud.code_engine.code_engine.v2.model.Function;
6064
import com.ibm.cloud.code_engine.code_engine.v2.model.FunctionList;
6165
import com.ibm.cloud.code_engine.code_engine.v2.model.FunctionRuntimeList;
66+
import com.ibm.cloud.code_engine.code_engine.v2.model.GetAllowedOutboundDestinationOptions;
6267
import com.ibm.cloud.code_engine.code_engine.v2.model.GetAppOptions;
6368
import com.ibm.cloud.code_engine.code_engine.v2.model.GetAppRevisionOptions;
6469
import com.ibm.cloud.code_engine.code_engine.v2.model.GetBindingOptions;
@@ -77,6 +82,7 @@
7782
import com.ibm.cloud.code_engine.code_engine.v2.model.JobList;
7883
import com.ibm.cloud.code_engine.code_engine.v2.model.JobRun;
7984
import com.ibm.cloud.code_engine.code_engine.v2.model.JobRunList;
85+
import com.ibm.cloud.code_engine.code_engine.v2.model.ListAllowedOutboundDestinationOptions;
8086
import com.ibm.cloud.code_engine.code_engine.v2.model.ListAppInstancesOptions;
8187
import com.ibm.cloud.code_engine.code_engine.v2.model.ListAppRevisionsOptions;
8288
import com.ibm.cloud.code_engine.code_engine.v2.model.ListAppsOptions;
@@ -99,6 +105,7 @@
99105
import com.ibm.cloud.code_engine.code_engine.v2.model.ReplaceSecretOptions;
100106
import com.ibm.cloud.code_engine.code_engine.v2.model.Secret;
101107
import com.ibm.cloud.code_engine.code_engine.v2.model.SecretList;
108+
import com.ibm.cloud.code_engine.code_engine.v2.model.UpdateAllowedOutboundDestinationOptions;
102109
import com.ibm.cloud.code_engine.code_engine.v2.model.UpdateAppOptions;
103110
import com.ibm.cloud.code_engine.code_engine.v2.model.UpdateBuildOptions;
104111
import com.ibm.cloud.code_engine.code_engine.v2.model.UpdateDomainMappingOptions;
@@ -175,7 +182,7 @@ public CodeEngine(String serviceName, Authenticator authenticator) {
175182
* Gets the version.
176183
*
177184
* The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between
178-
* `2021-03-31` and `2024-09-27`.
185+
* `2021-03-31` and `2024-11-18`.
179186
*
180187
* @return the version
181188
*/
@@ -310,6 +317,148 @@ public ServiceCall<Void> deleteProject(DeleteProjectOptions deleteProjectOptions
310317
return createServiceCall(builder.build(), responseConverter);
311318
}
312319

320+
/**
321+
* List allowed outbound destinations.
322+
*
323+
* List all allowed outbound destinations in a project.
324+
*
325+
* @param listAllowedOutboundDestinationOptions the {@link ListAllowedOutboundDestinationOptions} containing the options for the call
326+
* @return a {@link ServiceCall} with a result of type {@link AllowedOutboundDestinationList}
327+
*/
328+
public ServiceCall<AllowedOutboundDestinationList> listAllowedOutboundDestination(ListAllowedOutboundDestinationOptions listAllowedOutboundDestinationOptions) {
329+
com.ibm.cloud.sdk.core.util.Validator.notNull(listAllowedOutboundDestinationOptions,
330+
"listAllowedOutboundDestinationOptions cannot be null");
331+
Map<String, String> pathParamsMap = new HashMap<String, String>();
332+
pathParamsMap.put("project_id", listAllowedOutboundDestinationOptions.projectId());
333+
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/projects/{project_id}/allowed_outbound_destinations", pathParamsMap));
334+
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("code_engine", "v2", "listAllowedOutboundDestination");
335+
for (Entry<String, String> header : sdkHeaders.entrySet()) {
336+
builder.header(header.getKey(), header.getValue());
337+
}
338+
builder.header("Accept", "application/json");
339+
if (listAllowedOutboundDestinationOptions.limit() != null) {
340+
builder.query("limit", String.valueOf(listAllowedOutboundDestinationOptions.limit()));
341+
}
342+
if (listAllowedOutboundDestinationOptions.start() != null) {
343+
builder.query("start", String.valueOf(listAllowedOutboundDestinationOptions.start()));
344+
}
345+
ResponseConverter<AllowedOutboundDestinationList> responseConverter =
346+
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<AllowedOutboundDestinationList>() { }.getType());
347+
return createServiceCall(builder.build(), responseConverter);
348+
}
349+
350+
/**
351+
* Create an allowed outbound destination.
352+
*
353+
* Create an allowed outbound destination.
354+
*
355+
* @param createAllowedOutboundDestinationOptions the {@link CreateAllowedOutboundDestinationOptions} containing the options for the call
356+
* @return a {@link ServiceCall} with a result of type {@link AllowedOutboundDestination}
357+
*/
358+
public ServiceCall<AllowedOutboundDestination> createAllowedOutboundDestination(CreateAllowedOutboundDestinationOptions createAllowedOutboundDestinationOptions) {
359+
com.ibm.cloud.sdk.core.util.Validator.notNull(createAllowedOutboundDestinationOptions,
360+
"createAllowedOutboundDestinationOptions cannot be null");
361+
Map<String, String> pathParamsMap = new HashMap<String, String>();
362+
pathParamsMap.put("project_id", createAllowedOutboundDestinationOptions.projectId());
363+
RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/projects/{project_id}/allowed_outbound_destinations", pathParamsMap));
364+
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("code_engine", "v2", "createAllowedOutboundDestination");
365+
for (Entry<String, String> header : sdkHeaders.entrySet()) {
366+
builder.header(header.getKey(), header.getValue());
367+
}
368+
builder.header("Accept", "application/json");
369+
if (this.version != null) {
370+
builder.query("version", String.valueOf(this.version));
371+
}
372+
builder.bodyContent(com.ibm.cloud.sdk.core.util.GsonSingleton.getGsonWithoutPrettyPrinting().toJson(createAllowedOutboundDestinationOptions.allowedOutboundDestination()), "application/json");
373+
ResponseConverter<AllowedOutboundDestination> responseConverter =
374+
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<AllowedOutboundDestination>() { }.getType());
375+
return createServiceCall(builder.build(), responseConverter);
376+
}
377+
378+
/**
379+
* Get an allowed outbound destination.
380+
*
381+
* Display the details of an allowed outbound destination.
382+
*
383+
* @param getAllowedOutboundDestinationOptions the {@link GetAllowedOutboundDestinationOptions} containing the options for the call
384+
* @return a {@link ServiceCall} with a result of type {@link AllowedOutboundDestination}
385+
*/
386+
public ServiceCall<AllowedOutboundDestination> getAllowedOutboundDestination(GetAllowedOutboundDestinationOptions getAllowedOutboundDestinationOptions) {
387+
com.ibm.cloud.sdk.core.util.Validator.notNull(getAllowedOutboundDestinationOptions,
388+
"getAllowedOutboundDestinationOptions cannot be null");
389+
Map<String, String> pathParamsMap = new HashMap<String, String>();
390+
pathParamsMap.put("project_id", getAllowedOutboundDestinationOptions.projectId());
391+
pathParamsMap.put("name", getAllowedOutboundDestinationOptions.name());
392+
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/projects/{project_id}/allowed_outbound_destinations/{name}", pathParamsMap));
393+
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("code_engine", "v2", "getAllowedOutboundDestination");
394+
for (Entry<String, String> header : sdkHeaders.entrySet()) {
395+
builder.header(header.getKey(), header.getValue());
396+
}
397+
builder.header("Accept", "application/json");
398+
if (this.version != null) {
399+
builder.query("version", String.valueOf(this.version));
400+
}
401+
ResponseConverter<AllowedOutboundDestination> responseConverter =
402+
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<AllowedOutboundDestination>() { }.getType());
403+
return createServiceCall(builder.build(), responseConverter);
404+
}
405+
406+
/**
407+
* Delete an allowed outbound destination.
408+
*
409+
* Delete an allowed outbound destination.
410+
*
411+
* @param deleteAllowedOutboundDestinationOptions the {@link DeleteAllowedOutboundDestinationOptions} containing the options for the call
412+
* @return a {@link ServiceCall} with a void result
413+
*/
414+
public ServiceCall<Void> deleteAllowedOutboundDestination(DeleteAllowedOutboundDestinationOptions deleteAllowedOutboundDestinationOptions) {
415+
com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAllowedOutboundDestinationOptions,
416+
"deleteAllowedOutboundDestinationOptions cannot be null");
417+
Map<String, String> pathParamsMap = new HashMap<String, String>();
418+
pathParamsMap.put("project_id", deleteAllowedOutboundDestinationOptions.projectId());
419+
pathParamsMap.put("name", deleteAllowedOutboundDestinationOptions.name());
420+
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/projects/{project_id}/allowed_outbound_destinations/{name}", pathParamsMap));
421+
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("code_engine", "v2", "deleteAllowedOutboundDestination");
422+
for (Entry<String, String> header : sdkHeaders.entrySet()) {
423+
builder.header(header.getKey(), header.getValue());
424+
}
425+
if (this.version != null) {
426+
builder.query("version", String.valueOf(this.version));
427+
}
428+
ResponseConverter<Void> responseConverter = ResponseConverterUtils.getVoid();
429+
return createServiceCall(builder.build(), responseConverter);
430+
}
431+
432+
/**
433+
* Update an allowed outbound destination.
434+
*
435+
* Update an allowed outbound destination.
436+
*
437+
* @param updateAllowedOutboundDestinationOptions the {@link UpdateAllowedOutboundDestinationOptions} containing the options for the call
438+
* @return a {@link ServiceCall} with a result of type {@link AllowedOutboundDestination}
439+
*/
440+
public ServiceCall<AllowedOutboundDestination> updateAllowedOutboundDestination(UpdateAllowedOutboundDestinationOptions updateAllowedOutboundDestinationOptions) {
441+
com.ibm.cloud.sdk.core.util.Validator.notNull(updateAllowedOutboundDestinationOptions,
442+
"updateAllowedOutboundDestinationOptions cannot be null");
443+
Map<String, String> pathParamsMap = new HashMap<String, String>();
444+
pathParamsMap.put("project_id", updateAllowedOutboundDestinationOptions.projectId());
445+
pathParamsMap.put("name", updateAllowedOutboundDestinationOptions.name());
446+
RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/projects/{project_id}/allowed_outbound_destinations/{name}", pathParamsMap));
447+
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("code_engine", "v2", "updateAllowedOutboundDestination");
448+
for (Entry<String, String> header : sdkHeaders.entrySet()) {
449+
builder.header(header.getKey(), header.getValue());
450+
}
451+
builder.header("Accept", "application/json");
452+
builder.header("If-Match", updateAllowedOutboundDestinationOptions.ifMatch());
453+
if (this.version != null) {
454+
builder.query("version", String.valueOf(this.version));
455+
}
456+
builder.bodyContent(com.ibm.cloud.sdk.core.util.GsonSingleton.getGsonWithSerializeNulls().toJson(updateAllowedOutboundDestinationOptions.allowedOutboundDestination()), "application/merge-patch+json");
457+
ResponseConverter<AllowedOutboundDestination> responseConverter =
458+
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<AllowedOutboundDestination>() { }.getType());
459+
return createServiceCall(builder.build(), responseConverter);
460+
}
461+
313462
/**
314463
* List egress IP addresses.
315464
*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2024.
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+
* AllowedOutboundDestination Describes the model of an allowed outbound destination.
21+
*
22+
* Classes which extend this class:
23+
* - AllowedOutboundDestinationCidrBlockData
24+
*/
25+
public class AllowedOutboundDestination extends GenericModel {
26+
27+
/**
28+
* Specify the type of the allowed outbound destination. Allowed types are: 'cidr_block'.
29+
*/
30+
public interface Type {
31+
/** cidr_block. */
32+
String CIDR_BLOCK = "cidr_block";
33+
}
34+
35+
@SerializedName("entity_tag")
36+
protected String entityTag;
37+
protected String type;
38+
@SerializedName("cidr_block")
39+
protected String cidrBlock;
40+
protected String name;
41+
42+
protected AllowedOutboundDestination() { }
43+
44+
/**
45+
* Gets the entityTag.
46+
*
47+
* The version of the allowed outbound destination, which is used to achieve optimistic locking.
48+
*
49+
* @return the entityTag
50+
*/
51+
public String getEntityTag() {
52+
return entityTag;
53+
}
54+
55+
/**
56+
* Gets the type.
57+
*
58+
* Specify the type of the allowed outbound destination. Allowed types are: 'cidr_block'.
59+
*
60+
* @return the type
61+
*/
62+
public String getType() {
63+
return type;
64+
}
65+
66+
/**
67+
* Gets the cidrBlock.
68+
*
69+
* The IP address range.
70+
*
71+
* @return the cidrBlock
72+
*/
73+
public String getCidrBlock() {
74+
return cidrBlock;
75+
}
76+
77+
/**
78+
* Gets the name.
79+
*
80+
* The name of the CIDR block.
81+
*
82+
* @return the name
83+
*/
84+
public String getName() {
85+
return name;
86+
}
87+
}
88+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2024.
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+
/**
17+
* Allowed outbound destination CIDR block.
18+
*/
19+
public class AllowedOutboundDestinationCidrBlockData extends AllowedOutboundDestination {
20+
21+
/**
22+
* Specify the type of the allowed outbound destination. Allowed types are: 'cidr_block'.
23+
*/
24+
public interface Type {
25+
/** cidr_block. */
26+
String CIDR_BLOCK = "cidr_block";
27+
}
28+
29+
30+
protected AllowedOutboundDestinationCidrBlockData() { }
31+
}
32+

0 commit comments

Comments
 (0)