Skip to content

Commit dc88901

Browse files
feat(api): Updated node-sdk to adopt Code Engine API specification changes
1 parent 9656d98 commit dc88901

File tree

7 files changed

+244
-73
lines changed

7 files changed

+244
-73
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ dist: focal
22

33
language: node_js
44
node_js:
5-
- 18
5+
- 22
66
cache: npm
77

88
branches:

code-engine/v2.ts

Lines changed: 128 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
/**
18-
* IBM OpenAPI SDK Code Generator Version: 3.94.1-71478489-20240820-161623
18+
* IBM OpenAPI SDK Code Generator Version: 3.99.0-d27cee72-20250129-204831
1919
*/
2020

2121
/* eslint-disable max-classes-per-file */
@@ -75,7 +75,7 @@ class CodeEngineV2 extends BaseService {
7575
}
7676

7777
/** The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between
78-
* `2021-03-31` and `2025-01-10`.
78+
* `2021-03-31` and `2025-02-20`.
7979
*/
8080
version?: string;
8181

@@ -84,7 +84,7 @@ class CodeEngineV2 extends BaseService {
8484
*
8585
* @param {Object} options - Options for the service.
8686
* @param {string} [options.version] - The API version, in format `YYYY-MM-DD`. For the API behavior documented here,
87-
* specify any date between `2021-03-31` and `2025-01-10`.
87+
* specify any date between `2021-03-31` and `2025-02-20`.
8888
* @param {string} [options.serviceUrl] - The base URL for the service
8989
* @param {OutgoingHttpHeaders} [options.headers] - Default headers that shall be included with every request to the service.
9090
* @param {Authenticator} options.authenticator - The Authenticator object used to authenticate requests to the service
@@ -2938,6 +2938,8 @@ class CodeEngineV2 extends BaseService {
29382938
* @param {string} params.outputSecret - The secret that is required to access the image registry. Make sure that the
29392939
* secret is granted with push permissions towards the specified container registry namespace.
29402940
* @param {string} params.strategyType - The strategy to use for building the image.
2941+
* @param {BuildParamPrototype[]} [params.runBuildParams] - Optional references to config maps and secret keys, or
2942+
* literal values that are exposed as build arguments within the Docker file.
29412943
* @param {string} [params.sourceContextDir] - Optional directory in the repository that contains the buildpacks file
29422944
* or the Dockerfile.
29432945
* @param {string} [params.sourceRevision] - Commit, tag, or branch in the source repository to pull. This field is
@@ -2976,6 +2978,7 @@ class CodeEngineV2 extends BaseService {
29762978
'outputImage',
29772979
'outputSecret',
29782980
'strategyType',
2981+
'runBuildParams',
29792982
'sourceContextDir',
29802983
'sourceRevision',
29812984
'sourceSecret',
@@ -2996,6 +2999,7 @@ class CodeEngineV2 extends BaseService {
29962999
'output_image': _params.outputImage,
29973000
'output_secret': _params.outputSecret,
29983001
'strategy_type': _params.strategyType,
3002+
'run_build_params': _params.runBuildParams,
29993003
'source_context_dir': _params.sourceContextDir,
30003004
'source_revision': _params.sourceRevision,
30013005
'source_secret': _params.sourceSecret,
@@ -3142,6 +3146,8 @@ class CodeEngineV2 extends BaseService {
31423146
* @param {string} [params.outputImage] - The name of the image.
31433147
* @param {string} [params.outputSecret] - The secret that is required to access the image registry. Make sure that
31443148
* the secret is granted with push permissions towards the specified container registry namespace.
3149+
* @param {BuildParamPrototype[]} [params.runBuildParams] - Optional references to config maps and secret keys, or
3150+
* literal values that are exposed as build arguments within the Docker file.
31453151
* @param {string} [params.sourceContextDir] - Optional directory in the repository that contains the buildpacks file
31463152
* or the Dockerfile.
31473153
* @param {string} [params.sourceRevision] - Commit, tag, or branch in the source repository to pull. This field is
@@ -3181,6 +3187,7 @@ class CodeEngineV2 extends BaseService {
31813187
'ifMatch',
31823188
'outputImage',
31833189
'outputSecret',
3190+
'runBuildParams',
31843191
'sourceContextDir',
31853192
'sourceRevision',
31863193
'sourceSecret',
@@ -3200,6 +3207,7 @@ class CodeEngineV2 extends BaseService {
32003207
const body = {
32013208
'output_image': _params.outputImage,
32023209
'output_secret': _params.outputSecret,
3210+
'run_build_params': _params.runBuildParams,
32033211
'source_context_dir': _params.sourceContextDir,
32043212
'source_revision': _params.sourceRevision,
32053213
'source_secret': _params.sourceSecret,
@@ -3318,6 +3326,8 @@ class CodeEngineV2 extends BaseService {
33183326
* @param {string} [params.outputImage] - The name of the image.
33193327
* @param {string} [params.outputSecret] - The secret that is required to access the image registry. Make sure that
33203328
* the secret is granted with push permissions towards the specified container registry namespace.
3329+
* @param {BuildParamPrototype[]} [params.runBuildParams] - Optional references to config maps and secret keys, or
3330+
* literal values that are exposed as build arguments within the Docker file.
33213331
* @param {string} [params.serviceAccount] - Optional service account, which is used for resource control.” or
33223332
* “Optional service account that is used for resource control.
33233333
* @param {string} [params.sourceContextDir] - Optional directory in the repository that contains the buildpacks file
@@ -3359,6 +3369,7 @@ class CodeEngineV2 extends BaseService {
33593369
'name',
33603370
'outputImage',
33613371
'outputSecret',
3372+
'runBuildParams',
33623373
'serviceAccount',
33633374
'sourceContextDir',
33643375
'sourceRevision',
@@ -3381,6 +3392,7 @@ class CodeEngineV2 extends BaseService {
33813392
'name': _params.name,
33823393
'output_image': _params.outputImage,
33833394
'output_secret': _params.outputSecret,
3395+
'run_build_params': _params.runBuildParams,
33843396
'service_account': _params.serviceAccount,
33853397
'source_context_dir': _params.sourceContextDir,
33863398
'source_revision': _params.sourceRevision,
@@ -4090,6 +4102,7 @@ class CodeEngineV2 extends BaseService {
40904102
*
40914103
* @param {Object} params - The parameters to send to the service.
40924104
* @param {string} params.projectId - The ID of the project.
4105+
* @param {string} [params.format] - Secret format to filter results by.
40934106
* @param {number} [params.limit] - Optional maximum number of secrets per page.
40944107
* @param {string} [params.start] - An optional token that indicates the beginning of the page of results to be
40954108
* returned. If omitted, the first page of results is returned. This value is obtained from the 'start' query
@@ -4102,13 +4115,14 @@ class CodeEngineV2 extends BaseService {
41024115
): Promise<CodeEngineV2.Response<CodeEngineV2.SecretList>> {
41034116
const _params = { ...params };
41044117
const _requiredParams = ['projectId'];
4105-
const _validParams = ['projectId', 'limit', 'start', 'headers'];
4118+
const _validParams = ['projectId', 'format', 'limit', 'start', 'headers'];
41064119
const _validationErrors = validateParams(_params, _requiredParams, _validParams);
41074120
if (_validationErrors) {
41084121
return Promise.reject(_validationErrors);
41094122
}
41104123

41114124
const query = {
4125+
'format': _params.format,
41124126
'limit': _params.limit,
41134127
'start': _params.start,
41144128
};
@@ -4385,7 +4399,7 @@ namespace CodeEngineV2 {
43854399
/** Options for the `CodeEngineV2` constructor. */
43864400
export interface Options extends UserOptions {
43874401
/** The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between
4388-
* `2021-03-31` and `2025-01-10`.
4402+
* `2021-03-31` and `2025-02-20`.
43894403
*/
43904404
version?: string;
43914405
}
@@ -5434,6 +5448,10 @@ namespace CodeEngineV2 {
54345448
outputSecret: string;
54355449
/** The strategy to use for building the image. */
54365450
strategyType: CreateBuildConstants.StrategyType | string;
5451+
/** Optional references to config maps and secret keys, or literal values that are exposed as build arguments
5452+
* within the Docker file.
5453+
*/
5454+
runBuildParams?: BuildParamPrototype[];
54375455
/** Optional directory in the repository that contains the buildpacks file or the Dockerfile. */
54385456
sourceContextDir?: string;
54395457
/** Commit, tag, or branch in the source repository to pull. This field is optional if the `source_type` is
@@ -5528,6 +5546,10 @@ namespace CodeEngineV2 {
55285546
* permissions towards the specified container registry namespace.
55295547
*/
55305548
outputSecret?: string;
5549+
/** Optional references to config maps and secret keys, or literal values that are exposed as build arguments
5550+
* within the Docker file.
5551+
*/
5552+
runBuildParams?: BuildParamPrototype[];
55315553
/** Optional directory in the repository that contains the buildpacks file or the Dockerfile. */
55325554
sourceContextDir?: string;
55335555
/** Commit, tag, or branch in the source repository to pull. This field is optional if the `source_type` is
@@ -5624,6 +5646,10 @@ namespace CodeEngineV2 {
56245646
* permissions towards the specified container registry namespace.
56255647
*/
56265648
outputSecret?: string;
5649+
/** Optional references to config maps and secret keys, or literal values that are exposed as build arguments
5650+
* within the Docker file.
5651+
*/
5652+
runBuildParams?: BuildParamPrototype[];
56275653
/** Optional service account, which is used for resource control.” or “Optional service account that is used for
56285654
* resource control.
56295655
*/
@@ -5847,6 +5873,8 @@ namespace CodeEngineV2 {
58475873
export interface ListSecretsParams {
58485874
/** The ID of the project. */
58495875
projectId: string;
5876+
/** Secret format to filter results by. */
5877+
format?: ListSecretsConstants.Format | string;
58505878
/** Optional maximum number of secrets per page. */
58515879
limit?: number;
58525880
/** An optional token that indicates the beginning of the page of results to be returned. If omitted, the first
@@ -5857,6 +5885,20 @@ namespace CodeEngineV2 {
58575885
headers?: OutgoingHttpHeaders;
58585886
}
58595887

5888+
/** Constants for the `listSecrets` operation. */
5889+
export namespace ListSecretsConstants {
5890+
/** Secret format to filter results by. */
5891+
export enum Format {
5892+
GENERIC = 'generic',
5893+
SSH_AUTH = 'ssh_auth',
5894+
REGISTRY = 'registry',
5895+
BASIC_AUTH = 'basic_auth',
5896+
TLS = 'tls',
5897+
SERVICE_ACCESS = 'service_access',
5898+
SERVICE_OPERATOR = 'service_operator',
5899+
}
5900+
}
5901+
58605902
/** Parameters for the `createSecret` operation. */
58615903
export interface CreateSecretParams {
58625904
/** The ID of the project. */
@@ -6192,8 +6234,6 @@ namespace CodeEngineV2 {
61926234
region?: string;
61936235
/** The type of the app instance. */
61946236
resource_type?: AppInstance.Constants.ResourceType | string;
6195-
/** The number of restarts of the app instance. */
6196-
restarts?: number;
61976237
/** The name of the revision that is associated with this instance. */
61986238
revision_name: string;
61996239
/** The number of CPU set for the instance. For valid values see [Supported memory and CPU
@@ -6215,10 +6255,8 @@ namespace CodeEngineV2 {
62156255
scale_memory_limit: string;
62166256
/** The current status of the instance. */
62176257
status?: AppInstance.Constants.Status | string;
6218-
/** The status of a container. */
6219-
system_container?: ContainerStatus;
6220-
/** The status of a container. */
6221-
user_container?: ContainerStatus;
6258+
/** The status of the pod and it's containers. */
6259+
status_details?: AppInstanceStatusDetails;
62226260
}
62236261
export namespace AppInstance {
62246262
export namespace Constants {
@@ -6250,6 +6288,18 @@ namespace CodeEngineV2 {
62506288
next?: ListNextMetadata;
62516289
}
62526290

6291+
/**
6292+
* The status of the pod and it's containers.
6293+
*/
6294+
export interface AppInstanceStatusDetails {
6295+
/** The number of restarts of the app instance. */
6296+
restarts?: number;
6297+
/** The status of a container. */
6298+
system_container?: ContainerStatus;
6299+
/** The status of a container. */
6300+
user_container?: ContainerStatus;
6301+
}
6302+
62536303
/**
62546304
* Contains a list of apps and pagination information.
62556305
*/
@@ -6543,6 +6593,10 @@ namespace CodeEngineV2 {
65436593
region?: string;
65446594
/** The type of the build. */
65456595
resource_type?: Build.Constants.ResourceType | string;
6596+
/** References to config maps and secret keys, or literal values, which are defined by the build owner and are
6597+
* exposed as build arguments in Docker files.
6598+
*/
6599+
run_build_params?: BuildParam[];
65466600
/** Optional directory in the repository that contains the buildpacks file or the Dockerfile. */
65476601
source_context_dir?: string;
65486602
/** Commit, tag, or branch in the source repository to pull. This field is optional if the `source_type` is
@@ -6630,6 +6684,58 @@ namespace CodeEngineV2 {
66306684
next?: ListNextMetadata;
66316685
}
66326686

6687+
/**
6688+
* Response model for build params.
6689+
*/
6690+
export interface BuildParam {
6691+
/** The key to reference as build param. */
6692+
key?: string;
6693+
/** The name of the build param. */
6694+
name?: string;
6695+
/** The name of the secret or config map. */
6696+
reference?: string;
6697+
/** Specify the type of the build param. */
6698+
type: BuildParam.Constants.Type | string;
6699+
/** The literal value of the build param. */
6700+
value?: string;
6701+
}
6702+
export namespace BuildParam {
6703+
export namespace Constants {
6704+
/** Specify the type of the build param. */
6705+
export enum Type {
6706+
LITERAL = 'literal',
6707+
CONFIG_MAP_KEY_REFERENCE = 'config_map_key_reference',
6708+
SECRET_KEY_REFERENCE = 'secret_key_reference',
6709+
}
6710+
}
6711+
}
6712+
6713+
/**
6714+
* Prototype model for build params.
6715+
*/
6716+
export interface BuildParamPrototype {
6717+
/** The key to reference as build param. */
6718+
key?: string;
6719+
/** The name of the build param. */
6720+
name?: string;
6721+
/** The name of the secret or config map. */
6722+
reference?: string;
6723+
/** Specify the type of the build param. */
6724+
type: BuildParamPrototype.Constants.Type | string;
6725+
/** The literal value of the build param. */
6726+
value?: string;
6727+
}
6728+
export namespace BuildParamPrototype {
6729+
export namespace Constants {
6730+
/** Specify the type of the build param. */
6731+
export enum Type {
6732+
LITERAL = 'literal',
6733+
CONFIG_MAP_KEY_REFERENCE = 'config_map_key_reference',
6734+
SECRET_KEY_REFERENCE = 'secret_key_reference',
6735+
}
6736+
}
6737+
}
6738+
66336739
/**
66346740
* Response model for build run objects.
66356741
*/
@@ -6661,6 +6767,10 @@ namespace CodeEngineV2 {
66616767
region?: string;
66626768
/** The type of the build run. */
66636769
resource_type?: BuildRun.Constants.ResourceType | string;
6770+
/** References to config maps and secret keys, or literal values, which are defined by the build owner and are
6771+
* exposed as build arguments in Docker files.
6772+
*/
6773+
run_build_params?: BuildParam[];
66646774
/** Optional service account, which is used for resource control.” or “Optional service account that is used for
66656775
* resource control.
66666776
*/
@@ -6909,35 +7019,21 @@ namespace CodeEngineV2 {
69097019
/** The time the container terminated. Only populated in an observed failure state. */
69107020
completed_at?: string;
69117021
/** The status of the container. */
6912-
container_status?: string;
7022+
container_status?: ContainerStatusDetails.Constants.ContainerStatus | string;
69137023
/** The exit code of the last termination of the container. Only populated in an observed failure state. */
69147024
exit_code?: number;
69157025
/** The reason the container is not yet running or has failed. Only populated in non-running states. */
6916-
reason?: ContainerStatusDetails.Constants.Reason | string;
7026+
reason?: string;
69177027
/** The time the container started. */
69187028
started_at?: string;
69197029
}
69207030
export namespace ContainerStatusDetails {
69217031
export namespace Constants {
6922-
/** The reason the container is not yet running or has failed. Only populated in non-running states. */
6923-
export enum Reason {
6924-
READY = 'ready',
6925-
WAITING = 'waiting',
6926-
DEPLOYING = 'deploying',
6927-
DEPLOYING_WAITING_FOR_RESOURCES = 'deploying_waiting_for_resources',
6928-
INITIAL_SCALE_NEVER_ACHIEVED = 'initial_scale_never_achieved',
6929-
FETCH_IMAGE_FAILED_UNKNOWN_MANIFEST = 'fetch_image_failed_unknown_manifest',
6930-
FETCH_IMAGE_FAILED_UNKNOWN_REPOSITORY = 'fetch_image_failed_unknown_repository',
6931-
FETCH_IMAGE_FAILED_REGISTRY_NOT_FOUND = 'fetch_image_failed_registry_not_found',
6932-
FETCH_IMAGE_FAILED_MISSING_PULL_SECRET = 'fetch_image_failed_missing_pull_secret',
6933-
FETCH_IMAGE_FAILED_WRONG_PULL_CREDENTIALS = 'fetch_image_failed_wrong_pull_credentials',
6934-
FETCH_IMAGE_FAILED_MISSING_PULL_CREDENTIALS = 'fetch_image_failed_missing_pull_credentials',
6935-
CONTAINER_FAILED_EXIT_CODE_0 = 'container_failed_exit_code_0',
6936-
CONTAINER_FAILED_EXIT_CODE_1 = 'container_failed_exit_code_1',
6937-
CONTAINER_FAILED_EXIT_CODE_139 = 'container_failed_exit_code_139',
6938-
CONTAINER_FAILED_EXIT_CODE_24 = 'container_failed_exit_code_24',
6939-
IMAGE_PULL_BACK_OFF = 'image_pull_back_off',
6940-
INVALID_TAR_HEADER_IMAGE_PULL_ERR = 'invalid_tar_header_image_pull_err',
7032+
/** The status of the container. */
7033+
export enum ContainerStatus {
7034+
RUNNING = 'running',
7035+
PENDING = 'pending',
7036+
TERMINATED = 'terminated',
69417037
}
69427038
}
69437039
}

examples/code-engine.v2.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('CodeEngineV2', () => {
6262
// begin-common
6363

6464
codeEngineService = CodeEngineV2.newInstance({
65-
version: '2025-01-10',
65+
version: '2025-02-20',
6666
});
6767

6868
// end-common
@@ -1524,6 +1524,7 @@ describe('CodeEngineV2', () => {
15241524

15251525
const params = {
15261526
projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
1527+
format: 'ssh_auth',
15271528
limit: 100,
15281529
};
15291530

0 commit comments

Comments
 (0)