Skip to content

Commit

Permalink
feat(api): Updated java-sdk to adopt Code Engine API specification ch…
Browse files Browse the repository at this point in the history
…anges
  • Loading branch information
codeengine-ui-team committed Nov 20, 2024
1 parent d3dc0bd commit 015ba72
Show file tree
Hide file tree
Showing 31 changed files with 2,782 additions and 36 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Build Status](https://travis-ci.com/IBM/code-engine-java-sdk.svg?branch=main)](https://travis-ci.com/IBM/code-engine-java-sdk)
[![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)

# IBM Cloud Code Engine Java SDK Version 4.10.0
# IBM Cloud Code Engine Java SDK Version 4.12.1

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

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

Service Name | Artifact Coordinates
--- | ---
[Code Engine](https://cloud.ibm.com/apidocs/codeengine/codeengine-v2.0.0) | com.ibm.cloud.code-engine:4.10.0
[Code Engine](https://cloud.ibm.com/apidocs/codeengine/codeengine-v2.0.0) | com.ibm.cloud.code-engine:4.12.1

## Prerequisites

Expand All @@ -51,7 +51,7 @@ Service Name | Artifact Coordinates

## Installation

The current version of this SDK is: 4.10.0
The current version of this SDK is: 4.12.1

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

Expand All @@ -70,14 +70,14 @@ Here are examples for maven and gradle:
<dependency>
<groupId>com.ibm.cloud</groupId>
<artifactId>code-engine</artifactId>
<version>4.10.0</version>
<version>4.12.1</version>
</dependency>
```

### Gradle

```gradle
compile 'com.ibm.cloud:code-engine:4.10.0'
compile 'com.ibm.cloud:code-engine:4.12.1'
```

## Using the SDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
package com.ibm.cloud.code_engine.code_engine.v2;

import com.google.gson.JsonObject;
import com.ibm.cloud.code_engine.code_engine.v2.model.AllowedOutboundDestination;
import com.ibm.cloud.code_engine.code_engine.v2.model.AllowedOutboundDestinationList;
import com.ibm.cloud.code_engine.code_engine.v2.model.App;
import com.ibm.cloud.code_engine.code_engine.v2.model.AppInstanceList;
import com.ibm.cloud.code_engine.code_engine.v2.model.AppList;
Expand All @@ -31,6 +33,7 @@
import com.ibm.cloud.code_engine.code_engine.v2.model.BuildRunList;
import com.ibm.cloud.code_engine.code_engine.v2.model.ConfigMap;
import com.ibm.cloud.code_engine.code_engine.v2.model.ConfigMapList;
import com.ibm.cloud.code_engine.code_engine.v2.model.CreateAllowedOutboundDestinationOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.CreateAppOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.CreateBindingOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.CreateBuildOptions;
Expand All @@ -42,6 +45,7 @@
import com.ibm.cloud.code_engine.code_engine.v2.model.CreateJobRunOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.CreateProjectOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.CreateSecretOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.DeleteAllowedOutboundDestinationOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.DeleteAppOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.DeleteAppRevisionOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.DeleteBindingOptions;
Expand All @@ -59,6 +63,7 @@
import com.ibm.cloud.code_engine.code_engine.v2.model.Function;
import com.ibm.cloud.code_engine.code_engine.v2.model.FunctionList;
import com.ibm.cloud.code_engine.code_engine.v2.model.FunctionRuntimeList;
import com.ibm.cloud.code_engine.code_engine.v2.model.GetAllowedOutboundDestinationOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.GetAppOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.GetAppRevisionOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.GetBindingOptions;
Expand All @@ -77,6 +82,7 @@
import com.ibm.cloud.code_engine.code_engine.v2.model.JobList;
import com.ibm.cloud.code_engine.code_engine.v2.model.JobRun;
import com.ibm.cloud.code_engine.code_engine.v2.model.JobRunList;
import com.ibm.cloud.code_engine.code_engine.v2.model.ListAllowedOutboundDestinationOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.ListAppInstancesOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.ListAppRevisionsOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.ListAppsOptions;
Expand All @@ -99,6 +105,7 @@
import com.ibm.cloud.code_engine.code_engine.v2.model.ReplaceSecretOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.Secret;
import com.ibm.cloud.code_engine.code_engine.v2.model.SecretList;
import com.ibm.cloud.code_engine.code_engine.v2.model.UpdateAllowedOutboundDestinationOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.UpdateAppOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.UpdateBuildOptions;
import com.ibm.cloud.code_engine.code_engine.v2.model.UpdateDomainMappingOptions;
Expand Down Expand Up @@ -175,7 +182,7 @@ public CodeEngine(String serviceName, Authenticator authenticator) {
* Gets the version.
*
* The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between
* `2021-03-31` and `2024-09-27`.
* `2021-03-31` and `2024-11-18`.
*
* @return the version
*/
Expand Down Expand Up @@ -310,6 +317,148 @@ public ServiceCall<Void> deleteProject(DeleteProjectOptions deleteProjectOptions
return createServiceCall(builder.build(), responseConverter);
}

/**
* List allowed outbound destinations.
*
* List all allowed outbound destinations in a project.
*
* @param listAllowedOutboundDestinationOptions the {@link ListAllowedOutboundDestinationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link AllowedOutboundDestinationList}
*/
public ServiceCall<AllowedOutboundDestinationList> listAllowedOutboundDestination(ListAllowedOutboundDestinationOptions listAllowedOutboundDestinationOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(listAllowedOutboundDestinationOptions,
"listAllowedOutboundDestinationOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("project_id", listAllowedOutboundDestinationOptions.projectId());
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/projects/{project_id}/allowed_outbound_destinations", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("code_engine", "v2", "listAllowedOutboundDestination");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listAllowedOutboundDestinationOptions.limit() != null) {
builder.query("limit", String.valueOf(listAllowedOutboundDestinationOptions.limit()));
}
if (listAllowedOutboundDestinationOptions.start() != null) {
builder.query("start", String.valueOf(listAllowedOutboundDestinationOptions.start()));
}
ResponseConverter<AllowedOutboundDestinationList> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<AllowedOutboundDestinationList>() { }.getType());
return createServiceCall(builder.build(), responseConverter);
}

/**
* Create an allowed outbound destination.
*
* Create an allowed outbound destination.
*
* @param createAllowedOutboundDestinationOptions the {@link CreateAllowedOutboundDestinationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link AllowedOutboundDestination}
*/
public ServiceCall<AllowedOutboundDestination> createAllowedOutboundDestination(CreateAllowedOutboundDestinationOptions createAllowedOutboundDestinationOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(createAllowedOutboundDestinationOptions,
"createAllowedOutboundDestinationOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("project_id", createAllowedOutboundDestinationOptions.projectId());
RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/projects/{project_id}/allowed_outbound_destinations", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("code_engine", "v2", "createAllowedOutboundDestination");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (this.version != null) {
builder.query("version", String.valueOf(this.version));
}
builder.bodyContent(com.ibm.cloud.sdk.core.util.GsonSingleton.getGsonWithoutPrettyPrinting().toJson(createAllowedOutboundDestinationOptions.allowedOutboundDestination()), "application/json");
ResponseConverter<AllowedOutboundDestination> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<AllowedOutboundDestination>() { }.getType());
return createServiceCall(builder.build(), responseConverter);
}

/**
* Get an allowed outbound destination.
*
* Display the details of an allowed outbound destination.
*
* @param getAllowedOutboundDestinationOptions the {@link GetAllowedOutboundDestinationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link AllowedOutboundDestination}
*/
public ServiceCall<AllowedOutboundDestination> getAllowedOutboundDestination(GetAllowedOutboundDestinationOptions getAllowedOutboundDestinationOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(getAllowedOutboundDestinationOptions,
"getAllowedOutboundDestinationOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("project_id", getAllowedOutboundDestinationOptions.projectId());
pathParamsMap.put("name", getAllowedOutboundDestinationOptions.name());
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/projects/{project_id}/allowed_outbound_destinations/{name}", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("code_engine", "v2", "getAllowedOutboundDestination");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (this.version != null) {
builder.query("version", String.valueOf(this.version));
}
ResponseConverter<AllowedOutboundDestination> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<AllowedOutboundDestination>() { }.getType());
return createServiceCall(builder.build(), responseConverter);
}

/**
* Delete an allowed outbound destination.
*
* Delete an allowed outbound destination.
*
* @param deleteAllowedOutboundDestinationOptions the {@link DeleteAllowedOutboundDestinationOptions} containing the options for the call
* @return a {@link ServiceCall} with a void result
*/
public ServiceCall<Void> deleteAllowedOutboundDestination(DeleteAllowedOutboundDestinationOptions deleteAllowedOutboundDestinationOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAllowedOutboundDestinationOptions,
"deleteAllowedOutboundDestinationOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("project_id", deleteAllowedOutboundDestinationOptions.projectId());
pathParamsMap.put("name", deleteAllowedOutboundDestinationOptions.name());
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/projects/{project_id}/allowed_outbound_destinations/{name}", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("code_engine", "v2", "deleteAllowedOutboundDestination");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
if (this.version != null) {
builder.query("version", String.valueOf(this.version));
}
ResponseConverter<Void> responseConverter = ResponseConverterUtils.getVoid();
return createServiceCall(builder.build(), responseConverter);
}

/**
* Update an allowed outbound destination.
*
* Update an allowed outbound destination.
*
* @param updateAllowedOutboundDestinationOptions the {@link UpdateAllowedOutboundDestinationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link AllowedOutboundDestination}
*/
public ServiceCall<AllowedOutboundDestination> updateAllowedOutboundDestination(UpdateAllowedOutboundDestinationOptions updateAllowedOutboundDestinationOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(updateAllowedOutboundDestinationOptions,
"updateAllowedOutboundDestinationOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("project_id", updateAllowedOutboundDestinationOptions.projectId());
pathParamsMap.put("name", updateAllowedOutboundDestinationOptions.name());
RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/projects/{project_id}/allowed_outbound_destinations/{name}", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("code_engine", "v2", "updateAllowedOutboundDestination");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.header("If-Match", updateAllowedOutboundDestinationOptions.ifMatch());
if (this.version != null) {
builder.query("version", String.valueOf(this.version));
}
builder.bodyContent(com.ibm.cloud.sdk.core.util.GsonSingleton.getGsonWithSerializeNulls().toJson(updateAllowedOutboundDestinationOptions.allowedOutboundDestination()), "application/merge-patch+json");
ResponseConverter<AllowedOutboundDestination> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<AllowedOutboundDestination>() { }.getType());
return createServiceCall(builder.build(), responseConverter);
}

/**
* List egress IP addresses.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* (C) Copyright IBM Corp. 2024.
*
* 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 com.ibm.cloud.code_engine.code_engine.v2.model;

import com.google.gson.annotations.SerializedName;
import com.ibm.cloud.sdk.core.service.model.GenericModel;

/**
* AllowedOutboundDestination Describes the model of an allowed outbound destination.
*
* Classes which extend this class:
* - AllowedOutboundDestinationCidrBlockData
*/
public class AllowedOutboundDestination extends GenericModel {

/**
* Specify the type of the allowed outbound destination. Allowed types are: 'cidr_block'.
*/
public interface Type {
/** cidr_block. */
String CIDR_BLOCK = "cidr_block";
}

@SerializedName("entity_tag")
protected String entityTag;
protected String type;
@SerializedName("cidr_block")
protected String cidrBlock;
protected String name;

protected AllowedOutboundDestination() { }

/**
* Gets the entityTag.
*
* The version of the allowed outbound destination, which is used to achieve optimistic locking.
*
* @return the entityTag
*/
public String getEntityTag() {
return entityTag;
}

/**
* Gets the type.
*
* Specify the type of the allowed outbound destination. Allowed types are: 'cidr_block'.
*
* @return the type
*/
public String getType() {
return type;
}

/**
* Gets the cidrBlock.
*
* The IP address range.
*
* @return the cidrBlock
*/
public String getCidrBlock() {
return cidrBlock;
}

/**
* Gets the name.
*
* The name of the CIDR block.
*
* @return the name
*/
public String getName() {
return name;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* (C) Copyright IBM Corp. 2024.
*
* 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 com.ibm.cloud.code_engine.code_engine.v2.model;

/**
* Allowed outbound destination CIDR block.
*/
public class AllowedOutboundDestinationCidrBlockData extends AllowedOutboundDestination {

/**
* Specify the type of the allowed outbound destination. Allowed types are: 'cidr_block'.
*/
public interface Type {
/** cidr_block. */
String CIDR_BLOCK = "cidr_block";
}


protected AllowedOutboundDestinationCidrBlockData() { }
}

Loading

0 comments on commit 015ba72

Please sign in to comment.