Skip to content

Commit 9656d98

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

File tree

5 files changed

+168
-58
lines changed

5 files changed

+168
-58
lines changed

code-engine/v2.ts

Lines changed: 127 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* (C) Copyright IBM Corp. 2024.
2+
* (C) Copyright IBM Corp. 2025.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -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 `2024-11-18`.
78+
* `2021-03-31` and `2025-01-10`.
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 `2024-11-18`.
87+
* specify any date between `2021-03-31` and `2025-01-10`.
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
@@ -4385,7 +4385,7 @@ namespace CodeEngineV2 {
43854385
/** Options for the `CodeEngineV2` constructor. */
43864386
export interface Options extends UserOptions {
43874387
/** The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between
4388-
* `2021-03-31` and `2024-11-18`.
4388+
* `2021-03-31` and `2025-01-10`.
43894389
*/
43904390
version?: string;
43914391
}
@@ -5433,7 +5433,7 @@ namespace CodeEngineV2 {
54335433
*/
54345434
outputSecret: string;
54355435
/** The strategy to use for building the image. */
5436-
strategyType: string;
5436+
strategyType: CreateBuildConstants.StrategyType | string;
54375437
/** Optional directory in the repository that contains the buildpacks file or the Dockerfile. */
54385438
sourceContextDir?: string;
54395439
/** Commit, tag, or branch in the source repository to pull. This field is optional if the `source_type` is
@@ -5463,7 +5463,7 @@ namespace CodeEngineV2 {
54635463
/** Optional size for the build, which determines the amount of resources used. Build sizes are `small`,
54645464
* `medium`, `large`, `xlarge`, `xxlarge`.
54655465
*/
5466-
strategySize?: string;
5466+
strategySize?: CreateBuildConstants.StrategySize | string;
54675467
/** Optional path to the specification file that is used for build strategies for building an image. */
54685468
strategySpecFile?: string;
54695469
/** The maximum amount of time, in seconds, that can pass before the build must succeed or fail. */
@@ -5473,11 +5473,24 @@ namespace CodeEngineV2 {
54735473

54745474
/** Constants for the `createBuild` operation. */
54755475
export namespace CreateBuildConstants {
5476+
/** The strategy to use for building the image. */
5477+
export enum StrategyType {
5478+
DOCKERFILE = 'dockerfile',
5479+
BUILDPACKS = 'buildpacks',
5480+
}
54765481
/** Specifies the type of source to determine if your build source is in a repository or based on local source code. * local - For builds from local source code. * git - For builds from git version controlled source code. */
54775482
export enum SourceType {
54785483
LOCAL = 'local',
54795484
GIT = 'git',
54805485
}
5486+
/** Optional size for the build, which determines the amount of resources used. Build sizes are `small`, `medium`, `large`, `xlarge`, `xxlarge`. */
5487+
export enum StrategySize {
5488+
SMALL = 'small',
5489+
MEDIUM = 'medium',
5490+
LARGE = 'large',
5491+
XLARGE = 'xlarge',
5492+
XXLARGE = 'xxlarge',
5493+
}
54815494
}
54825495

54835496
/** Parameters for the `getBuild` operation. */
@@ -5544,11 +5557,11 @@ namespace CodeEngineV2 {
55445557
/** Optional size for the build, which determines the amount of resources used. Build sizes are `small`,
55455558
* `medium`, `large`, `xlarge`, `xxlarge`.
55465559
*/
5547-
strategySize?: string;
5560+
strategySize?: UpdateBuildConstants.StrategySize | string;
55485561
/** Optional path to the specification file that is used for build strategies for building an image. */
55495562
strategySpecFile?: string;
55505563
/** The strategy to use for building the image. */
5551-
strategyType?: string;
5564+
strategyType?: UpdateBuildConstants.StrategyType | string;
55525565
/** The maximum amount of time, in seconds, that can pass before the build must succeed or fail. */
55535566
timeout?: number;
55545567
headers?: OutgoingHttpHeaders;
@@ -5561,6 +5574,19 @@ namespace CodeEngineV2 {
55615574
LOCAL = 'local',
55625575
GIT = 'git',
55635576
}
5577+
/** Optional size for the build, which determines the amount of resources used. Build sizes are `small`, `medium`, `large`, `xlarge`, `xxlarge`. */
5578+
export enum StrategySize {
5579+
SMALL = 'small',
5580+
MEDIUM = 'medium',
5581+
LARGE = 'large',
5582+
XLARGE = 'xlarge',
5583+
XXLARGE = 'xxlarge',
5584+
}
5585+
/** The strategy to use for building the image. */
5586+
export enum StrategyType {
5587+
DOCKERFILE = 'dockerfile',
5588+
BUILDPACKS = 'buildpacks',
5589+
}
55645590
}
55655591

55665592
/** Parameters for the `listBuildRuns` operation. */
@@ -5631,11 +5657,11 @@ namespace CodeEngineV2 {
56315657
/** Optional size for the build, which determines the amount of resources used. Build sizes are `small`,
56325658
* `medium`, `large`, `xlarge`, `xxlarge`.
56335659
*/
5634-
strategySize?: string;
5660+
strategySize?: CreateBuildRunConstants.StrategySize | string;
56355661
/** Optional path to the specification file that is used for build strategies for building an image. */
56365662
strategySpecFile?: string;
56375663
/** The strategy to use for building the image. */
5638-
strategyType?: string;
5664+
strategyType?: CreateBuildRunConstants.StrategyType | string;
56395665
/** The maximum amount of time, in seconds, that can pass before the build must succeed or fail. */
56405666
timeout?: number;
56415667
headers?: OutgoingHttpHeaders;
@@ -5656,6 +5682,19 @@ namespace CodeEngineV2 {
56565682
LOCAL = 'local',
56575683
GIT = 'git',
56585684
}
5685+
/** Optional size for the build, which determines the amount of resources used. Build sizes are `small`, `medium`, `large`, `xlarge`, `xxlarge`. */
5686+
export enum StrategySize {
5687+
SMALL = 'small',
5688+
MEDIUM = 'medium',
5689+
LARGE = 'large',
5690+
XLARGE = 'xlarge',
5691+
XXLARGE = 'xxlarge',
5692+
}
5693+
/** The strategy to use for building the image. */
5694+
export enum StrategyType {
5695+
DOCKERFILE = 'dockerfile',
5696+
BUILDPACKS = 'buildpacks',
5697+
}
56595698
}
56605699

56615700
/** Parameters for the `getBuildRun` operation. */
@@ -6537,11 +6576,11 @@ namespace CodeEngineV2 {
65376576
/** Optional size for the build, which determines the amount of resources used. Build sizes are `small`,
65386577
* `medium`, `large`, `xlarge`, `xxlarge`.
65396578
*/
6540-
strategy_size: string;
6579+
strategy_size: Build.Constants.StrategySize | string;
65416580
/** Optional path to the specification file that is used for build strategies for building an image. */
65426581
strategy_spec_file?: string;
65436582
/** The strategy to use for building the image. */
6544-
strategy_type: string;
6583+
strategy_type: Build.Constants.StrategyType | string;
65456584
/** The maximum amount of time, in seconds, that can pass before the build must succeed or fail. */
65466585
timeout?: number;
65476586
}
@@ -6561,6 +6600,19 @@ namespace CodeEngineV2 {
65616600
READY = 'ready',
65626601
FAILED = 'failed',
65636602
}
6603+
/** Optional size for the build, which determines the amount of resources used. Build sizes are `small`, `medium`, `large`, `xlarge`, `xxlarge`. */
6604+
export enum StrategySize {
6605+
SMALL = 'small',
6606+
MEDIUM = 'medium',
6607+
LARGE = 'large',
6608+
XLARGE = 'xlarge',
6609+
XXLARGE = 'xxlarge',
6610+
}
6611+
/** The strategy to use for building the image. */
6612+
export enum StrategyType {
6613+
DOCKERFILE = 'dockerfile',
6614+
BUILDPACKS = 'buildpacks',
6615+
}
65646616
}
65656617
}
65666618

@@ -6646,11 +6698,11 @@ namespace CodeEngineV2 {
66466698
/** Optional size for the build, which determines the amount of resources used. Build sizes are `small`,
66476699
* `medium`, `large`, `xlarge`, `xxlarge`.
66486700
*/
6649-
strategy_size?: string;
6701+
strategy_size?: BuildRun.Constants.StrategySize | string;
66506702
/** Optional path to the specification file that is used for build strategies for building an image. */
66516703
strategy_spec_file?: string;
66526704
/** The strategy to use for building the image. */
6653-
strategy_type?: string;
6705+
strategy_type?: BuildRun.Constants.StrategyType | string;
66546706
/** The maximum amount of time, in seconds, that can pass before the build must succeed or fail. */
66556707
timeout?: number;
66566708
}
@@ -6680,6 +6732,19 @@ namespace CodeEngineV2 {
66806732
PENDING = 'pending',
66816733
FAILED = 'failed',
66826734
}
6735+
/** Optional size for the build, which determines the amount of resources used. Build sizes are `small`, `medium`, `large`, `xlarge`, `xxlarge`. */
6736+
export enum StrategySize {
6737+
SMALL = 'small',
6738+
MEDIUM = 'medium',
6739+
LARGE = 'large',
6740+
XLARGE = 'xlarge',
6741+
XXLARGE = 'xxlarge',
6742+
}
6743+
/** The strategy to use for building the image. */
6744+
export enum StrategyType {
6745+
DOCKERFILE = 'dockerfile',
6746+
BUILDPACKS = 'buildpacks',
6747+
}
66836748
}
66846749
}
66856750

@@ -7198,6 +7263,36 @@ namespace CodeEngineV2 {
71987263
}
71997264
}
72007265

7266+
/**
7267+
* IndexDetails.
7268+
*/
7269+
export interface IndexDetails {
7270+
/** The timestamp when the job run index finished processing. */
7271+
finished_at?: string;
7272+
/** Reason why latest retry of the job run index failed. Possible values include but are not limited to
7273+
* `OOMKilled`, `ContainerExitedCode1` or `ExceededEphemeralStorage`.
7274+
*/
7275+
last_failure_reason?: string;
7276+
/** Number of retries of this job run index. */
7277+
retries?: number;
7278+
/** The timestamp when the job run index started processing. */
7279+
started_at?: string;
7280+
/** Current status of the job run index. */
7281+
status?: IndexDetails.Constants.Status | string;
7282+
}
7283+
export namespace IndexDetails {
7284+
export namespace Constants {
7285+
/** Current status of the job run index. */
7286+
export enum Status {
7287+
PENDING = 'pending',
7288+
RUNNING = 'running',
7289+
SUCCEEDED = 'succeeded',
7290+
FAILED = 'failed',
7291+
UNKNOWN = 'unknown',
7292+
}
7293+
}
7294+
}
7295+
72017296
/**
72027297
* Job is the response model for job resources.
72037298
*/
@@ -7491,6 +7586,8 @@ namespace CodeEngineV2 {
74917586
failed?: number;
74927587
/** List of job run indices that failed. */
74937588
failed_indices?: string;
7589+
/** Detailed process information per index. */
7590+
indices_details?: JsonObject;
74947591
/** Number of pending job run instances. */
74957592
pending?: number;
74967593
/** List of job run indices that are pending. */
@@ -7782,7 +7879,7 @@ namespace CodeEngineV2 {
77827879
*/
77837880
region?: string;
77847881
/** The type of the secret. */
7785-
resource_type?: string;
7882+
resource_type?: Secret.Constants.ResourceType | string;
77867883
/** Properties for Service Access Secrets. */
77877884
service_access?: ServiceAccessSecretProps;
77887885
/** Properties for the IBM Cloud Operator Secret. */
@@ -7801,6 +7898,18 @@ namespace CodeEngineV2 {
78017898
SERVICE_OPERATOR = 'service_operator',
78027899
OTHER = 'other',
78037900
}
7901+
/** The type of the secret. */
7902+
export enum ResourceType {
7903+
SECRET_V2 = 'secret_v2',
7904+
SECRET_AUTH_SSH_V2 = 'secret_auth_ssh_v2',
7905+
SECRET_BASIC_AUTH_V2 = 'secret_basic_auth_v2',
7906+
SECRET_GENERIC_V2 = 'secret_generic_v2',
7907+
SECRET_OPERATOR_V2 = 'secret_operator_v2',
7908+
SECRET_OTHER_V2 = 'secret_other_v2',
7909+
SECRET_REGISTRY_V2 = 'secret_registry_v2',
7910+
SECRET_SERVICE_ACCESS_V2 = 'secret_service_access_v2',
7911+
SECRET_TLS_V2 = 'secret_tls_v2',
7912+
}
78047913
}
78057914
}
78067915

@@ -7949,7 +8058,7 @@ namespace CodeEngineV2 {
79498058
*/
79508059
export interface AllowedOutboundDestinationPatchCidrBlockDataPatch
79518060
extends AllowedOutboundDestinationPatch {
7952-
/** The IP address range. */
8061+
/** The IPv4 address range. */
79538062
cidr_block?: string;
79548063
}
79558064
export namespace AllowedOutboundDestinationPatchCidrBlockDataPatch {
@@ -7966,7 +8075,7 @@ namespace CodeEngineV2 {
79668075
*/
79678076
export interface AllowedOutboundDestinationPrototypeCidrBlockDataPrototype
79688077
extends AllowedOutboundDestinationPrototype {
7969-
/** The IP address range. */
8078+
/** The IPv4 address range. */
79708079
cidr_block: string;
79718080
/** The name of the CIDR block. */
79728081
name: string;
@@ -7984,7 +8093,7 @@ namespace CodeEngineV2 {
79848093
* Allowed outbound destination CIDR block.
79858094
*/
79868095
export interface AllowedOutboundDestinationCidrBlockData extends AllowedOutboundDestination {
7987-
/** The IP address range. */
8096+
/** The IPv4 address range. */
79888097
cidr_block: string;
79898098
/** The name of the CIDR block. */
79908099
name: string;

examples/code-engine.v2.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @jest-environment node
33
*/
44
/**
5-
* (C) Copyright IBM Corp. 2024.
5+
* (C) Copyright IBM Corp. 2025.
66
*
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
@@ -62,7 +62,7 @@ describe('CodeEngineV2', () => {
6262
// begin-common
6363

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

6868
// end-common

0 commit comments

Comments
 (0)