IBM Cloud API Docs

Introduction

IBM Cloud Code Engine is a fully managed, serverless platform that runs your containerized workloads, including web apps, micro-services, event-driven functions, or batch jobs. Code Engine even builds container images for you from your source code. All these workloads can seamlessly work together because they are all hosted within the same Kubernetes infrastructure. The Code Engine experience is designed so that you can focus on writing code and not on the infrastructure that is needed to host it. For more information about Code Engine, see Getting started with Code Engine.

These code examples use the client library that is provided for Java.

Maven example:

<dependency>
    <groupId>com.ibm.cloud</groupId>
    <artifactId>code-engine</artifactId>
    <version>4.10.0</version>
</dependency>

Gradle example:

compile 'com.ibm.cloud:code-engine:4.10.0'

For more information, view the project on GitHub: https://github.com/IBM/code-engine-java-sdk. See also Using the SDK.

These code examples use the client library that is provided for Node.js.

Installation:

npm install @ibm-cloud/ibm-code-engine-sdk

For more information, view the project on GitHub: https://github.com/IBM/code-engine-node-sdk. See also Using the SDK.

These code examples use the client library that is provided for Python.

Installation:

pip install --upgrade "ibm_code_engine_sdk>=4.1.1"

For more information, view the project on GitHub: https://github.com/IBM/code-engine-python-sdk. See also Using the SDK.

These code examples uses the SDK library that is provided for Go.

Run the go get command to retrieve the toolchain SDK and add it to the GOPATH workspace or to the project's Go module dependencies.

go get -u github.com/IBM/code-engine-go-sdk/codeenginev2

To use the SDK within a program, import the package by running the go build or go mod tidy commands to load the package.

import "github.com/IBM/code-engine-go-sdk/codeenginev2"

For more information, view the project on GitHub: https://github.com/IBM/code-engine-go-sdk. See also Using the SDK.

Authentication

You can create and manage Identity and Access Management (IAM)-based projects in Code Engine. IAM-based projects are created in resource groups and are managed with IAM access policies.

This API requires IAM authentication. You can retrieve your IAM access token by running the ibmcloud iam oauth-tokens command. You must pass the IAM token in the Authorization header.

For more information about using IAM with Code Engine APIs, see the API reference.

The curl examples require a bearer token. You can retrieve a token with the following command.

ibmcloud iam oauth-tokens --output json

You can also use jq to get clean output.

token=`ibmcloud iam oauth-tokens --output json | jq .iam_token -r`
import com.ibm.cloud.sdk.core.security.IamAuthenticator;
import com.ibm.cloud.sdk.core.service.exception.ServiceResponseException;

IamAuthenticator authenticator = new IamAuthenticator.Builder().apikey(System.getenv("CE_API_KEY"))
                .clientId("bx").clientSecret("bx").url("https://iam.cloud.ibm.com").build();

For System.getenv("CE_API_KEY") to work, you must provide an IBM Cloud IAM API key inside your runtime environment as variable CE_API_KEY.

import { IamAuthenticator, UserOptions } from 'ibm-cloud-sdk-core';

// Initialize the IAM authenticator using an API key
const authenticator = new IamAuthenticator({
  apikey: process.env.CE_API_KEY,
  clientId: 'bx',
  clientSecret: 'bx',
  url: 'https://iam.cloud.ibm.com',
});

For process.env.CE_API_KEY to work, you must provide an IBM Cloud IAM API key inside your runtime environment as variable CE_API_KEY.

import os
import time
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator

# Initialize the IAM authenticator using an API key
authenticator = IAMAuthenticator(os.environ.get(
    'CE_API_KEY'), url='https://iam.cloud.ibm.com')

For os.environ.get('CE_API_KEY') to work, you must provide an IBM Cloud IAM API key inside your runtime environment as variable CE_API_KEY.

import "github.com/IBM/go-sdk-core/v5/core"

// Initialize the IAM authenticator using an API key
authenticator := &core.IamAuthenticator{
  ApiKey:       os.Getenv("CE_API_KEY"),
  ClientId:     "bx",
  ClientSecret: "bx",
  URL:          "https://iam.cloud.ibm.com",
}

For os.Getenv("CE_API_KEY") to work, you must provide an IBM Cloud IAM API key inside your runtime environment as variable CE_API_KEY.

Endpoint URLs

The endpont URLs are based on the region of the service instance. For example, when Code Engine is hosted in Dallas, TX (us-south), the base URL is https://api.us-south.codeengine.cloud.ibm.com.

To find out which URL to use, view the service credentials by clicking the service instance in the Resource list from the console. Use that URL in your requests to Code Engine.

All regions might not support Code Engine. For more information, see Regions.

The version information is appended to the base URL to access resources. For example /v2, resulting in the URL https://api.us-south.codeengine.cloud.ibm.com/v2 for Dallas, TX (us-south).

Example API request

curl -X {request_method} "https://api.{region}.codeengine.cloud.ibm.com/v2{method_endpoint}"

Replace {request_method}, {region} and {method_endpoint} in this example with the values for your specific API call.

For more information about endpoints by region, see Regions.

import com.ibm.cloud.code_engine.code_engine.v2.CodeEngine;

// Construct the Code Engine client using the IAM authenticator.
CodeEngine service = new CodeEngine("Code Engine Client", authenticator);
service.setServiceUrl("https://api." + REGION + ".codeengine.cloud.ibm.com/v2");

Replace REGION with the identifier of the region that you are going to use, for example us-east.

For more information about endpoints by region, see Regions.

import CodeEngineV2 from "@ibm-cloud/ibm-code-engine-sdk/dist/code-engine/v2";

const codeEngineApiEndpoint = `https://api.${REGION}.codeengine.cloud.ibm.com/v2`;

// Construct the Code Engine client using the IAM authenticator.
const options: UserOptions = {
  authenticator,
  serviceUrl: codeEngineApiEndpoint,
};
const codeEngineService = CodeEngineV2.newInstance(options);

Replace REGION with the identifier of the region that you are going to use, for example us-east.

For more information about endpoints by region, see Regions.

Setting up a Code Engine client by passing the previously instantiated IAM authenticator.

from ibm_code_engine_sdk.code_engine_v2 import CodeEngineV2

service = CodeEngineV2(authenticator=authenticator)
service.set_service_url('https://api.'+REGION+'.codeengine.cloud.ibm.com/v2')

Replace REGION with the identifier of the region that you are going to use, for example us-east.

For more information about endpoints by region, see Regions.

Setting up a Code Engine client by passing the previously instantiated IAM authenticator.

ceClient, err := codeenginev2.NewCodeEngineV2(&codeenginev2.CodeEngineV2Options{
  Authenticator: authenticator,
  URL:           "https://api."+ REGION + ".codeengine.cloud.ibm.com/v2",
})
if err != nil {
  fmt.Printf("NewCodeEngineV2 error: %s\n", err.Error())
  os.Exit(1)
  return
}

Replace REGION with the identifier of the region that you are going to use, for example us-east.

For more information about endpoints by region, see Regions.

Error handling

This API uses standard HTTP response codes to indicate whether a method completed or the type of error that occurred.

HTTP error code Description Recovery
200 Success The request was successful.
400 Bad Request The input parameters in the request body are either incomplete or in the wrong format. Be sure to include all required parameters in your request.
401 Unauthorized You are not authorized to make this request. Log in to IBM Cloud and try again. If this error persists, contact the account owner to check your permissions.
403 Forbidden The supplied authentication is not authorized to access '{project}'. Check that you have the correct access credentials and permissions.
404 Not Found The requested resource could not be found. Check that the namespace ID is correct and try again.
408 Request Timeout The connection to the server timed out. Wait a few minutes, then try again.
409 Conflict The entity is already in the requested state.
500 Internal Server Error IBM Cloud Code Engine is currently unavailable. Your request could not be processed. Please wait a few minutes and try again. If you still encounter this problem, note the incident ID and contact IBM Cloud support.

Concurrent update protection

To prevent multiple clients from unknowingly overwriting each other's updates, select API methods support entity-tags and conditional requests as specified in RFC 7232.

The API requires you to specify version information when you update resources, preventing concurrent requests to overwrite each other. To accomplish that use the ETag header in the resource response header information. The ETag is sent with every successful CREATE, GET and UPDATE operation response. The value inside the header represents the version of the resource at the point in time when it was retrieved by the API. To perform an update on a resource, the API requires the custom request header If-Match, which must be set to the previously received version value or, alternatively to *, which indicates that any version can be updated by this operation. If the resource’s version on the server and the value inside the If-Match header don’t match, the API responds with an error that contains the status code 412 Precondition Failed and a message that indicates a conflict on the resource instance, for example, app_conflict_update.

If you encounter this issue, you can request the current version of the resource with a GET operation. The successful response contains a new ETag value that can be used to issue a new Update operation with the resource modifications.

The ETag and If-Match headers must be used on all UPDATE methods that explicitly require these headers, for example, the Update an application method. Other related headers that are described in RFC 7232, such as If-None-Match and If-Modified-Since, are not supported.

Change log

For a complete list of changes and improvements to this API, see the Code Engine API change log.

Pagination

Some API requests might return a large number of results. To avoid performance issues, these results are returned one page at a time, with a limited number of results on each page. GET requests for the following resources use pagination:

  • /v2/projects
  • /v2/projects/{project_id}/apps
  • /v2/projects/{project_id}/apps/{app_name}/revisions
  • /v2/projects/{project_id}/jobs
  • /v2/projects/{project_id}/job_runs
  • /v2/projects/{project_id}/builds
  • /v2/projects/{project_id}/build_runs
  • /v2/projects/{project_id}/config_maps
  • /v2/projects/{project_id}/secrets

The default page size is 50 objects. To use a different page size, use the limit query parameter and specify a page size up to 100, which is the maximum.

For requests that uses pagination, the response includes a next object that specifies the pagination information. The next object is the URL for requesting the next page of results. The next property is null if there are no more results, and retains the same limit parameter that is used for the initial request.

Methods

List all projects

List all projects in the current account.

GET /projects

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • resource-controller.instance.retrieve

Request

Query Parameters

  • Optional maximum number of projects per page.

    Possible values: 1 ≤ value ≤ 100

    Default: 50

    Example: 100

  • An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the next object of the operation response.

    Possible values: 0 ≤ length ≤ 3000, Value must match regular expression ^[a-zA-Z0-9=]+$

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects"   -H "Authorization: ${token}" 
    
  • listProjectsOptions := &codeenginev2.ListProjectsOptions{
      Limit: core.Int64Ptr(int64(100)),
    }
    
    pager, err := codeEngineService.NewProjectsPager(listProjectsOptions)
    if err != nil {
      panic(err)
    }
    
    var allResults []codeenginev2.Project
    for pager.HasNext() {
      nextPage, err := pager.GetNext()
      if err != nil {
        panic(err)
      }
      allResults = append(allResults, nextPage...)
    }
    b, _ := json.MarshalIndent(allResults, "", "  ")
    fmt.Println(string(b))
    
  • ListProjectsOptions listProjectsOptions = new ListProjectsOptions.Builder()
      .limit(Long.valueOf("100"))
      .build();
    
    ProjectsPager pager = new ProjectsPager(codeEngineService, listProjectsOptions);
    List<Project> allResults = new ArrayList<>();
    while (pager.hasNext()) {
      List<Project> nextPage = pager.getNext();
      allResults.addAll(nextPage);
    }
    
    System.out.println(GsonSingleton.getGson().toJson(allResults));
    
  • const params = {
      limit: 100,
    };
    
    const allResults = [];
    try {
      const pager = new CodeEngineV2.ProjectsPager(codeEngineService, params);
      while (pager.hasNext()) {
        const nextPage = await pager.getNext();
        expect(nextPage).not.toBeNull();
        allResults.push(...nextPage);
      }
      console.log(JSON.stringify(allResults, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • all_results = []
    pager = ProjectsPager(
        client=code_engine_service,
        limit=100,
    )
    while pager.has_next():
        next_page = pager.get_next()
        assert next_page is not None
        all_results.extend(next_page)
    
    print(json.dumps(all_results, indent=2))
    

Response

Contains a list of projects and pagination information.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "projects": [
        {
          "name": "test_project",
          "id": "15314cc3-85b4-4338-903f-c28cdee6d005",
          "crn": "crn:v1:bluemix:public:codeengine:us-east:a/4329073d16d2f3663f74bfa955259139:15314cc3-85b4-4338-903f-c28cdee6d005::",
          "status": "active",
          "region": "us-east",
          "account_id": "f9f1030ebf674eda8d57bdbc2b9e536a",
          "created_at": "2021-03-29T12:18:13.992359829Z",
          "resource_type": "project_v2",
          "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/15314cc3-85b4-4338-903f-c28cdee6d005",
          "resource_group_id": "b91e849cedb04e7e92bd68c040c672dc"
        }
      ],
      "limit": 50
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Create a project

Create a Code Engine project on IBM Cloud. The project will be created in the region that corresponds to the API endpoint that is being called.

POST /projects

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • resource-controller.instance.create

Auditing

Calling this method generates the following auditing event.

  • resource-controller.instance.create

Request

Project prototype

Examples:
{
  "name": "test_project",
  "resource_group_id": "b91e849cedb04e7e92bd68c040c672dc",
  "tags": [
    "code-engine",
    "my-tag"
  ]
}
  • curl -X POST   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects"   -H "Authorization: ${token}"   -H "Content-Type: application/json"   -d '{     "name": "my-project"   }'
  • createProjectOptions := codeEngineService.NewCreateProjectOptions(
      "my-project",
    )
    
    project, response, err := codeEngineService.CreateProject(createProjectOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(project, "", "  ")
    fmt.Println(string(b))
    
  • CreateProjectOptions createProjectOptions = new CreateProjectOptions.Builder()
      .name("my-project")
      .build();
    
    Response<Project> response = codeEngineService.createProject(createProjectOptions).execute();
    Project project = response.getResult();
    
    System.out.println(project);
    
  • const params = {
      name: 'my-project',
    };
    
    let res;
    try {
      res = await codeEngineService.createProject(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.create_project(
        name='my-project',
    )
    project = response.get_result()
    
    print(json.dumps(project, indent=2))
    

Response

Describes the model of a project.

Status Code

  • Accepted

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "name": "test_project",
      "id": "15314cc3-85b4-4338-903f-c28cdee6d005",
      "crn": "crn:v1:bluemix:public:codeengine:us-east:a/4329073d16d2f3663f74bfa955259139:15314cc3-85b4-4338-903f-c28cdee6d005::",
      "status": "active",
      "region": "us-east",
      "account_id": "f9f1030ebf674eda8d57bdbc2b9e536a",
      "created_at": "2021-03-29T12:18:13.992359829Z",
      "resource_type": "project_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/15314cc3-85b4-4338-903f-c28cdee6d005",
      "resource_group_id": "b91e849cedb04e7e92bd68c040c672dc"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Get a project

Display the details of a single project.

GET /projects/{id}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • resource-controller.instance.retrieve

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${id}"   -H "Authorization: ${token}" 
    
  • getProjectOptions := codeEngineService.NewGetProjectOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
    )
    
    project, response, err := codeEngineService.GetProject(getProjectOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(project, "", "  ")
    fmt.Println(string(b))
    
  • GetProjectOptions getProjectOptions = new GetProjectOptions.Builder()
      .id("15314cc3-85b4-4338-903f-c28cdee6d005")
      .build();
    
    Response<Project> response = codeEngineService.getProject(getProjectOptions).execute();
    Project project = response.getResult();
    
    System.out.println(project);
    
  • const params = {
      id: '15314cc3-85b4-4338-903f-c28cdee6d005',
    };
    
    let res;
    try {
      res = await codeEngineService.getProject(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.get_project(
        id='15314cc3-85b4-4338-903f-c28cdee6d005',
    )
    project = response.get_result()
    
    print(json.dumps(project, indent=2))
    

Response

Describes the model of a project.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "test_project",
      "id": "15314cc3-85b4-4338-903f-c28cdee6d005",
      "crn": "crn:v1:bluemix:public:codeengine:us-east:a/4329073d16d2f3663f74bfa955259139:15314cc3-85b4-4338-903f-c28cdee6d005::",
      "status": "active",
      "region": "us-east",
      "account_id": "f9f1030ebf674eda8d57bdbc2b9e536a",
      "created_at": "2021-03-29T12:18:13.992359829Z",
      "resource_type": "project_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/15314cc3-85b4-4338-903f-c28cdee6d005",
      "resource_group_id": "b91e849cedb04e7e92bd68c040c672dc"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Delete a project

Delete a project.

DELETE /projects/{id}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • resource-controller.instance.delete

Auditing

Calling this method generates the following auditing event.

  • resource-controller.instance.delete

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • curl -X DELETE   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${id}"   -H "Authorization: ${token}" 
    
  • deleteProjectOptions := codeEngineService.NewDeleteProjectOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
    )
    
    response, err := codeEngineService.DeleteProject(deleteProjectOptions)
    if err != nil {
      panic(err)
    }
    if response.StatusCode != 202 {
      fmt.Printf("\nUnexpected response status code received from DeleteProject(): %d\n", response.StatusCode)
    }
    
  • DeleteProjectOptions deleteProjectOptions = new DeleteProjectOptions.Builder()
      .id("15314cc3-85b4-4338-903f-c28cdee6d005")
      .build();
    
    Response<Void> response = codeEngineService.deleteProject(deleteProjectOptions).execute();
    
  • const params = {
      id: '15314cc3-85b4-4338-903f-c28cdee6d005',
    };
    
    try {
      await codeEngineService.deleteProject(params);
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.delete_project(
        id='15314cc3-85b4-4338-903f-c28cdee6d005',
    )
    

Response

Status Code

  • Accepted

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

List egress IP addresses

Lists all egress IP addresses (public and private) that are used by components running in this project. For information about using egress IP addresses, see Code Engine public and private IP addresses.

GET /projects/{project_id}/egress_ips

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/egress_ips"   -H "Authorization: ${token}" 
    
  • getProjectEgressIpsOptions := codeEngineService.NewGetProjectEgressIpsOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
    )
    
    projectEgressIpAddresses, response, err := codeEngineService.GetProjectEgressIps(getProjectEgressIpsOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(projectEgressIpAddresses, "", "  ")
    fmt.Println(string(b))
    
  • GetProjectEgressIpsOptions getProjectEgressIpsOptions = new GetProjectEgressIpsOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .build();
    
    Response<ProjectEgressIPAddresses> response = codeEngineService.getProjectEgressIps(getProjectEgressIpsOptions).execute();
    ProjectEgressIPAddresses projectEgressIpAddresses = response.getResult();
    
    System.out.println(projectEgressIpAddresses);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
    };
    
    let res;
    try {
      res = await codeEngineService.getProjectEgressIps(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.get_project_egress_ips(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
    )
    project_egress_ip_addresses = response.get_result()
    
    print(json.dumps(project_egress_ip_addresses, indent=2))
    

Response

Describes the model of egress IP addresses.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "private": [
        "10.223.236.11",
        "10.223.242.142",
        "10.12.3.244"
      ],
      "public": [
        "159.23.99.151",
        "130.198.13.241",
        "135.90.137.31"
      ]
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Get the status details for a project

Retrieves status details about the given project.

GET /projects/{project_id}/status_details

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/status_details"   -H "Authorization: ${token}" 
    
  • getProjectStatusDetailsOptions := codeEngineService.NewGetProjectStatusDetailsOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
    )
    
    projectStatusDetails, response, err := codeEngineService.GetProjectStatusDetails(getProjectStatusDetailsOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(projectStatusDetails, "", "  ")
    fmt.Println(string(b))
    
  • GetProjectStatusDetailsOptions getProjectStatusDetailsOptions = new GetProjectStatusDetailsOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .build();
    
    Response<ProjectStatusDetails> response = codeEngineService.getProjectStatusDetails(getProjectStatusDetailsOptions).execute();
    ProjectStatusDetails projectStatusDetails = response.getResult();
    
    System.out.println(projectStatusDetails);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
    };
    
    let res;
    try {
      res = await codeEngineService.getProjectStatusDetails(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.get_project_status_details(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
    )
    project_status_details = response.get_result()
    
    print(json.dumps(project_status_details, indent=2))
    

Response

Describes the model of a project status details.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "domain": "ready",
      "project": "enabled"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

List applications

List all applications in a project.

GET /projects/{project_id}/apps

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.application.list

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

  • Optional maximum number of apps per page.

    Possible values: 1 ≤ value ≤ 500

    Default: 50

    Example: 100

  • An optional token that indicates the beginning of the page of results to be returned. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the next object of the operation response.

    Possible values: 0 ≤ length ≤ 3000, Value must match regular expression ^[a-zA-Z0-9=]+$

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/apps"   -H "Authorization: ${token}" 
    
  • listAppsOptions := &codeenginev2.ListAppsOptions{
      ProjectID: core.StringPtr("15314cc3-85b4-4338-903f-c28cdee6d005"),
      Limit: core.Int64Ptr(int64(100)),
    }
    
    pager, err := codeEngineService.NewAppsPager(listAppsOptions)
    if err != nil {
      panic(err)
    }
    
    var allResults []codeenginev2.App
    for pager.HasNext() {
      nextPage, err := pager.GetNext()
      if err != nil {
        panic(err)
      }
      allResults = append(allResults, nextPage...)
    }
    b, _ := json.MarshalIndent(allResults, "", "  ")
    fmt.Println(string(b))
    
  • ListAppsOptions listAppsOptions = new ListAppsOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .limit(Long.valueOf("100"))
      .build();
    
    AppsPager pager = new AppsPager(codeEngineService, listAppsOptions);
    List<App> allResults = new ArrayList<>();
    while (pager.hasNext()) {
      List<App> nextPage = pager.getNext();
      allResults.addAll(nextPage);
    }
    
    System.out.println(GsonSingleton.getGson().toJson(allResults));
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      limit: 100,
    };
    
    const allResults = [];
    try {
      const pager = new CodeEngineV2.AppsPager(codeEngineService, params);
      while (pager.hasNext()) {
        const nextPage = await pager.getNext();
        expect(nextPage).not.toBeNull();
        allResults.push(...nextPage);
      }
      console.log(JSON.stringify(allResults, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • all_results = []
    pager = AppsPager(
        client=code_engine_service,
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        limit=100,
    )
    while pager.has_next():
        next_page = pager.get_next()
        assert next_page is not None
        all_results.extend(next_page)
    
    print(json.dumps(all_results, indent=2))
    

Response

Contains a list of apps and pagination information.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "apps": [
        {
          "name": "my-app",
          "id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
          "region": "us-east",
          "project_id": "15314cc3-85b4-4338-903f-c28cdee6d005",
          "created_at": "2022-11-15T22:07:55+01:00",
          "resource_type": "app_v2",
          "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/apps/my-app",
          "managed_domain_mappings": "local_public",
          "endpoint_internal": "http://my-app.vg67hzldruk.svc.cluster.local",
          "entity_tag": "1",
          "image_reference": "icr.io/codeengine/helloworld",
          "image_port": 8080,
          "scale_cpu_limit": "1",
          "scale_memory_limit": "4G",
          "scale_ephemeral_storage_limit": "400M",
          "scale_concurrency": 100,
          "scale_initial_instances": 1,
          "scale_min_instances": 0,
          "scale_max_instances": 10,
          "scale_request_timeout": 300,
          "run_arguments": [],
          "run_commands": [],
          "run_volume_mounts": [],
          "run_env_variables": [
            {
              "type": "literal",
              "name": "CE_SUBDOMAIN",
              "value": "uyh5shf7s0f"
            },
            {
              "type": "literal",
              "name": "CE_APP",
              "value": "my-app"
            },
            {
              "type": "literal",
              "name": "CE_DOMAIN",
              "value": "us-east.codeengine.appdomain.cloud"
            }
          ],
          "status": "ready"
        }
      ],
      "limit": 50
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Create an application

Create an application.

POST /projects/{project_id}/apps

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.create

Auditing

Calling this method generates the following auditing event.

  • codeengine.application.create

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

App prototype

Examples:
{
  "name": "my-app",
  "image_reference": "icr.io/codeengine/helloworld"
}
  • curl -X POST   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/apps"   -H "Authorization: ${token}"   -H "Content-Type: application/json"   -d '{     "name": "my-app",     "image_reference": "icr.io/codeengine/helloworld"   }'
  • createAppOptions := codeEngineService.NewCreateAppOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "icr.io/codeengine/helloworld",
      "my-app",
    )
    
    app, response, err := codeEngineService.CreateApp(createAppOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(app, "", "  ")
    fmt.Println(string(b))
    
  • CreateAppOptions createAppOptions = new CreateAppOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .imageReference("icr.io/codeengine/helloworld")
      .name("my-app")
      .build();
    
    Response<App> response = codeEngineService.createApp(createAppOptions).execute();
    App app = response.getResult();
    
    System.out.println(app);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      imageReference: 'icr.io/codeengine/helloworld',
      name: 'my-app',
    };
    
    let res;
    try {
      res = await codeEngineService.createApp(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.create_app(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        image_reference='icr.io/codeengine/helloworld',
        name='my-app',
    )
    app = response.get_result()
    
    print(json.dumps(app, indent=2))
    

Response

App is the response model for app resources.

Status Code

  • Created

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "name": "my-app",
      "id": "3bf57be1-66f0-4a89-ad34-ed77c049935e",
      "region": "us-east",
      "project_id": "15314cc3-85b4-4338-903f-c28cdee6d005",
      "created_at": "2022-11-15T22:07:55+01:00",
      "resource_type": "app_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/apps/my-app",
      "managed_domain_mappings": "local_public",
      "endpoint_internal": "http://my-app.vg67hzldruk.svc.cluster.local",
      "entity_tag": "1",
      "image_reference": "icr.io/codeengine/helloworld",
      "image_port": 8080,
      "scale_cpu_limit": "1",
      "scale_down_delay": 0,
      "scale_memory_limit": "4G",
      "scale_ephemeral_storage_limit": "400M",
      "scale_concurrency": 100,
      "scale_initial_instances": 1,
      "scale_min_instances": 0,
      "scale_max_instances": 10,
      "scale_request_timeout": 300,
      "run_arguments": [],
      "run_commands": [],
      "run_volume_mounts": [],
      "run_env_variables": [
        {
          "type": "literal",
          "name": "CE_SUBDOMAIN",
          "value": "uyh5shf7s0f"
        },
        {
          "type": "literal",
          "name": "CE_APP",
          "value": "my-app"
        },
        {
          "type": "literal",
          "name": "CE_DOMAIN",
          "value": "us-east.codeengine.appdomain.cloud"
        }
      ],
      "status": "ready"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Get an application

Display the details of an application.

GET /projects/{project_id}/apps/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.application.read

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your application.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z]([-a-z0-9]*[a-z0-9])?$

    Example: my-app

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/apps/${name}"   -H "Authorization: ${token}" 
    
  • getAppOptions := codeEngineService.NewGetAppOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-app",
    )
    
    app, response, err := codeEngineService.GetApp(getAppOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(app, "", "  ")
    fmt.Println(string(b))
    
  • GetAppOptions getAppOptions = new GetAppOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-app")
      .build();
    
    Response<App> response = codeEngineService.getApp(getAppOptions).execute();
    App app = response.getResult();
    
    System.out.println(app);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-app',
    };
    
    let res;
    try {
      res = await codeEngineService.getApp(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.get_app(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-app',
    )
    app = response.get_result()
    
    print(json.dumps(app, indent=2))
    

Response

App is the response model for app resources.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "my-app",
      "id": "3bf57be1-66f0-4a89-ad34-ed77c049935e",
      "region": "us-east",
      "project_id": "15314cc3-85b4-4338-903f-c28cdee6d005",
      "created_at": "2022-11-15T22:07:55+01:00",
      "resource_type": "app_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/apps/my-app",
      "managed_domain_mappings": "local_public",
      "endpoint_internal": "http://my-app.vg67hzldruk.svc.cluster.local",
      "entity_tag": "1",
      "image_reference": "icr.io/codeengine/helloworld",
      "image_port": 8080,
      "scale_cpu_limit": "1",
      "scale_down_delay": 0,
      "scale_memory_limit": "4G",
      "scale_ephemeral_storage_limit": "400M",
      "scale_concurrency": 100,
      "scale_initial_instances": 1,
      "scale_min_instances": 0,
      "scale_max_instances": 10,
      "scale_request_timeout": 300,
      "run_arguments": [],
      "run_commands": [],
      "run_volume_mounts": [],
      "run_env_variables": [
        {
          "type": "literal",
          "name": "CE_SUBDOMAIN",
          "value": "uyh5shf7s0f"
        },
        {
          "type": "literal",
          "name": "CE_APP",
          "value": "my-app"
        },
        {
          "type": "literal",
          "name": "CE_DOMAIN",
          "value": "us-east.codeengine.appdomain.cloud"
        }
      ],
      "status": "ready"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Delete an application

Delete an application.

DELETE /projects/{project_id}/apps/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.delete

Auditing

Calling this method generates the following auditing events.

  • codeengine.application.read

  • codeengine.application.delete

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your application.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z]([-a-z0-9]*[a-z0-9])?$

    Example: my-app

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

  • curl -X DELETE   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/apps/${name}"   -H "Authorization: ${token}" 
    
  • deleteAppOptions := codeEngineService.NewDeleteAppOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-app",
    )
    
    response, err := codeEngineService.DeleteApp(deleteAppOptions)
    if err != nil {
      panic(err)
    }
    if response.StatusCode != 202 {
      fmt.Printf("\nUnexpected response status code received from DeleteApp(): %d\n", response.StatusCode)
    }
    
  • DeleteAppOptions deleteAppOptions = new DeleteAppOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-app")
      .build();
    
    Response<Void> response = codeEngineService.deleteApp(deleteAppOptions).execute();
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-app',
    };
    
    try {
      await codeEngineService.deleteApp(params);
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.delete_app(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-app',
    )
    

Response

Status Code

  • Accepted

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Update an application

An application contains one or more revisions. A revision represents an immutable version of the configuration properties of the application. Each update of an application configuration property creates a new revision of the application. Learn more

PATCH /projects/{project_id}/apps/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.update

Auditing

Calling this method generates the following auditing events.

  • codeengine.application.read

  • codeengine.application.list

  • codeengine.application.update

Request

Custom Headers

  • Version of the app settings to be updated. Specify the version that you retrieved as entity_tag (ETag header) when reading the app. This value helps identifying parallel usage of this API. Pass * to indicate to update any version available. This might result in stale updates.

    Possible values: 1 ≤ length ≤ 256, Value must match regular expression ^[0-9]*$

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your application.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z]([-a-z0-9]*[a-z0-9])?$

    Example: my-app

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

App patch

Examples:
{
  "image_reference": "icr.io/codeengine/hello"
}
  • curl -X PATCH   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/apps/${name}"   -H "Authorization: ${token}"   -H "Content-Type: application/merge-patch+json"   -d '{  }'
  • appPatchModel := &codeenginev2.AppPatch{
    }
    appPatchModelAsPatch, asPatchErr := appPatchModel.AsPatch()
    Expect(asPatchErr).To(BeNil())
    
    updateAppOptions := codeEngineService.NewUpdateAppOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-app",
      "testString",
      appPatchModelAsPatch,
    )
    
    app, response, err := codeEngineService.UpdateApp(updateAppOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(app, "", "  ")
    fmt.Println(string(b))
    
  • AppPatch appPatchModel = new AppPatch.Builder()
      .build();
    Map<String, Object> appPatchModelAsPatch = appPatchModel.asPatch();
    UpdateAppOptions updateAppOptions = new UpdateAppOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-app")
      .ifMatch("testString")
      .app(appPatchModelAsPatch)
      .build();
    
    Response<App> response = codeEngineService.updateApp(updateAppOptions).execute();
    App app = response.getResult();
    
    System.out.println(app);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-app',
      ifMatch: 'testString',
    };
    
    let res;
    try {
      res = await codeEngineService.updateApp(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • app_patch_model = {}
    
    response = code_engine_service.update_app(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-app',
        if_match='testString',
        app=app_patch_model,
    )
    app = response.get_result()
    
    print(json.dumps(app, indent=2))
    

Response

App is the response model for app resources.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "my-app",
      "id": "3bf57be1-66f0-4a89-ad34-ed77c049935e",
      "region": "us-east",
      "project_id": "15314cc3-85b4-4338-903f-c28cdee6d005",
      "created_at": "2022-11-15T22:07:55+01:00",
      "resource_type": "app_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/apps/my-app",
      "managed_domain_mappings": "local_public",
      "endpoint_internal": "http://my-app.vg67hzldruk.svc.cluster.local",
      "entity_tag": "1",
      "image_reference": "icr.io/codeengine/helloworld",
      "image_port": 8080,
      "scale_cpu_limit": "1",
      "scale_down_delay": 0,
      "scale_memory_limit": "4G",
      "scale_ephemeral_storage_limit": "400M",
      "scale_concurrency": 100,
      "scale_initial_instances": 1,
      "scale_min_instances": 0,
      "scale_max_instances": 10,
      "scale_request_timeout": 300,
      "run_arguments": [],
      "run_commands": [],
      "run_volume_mounts": [],
      "run_env_variables": [
        {
          "type": "literal",
          "name": "CE_SUBDOMAIN",
          "value": "uyh5shf7s0f"
        },
        {
          "type": "literal",
          "name": "CE_APP",
          "value": "my-app"
        },
        {
          "type": "literal",
          "name": "CE_DOMAIN",
          "value": "us-east.codeengine.appdomain.cloud"
        }
      ],
      "status": "ready"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

List application revisions

List all application revisions in a particular application.

GET /projects/{project_id}/apps/{app_name}/revisions

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.application.list

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your application.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z]([-a-z0-9]*[a-z0-9])?$

    Example: my-app

Query Parameters

  • Optional maximum number of apps per page.

    Possible values: 1 ≤ value ≤ 500

    Default: 50

    Example: 100

  • An optional token that indicates the beginning of the page of results to be returned. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the next object of the operation response.

    Possible values: 0 ≤ length ≤ 3000, Value must match regular expression ^[a-zA-Z0-9=]+$

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/apps/${app_name}/revisions"   -H "Authorization: ${token}" 
    
  • listAppRevisionsOptions := &codeenginev2.ListAppRevisionsOptions{
      ProjectID: core.StringPtr("15314cc3-85b4-4338-903f-c28cdee6d005"),
      AppName: core.StringPtr("my-app"),
      Limit: core.Int64Ptr(int64(100)),
    }
    
    pager, err := codeEngineService.NewAppRevisionsPager(listAppRevisionsOptions)
    if err != nil {
      panic(err)
    }
    
    var allResults []codeenginev2.AppRevision
    for pager.HasNext() {
      nextPage, err := pager.GetNext()
      if err != nil {
        panic(err)
      }
      allResults = append(allResults, nextPage...)
    }
    b, _ := json.MarshalIndent(allResults, "", "  ")
    fmt.Println(string(b))
    
  • ListAppRevisionsOptions listAppRevisionsOptions = new ListAppRevisionsOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .appName("my-app")
      .limit(Long.valueOf("100"))
      .build();
    
    AppRevisionsPager pager = new AppRevisionsPager(codeEngineService, listAppRevisionsOptions);
    List<AppRevision> allResults = new ArrayList<>();
    while (pager.hasNext()) {
      List<AppRevision> nextPage = pager.getNext();
      allResults.addAll(nextPage);
    }
    
    System.out.println(GsonSingleton.getGson().toJson(allResults));
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      appName: 'my-app',
      limit: 100,
    };
    
    const allResults = [];
    try {
      const pager = new CodeEngineV2.AppRevisionsPager(codeEngineService, params);
      while (pager.hasNext()) {
        const nextPage = await pager.getNext();
        expect(nextPage).not.toBeNull();
        allResults.push(...nextPage);
      }
      console.log(JSON.stringify(allResults, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • all_results = []
    pager = AppRevisionsPager(
        client=code_engine_service,
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        app_name='my-app',
        limit=100,
    )
    while pager.has_next():
        next_page = pager.get_next()
        assert next_page is not None
        all_results.extend(next_page)
    
    print(json.dumps(all_results, indent=2))
    

Response

Contains a list of app revisions and pagination information.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "revisions": [
        {
          "name": "my-app-00001",
          "app_name": "my-app",
          "id": "b63b3e28-2c1b-4784-9cd6-18c201fc6806",
          "region": "us-east",
          "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
          "created_at": "2022-11-15T22:07:55+01:00",
          "resource_type": "app_revision_v2",
          "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/apps/my-app/revisions/my-app-00001",
          "image_reference": "icr.io/codeengine/helloworld",
          "image_port": 8080,
          "scale_cpu_limit": "1",
          "scale_memory_limit": "4G",
          "scale_ephemeral_storage_limit": "400M",
          "scale_concurrency": 100,
          "scale_initial_instances": 1,
          "scale_min_instances": 0,
          "scale_max_instances": 10,
          "scale_request_timeout": 300,
          "run_arguments": [],
          "run_commands": [],
          "run_volume_mounts": [],
          "run_env_variables": [
            {
              "type": "literal",
              "name": "CE_SUBDOMAIN",
              "value": "uyh5shf7s0f"
            },
            {
              "type": "literal",
              "name": "CE_APP",
              "value": "my-app"
            },
            {
              "type": "literal",
              "name": "CE_DOMAIN",
              "value": "us-east.codeengine.appdomain.cloud"
            }
          ],
          "status": "ready"
        }
      ],
      "limit": 50
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Get an application revision

Display the details of an application revision.

GET /projects/{project_id}/apps/{app_name}/revisions/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.application.read

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your application.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z]([-a-z0-9]*[a-z0-9])?$

    Example: my-app

  • The name of your application revision.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z]([-a-z0-9]*[a-z0-9])?$

    Example: my-app-00001

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/apps/${app_name}/revisions/${name}"   -H "Authorization: ${token}" 
    
  • getAppRevisionOptions := codeEngineService.NewGetAppRevisionOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-app",
      "my-app-00001",
    )
    
    appRevision, response, err := codeEngineService.GetAppRevision(getAppRevisionOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(appRevision, "", "  ")
    fmt.Println(string(b))
    
  • GetAppRevisionOptions getAppRevisionOptions = new GetAppRevisionOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .appName("my-app")
      .name("my-app-00001")
      .build();
    
    Response<AppRevision> response = codeEngineService.getAppRevision(getAppRevisionOptions).execute();
    AppRevision appRevision = response.getResult();
    
    System.out.println(appRevision);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      appName: 'my-app',
      name: 'my-app-00001',
    };
    
    let res;
    try {
      res = await codeEngineService.getAppRevision(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.get_app_revision(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        app_name='my-app',
        name='my-app-00001',
    )
    app_revision = response.get_result()
    
    print(json.dumps(app_revision, indent=2))
    

Response

AppRevision is the response model for app revision resources.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "my-app-00001",
      "app_name": "my-app",
      "id": "b63b3e28-2c1b-4784-9cd6-18c201fc6806",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T22:07:55+01:00",
      "resource_type": "app_revision_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/apps/my-app/revisions/my-app-00001",
      "image_reference": "icr.io/codeengine/helloworld",
      "image_port": 8080,
      "scale_cpu_limit": "1",
      "scale_memory_limit": "4G",
      "scale_ephemeral_storage_limit": "400M",
      "scale_concurrency": 100,
      "scale_initial_instances": 1,
      "scale_min_instances": 0,
      "scale_max_instances": 10,
      "scale_request_timeout": 300,
      "run_arguments": [],
      "run_commands": [],
      "run_volume_mounts": [],
      "run_env_variables": [
        {
          "type": "literal",
          "name": "CE_SUBDOMAIN",
          "value": "uyh5shf7s0f"
        },
        {
          "type": "literal",
          "name": "CE_APP",
          "value": "my-app"
        },
        {
          "type": "literal",
          "name": "CE_DOMAIN",
          "value": "us-east.codeengine.appdomain.cloud"
        }
      ],
      "status": "ready"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Delete an application revision

Delete an application revision.

DELETE /projects/{project_id}/apps/{app_name}/revisions/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.delete

Auditing

Calling this method generates the following auditing event.

  • codeengine.application.delete

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your application.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z]([-a-z0-9]*[a-z0-9])?$

    Example: my-app

  • The name of your application revision.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z]([-a-z0-9]*[a-z0-9])?$

    Example: my-app-00001

  • curl -X DELETE   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/apps/${app_name}/revisions/${name}"   -H "Authorization: ${token}" 
    
  • deleteAppRevisionOptions := codeEngineService.NewDeleteAppRevisionOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-app",
      "my-app-00001",
    )
    
    response, err := codeEngineService.DeleteAppRevision(deleteAppRevisionOptions)
    if err != nil {
      panic(err)
    }
    if response.StatusCode != 202 {
      fmt.Printf("\nUnexpected response status code received from DeleteAppRevision(): %d\n", response.StatusCode)
    }
    
  • DeleteAppRevisionOptions deleteAppRevisionOptions = new DeleteAppRevisionOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .appName("my-app")
      .name("my-app-00001")
      .build();
    
    Response<Void> response = codeEngineService.deleteAppRevision(deleteAppRevisionOptions).execute();
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      appName: 'my-app',
      name: 'my-app-00001',
    };
    
    try {
      await codeEngineService.deleteAppRevision(params);
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.delete_app_revision(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        app_name='my-app',
        name='my-app-00001',
    )
    

Response

Status Code

  • Accepted

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

List application instances

List all instances of an application.

GET /projects/{project_id}/apps/{app_name}/instances

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.application.list

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your application.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z]([-a-z0-9]*[a-z0-9])?$

    Example: my-app

Query Parameters

  • Optional maximum number of apps per page.

    Possible values: 1 ≤ value ≤ 500

    Default: 50

    Example: 100

  • An optional token that indicates the beginning of the page of results to be returned. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the next object of the operation response.

    Possible values: 0 ≤ length ≤ 3000, Value must match regular expression ^[a-zA-Z0-9=]+$

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/apps/${app_name}/instances"   -H "Authorization: ${token}" 
    
  • listAppInstancesOptions := &codeenginev2.ListAppInstancesOptions{
      ProjectID: core.StringPtr("15314cc3-85b4-4338-903f-c28cdee6d005"),
      AppName: core.StringPtr("my-app"),
      Limit: core.Int64Ptr(int64(100)),
    }
    
    pager, err := codeEngineService.NewAppInstancesPager(listAppInstancesOptions)
    if err != nil {
      panic(err)
    }
    
    var allResults []codeenginev2.AppInstance
    for pager.HasNext() {
      nextPage, err := pager.GetNext()
      if err != nil {
        panic(err)
      }
      allResults = append(allResults, nextPage...)
    }
    b, _ := json.MarshalIndent(allResults, "", "  ")
    fmt.Println(string(b))
    
  • ListAppInstancesOptions listAppInstancesOptions = new ListAppInstancesOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .appName("my-app")
      .limit(Long.valueOf("100"))
      .build();
    
    AppInstancesPager pager = new AppInstancesPager(codeEngineService, listAppInstancesOptions);
    List<AppInstance> allResults = new ArrayList<>();
    while (pager.hasNext()) {
      List<AppInstance> nextPage = pager.getNext();
      allResults.addAll(nextPage);
    }
    
    System.out.println(GsonSingleton.getGson().toJson(allResults));
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      appName: 'my-app',
      limit: 100,
    };
    
    const allResults = [];
    try {
      const pager = new CodeEngineV2.AppInstancesPager(codeEngineService, params);
      while (pager.hasNext()) {
        const nextPage = await pager.getNext();
        expect(nextPage).not.toBeNull();
        allResults.push(...nextPage);
      }
      console.log(JSON.stringify(allResults, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • all_results = []
    pager = AppInstancesPager(
        client=code_engine_service,
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        app_name='my-app',
        limit=100,
    )
    while pager.has_next():
        next_page = pager.get_next()
        assert next_page is not None
        all_results.extend(next_page)
    
    print(json.dumps(all_results, indent=2))
    

Response

Contains a list of app instances and pagination information.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "instances": [
        {
          "name": "crash-00001-deployment-86c64f66fd-cjwqp",
          "resource_type": "app_instance_v2",
          "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/apps/my-app/instances",
          "id": "7755a00a-0d8f-4eab-8dbd-ab43fc3498dd",
          "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
          "created_at": "2023-10-23T11:56:46-04:00",
          "region": "us-east",
          "status": "running",
          "scale_cpu_limit": "0.125",
          "scale_memory_limit": "250M",
          "scale_ephemeral_storage_limit": "400M",
          "app_name": "crash",
          "revision_name": "crash-00001",
          "restarts": 58,
          "status_details": {
            "user_container": {
              "current_state": {
                "container_status": "terminated",
                "reason": "OOMKilled",
                "exit_code": 1,
                "started_at": "2023-10-23T16:55:36-04:00",
                "completed_at": "2023-10-23T16:56:02-04:00"
              },
              "last_observed_state": {
                "container_status": "terminated",
                "reason": "OOMKilled",
                "exit_code": 1,
                "started_at": "2023-10-23T16:49:58-04:00",
                "completed_at": "2023-10-23T16:50:24-04:00"
              }
            },
            "system_containers": {
              "current_state": {
                "container_status": "running",
                "start_time": "2023-10-23T11:57:10-04:00"
              },
              "last_observed_state": {}
            }
          }
        }
      ],
      "limit": 50,
      "first": {
        "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/apps/my-app/instances?limit=50"
      }
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

List jobs

List all jobs in a project.

GET /projects/{project_id}/jobs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.job.list

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

  • Optional maximum number of jobs per page.

    Possible values: 1 ≤ value ≤ 500

    Default: 50

    Example: 100

  • An optional token that indicates the beginning of the page of results to be returned. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the next object of the operation response.

    Possible values: 0 ≤ length ≤ 3000, Value must match regular expression ^[a-zA-Z0-9=]+$

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/jobs"   -H "Authorization: ${token}" 
    
  • listJobsOptions := &codeenginev2.ListJobsOptions{
      ProjectID: core.StringPtr("15314cc3-85b4-4338-903f-c28cdee6d005"),
      Limit: core.Int64Ptr(int64(100)),
    }
    
    pager, err := codeEngineService.NewJobsPager(listJobsOptions)
    if err != nil {
      panic(err)
    }
    
    var allResults []codeenginev2.Job
    for pager.HasNext() {
      nextPage, err := pager.GetNext()
      if err != nil {
        panic(err)
      }
      allResults = append(allResults, nextPage...)
    }
    b, _ := json.MarshalIndent(allResults, "", "  ")
    fmt.Println(string(b))
    
  • ListJobsOptions listJobsOptions = new ListJobsOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .limit(Long.valueOf("100"))
      .build();
    
    JobsPager pager = new JobsPager(codeEngineService, listJobsOptions);
    List<Job> allResults = new ArrayList<>();
    while (pager.hasNext()) {
      List<Job> nextPage = pager.getNext();
      allResults.addAll(nextPage);
    }
    
    System.out.println(GsonSingleton.getGson().toJson(allResults));
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      limit: 100,
    };
    
    const allResults = [];
    try {
      const pager = new CodeEngineV2.JobsPager(codeEngineService, params);
      while (pager.hasNext()) {
        const nextPage = await pager.getNext();
        expect(nextPage).not.toBeNull();
        allResults.push(...nextPage);
      }
      console.log(JSON.stringify(allResults, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • all_results = []
    pager = JobsPager(
        client=code_engine_service,
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        limit=100,
    )
    while pager.has_next():
        next_page = pager.get_next()
        assert next_page is not None
        all_results.extend(next_page)
    
    print(json.dumps(all_results, indent=2))
    

Response

Contains a list of jobs and pagination information.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "jobs": [
        {
          "name": "my-job",
          "id": "7e49dd78-09d0-45c7-ad7e-cd968e0e7747",
          "region": "us-east",
          "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
          "created_at": "2022-11-15T21:40:40+01:00",
          "resource_type": "job_v2",
          "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/jobs/my-job",
          "image_reference": "icr.io/codeengine/helloworld",
          "run_mode": "task",
          "run_arguments": [],
          "run_commands": [],
          "run_volume_mounts": [],
          "run_env_variables": [],
          "scale_array_spec": "0",
          "scale_max_execution_time": 7200,
          "scale_retry_limit": 3,
          "scale_cpu_limit": "1",
          "scale_memory_limit": "4G",
          "scale_ephemeral_storage_limit": "400M",
          "status": "ready",
          "entity_tag": "2386231540"
        }
      ],
      "limit": 50
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Create a job

Create a job.

POST /projects/{project_id}/jobs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.create

Auditing

Calling this method generates the following auditing event.

  • codeengine.job.create

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

Job prototype

Examples:
{
  "name": "my-job",
  "image_reference": "icr.io/codeengine/helloworld",
  "run_env_variables": [
    {
      "type": "literal",
      "name": "MY_PROPERTY",
      "value": "VALUE"
    }
  ]
}
  • curl -X POST   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/jobs"   -H "Authorization: ${token}"   -H "Content-Type: application/json"   -d '{     "image_reference": "icr.io/codeengine/helloworld",     "name": "my-job"   }'
  • createJobOptions := codeEngineService.NewCreateJobOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "icr.io/codeengine/helloworld",
      "my-job",
    )
    
    job, response, err := codeEngineService.CreateJob(createJobOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(job, "", "  ")
    fmt.Println(string(b))
    
  • CreateJobOptions createJobOptions = new CreateJobOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .imageReference("icr.io/codeengine/helloworld")
      .name("my-job")
      .build();
    
    Response<Job> response = codeEngineService.createJob(createJobOptions).execute();
    Job job = response.getResult();
    
    System.out.println(job);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      imageReference: 'icr.io/codeengine/helloworld',
      name: 'my-job',
    };
    
    let res;
    try {
      res = await codeEngineService.createJob(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.create_job(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        image_reference='icr.io/codeengine/helloworld',
        name='my-job',
    )
    job = response.get_result()
    
    print(json.dumps(job, indent=2))
    

Response

Job is the response model for job resources

Status Code

  • Created

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "name": "my-job",
      "id": "7e49dd78-09d0-45c7-ad7e-cd968e0e7747",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T21:40:40+01:00",
      "resource_type": "job_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/jobs/my-job",
      "image_reference": "icr.io/codeengine/helloworld",
      "run_arguments": [],
      "run_commands": [],
      "run_mode": "task",
      "run_volume_mounts": [],
      "run_env_variables": [],
      "scale_array_spec": "0",
      "scale_max_execution_time": 7200,
      "scale_retry_limit": 3,
      "scale_cpu_limit": "1",
      "scale_memory_limit": "4G",
      "scale_ephemeral_storage_limit": "400M",
      "status": "ready",
      "entity_tag": "2386231540"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Get a job

Display the details of a job.

GET /projects/{project_id}/jobs/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.job.read

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your job.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?$

    Example: my-job

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/jobs/${name}"   -H "Authorization: ${token}" 
    
  • getJobOptions := codeEngineService.NewGetJobOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-job",
    )
    
    job, response, err := codeEngineService.GetJob(getJobOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(job, "", "  ")
    fmt.Println(string(b))
    
  • GetJobOptions getJobOptions = new GetJobOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-job")
      .build();
    
    Response<Job> response = codeEngineService.getJob(getJobOptions).execute();
    Job job = response.getResult();
    
    System.out.println(job);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-job',
    };
    
    let res;
    try {
      res = await codeEngineService.getJob(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.get_job(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-job',
    )
    job = response.get_result()
    
    print(json.dumps(job, indent=2))
    

Response

Job is the response model for job resources

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "my-job",
      "id": "7e49dd78-09d0-45c7-ad7e-cd968e0e7747",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T21:40:40+01:00",
      "resource_type": "job_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/jobs/my-job",
      "image_reference": "icr.io/codeengine/helloworld",
      "run_arguments": [],
      "run_commands": [],
      "run_mode": "task",
      "run_volume_mounts": [],
      "run_env_variables": [],
      "scale_array_spec": "0",
      "scale_max_execution_time": 7200,
      "scale_retry_limit": 3,
      "scale_cpu_limit": "1",
      "scale_memory_limit": "4G",
      "scale_ephemeral_storage_limit": "400M",
      "status": "ready",
      "entity_tag": "2386231540"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Delete a job

Delete a job.

DELETE /projects/{project_id}/jobs/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.delete

Auditing

Calling this method generates the following auditing event.

  • codeengine.job.delete

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your job.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?$

    Example: my-job

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

  • curl -X DELETE   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/jobs/${name}"   -H "Authorization: ${token}" 
    
  • deleteJobOptions := codeEngineService.NewDeleteJobOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-job",
    )
    
    response, err := codeEngineService.DeleteJob(deleteJobOptions)
    if err != nil {
      panic(err)
    }
    if response.StatusCode != 202 {
      fmt.Printf("\nUnexpected response status code received from DeleteJob(): %d\n", response.StatusCode)
    }
    
  • DeleteJobOptions deleteJobOptions = new DeleteJobOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-job")
      .build();
    
    Response<Void> response = codeEngineService.deleteJob(deleteJobOptions).execute();
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-job',
    };
    
    try {
      await codeEngineService.deleteJob(params);
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.delete_job(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-job',
    )
    

Response

Status Code

  • Accepted

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Update a job

Update the given job.

PATCH /projects/{project_id}/jobs/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.update

Auditing

Calling this method generates the following auditing events.

  • codeengine.job.read

  • codeengine.job.update

Request

Custom Headers

  • Version of the job settings to be updated. Specify the version that you retrieved as entity_tag (ETag header) when reading the job. This value helps identifying parallel usage of this API. Pass * to indicate to update any version available. This might result in stale updates.

    Possible values: 1 ≤ length ≤ 256, Value must match regular expression ^[0-9]*$

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your job.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?$

    Example: my-job

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

Job patch prototype

Examples:
{
  "image_reference": "icr.io/codeengine/hello",
  "run_env_variables": [
    {
      "type": "literal",
      "name": "MY_PROPERTY",
      "value": "OTHER"
    }
  ]
}
  • curl -X PATCH   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/jobs/${name}"   -H "Authorization: ${token}"   -H "Content-Type: application/merge-patch+json"   -d '{  }'
  • jobPatchModel := &codeenginev2.JobPatch{
    }
    jobPatchModelAsPatch, asPatchErr := jobPatchModel.AsPatch()
    Expect(asPatchErr).To(BeNil())
    
    updateJobOptions := codeEngineService.NewUpdateJobOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-job",
      "testString",
      jobPatchModelAsPatch,
    )
    
    job, response, err := codeEngineService.UpdateJob(updateJobOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(job, "", "  ")
    fmt.Println(string(b))
    
  • JobPatch jobPatchModel = new JobPatch.Builder()
      .build();
    Map<String, Object> jobPatchModelAsPatch = jobPatchModel.asPatch();
    UpdateJobOptions updateJobOptions = new UpdateJobOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-job")
      .ifMatch("testString")
      .job(jobPatchModelAsPatch)
      .build();
    
    Response<Job> response = codeEngineService.updateJob(updateJobOptions).execute();
    Job job = response.getResult();
    
    System.out.println(job);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-job',
      ifMatch: 'testString',
    };
    
    let res;
    try {
      res = await codeEngineService.updateJob(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • job_patch_model = {}
    
    response = code_engine_service.update_job(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-job',
        if_match='testString',
        job=job_patch_model,
    )
    job = response.get_result()
    
    print(json.dumps(job, indent=2))
    

Response

Job is the response model for job resources

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "my-job",
      "id": "7e49dd78-09d0-45c7-ad7e-cd968e0e7747",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T21:40:40+01:00",
      "resource_type": "job_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/jobs/my-job",
      "image_reference": "icr.io/codeengine/helloworld",
      "run_arguments": [],
      "run_commands": [],
      "run_mode": "task",
      "run_volume_mounts": [],
      "run_env_variables": [],
      "scale_array_spec": "0",
      "scale_max_execution_time": 7200,
      "scale_retry_limit": 3,
      "scale_cpu_limit": "1",
      "scale_memory_limit": "4G",
      "scale_ephemeral_storage_limit": "400M",
      "status": "ready",
      "entity_tag": "2386231540"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

List job runs

List all job runs in a project.

GET /projects/{project_id}/job_runs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.jobrun.list

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

  • Optional name of the job that you want to use to filter.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?$

    Example: my-job

  • Optional maximum number of job runs per page.

    Possible values: 1 ≤ value ≤ 500

    Default: 50

    Example: 100

  • An optional token that indicates the beginning of the page of results to be returned. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the next object of the operation response.

    Possible values: 0 ≤ length ≤ 3000, Value must match regular expression ^[a-zA-Z0-9=]+$

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/job_runs"   -H "Authorization: ${token}" 
    
  • listJobRunsOptions := &codeenginev2.ListJobRunsOptions{
      ProjectID: core.StringPtr("15314cc3-85b4-4338-903f-c28cdee6d005"),
      JobName: core.StringPtr("my-job"),
      Limit: core.Int64Ptr(int64(100)),
    }
    
    pager, err := codeEngineService.NewJobRunsPager(listJobRunsOptions)
    if err != nil {
      panic(err)
    }
    
    var allResults []codeenginev2.JobRun
    for pager.HasNext() {
      nextPage, err := pager.GetNext()
      if err != nil {
        panic(err)
      }
      allResults = append(allResults, nextPage...)
    }
    b, _ := json.MarshalIndent(allResults, "", "  ")
    fmt.Println(string(b))
    
  • ListJobRunsOptions listJobRunsOptions = new ListJobRunsOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .jobName("my-job")
      .limit(Long.valueOf("100"))
      .build();
    
    JobRunsPager pager = new JobRunsPager(codeEngineService, listJobRunsOptions);
    List<JobRun> allResults = new ArrayList<>();
    while (pager.hasNext()) {
      List<JobRun> nextPage = pager.getNext();
      allResults.addAll(nextPage);
    }
    
    System.out.println(GsonSingleton.getGson().toJson(allResults));
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      jobName: 'my-job',
      limit: 100,
    };
    
    const allResults = [];
    try {
      const pager = new CodeEngineV2.JobRunsPager(codeEngineService, params);
      while (pager.hasNext()) {
        const nextPage = await pager.getNext();
        expect(nextPage).not.toBeNull();
        allResults.push(...nextPage);
      }
      console.log(JSON.stringify(allResults, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • all_results = []
    pager = JobRunsPager(
        client=code_engine_service,
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        job_name='my-job',
        limit=100,
    )
    while pager.has_next():
        next_page = pager.get_next()
        assert next_page is not None
        all_results.extend(next_page)
    
    print(json.dumps(all_results, indent=2))
    

Response

Contains a list of job runs and pagination information.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "job_runs": [
        {
          "job_name": "my-job",
          "name": "my-job-run-1",
          "id": "ced5039e-b1d3-4c51-aa29-8dbde3531ace",
          "region": "us-east",
          "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
          "created_at": "2022-11-15T22:06:21+01:00",
          "resource_type": "job_run_v2",
          "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/jobs/my-job-run-1",
          "image_reference": "icr.io/codeengine/helloworld",
          "run_arguments": [],
          "run_commands": [],
          "run_mode": "task",
          "run_volume_mounts": [],
          "run_env_variables": [],
          "scale_array_spec": "0",
          "scale_max_execution_time": 7200,
          "scale_retry_limit": 3,
          "scale_cpu_limit": "1",
          "scale_memory_limit": "4G",
          "scale_ephemeral_storage_limit": "400M",
          "status": "completed"
        }
      ],
      "limit": 50
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Create a job run

Create an job run.

POST /projects/{project_id}/job_runs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.create

Auditing

Calling this method generates the following auditing event.

  • codeengine.jobrun.create

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

Job run prototype

Examples:
{
  "name": "my-job-run-1",
  "job_name": "my-job"
}
  • curl -X POST   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/job_runs"   -H "Authorization: ${token}"   -H "Content-Type: application/json"   -d '{  }'
  • createJobRunOptions := codeEngineService.NewCreateJobRunOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
    )
    
    jobRun, response, err := codeEngineService.CreateJobRun(createJobRunOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(jobRun, "", "  ")
    fmt.Println(string(b))
    
  • CreateJobRunOptions createJobRunOptions = new CreateJobRunOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .build();
    
    Response<JobRun> response = codeEngineService.createJobRun(createJobRunOptions).execute();
    JobRun jobRun = response.getResult();
    
    System.out.println(jobRun);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
    };
    
    let res;
    try {
      res = await codeEngineService.createJobRun(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.create_job_run(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
    )
    job_run = response.get_result()
    
    print(json.dumps(job_run, indent=2))
    

Response

Response model for job run resources.

Status Code

  • Accepted

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "job_name": "my-job",
      "name": "my-job-run-1",
      "id": "ced5039e-b1d3-4c51-aa29-8dbde3531ace",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T22:06:21+01:00",
      "resource_type": "job_run_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/jobs/my-job-run-1",
      "image_reference": "icr.io/codeengine/helloworld",
      "run_arguments": [],
      "run_commands": [],
      "run_mode": "task",
      "run_volume_mounts": [],
      "run_env_variables": [],
      "scale_array_spec": "0",
      "scale_max_execution_time": 7200,
      "scale_retry_limit": 3,
      "scale_cpu_limit": "1",
      "scale_memory_limit": "4G",
      "scale_ephemeral_storage_limit": "400M",
      "status": "completed"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Get a job run

Display the details of a job run.

GET /projects/{project_id}/job_runs/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.jobrun.read

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your job run.

    Possible values: 1 ≤ length ≤ 53, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?$

    Example: my-job-run

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/job_runs/${name}"   -H "Authorization: ${token}" 
    
  • getJobRunOptions := codeEngineService.NewGetJobRunOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-job-run",
    )
    
    jobRun, response, err := codeEngineService.GetJobRun(getJobRunOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(jobRun, "", "  ")
    fmt.Println(string(b))
    
  • GetJobRunOptions getJobRunOptions = new GetJobRunOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-job-run")
      .build();
    
    Response<JobRun> response = codeEngineService.getJobRun(getJobRunOptions).execute();
    JobRun jobRun = response.getResult();
    
    System.out.println(jobRun);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-job-run',
    };
    
    let res;
    try {
      res = await codeEngineService.getJobRun(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.get_job_run(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-job-run',
    )
    job_run = response.get_result()
    
    print(json.dumps(job_run, indent=2))
    

Response

Response model for job run resources.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "job_name": "my-job",
      "name": "my-job-run-1",
      "id": "ced5039e-b1d3-4c51-aa29-8dbde3531ace",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T22:06:21+01:00",
      "resource_type": "job_run_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/jobs/my-job-run-1",
      "image_reference": "icr.io/codeengine/helloworld",
      "run_arguments": [],
      "run_commands": [],
      "run_mode": "task",
      "run_volume_mounts": [],
      "run_env_variables": [],
      "scale_array_spec": "0",
      "scale_max_execution_time": 7200,
      "scale_retry_limit": 3,
      "scale_cpu_limit": "1",
      "scale_memory_limit": "4G",
      "scale_ephemeral_storage_limit": "400M",
      "status": "completed"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Delete a job run

Delete a job run.

DELETE /projects/{project_id}/job_runs/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.delete

Auditing

Calling this method generates the following auditing event.

  • codeengine.jobrun.delete

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your job run.

    Possible values: 1 ≤ length ≤ 53, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?$

    Example: my-job-run

  • curl -X DELETE   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/job_runs/${name}"   -H "Authorization: ${token}" 
    
  • deleteJobRunOptions := codeEngineService.NewDeleteJobRunOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-job-run",
    )
    
    response, err := codeEngineService.DeleteJobRun(deleteJobRunOptions)
    if err != nil {
      panic(err)
    }
    if response.StatusCode != 202 {
      fmt.Printf("\nUnexpected response status code received from DeleteJobRun(): %d\n", response.StatusCode)
    }
    
  • DeleteJobRunOptions deleteJobRunOptions = new DeleteJobRunOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-job-run")
      .build();
    
    Response<Void> response = codeEngineService.deleteJobRun(deleteJobRunOptions).execute();
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-job-run',
    };
    
    try {
      await codeEngineService.deleteJobRun(params);
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.delete_job_run(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-job-run',
    )
    

Response

Status Code

  • Accepted

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

List the function runtimes

List all valid function runtimes.

GET /function_runtimes

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Request

No Request Parameters

This method does not accept any request parameters.

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/function_runtimes"   -H "Authorization: ${token}" 
    
  • listFunctionRuntimesOptions := codeEngineService.NewListFunctionRuntimesOptions()
    
    functionRuntimeList, response, err := codeEngineService.ListFunctionRuntimes(listFunctionRuntimesOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(functionRuntimeList, "", "  ")
    fmt.Println(string(b))
    
  • ListFunctionRuntimesOptions listFunctionRuntimesOptions = new ListFunctionRuntimesOptions();
    
    Response<FunctionRuntimeList> response = codeEngineService.listFunctionRuntimes(listFunctionRuntimesOptions).execute();
    FunctionRuntimeList functionRuntimeList = response.getResult();
    
    System.out.println(functionRuntimeList);
    
  • let res;
    try {
      res = await codeEngineService.listFunctionRuntimes({});
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.list_function_runtimes()
    function_runtime_list = response.get_result()
    
    print(json.dumps(function_runtime_list, indent=2))
    

Response

Contains a list of Function runtimes.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "function_runtimes": [
        {
          "name": "Node.js 18",
          "id": "nodejs-18",
          "family": "nodejs",
          "default": true,
          "optimized": true,
          "deprecated": false
        },
        {
          "name": "Python 3.11",
          "id": "python-3.11",
          "family": "python",
          "default": true,
          "optimized": true,
          "deprecated": false
        }
      ]
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

List functions

List all functions in a project.

GET /projects/{project_id}/functions

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.function.list

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

  • Optional maximum number of functions per page.

    Possible values: 1 ≤ value ≤ 500

    Default: 50

    Example: 100

  • An optional token that indicates the beginning of the page of results to be returned. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation response.

    Possible values: 0 ≤ length ≤ 3000, Value must match regular expression ^[a-zA-Z0-9=]+$

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/functions"   -H "Authorization: ${token}" 
    
  • listFunctionsOptions := &codeenginev2.ListFunctionsOptions{
      ProjectID: core.StringPtr("15314cc3-85b4-4338-903f-c28cdee6d005"),
      Limit: core.Int64Ptr(int64(100)),
    }
    
    pager, err := codeEngineService.NewFunctionsPager(listFunctionsOptions)
    if err != nil {
      panic(err)
    }
    
    var allResults []codeenginev2.Function
    for pager.HasNext() {
      nextPage, err := pager.GetNext()
      if err != nil {
        panic(err)
      }
      allResults = append(allResults, nextPage...)
    }
    b, _ := json.MarshalIndent(allResults, "", "  ")
    fmt.Println(string(b))
    
  • ListFunctionsOptions listFunctionsOptions = new ListFunctionsOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .limit(Long.valueOf("100"))
      .build();
    
    FunctionsPager pager = new FunctionsPager(codeEngineService, listFunctionsOptions);
    List<Function> allResults = new ArrayList<>();
    while (pager.hasNext()) {
      List<Function> nextPage = pager.getNext();
      allResults.addAll(nextPage);
    }
    
    System.out.println(GsonSingleton.getGson().toJson(allResults));
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      limit: 100,
    };
    
    const allResults = [];
    try {
      const pager = new CodeEngineV2.FunctionsPager(codeEngineService, params);
      while (pager.hasNext()) {
        const nextPage = await pager.getNext();
        expect(nextPage).not.toBeNull();
        allResults.push(...nextPage);
      }
      console.log(JSON.stringify(allResults, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • all_results = []
    pager = FunctionsPager(
        client=code_engine_service,
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        limit=100,
    )
    while pager.has_next():
        next_page = pager.get_next()
        assert next_page is not None
        all_results.extend(next_page)
    
    print(json.dumps(all_results, indent=2))
    

Response

Contains a list of functions and pagination information.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "functions": [
        {
          "name": "my-function",
          "id": "3bf57be1-66f0-4a89-ad34-ed77c049935e",
          "project_id": "15314cc3-85b4-4338-903f-c28cdee6d005",
          "created_at": "2023-11-15T22:07:55Z",
          "resource_type": "function_v2",
          "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/functions/my-function",
          "region": "us-east",
          "runtime": "nodejs-18",
          "code_binary": true,
          "code_reference": "icr.io/codeengine/samples/function-nodejs-codebundle",
          "code_secret": "my-secret",
          "entity_tag": "1",
          "endpoint": "https://my-function.uyh5shf7s0f.us-east.codeengine.appdomain.cloud",
          "endpoint_internal": "http://my-function.uyh5shf7s0f.function.cluster.local",
          "managed_domain_mappings": "local_public",
          "scale_cpu_limit": "0.5",
          "scale_memory_limit": "2G",
          "scale_concurrency": 1,
          "scale_max_execution_time": 60,
          "scale_down_delay": 0,
          "status": "ready",
          "status_details": {
            "reason": "ready"
          },
          "run_env_variables": [
            {
              "type": "literal",
              "name": "CE_API_BASE_URL",
              "value": "https://api.us-east.codeengine.cloud.ibm.com"
            },
            {
              "type": "literal",
              "name": "CE_DOMAIN",
              "value": "us-east.codeengine.appdomain.cloud"
            },
            {
              "type": "literal",
              "name": "CE_FUNCTION",
              "value": "my-function"
            },
            {
              "type": "literal",
              "name": "CE_REGION",
              "value": "us-east"
            },
            {
              "type": "literal",
              "name": "CE_SUBDOMAIN",
              "value": "uyh5shf7s0f"
            },
            {
              "type": "literal",
              "name": "CE_PROJECT_ID",
              "value": "15314cc3-85b4-4338-903f-c28cdee6d005"
            }
          ]
        }
      ],
      "limit": 50
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Create a function

Create a function.

POST /projects/{project_id}/functions

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.create

Auditing

Calling this method generates the following auditing event.

  • codeengine.function.create

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

Function prototype

Examples:
{
  "name": "my-function",
  "runtime": "nodejs-18",
  "code_reference": "data:text/plain;base64,<base64encoded-source-code>"
}
  • curl -X POST   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/functions"   -H "Authorization: ${token}"   -H "Content-Type: application/json"   -d '{     "name": "my-function",     "runtime": "nodejs-18",     "code_reference": "data:text/plain;base64,<base64encoded-source-code>"   }'
  • createFunctionOptions := codeEngineService.NewCreateFunctionOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "data:text/plain;base64,<base64encoded-source-code>",
      "my-function",
      "nodejs-18",
    )
    
    function, response, err := codeEngineService.CreateFunction(createFunctionOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(function, "", "  ")
    fmt.Println(string(b))
    
  • CreateFunctionOptions createFunctionOptions = new CreateFunctionOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .codeReference("data:text/plain;base64,<base64encoded-source-code>")
      .name("my-function")
      .runtime("nodejs-18")
      .build();
    
    Response<Function> response = codeEngineService.createFunction(createFunctionOptions).execute();
    Function function = response.getResult();
    
    System.out.println(function);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      codeReference: 'data:text/plain;base64,<base64encoded-source-code>',
      name: 'my-function',
      runtime: 'nodejs-18',
    };
    
    let res;
    try {
      res = await codeEngineService.createFunction(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.create_function(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        code_reference='data:text/plain;base64,<base64encoded-source-code>',
        name='my-function',
        runtime='nodejs-18',
    )
    function = response.get_result()
    
    print(json.dumps(function, indent=2))
    

Response

Function is the response model for function resources

Status Code

  • Created

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "name": "my-function",
      "id": "3bf57be1-66f0-4a89-ad34-ed77c049935e",
      "region": "us-east",
      "project_id": "15314cc3-85b4-4338-903f-c28cdee6d005",
      "created_at": "2023-11-15T22:07:55Z",
      "resource_type": "function_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/functions/my-function",
      "runtime": "nodejs-18",
      "code_binary": false,
      "code_reference": "data:text/plain;base64,<base64encoded-source-code>",
      "managed_domain_mappings": "local_public",
      "entity_tag": "1",
      "endpoint": "https://my-function.uyh5shf7s0f.us-east.codeengine.appdomain.cloud",
      "endpoint_internal": "http://my-function.uyh5shf7s0f.function.cluster.local",
      "scale_cpu_limit": "0.5",
      "scale_memory_limit": "2G",
      "scale_concurrency": 1,
      "scale_max_execution_time": 60,
      "scale_down_delay": 0,
      "status": "ready",
      "status_details": {
        "reason": "ready"
      },
      "run_env_variables": []
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Get a function

Display the details of a function.

GET /projects/{project_id}/functions/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.function.read

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your function.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z]([-a-z0-9]*[a-z0-9])?$

    Example: my-function

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/functions/${name}"   -H "Authorization: ${token}" 
    
  • getFunctionOptions := codeEngineService.NewGetFunctionOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-function",
    )
    
    function, response, err := codeEngineService.GetFunction(getFunctionOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(function, "", "  ")
    fmt.Println(string(b))
    
  • GetFunctionOptions getFunctionOptions = new GetFunctionOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-function")
      .build();
    
    Response<Function> response = codeEngineService.getFunction(getFunctionOptions).execute();
    Function function = response.getResult();
    
    System.out.println(function);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-function',
    };
    
    let res;
    try {
      res = await codeEngineService.getFunction(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.get_function(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-function',
    )
    function = response.get_result()
    
    print(json.dumps(function, indent=2))
    

Response

Function is the response model for function resources

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "my-function",
      "id": "3bf57be1-66f0-4a89-ad34-ed77c049935e",
      "region": "us-east",
      "project_id": "15314cc3-85b4-4338-903f-c28cdee6d005",
      "created_at": "2023-11-15T22:07:55Z",
      "resource_type": "function_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/functions/my-function",
      "runtime": "nodejs-18",
      "code_binary": false,
      "code_reference": "data:text/plain;base64,<base64encoded-source-code>",
      "managed_domain_mappings": "local_public",
      "entity_tag": "1",
      "endpoint": "https://my-function.uyh5shf7s0f.us-east.codeengine.appdomain.cloud",
      "endpoint_internal": "http://my-function.uyh5shf7s0f.function.cluster.local",
      "scale_cpu_limit": "0.5",
      "scale_memory_limit": "2G",
      "scale_concurrency": 1,
      "scale_max_execution_time": 60,
      "scale_down_delay": 0,
      "status": "ready",
      "status_details": {
        "reason": "ready"
      },
      "run_env_variables": []
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Delete a function

Delete a function.

DELETE /projects/{project_id}/functions/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.delete

Auditing

Calling this method generates the following auditing event.

  • codeengine.function.delete

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your function.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z]([-a-z0-9]*[a-z0-9])?$

    Example: my-function

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

  • curl -X DELETE   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/functions/${name}"   -H "Authorization: ${token}" 
    
  • deleteFunctionOptions := codeEngineService.NewDeleteFunctionOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-function",
    )
    
    response, err := codeEngineService.DeleteFunction(deleteFunctionOptions)
    if err != nil {
      panic(err)
    }
    if response.StatusCode != 202 {
      fmt.Printf("\nUnexpected response status code received from DeleteFunction(): %d\n", response.StatusCode)
    }
    
  • DeleteFunctionOptions deleteFunctionOptions = new DeleteFunctionOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-function")
      .build();
    
    Response<Void> response = codeEngineService.deleteFunction(deleteFunctionOptions).execute();
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-function',
    };
    
    try {
      await codeEngineService.deleteFunction(params);
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.delete_function(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-function',
    )
    

Response

Status Code

  • Accepted

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Update a function

Update the given function.

PATCH /projects/{project_id}/functions/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.update

Auditing

Calling this method generates the following auditing events.

  • codeengine.function.read

  • codeengine.function.update

Request

Custom Headers

  • Version of the function settings to be updated. Specify the version that you retrieved as entity_tag (ETag header) when reading the function. This value helps identifying parallel usage of this API. Pass * to indicate to update any version available. This might result in stale updates.

    Possible values: 1 ≤ length ≤ 256, Value must match regular expression ^[0-9]*$

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your function.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z]([-a-z0-9]*[a-z0-9])?$

    Example: my-function

Query Parameters

  • 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.

    Possible values: length = 10, Value must match regular expression ^[0-9]{4}-[0-9]{2}-[0-9]{2}$

    Example: 2024-09-27

Function patch

Examples:
{
  "code_reference": "icr.io/codeengine/samples/function-nodejs-codebundle",
  "code_secret": "my-secret",
  "scale_cpu_limit": "1",
  "scale_memory_limit": "4G"
}
  • curl -X PATCH   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/functions/${name}"   -H "Authorization: ${token}"   -H "Content-Type: application/merge-patch+json"   -d '{  }'
  • functionPatchModel := &codeenginev2.FunctionPatch{
    }
    functionPatchModelAsPatch, asPatchErr := functionPatchModel.AsPatch()
    Expect(asPatchErr).To(BeNil())
    
    updateFunctionOptions := codeEngineService.NewUpdateFunctionOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-function",
      "testString",
      functionPatchModelAsPatch,
    )
    
    function, response, err := codeEngineService.UpdateFunction(updateFunctionOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(function, "", "  ")
    fmt.Println(string(b))
    
  • FunctionPatch functionPatchModel = new FunctionPatch.Builder()
      .build();
    Map<String, Object> functionPatchModelAsPatch = functionPatchModel.asPatch();
    UpdateFunctionOptions updateFunctionOptions = new UpdateFunctionOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-function")
      .ifMatch("testString")
      .function(functionPatchModelAsPatch)
      .build();
    
    Response<Function> response = codeEngineService.updateFunction(updateFunctionOptions).execute();
    Function function = response.getResult();
    
    System.out.println(function);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-function',
      ifMatch: 'testString',
    };
    
    let res;
    try {
      res = await codeEngineService.updateFunction(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • function_patch_model = {}
    
    response = code_engine_service.update_function(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-function',
        if_match='testString',
        function=function_patch_model,
    )
    function = response.get_result()
    
    print(json.dumps(function, indent=2))
    

Response

Function is the response model for function resources

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "my-function",
      "id": "3bf57be1-66f0-4a89-ad34-ed77c049935e",
      "region": "us-east",
      "project_id": "15314cc3-85b4-4338-903f-c28cdee6d005",
      "created_at": "2023-11-15T22:07:55Z",
      "resource_type": "function_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/functions/my-function",
      "runtime": "nodejs-18",
      "code_binary": false,
      "code_reference": "data:text/plain;base64,<base64encoded-source-code>",
      "managed_domain_mappings": "local_public",
      "entity_tag": "1",
      "endpoint": "https://my-function.uyh5shf7s0f.us-east.codeengine.appdomain.cloud",
      "endpoint_internal": "http://my-function.uyh5shf7s0f.function.cluster.local",
      "scale_cpu_limit": "0.5",
      "scale_memory_limit": "2G",
      "scale_concurrency": 1,
      "scale_max_execution_time": 60,
      "scale_down_delay": 0,
      "status": "ready",
      "status_details": {
        "reason": "ready"
      },
      "run_env_variables": []
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

List bindings

List all bindings in a project.

GET /projects/{project_id}/bindings

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing events.

  • codeengine.secret.list

  • codeengine.application.list

  • codeengine.job.list

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Query Parameters

  • Optional maximum number of bindings per page.

    Possible values: 1 ≤ value ≤ 500

    Default: 50

    Example: 100

  • An optional token that indicates the beginning of the page of results to be returned. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the next object of the operation response.

    Possible values: 0 ≤ length ≤ 3000, Value must match regular expression ^[a-zA-Z0-9=]+$

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/bindings"   -H "Authorization: ${token}" 
    
  • listBindingsOptions := &codeenginev2.ListBindingsOptions{
      ProjectID: core.StringPtr("15314cc3-85b4-4338-903f-c28cdee6d005"),
      Limit: core.Int64Ptr(int64(100)),
    }
    
    pager, err := codeEngineService.NewBindingsPager(listBindingsOptions)
    if err != nil {
      panic(err)
    }
    
    var allResults []codeenginev2.Binding
    for pager.HasNext() {
      nextPage, err := pager.GetNext()
      if err != nil {
        panic(err)
      }
      allResults = append(allResults, nextPage...)
    }
    b, _ := json.MarshalIndent(allResults, "", "  ")
    fmt.Println(string(b))
    
  • ListBindingsOptions listBindingsOptions = new ListBindingsOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .limit(Long.valueOf("100"))
      .build();
    
    BindingsPager pager = new BindingsPager(codeEngineService, listBindingsOptions);
    List<Binding> allResults = new ArrayList<>();
    while (pager.hasNext()) {
      List<Binding> nextPage = pager.getNext();
      allResults.addAll(nextPage);
    }
    
    System.out.println(GsonSingleton.getGson().toJson(allResults));
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      limit: 100,
    };
    
    const allResults = [];
    try {
      const pager = new CodeEngineV2.BindingsPager(codeEngineService, params);
      while (pager.hasNext()) {
        const nextPage = await pager.getNext();
        expect(nextPage).not.toBeNull();
        allResults.push(...nextPage);
      }
      console.log(JSON.stringify(allResults, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • all_results = []
    pager = BindingsPager(
        client=code_engine_service,
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        limit=100,
    )
    while pager.has_next():
        next_page = pager.get_next()
        assert next_page is not None
        all_results.extend(next_page)
    
    print(json.dumps(all_results, indent=2))
    

Response

Contains a list of bindings and pagination information.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "bindings": [
        {
          "component": {
            "resource_type": "app_v2",
            "name": "my-app-1"
          },
          "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/bindings/app_my-app-1_my-service-access_PREFIX",
          "id": "app_my-app-1_my-service-access_PREFIX",
          "prefix": "PREFIX",
          "region": "us-east",
          "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b",
          "resource_type": "binding_v2",
          "secret_name": "my-service-access",
          "status": "active"
        }
      ],
      "limit": 50
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Create a binding

Create a binding. Creating a service binding with a Code Engine app will update the app, creating a new revision. For more information see the documentaion

POST /projects/{project_id}/bindings

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following actions. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.create

  • codeengine.tenant.entities.update

Auditing

Calling this method generates the following auditing events.

  • codeengine.secret.create

  • codeengine.secret.read

  • codeengine.secret.update

  • codeengine.application.list

  • codeengine.application.update

  • codeengine.job.list

  • codeengine.job.update

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Binding prototype.

Examples:
{
  "component": {
    "resource_type": "app_v2",
    "name": "my-app-1"
  },
  "prefix": "PREFIX",
  "secret_name": "my-service-access"
}
  • curl -X POST   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/bindings"   -H "Authorization: ${token}"   -H "Content-Type: application/json"   -d '{     "component": {       "resource_type": "app_v2",       "name": "my-app-1",     },     "prefix": "MY_COS",     "secret_name": "my-service-access"   }'
  • componentRefModel := &codeenginev2.ComponentRef{
      Name: core.StringPtr("my-app-1"),
      ResourceType: core.StringPtr("app_v2"),
    }
    
    createBindingOptions := codeEngineService.NewCreateBindingOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      componentRefModel,
      "MY_COS",
      "my-service-access",
    )
    
    binding, response, err := codeEngineService.CreateBinding(createBindingOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(binding, "", "  ")
    fmt.Println(string(b))
    
  • ComponentRef componentRefModel = new ComponentRef.Builder()
      .name("my-app-1")
      .resourceType("app_v2")
      .build();
    CreateBindingOptions createBindingOptions = new CreateBindingOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .component(componentRefModel)
      .prefix("MY_COS")
      .secretName("my-service-access")
      .build();
    
    Response<Binding> response = codeEngineService.createBinding(createBindingOptions).execute();
    Binding binding = response.getResult();
    
    System.out.println(binding);
    
  • // Request models needed by this operation.
    
    // ComponentRef
    const componentRefModel = {
      name: 'my-app-1',
      resource_type: 'app_v2',
    };
    
    const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      component: componentRefModel,
      prefix: 'MY_COS',
      secretName: 'my-service-access',
    };
    
    let res;
    try {
      res = await codeEngineService.createBinding(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • component_ref_model = {
        'name': 'my-app-1',
        'resource_type': 'app_v2',
    }
    
    response = code_engine_service.create_binding(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        component=component_ref_model,
        prefix='MY_COS',
        secret_name='my-service-access',
    )
    binding = response.get_result()
    
    print(json.dumps(binding, indent=2))
    

Response

Describes the model of a binding.

Status Code

  • Created

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "component": {
        "resource_type": "app_v2",
        "name": "my-app-1"
      },
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/15314cc3-85b4-4338-903f-c28cdee6d005/bindings/a172ced-b5f21bc-71ba50c-1638604",
      "id": "a172ced-b5f21bc-71ba50c-1638604",
      "prefix": "PREFIX",
      "project_id": "15314cc3-85b4-4338-903f-c28cdee6d005",
      "resource_type": "binding_v2",
      "secret_name": "my-service-access",
      "status": "active"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Get a binding

Display the details of a binding.

GET /projects/{project_id}/bindings/{id}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.secret.list

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The id of your binding.

    Possible values: 1 ≤ length ≤ 253, Value must match regular expression .+

    Example: a172ced-b5f21bc-71ba50c-1638604

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/bindings/${id}"   -H "Authorization: ${token}" 
    
  • getBindingOptions := codeEngineService.NewGetBindingOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "a172ced-b5f21bc-71ba50c-1638604",
    )
    
    binding, response, err := codeEngineService.GetBinding(getBindingOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(binding, "", "  ")
    fmt.Println(string(b))
    
  • GetBindingOptions getBindingOptions = new GetBindingOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .id("a172ced-b5f21bc-71ba50c-1638604")
      .build();
    
    Response<Binding> response = codeEngineService.getBinding(getBindingOptions).execute();
    Binding binding = response.getResult();
    
    System.out.println(binding);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      id: 'a172ced-b5f21bc-71ba50c-1638604',
    };
    
    let res;
    try {
      res = await codeEngineService.getBinding(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.get_binding(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        id='a172ced-b5f21bc-71ba50c-1638604',
    )
    binding = response.get_result()
    
    print(json.dumps(binding, indent=2))
    

Response

Describes the model of a binding.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "component": {
        "resource_type": "app_v2",
        "name": "my-app-1"
      },
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/15314cc3-85b4-4338-903f-c28cdee6d005/bindings/a172ced-b5f21bc-71ba50c-1638604",
      "id": "a172ced-b5f21bc-71ba50c-1638604",
      "prefix": "PREFIX",
      "project_id": "15314cc3-85b4-4338-903f-c28cdee6d005",
      "resource_type": "binding_v2",
      "secret_name": "my-service-access",
      "status": "active"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Delete a binding

Delete a binding.

DELETE /projects/{project_id}/bindings/{id}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following actions. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.delete

  • codeengine.tenant.entities.update

Auditing

Calling this method generates the following auditing events.

  • codeengine.secret.list

  • codeengine.secret.update

  • codeengine.application.list

  • codeengine.application.update

  • codeengine.job.list

  • codeengine.job.update

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The id of your binding.

    Possible values: 1 ≤ length ≤ 253, Value must match regular expression .+

    Example: a172ced-b5f21bc-71ba50c-1638604

  • curl -X DELETE   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/bindings/${id}"   -H "Authorization: ${token}" 
    
  • deleteBindingOptions := codeEngineService.NewDeleteBindingOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "a172ced-b5f21bc-71ba50c-1638604",
    )
    
    response, err := codeEngineService.DeleteBinding(deleteBindingOptions)
    if err != nil {
      panic(err)
    }
    if response.StatusCode != 202 {
      fmt.Printf("\nUnexpected response status code received from DeleteBinding(): %d\n", response.StatusCode)
    }
    
  • DeleteBindingOptions deleteBindingOptions = new DeleteBindingOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .id("a172ced-b5f21bc-71ba50c-1638604")
      .build();
    
    Response<Void> response = codeEngineService.deleteBinding(deleteBindingOptions).execute();
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      id: 'a172ced-b5f21bc-71ba50c-1638604',
    };
    
    try {
      await codeEngineService.deleteBinding(params);
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.delete_binding(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        id='a172ced-b5f21bc-71ba50c-1638604',
    )
    

Response

Status Code

  • Accepted

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

List builds

List all builds in a project.

GET /projects/{project_id}/builds

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.build.list

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Query Parameters

  • Optional maximum number of builds per page.

    Possible values: 1 ≤ value ≤ 100

    Default: 50

    Example: 100

  • An optional token that indicates the beginning of the page of results to be returned. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the next object of the operation response.

    Possible values: 0 ≤ length ≤ 3000, Value must match regular expression ^[a-zA-Z0-9=]+$

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/builds"   -H "Authorization: ${token}" 
    
  • listBuildsOptions := &codeenginev2.ListBuildsOptions{
      ProjectID: core.StringPtr("15314cc3-85b4-4338-903f-c28cdee6d005"),
      Limit: core.Int64Ptr(int64(100)),
    }
    
    pager, err := codeEngineService.NewBuildsPager(listBuildsOptions)
    if err != nil {
      panic(err)
    }
    
    var allResults []codeenginev2.Build
    for pager.HasNext() {
      nextPage, err := pager.GetNext()
      if err != nil {
        panic(err)
      }
      allResults = append(allResults, nextPage...)
    }
    b, _ := json.MarshalIndent(allResults, "", "  ")
    fmt.Println(string(b))
    
  • ListBuildsOptions listBuildsOptions = new ListBuildsOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .limit(Long.valueOf("100"))
      .build();
    
    BuildsPager pager = new BuildsPager(codeEngineService, listBuildsOptions);
    List<Build> allResults = new ArrayList<>();
    while (pager.hasNext()) {
      List<Build> nextPage = pager.getNext();
      allResults.addAll(nextPage);
    }
    
    System.out.println(GsonSingleton.getGson().toJson(allResults));
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      limit: 100,
    };
    
    const allResults = [];
    try {
      const pager = new CodeEngineV2.BuildsPager(codeEngineService, params);
      while (pager.hasNext()) {
        const nextPage = await pager.getNext();
        expect(nextPage).not.toBeNull();
        allResults.push(...nextPage);
      }
      console.log(JSON.stringify(allResults, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • all_results = []
    pager = BuildsPager(
        client=code_engine_service,
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        limit=100,
    )
    while pager.has_next():
        next_page = pager.get_next()
        assert next_page is not None
        all_results.extend(next_page)
    
    print(json.dumps(all_results, indent=2))
    

Response

Contains a list of builds and pagination information.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "builds": [
        {
          "name": "my-build",
          "id": "27587824-aba8-4f70-8c1d-416326907049",
          "region": "us-east",
          "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
          "created_at": "2022-11-15T11:31:27+01:00",
          "entity_tag": "2385407409",
          "resource_type": "build_v2",
          "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/builds/my-build",
          "source_type": "git",
          "source_url": "https://github.com/IBM/CodeEngine",
          "source_revision": "main",
          "strategy_type": "dockerfile",
          "strategy_size": "medium",
          "output_image": "private.de.icr.io/icr_namespace/test-image-1",
          "output_secret": "ce-auto-icr-private-eu-de",
          "status": "ready",
          "timeout": 600
        }
      ],
      "limit": 50
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Create a build

Create a build.

POST /projects/{project_id}/builds

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.create

Auditing

Calling this method generates the following auditing event.

  • codeengine.build.create

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Build prototype

Examples:
{
  "name": "my-build",
  "source_type": "git",
  "source_revision": "main",
  "source_url": "https://github.com/IBM/CodeEngine",
  "strategy_type": "dockerfile",
  "strategy_size": "medium",
  "output_image": "private.de.icr.io/icr_namespace/test-image-1",
  "output_secret": "ce-auto-icr-private-eu-de"
}
  • curl -X POST   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/builds"   -H "Authorization: ${token}"   -H "Content-Type: application/json"   -d '{     "name": "my-build",     "output_image": "private.de.icr.io/icr_namespace/image-name",     "output_secret": "ce-auto-icr-private-eu-de",     "strategy_type": "dockerfile"   }'
  • createBuildOptions := codeEngineService.NewCreateBuildOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-build",
      "private.de.icr.io/icr_namespace/image-name",
      "ce-auto-icr-private-eu-de",
      "dockerfile",
    )
    
    build, response, err := codeEngineService.CreateBuild(createBuildOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(build, "", "  ")
    fmt.Println(string(b))
    
  • CreateBuildOptions createBuildOptions = new CreateBuildOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-build")
      .outputImage("private.de.icr.io/icr_namespace/image-name")
      .outputSecret("ce-auto-icr-private-eu-de")
      .strategyType("dockerfile")
      .build();
    
    Response<Build> response = codeEngineService.createBuild(createBuildOptions).execute();
    Build build = response.getResult();
    
    System.out.println(build);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-build',
      outputImage: 'private.de.icr.io/icr_namespace/image-name',
      outputSecret: 'ce-auto-icr-private-eu-de',
      strategyType: 'dockerfile',
    };
    
    let res;
    try {
      res = await codeEngineService.createBuild(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.create_build(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-build',
        output_image='private.de.icr.io/icr_namespace/image-name',
        output_secret='ce-auto-icr-private-eu-de',
        strategy_type='dockerfile',
    )
    build = response.get_result()
    
    print(json.dumps(build, indent=2))
    

Response

Response model for build definitions.

Status Code

  • Created

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "name": "my-build",
      "id": "27587824-aba8-4f70-8c1d-416326907049",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T11:31:27+01:00",
      "entity_tag": "2385407409",
      "resource_type": "build_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/builds/my-build",
      "source_type": "git",
      "source_url": "https://github.com/IBM/CodeEngine",
      "source_revision": "main",
      "strategy_type": "dockerfile",
      "strategy_size": "medium",
      "output_image": "private.de.icr.io/icr_namespace/test-image-1",
      "output_secret": "ce-auto-icr-private-eu-de",
      "status": "ready",
      "timeout": 600
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Get a build

Display the details of a build.

GET /projects/{project_id}/builds/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.build.read

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your build.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?$

    Example: my-build

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/builds/${name}"   -H "Authorization: ${token}" 
    
  • getBuildOptions := codeEngineService.NewGetBuildOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-build",
    )
    
    build, response, err := codeEngineService.GetBuild(getBuildOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(build, "", "  ")
    fmt.Println(string(b))
    
  • GetBuildOptions getBuildOptions = new GetBuildOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-build")
      .build();
    
    Response<Build> response = codeEngineService.getBuild(getBuildOptions).execute();
    Build build = response.getResult();
    
    System.out.println(build);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-build',
    };
    
    let res;
    try {
      res = await codeEngineService.getBuild(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.get_build(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-build',
    )
    build = response.get_result()
    
    print(json.dumps(build, indent=2))
    

Response

Response model for build definitions.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "my-build",
      "id": "27587824-aba8-4f70-8c1d-416326907049",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T11:31:27+01:00",
      "entity_tag": "2385407409",
      "resource_type": "build_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/builds/my-build",
      "source_type": "git",
      "source_url": "https://github.com/IBM/CodeEngine",
      "source_revision": "main",
      "strategy_type": "dockerfile",
      "strategy_size": "medium",
      "output_image": "private.de.icr.io/icr_namespace/test-image-1",
      "output_secret": "ce-auto-icr-private-eu-de",
      "status": "ready",
      "timeout": 600
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Delete a build

Delete a build.

DELETE /projects/{project_id}/builds/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.delete

Auditing

Calling this method generates the following auditing event.

  • codeengine.build.delete

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your build.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?$

    Example: my-build

  • curl -X DELETE   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/builds/${name}"   -H "Authorization: ${token}" 
    
  • deleteBuildOptions := codeEngineService.NewDeleteBuildOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-build",
    )
    
    response, err := codeEngineService.DeleteBuild(deleteBuildOptions)
    if err != nil {
      panic(err)
    }
    if response.StatusCode != 202 {
      fmt.Printf("\nUnexpected response status code received from DeleteBuild(): %d\n", response.StatusCode)
    }
    
  • DeleteBuildOptions deleteBuildOptions = new DeleteBuildOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-build")
      .build();
    
    Response<Void> response = codeEngineService.deleteBuild(deleteBuildOptions).execute();
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-build',
    };
    
    try {
      await codeEngineService.deleteBuild(params);
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.delete_build(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-build',
    )
    

Response

Status Code

  • Accepted

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Update a build

Update a build.

PATCH /projects/{project_id}/builds/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.update

Auditing

Calling this method generates the following auditing events.

  • codeengine.build.read

  • codeengine.build.update

Request

Custom Headers

  • Version of the build settings to be updated. Specify the version that you retrieved as entity_tag (ETag header) when reading the build. This value helps identifying parallel usage of this API. Pass * to indicate to update any version available. This might result in stale updates.

    Possible values: 1 ≤ length ≤ 256, Value must match regular expression ^[0-9]*$

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your build.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?$

    Example: my-build

Build patch

Examples:
{
  "source_type": "git",
  "source_revision": "main",
  "source_url": "https://github.com/IBM/CodeEngine",
  "strategy_type": "dockerfile",
  "strategy_size": "large",
  "output_image": "private.de.icr.io/icr_namespace/test-image-1",
  "output_secret": "ce-auto-icr-private-eu-de"
}
  • curl -X PATCH   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/builds/${name}"   -H "Authorization: ${token}"   -H "Content-Type: application/merge-patch+json"   -d '{  }'
  • buildPatchModel := &codeenginev2.BuildPatch{
    }
    buildPatchModelAsPatch, asPatchErr := buildPatchModel.AsPatch()
    Expect(asPatchErr).To(BeNil())
    
    updateBuildOptions := codeEngineService.NewUpdateBuildOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-build",
      "testString",
      buildPatchModelAsPatch,
    )
    
    build, response, err := codeEngineService.UpdateBuild(updateBuildOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(build, "", "  ")
    fmt.Println(string(b))
    
  • BuildPatch buildPatchModel = new BuildPatch.Builder()
      .build();
    Map<String, Object> buildPatchModelAsPatch = buildPatchModel.asPatch();
    UpdateBuildOptions updateBuildOptions = new UpdateBuildOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-build")
      .ifMatch("testString")
      .build(buildPatchModelAsPatch)
      .build();
    
    Response<Build> response = codeEngineService.updateBuild(updateBuildOptions).execute();
    Build build = response.getResult();
    
    System.out.println(build);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-build',
      ifMatch: 'testString',
    };
    
    let res;
    try {
      res = await codeEngineService.updateBuild(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • build_patch_model = {}
    
    response = code_engine_service.update_build(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-build',
        if_match='testString',
        build=build_patch_model,
    )
    build = response.get_result()
    
    print(json.dumps(build, indent=2))
    

Response

Response model for build definitions.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "my-build",
      "id": "27587824-aba8-4f70-8c1d-416326907049",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T11:31:27+01:00",
      "entity_tag": "2385407409",
      "resource_type": "build_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/builds/my-build",
      "source_type": "git",
      "source_url": "https://github.com/IBM/CodeEngine",
      "source_revision": "main",
      "strategy_type": "dockerfile",
      "strategy_size": "medium",
      "output_image": "private.de.icr.io/icr_namespace/test-image-1",
      "output_secret": "ce-auto-icr-private-eu-de",
      "status": "ready",
      "timeout": 600
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

List build runs

List all build runs in a project.

GET /projects/{project_id}/build_runs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.buildrun.list

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Query Parameters

  • Optional name of the build that should be filtered for.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?$

    Example: my-build

  • Optional maximum number of build runs per page.

    Possible values: 1 ≤ value ≤ 500

    Default: 50

    Example: 100

  • An optional token that indicates the beginning of the page of results to be returned. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the next object of the operation response.

    Possible values: 0 ≤ length ≤ 3000, Value must match regular expression ^[a-zA-Z0-9=]+$

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/build_runs"   -H "Authorization: ${token}" 
    
  • listBuildRunsOptions := &codeenginev2.ListBuildRunsOptions{
      ProjectID: core.StringPtr("15314cc3-85b4-4338-903f-c28cdee6d005"),
      BuildName: core.StringPtr("my-build"),
      Limit: core.Int64Ptr(int64(100)),
    }
    
    pager, err := codeEngineService.NewBuildRunsPager(listBuildRunsOptions)
    if err != nil {
      panic(err)
    }
    
    var allResults []codeenginev2.BuildRun
    for pager.HasNext() {
      nextPage, err := pager.GetNext()
      if err != nil {
        panic(err)
      }
      allResults = append(allResults, nextPage...)
    }
    b, _ := json.MarshalIndent(allResults, "", "  ")
    fmt.Println(string(b))
    
  • ListBuildRunsOptions listBuildRunsOptions = new ListBuildRunsOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .buildName("my-build")
      .limit(Long.valueOf("100"))
      .build();
    
    BuildRunsPager pager = new BuildRunsPager(codeEngineService, listBuildRunsOptions);
    List<BuildRun> allResults = new ArrayList<>();
    while (pager.hasNext()) {
      List<BuildRun> nextPage = pager.getNext();
      allResults.addAll(nextPage);
    }
    
    System.out.println(GsonSingleton.getGson().toJson(allResults));
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      buildName: 'my-build',
      limit: 100,
    };
    
    const allResults = [];
    try {
      const pager = new CodeEngineV2.BuildRunsPager(codeEngineService, params);
      while (pager.hasNext()) {
        const nextPage = await pager.getNext();
        expect(nextPage).not.toBeNull();
        allResults.push(...nextPage);
      }
      console.log(JSON.stringify(allResults, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • all_results = []
    pager = BuildRunsPager(
        client=code_engine_service,
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        build_name='my-build',
        limit=100,
    )
    while pager.has_next():
        next_page = pager.get_next()
        assert next_page is not None
        all_results.extend(next_page)
    
    print(json.dumps(all_results, indent=2))
    

Response

Contains a list of build runs and pagination information.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "build_runs": [
        {
          "name": "my-buildrun-1",
          "id": "ca151bf7-b1bf-4e18-a1cb-857329c2d097",
          "region": "us-east",
          "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b",
          "created_at": "2022-06-20T10:10:00+02:00",
          "resource_type": "build_run_v2",
          "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/build_runs/my-buildrun-1",
          "build_name": "my-build",
          "status": "succeeded"
        }
      ],
      "limit": 50
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Create a build run

Create a build run.

POST /projects/{project_id}/build_runs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.create

Auditing

Calling this method generates the following auditing event.

  • codeengine.buildrun.create

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Build run prototype

Examples:
{
  "name": "my-buildrun-1",
  "build_name": "my-build"
}
  • curl -X POST   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/build_runs"   -H "Authorization: ${token}"   -H "Content-Type: application/json"   -d '{  }'
  • createBuildRunOptions := codeEngineService.NewCreateBuildRunOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
    )
    
    buildRun, response, err := codeEngineService.CreateBuildRun(createBuildRunOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(buildRun, "", "  ")
    fmt.Println(string(b))
    
  • CreateBuildRunOptions createBuildRunOptions = new CreateBuildRunOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .build();
    
    Response<BuildRun> response = codeEngineService.createBuildRun(createBuildRunOptions).execute();
    BuildRun buildRun = response.getResult();
    
    System.out.println(buildRun);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
    };
    
    let res;
    try {
      res = await codeEngineService.createBuildRun(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.create_build_run(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
    )
    build_run = response.get_result()
    
    print(json.dumps(build_run, indent=2))
    

Response

Response model for build run objects.

Status Code

  • Accepted

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "name": "my-buildrun-1",
      "id": "ca151bf7-b1bf-4e18-a1cb-857329c2d097",
      "region": "us-east",
      "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b",
      "created_at": "2022-06-20T10:10:00+02:00",
      "resource_type": "build_run_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/build_runs/my-buildrun-1",
      "build_name": "my-build",
      "status": "succeeded"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Get a build run

Display the details of a build run.

GET /projects/{project_id}/build_runs/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.buildrun.read

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your build run.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?$

    Example: my-build-run

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/build_runs/${name}"   -H "Authorization: ${token}" 
    
  • getBuildRunOptions := codeEngineService.NewGetBuildRunOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-build-run",
    )
    
    buildRun, response, err := codeEngineService.GetBuildRun(getBuildRunOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(buildRun, "", "  ")
    fmt.Println(string(b))
    
  • GetBuildRunOptions getBuildRunOptions = new GetBuildRunOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-build-run")
      .build();
    
    Response<BuildRun> response = codeEngineService.getBuildRun(getBuildRunOptions).execute();
    BuildRun buildRun = response.getResult();
    
    System.out.println(buildRun);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-build-run',
    };
    
    let res;
    try {
      res = await codeEngineService.getBuildRun(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.get_build_run(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-build-run',
    )
    build_run = response.get_result()
    
    print(json.dumps(build_run, indent=2))
    

Response

Response model for build run objects.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "my-buildrun-1",
      "id": "ca151bf7-b1bf-4e18-a1cb-857329c2d097",
      "region": "us-east",
      "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b",
      "created_at": "2022-06-20T10:10:00+02:00",
      "resource_type": "build_run_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/build_runs/my-buildrun-1",
      "build_name": "my-build",
      "status": "succeeded"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Delete a build run

Delete a build run.

DELETE /projects/{project_id}/build_runs/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.delete

Auditing

Calling this method generates the following auditing event.

  • codeengine.buildrun.delete

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your build run.

    Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?$

    Example: my-build-run

  • curl -X DELETE   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/build_runs/${name}"   -H "Authorization: ${token}" 
    
  • deleteBuildRunOptions := codeEngineService.NewDeleteBuildRunOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-build-run",
    )
    
    response, err := codeEngineService.DeleteBuildRun(deleteBuildRunOptions)
    if err != nil {
      panic(err)
    }
    if response.StatusCode != 202 {
      fmt.Printf("\nUnexpected response status code received from DeleteBuildRun(): %d\n", response.StatusCode)
    }
    
  • DeleteBuildRunOptions deleteBuildRunOptions = new DeleteBuildRunOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-build-run")
      .build();
    
    Response<Void> response = codeEngineService.deleteBuildRun(deleteBuildRunOptions).execute();
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-build-run',
    };
    
    try {
      await codeEngineService.deleteBuildRun(params);
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.delete_build_run(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-build-run',
    )
    

Response

Status Code

  • Accepted

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

List domain mappings

List all domain mappings in a project.

GET /projects/{project_id}/domain_mappings

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.domainmapping.list

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Query Parameters

  • Optional maximum number of domain mappings per page.

    Possible values: 1 ≤ value ≤ 100

    Default: 50

    Example: 100

  • An optional token that indicates the beginning of the page of results to be returned. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the next object of the operation response.

    Possible values: 0 ≤ length ≤ 3000, Value must match regular expression ^[a-zA-Z0-9=]+$

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/domain_mappings"   -H "Authorization: ${token}" 
    
  • listDomainMappingsOptions := &codeenginev2.ListDomainMappingsOptions{
      ProjectID: core.StringPtr("15314cc3-85b4-4338-903f-c28cdee6d005"),
      Limit: core.Int64Ptr(int64(100)),
    }
    
    pager, err := codeEngineService.NewDomainMappingsPager(listDomainMappingsOptions)
    if err != nil {
      panic(err)
    }
    
    var allResults []codeenginev2.DomainMapping
    for pager.HasNext() {
      nextPage, err := pager.GetNext()
      if err != nil {
        panic(err)
      }
      allResults = append(allResults, nextPage...)
    }
    b, _ := json.MarshalIndent(allResults, "", "  ")
    fmt.Println(string(b))
    
  • ListDomainMappingsOptions listDomainMappingsOptions = new ListDomainMappingsOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .limit(Long.valueOf("100"))
      .build();
    
    DomainMappingsPager pager = new DomainMappingsPager(codeEngineService, listDomainMappingsOptions);
    List<DomainMapping> allResults = new ArrayList<>();
    while (pager.hasNext()) {
      List<DomainMapping> nextPage = pager.getNext();
      allResults.addAll(nextPage);
    }
    
    System.out.println(GsonSingleton.getGson().toJson(allResults));
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      limit: 100,
    };
    
    const allResults = [];
    try {
      const pager = new CodeEngineV2.DomainMappingsPager(codeEngineService, params);
      while (pager.hasNext()) {
        const nextPage = await pager.getNext();
        expect(nextPage).not.toBeNull();
        allResults.push(...nextPage);
      }
      console.log(JSON.stringify(allResults, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • all_results = []
    pager = DomainMappingsPager(
        client=code_engine_service,
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        limit=100,
    )
    while pager.has_next():
        next_page = pager.get_next()
        assert next_page is not None
        all_results.extend(next_page)
    
    print(json.dumps(all_results, indent=2))
    

Response

Contains a list of domain mappings and pagination information.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "domain_mappings": [
        {
          "name": "www.example.com",
          "id": "27587824-aba8-4f70-8c1d-416326907049",
          "region": "us-east",
          "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
          "created_at": "2022-11-15T11:31:27+01:00",
          "entity_tag": "2385407409",
          "resource_type": "domain_mapping_v2",
          "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/domain_mappings/www.example.com",
          "cname_target": "custom.abcdabcdabc.us-east.codeengine.appdomain.cloud",
          "component": {
            "name": "my-app",
            "resource_type": "app_v2"
          },
          "tls_secret": "my-tls-secret",
          "visibility": "custom",
          "user_managed": true,
          "status": "ready"
        }
      ],
      "limit": 50
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Create a domain mapping

Create a domain mapping

POST /projects/{project_id}/domain_mappings

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.create

Auditing

Calling this method generates the following auditing event.

  • codeengine.domainmapping.create

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

DomainMapping prototype

Examples:
{
  "name": "www.example.com",
  "component": {
    "name": "my-app",
    "resource_type": "app_v2"
  },
  "tls_secret": "my-tls-secret"
}
  • curl -X POST   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/domain_mappings"   -H "Authorization: ${token}"   -H "Content-Type: application/json"   -d '{     "name": "www.example.com",     "component": {       "resource_type": "app_v2",       "name": "my-app-1",     },     "tls_secret": "my-tls-secret"   }'
  • componentRefModel := &codeenginev2.ComponentRef{
      Name: core.StringPtr("my-app-1"),
      ResourceType: core.StringPtr("app_v2"),
    }
    
    createDomainMappingOptions := codeEngineService.NewCreateDomainMappingOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      componentRefModel,
      "www.example.com",
      "my-tls-secret",
    )
    
    domainMapping, response, err := codeEngineService.CreateDomainMapping(createDomainMappingOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(domainMapping, "", "  ")
    fmt.Println(string(b))
    
  • ComponentRef componentRefModel = new ComponentRef.Builder()
      .name("my-app-1")
      .resourceType("app_v2")
      .build();
    CreateDomainMappingOptions createDomainMappingOptions = new CreateDomainMappingOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .component(componentRefModel)
      .name("www.example.com")
      .tlsSecret("my-tls-secret")
      .build();
    
    Response<DomainMapping> response = codeEngineService.createDomainMapping(createDomainMappingOptions).execute();
    DomainMapping domainMapping = response.getResult();
    
    System.out.println(domainMapping);
    
  • // Request models needed by this operation.
    
    // ComponentRef
    const componentRefModel = {
      name: 'my-app-1',
      resource_type: 'app_v2',
    };
    
    const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      component: componentRefModel,
      name: 'www.example.com',
      tlsSecret: 'my-tls-secret',
    };
    
    let res;
    try {
      res = await codeEngineService.createDomainMapping(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • component_ref_model = {
        'name': 'my-app-1',
        'resource_type': 'app_v2',
    }
    
    response = code_engine_service.create_domain_mapping(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        component=component_ref_model,
        name='www.example.com',
        tls_secret='my-tls-secret',
    )
    domain_mapping = response.get_result()
    
    print(json.dumps(domain_mapping, indent=2))
    

Response

Response model for domain mapping definitions.

Status Code

  • Created

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "name": "www.example.com",
      "id": "27587824-aba8-4f70-8c1d-416326907049",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T11:31:27+01:00",
      "entity_tag": "2385407409",
      "resource_type": "domain_mapping_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/domain_mappings/www.example.com",
      "cname_target": "custom.abcdabcdabc.us-east.codeengine.appdomain.cloud",
      "component": {
        "name": "my-app",
        "resource_type": "app_v2"
      },
      "tls_secret": "my-tls-secret",
      "visibility": "custom",
      "user_managed": true,
      "status": "ready"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Get a domain mapping

Get domain mapping

GET /projects/{project_id}/domain_mappings/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.domainmapping.read

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your domain mapping.

    Possible values: 1 ≤ length ≤ 253, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([\-a-z0-9]*[a-z0-9])?)+$

    Example: www.example.com

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/domain_mappings/${name}"   -H "Authorization: ${token}" 
    
  • getDomainMappingOptions := codeEngineService.NewGetDomainMappingOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "www.example.com",
    )
    
    domainMapping, response, err := codeEngineService.GetDomainMapping(getDomainMappingOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(domainMapping, "", "  ")
    fmt.Println(string(b))
    
  • GetDomainMappingOptions getDomainMappingOptions = new GetDomainMappingOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("www.example.com")
      .build();
    
    Response<DomainMapping> response = codeEngineService.getDomainMapping(getDomainMappingOptions).execute();
    DomainMapping domainMapping = response.getResult();
    
    System.out.println(domainMapping);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'www.example.com',
    };
    
    let res;
    try {
      res = await codeEngineService.getDomainMapping(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.get_domain_mapping(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='www.example.com',
    )
    domain_mapping = response.get_result()
    
    print(json.dumps(domain_mapping, indent=2))
    

Response

Response model for domain mapping definitions.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "www.example.com",
      "id": "27587824-aba8-4f70-8c1d-416326907049",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T11:31:27+01:00",
      "entity_tag": "2385407409",
      "resource_type": "domain_mapping_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/domain_mappings/www.example.com",
      "cname_target": "custom.abcdabcdabc.us-east.codeengine.appdomain.cloud",
      "component": {
        "name": "my-app",
        "resource_type": "app_v2"
      },
      "tls_secret": "my-tls-secret",
      "visibility": "custom",
      "user_managed": true,
      "status": "ready"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Delete a domain mapping

Delete a domain mapping

DELETE /projects/{project_id}/domain_mappings/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.delete

Auditing

Calling this method generates the following auditing event.

  • codeengine.domainmapping.delete

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your domain mapping.

    Possible values: 1 ≤ length ≤ 253, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([\-a-z0-9]*[a-z0-9])?)+$

    Example: www.example.com

  • curl -X DELETE   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/domain_mappings/${name}"   -H "Authorization: ${token}" 
    
  • deleteDomainMappingOptions := codeEngineService.NewDeleteDomainMappingOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "www.example.com",
    )
    
    response, err := codeEngineService.DeleteDomainMapping(deleteDomainMappingOptions)
    if err != nil {
      panic(err)
    }
    if response.StatusCode != 202 {
      fmt.Printf("\nUnexpected response status code received from DeleteDomainMapping(): %d\n", response.StatusCode)
    }
    
  • DeleteDomainMappingOptions deleteDomainMappingOptions = new DeleteDomainMappingOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("www.example.com")
      .build();
    
    Response<Void> response = codeEngineService.deleteDomainMapping(deleteDomainMappingOptions).execute();
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'www.example.com',
    };
    
    try {
      await codeEngineService.deleteDomainMapping(params);
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.delete_domain_mapping(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='www.example.com',
    )
    

Response

Status Code

  • Accepted

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Update a domain mapping

Update a domain mapping

PATCH /projects/{project_id}/domain_mappings/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.update

Auditing

Calling this method generates the following auditing events.

  • codeengine.domainmapping.read

  • codeengine.domainmapping.update

Request

Custom Headers

  • Version of the domain mapping to be updated. Specify the version that you retrieved as entity_tag (ETag header) when reading the domain mapping. This value helps identify parallel usage of this API. Pass * to indicate to update any version available. This might result in stale updates.

    Possible values: 1 ≤ length ≤ 256, Value must match regular expression ^[0-9]*$

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your domain mapping.

    Possible values: 1 ≤ length ≤ 253, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([\-a-z0-9]*[a-z0-9])?)+$

    Example: www.example.com

DomainMapping patch

Examples:
{
  "component": {
    "name": "my-app",
    "resource_type": "app_v2"
  },
  "tls_secret": "my-tls-secret"
}
  • curl -X PATCH   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/domain_mappings/${name}"   -H "Authorization: ${token}"   -H "Content-Type: application/merge-patch+json"   -d '{  }'
  • domainMappingPatchModel := &codeenginev2.DomainMappingPatch{
    }
    domainMappingPatchModelAsPatch, asPatchErr := domainMappingPatchModel.AsPatch()
    Expect(asPatchErr).To(BeNil())
    
    updateDomainMappingOptions := codeEngineService.NewUpdateDomainMappingOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "www.example.com",
      "testString",
      domainMappingPatchModelAsPatch,
    )
    
    domainMapping, response, err := codeEngineService.UpdateDomainMapping(updateDomainMappingOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(domainMapping, "", "  ")
    fmt.Println(string(b))
    
  • DomainMappingPatch domainMappingPatchModel = new DomainMappingPatch.Builder()
      .build();
    Map<String, Object> domainMappingPatchModelAsPatch = domainMappingPatchModel.asPatch();
    UpdateDomainMappingOptions updateDomainMappingOptions = new UpdateDomainMappingOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("www.example.com")
      .ifMatch("testString")
      .domainMapping(domainMappingPatchModelAsPatch)
      .build();
    
    Response<DomainMapping> response = codeEngineService.updateDomainMapping(updateDomainMappingOptions).execute();
    DomainMapping domainMapping = response.getResult();
    
    System.out.println(domainMapping);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'www.example.com',
      ifMatch: 'testString',
    };
    
    let res;
    try {
      res = await codeEngineService.updateDomainMapping(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • domain_mapping_patch_model = {}
    
    response = code_engine_service.update_domain_mapping(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='www.example.com',
        if_match='testString',
        domain_mapping=domain_mapping_patch_model,
    )
    domain_mapping = response.get_result()
    
    print(json.dumps(domain_mapping, indent=2))
    

Response

Response model for domain mapping definitions.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "www.example.com",
      "id": "27587824-aba8-4f70-8c1d-416326907049",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T11:31:27+01:00",
      "entity_tag": "2385407409",
      "resource_type": "domain_mapping_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/domain_mappings/www.example.com",
      "cname_target": "custom.abcdabcdabc.us-east.codeengine.appdomain.cloud",
      "component": {
        "name": "my-app",
        "resource_type": "app_v2"
      },
      "tls_secret": "my-tls-secret",
      "visibility": "custom",
      "user_managed": true,
      "status": "ready"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

List config maps

List all config maps in a project.

GET /projects/{project_id}/config_maps

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.configmap.list

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Query Parameters

  • Optional maximum number of config maps per page.

    Possible values: 1 ≤ value ≤ 500

    Default: 50

    Example: 100

  • An optional token that indicates the beginning of the page of results to be returned. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the next object of the operation response.

    Possible values: 0 ≤ length ≤ 3000, Value must match regular expression ^[a-zA-Z0-9=]+$

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/config_maps"   -H "Authorization: ${token}" 
    
  • listConfigMapsOptions := &codeenginev2.ListConfigMapsOptions{
      ProjectID: core.StringPtr("15314cc3-85b4-4338-903f-c28cdee6d005"),
      Limit: core.Int64Ptr(int64(100)),
    }
    
    pager, err := codeEngineService.NewConfigMapsPager(listConfigMapsOptions)
    if err != nil {
      panic(err)
    }
    
    var allResults []codeenginev2.ConfigMap
    for pager.HasNext() {
      nextPage, err := pager.GetNext()
      if err != nil {
        panic(err)
      }
      allResults = append(allResults, nextPage...)
    }
    b, _ := json.MarshalIndent(allResults, "", "  ")
    fmt.Println(string(b))
    
  • ListConfigMapsOptions listConfigMapsOptions = new ListConfigMapsOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .limit(Long.valueOf("100"))
      .build();
    
    ConfigMapsPager pager = new ConfigMapsPager(codeEngineService, listConfigMapsOptions);
    List<ConfigMap> allResults = new ArrayList<>();
    while (pager.hasNext()) {
      List<ConfigMap> nextPage = pager.getNext();
      allResults.addAll(nextPage);
    }
    
    System.out.println(GsonSingleton.getGson().toJson(allResults));
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      limit: 100,
    };
    
    const allResults = [];
    try {
      const pager = new CodeEngineV2.ConfigMapsPager(codeEngineService, params);
      while (pager.hasNext()) {
        const nextPage = await pager.getNext();
        expect(nextPage).not.toBeNull();
        allResults.push(...nextPage);
      }
      console.log(JSON.stringify(allResults, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • all_results = []
    pager = ConfigMapsPager(
        client=code_engine_service,
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        limit=100,
    )
    while pager.has_next():
        next_page = pager.get_next()
        assert next_page is not None
        all_results.extend(next_page)
    
    print(json.dumps(all_results, indent=2))
    

Response

Contains a list of config maps and pagination information.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "config_maps": [
        {
          "name": "my-config-map",
          "id": "b8376985-d6df-43c5-8feb-194d45390bc8",
          "region": "us-east",
          "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
          "created_at": "2022-11-15T21:45:49+01:00",
          "resource_type": "config_map_v2",
          "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/config_maps/my-config-map",
          "data": {
            "MY_PROPERTY": "VALUE"
          },
          "entity_tag": "2386238209"
        }
      ],
      "limit": 50
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Create a config map

Create a config map.

POST /projects/{project_id}/config_maps

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.create

Auditing

Calling this method generates the following auditing event.

  • codeengine.configmap.create

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Config map prototype.

Examples:
{
  "name": "my-config-map",
  "data": {
    "MY_PROPERTY": "VALUE"
  }
}
  • curl -X POST   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/config_maps"   -H "Authorization: ${token}"   -H "Content-Type: application/json"   -d '{     "name": "my-config-map"   }'
  • createConfigMapOptions := codeEngineService.NewCreateConfigMapOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-config-map",
    )
    
    configMap, response, err := codeEngineService.CreateConfigMap(createConfigMapOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(configMap, "", "  ")
    fmt.Println(string(b))
    
  • CreateConfigMapOptions createConfigMapOptions = new CreateConfigMapOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-config-map")
      .build();
    
    Response<ConfigMap> response = codeEngineService.createConfigMap(createConfigMapOptions).execute();
    ConfigMap configMap = response.getResult();
    
    System.out.println(configMap);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-config-map',
    };
    
    let res;
    try {
      res = await codeEngineService.createConfigMap(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.create_config_map(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-config-map',
    )
    config_map = response.get_result()
    
    print(json.dumps(config_map, indent=2))
    

Response

Describes the model of a configmap.

Status Code

  • Created

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "name": "my-config-map",
      "id": "b8376985-d6df-43c5-8feb-194d45390bc8",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T21:45:49+01:00",
      "resource_type": "config_map_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/config_maps/my-config-map",
      "data": {
        "MY_PROPERTY": "VALUE"
      },
      "entity_tag": "2386238209"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Get a config map

Display the details of a config map.

GET /projects/{project_id}/config_maps/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.configmap.read

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your configmap.

    Possible values: 1 ≤ length ≤ 253, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([\-a-z0-9]*[a-z0-9])?)*$

    Example: my-config-map

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/config_maps/${name}"   -H "Authorization: ${token}" 
    
  • getConfigMapOptions := codeEngineService.NewGetConfigMapOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-config-map",
    )
    
    configMap, response, err := codeEngineService.GetConfigMap(getConfigMapOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(configMap, "", "  ")
    fmt.Println(string(b))
    
  • GetConfigMapOptions getConfigMapOptions = new GetConfigMapOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-config-map")
      .build();
    
    Response<ConfigMap> response = codeEngineService.getConfigMap(getConfigMapOptions).execute();
    ConfigMap configMap = response.getResult();
    
    System.out.println(configMap);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-config-map',
    };
    
    let res;
    try {
      res = await codeEngineService.getConfigMap(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.get_config_map(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-config-map',
    )
    config_map = response.get_result()
    
    print(json.dumps(config_map, indent=2))
    

Response

Describes the model of a configmap.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "my-config-map",
      "id": "b8376985-d6df-43c5-8feb-194d45390bc8",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T21:45:49+01:00",
      "resource_type": "config_map_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/config_maps/my-config-map",
      "data": {
        "MY_PROPERTY": "VALUE"
      },
      "entity_tag": "2386238209"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Update a config map

Update a config map.

PUT /projects/{project_id}/config_maps/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.update

Auditing

Calling this method generates the following auditing events.

  • codeengine.configmap.read

  • codeengine.configmap.update

Request

Custom Headers

  • Version of the config map settings to be updated. Specify the version that you retrieved as entity_tag (ETag header) when reading the config map. This value helps identifying parallel usage of this API. Pass * to indicate to update any version available. This might result in stale updates.

    Possible values: 1 ≤ length ≤ 256, Value must match regular expression ^[0-9]*$

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your configmap.

    Possible values: 1 ≤ length ≤ 253, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([\-a-z0-9]*[a-z0-9])?)*$

    Example: my-config-map

Config map prototype.

Examples:
{
  "data": {
    "MY_PROPERTY": "OTHER"
  }
}
  • curl -X PUT   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/config_maps/${name}"   -H "Authorization: ${token}"   -H "Content-Type: application/json"   -d '{  }'
  • replaceConfigMapOptions := codeEngineService.NewReplaceConfigMapOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-config-map",
      "testString",
    )
    
    configMap, response, err := codeEngineService.ReplaceConfigMap(replaceConfigMapOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(configMap, "", "  ")
    fmt.Println(string(b))
    
  • ReplaceConfigMapOptions replaceConfigMapOptions = new ReplaceConfigMapOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-config-map")
      .ifMatch("testString")
      .build();
    
    Response<ConfigMap> response = codeEngineService.replaceConfigMap(replaceConfigMapOptions).execute();
    ConfigMap configMap = response.getResult();
    
    System.out.println(configMap);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-config-map',
      ifMatch: 'testString',
    };
    
    let res;
    try {
      res = await codeEngineService.replaceConfigMap(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.replace_config_map(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-config-map',
        if_match='testString',
    )
    config_map = response.get_result()
    
    print(json.dumps(config_map, indent=2))
    

Response

Describes the model of a configmap.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "my-config-map",
      "id": "b8376985-d6df-43c5-8feb-194d45390bc8",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T21:45:49+01:00",
      "resource_type": "config_map_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/config_maps/my-config-map",
      "data": {
        "MY_PROPERTY": "VALUE"
      },
      "entity_tag": "2386238209"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Delete a config map

Delete a config map.

DELETE /projects/{project_id}/config_maps/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.delete

Auditing

Calling this method generates the following auditing event.

  • codeengine.configmap.delete

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your configmap.

    Possible values: 1 ≤ length ≤ 253, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([\-a-z0-9]*[a-z0-9])?)*$

    Example: my-config-map

  • curl -X DELETE   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/config_maps/${name}"   -H "Authorization: ${token}" 
    
  • deleteConfigMapOptions := codeEngineService.NewDeleteConfigMapOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-config-map",
    )
    
    response, err := codeEngineService.DeleteConfigMap(deleteConfigMapOptions)
    if err != nil {
      panic(err)
    }
    if response.StatusCode != 202 {
      fmt.Printf("\nUnexpected response status code received from DeleteConfigMap(): %d\n", response.StatusCode)
    }
    
  • DeleteConfigMapOptions deleteConfigMapOptions = new DeleteConfigMapOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-config-map")
      .build();
    
    Response<Void> response = codeEngineService.deleteConfigMap(deleteConfigMapOptions).execute();
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-config-map',
    };
    
    try {
      await codeEngineService.deleteConfigMap(params);
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.delete_config_map(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-config-map',
    )
    

Response

Status Code

  • Accepted

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

List secrets

List all secrets in a project.

GET /projects/{project_id}/secrets

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.secret.list

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Query Parameters

  • Optional maximum number of secrets per page.

    Possible values: 1 ≤ value ≤ 500

    Default: 50

    Example: 100

  • An optional token that indicates the beginning of the page of results to be returned. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the next object of the operation response.

    Possible values: 0 ≤ length ≤ 3000, Value must match regular expression ^[a-zA-Z0-9=]+$

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/secrets"   -H "Authorization: ${token}" 
    
  • listSecretsOptions := &codeenginev2.ListSecretsOptions{
      ProjectID: core.StringPtr("15314cc3-85b4-4338-903f-c28cdee6d005"),
      Limit: core.Int64Ptr(int64(100)),
    }
    
    pager, err := codeEngineService.NewSecretsPager(listSecretsOptions)
    if err != nil {
      panic(err)
    }
    
    var allResults []codeenginev2.Secret
    for pager.HasNext() {
      nextPage, err := pager.GetNext()
      if err != nil {
        panic(err)
      }
      allResults = append(allResults, nextPage...)
    }
    b, _ := json.MarshalIndent(allResults, "", "  ")
    fmt.Println(string(b))
    
  • ListSecretsOptions listSecretsOptions = new ListSecretsOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .limit(Long.valueOf("100"))
      .build();
    
    SecretsPager pager = new SecretsPager(codeEngineService, listSecretsOptions);
    List<Secret> allResults = new ArrayList<>();
    while (pager.hasNext()) {
      List<Secret> nextPage = pager.getNext();
      allResults.addAll(nextPage);
    }
    
    System.out.println(GsonSingleton.getGson().toJson(allResults));
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      limit: 100,
    };
    
    const allResults = [];
    try {
      const pager = new CodeEngineV2.SecretsPager(codeEngineService, params);
      while (pager.hasNext()) {
        const nextPage = await pager.getNext();
        expect(nextPage).not.toBeNull();
        allResults.push(...nextPage);
      }
      console.log(JSON.stringify(allResults, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • all_results = []
    pager = SecretsPager(
        client=code_engine_service,
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        limit=100,
    )
    while pager.has_next():
        next_page = pager.get_next()
        assert next_page is not None
        all_results.extend(next_page)
    
    print(json.dumps(all_results, indent=2))
    

Response

List of secret resources.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "secrets": [
        {
          "name": "my-secret",
          "id": "36e3a621-4895-4bd1-b7e8-1163ab49a28f",
          "region": "us-east",
          "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
          "created_at": "2022-11-15T21:59:08+01:00",
          "resource_type": "secret_generic_v2",
          "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/secrets/my-secret",
          "format": "generic",
          "data": {
            "MY_PROPERTY": "VALUE"
          },
          "entity_tag": "2386255530"
        }
      ],
      "limit": 50
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Create a secret

Create a secret.

POST /projects/{project_id}/secrets

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.create

Auditing

Calling this method generates the following auditing event.

  • codeengine.secret.create

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

Secret prototype.

Examples:
{
  "name": "my-secret",
  "format": "generic",
  "data": {
    "MY_PROPERTY": "VALUE"
  }
}
  • curl -X POST   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/secrets"   -H "Authorization: ${token}"   -H "Content-Type: application/json"   -d '{     "name": "my-secret",     "format": "generic"   }'
  • createSecretOptions := codeEngineService.NewCreateSecretOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "generic",
      "my-secret",
    )
    
    secret, response, err := codeEngineService.CreateSecret(createSecretOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(secret, "", "  ")
    fmt.Println(string(b))
    
  • CreateSecretOptions createSecretOptions = new CreateSecretOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .format("generic")
      .name("my-secret")
      .build();
    
    Response<Secret> response = codeEngineService.createSecret(createSecretOptions).execute();
    Secret secret = response.getResult();
    
    System.out.println(secret);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      format: 'generic',
      name: 'my-secret',
    };
    
    let res;
    try {
      res = await codeEngineService.createSecret(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.create_secret(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        format='generic',
        name='my-secret',
    )
    secret = response.get_result()
    
    print(json.dumps(secret, indent=2))
    

Response

Describes the model of a secret.

Status Code

  • Created

  • Bad Request

  • Unauthorized

  • Forbidden

  • Internal Server Error

Example responses
  • {
      "name": "my-secret",
      "id": "36e3a621-4895-4bd1-b7e8-1163ab49a28f",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T21:59:08+01:00",
      "resource_type": "secret_generic_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/secrets/my-secret",
      "format": "generic",
      "data": {
        "MY_PROPERTY": "VALUE"
      },
      "entity_tag": "2386255530"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Get a secret

Get a secret.

GET /projects/{project_id}/secrets/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.read

Auditing

Calling this method generates the following auditing event.

  • codeengine.secret.read

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your secret.

    Possible values: 1 ≤ length ≤ 253, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([\-a-z0-9]*[a-z0-9])?)*$

    Example: my-secret

  • curl -X GET   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/secrets/${name}"   -H "Authorization: ${token}" 
    
  • getSecretOptions := codeEngineService.NewGetSecretOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-secret",
    )
    
    secret, response, err := codeEngineService.GetSecret(getSecretOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(secret, "", "  ")
    fmt.Println(string(b))
    
  • GetSecretOptions getSecretOptions = new GetSecretOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-secret")
      .build();
    
    Response<Secret> response = codeEngineService.getSecret(getSecretOptions).execute();
    Secret secret = response.getResult();
    
    System.out.println(secret);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-secret',
    };
    
    let res;
    try {
      res = await codeEngineService.getSecret(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.get_secret(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-secret',
    )
    secret = response.get_result()
    
    print(json.dumps(secret, indent=2))
    

Response

Describes the model of a secret.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "name": "my-secret",
      "id": "36e3a621-4895-4bd1-b7e8-1163ab49a28f",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T21:59:08+01:00",
      "resource_type": "secret_generic_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/secrets/my-secret",
      "format": "generic",
      "data": {
        "MY_PROPERTY": "VALUE"
      },
      "entity_tag": "2386255530"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Update a secret

Update a secret.

PUT /projects/{project_id}/secrets/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.update

Auditing

Calling this method generates the following auditing events.

  • codeengine.secret.read

  • codeengine.secret.update

Request

Custom Headers

  • Version of the secret settings to be updated. Specify the version that you retrieved as entity_tag (ETag header) when reading the secret. This value helps identifying parallel usage of this API. Pass * to indicate to update any version available. This might result in stale updates.

    Possible values: 1 ≤ length ≤ 256, Value must match regular expression ^[0-9]*$

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your secret.

    Possible values: 1 ≤ length ≤ 253, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([\-a-z0-9]*[a-z0-9])?)*$

    Example: my-secret

Secret patch.

Examples:
{
  "format": "generic",
  "data": {
    "MY_PROPERTY": "OTHER"
  }
}
  • curl -X PUT   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/secrets/${name}"   -H "Authorization: ${token}"   -H "Content-Type: application/json"   -d '{     "format": "generic"   }'
  • replaceSecretOptions := codeEngineService.NewReplaceSecretOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-secret",
      "testString",
      "generic",
    )
    
    secret, response, err := codeEngineService.ReplaceSecret(replaceSecretOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(secret, "", "  ")
    fmt.Println(string(b))
    
  • ReplaceSecretOptions replaceSecretOptions = new ReplaceSecretOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-secret")
      .ifMatch("testString")
      .format("generic")
      .build();
    
    Response<Secret> response = codeEngineService.replaceSecret(replaceSecretOptions).execute();
    Secret secret = response.getResult();
    
    System.out.println(secret);
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-secret',
      ifMatch: 'testString',
      format: 'generic',
    };
    
    let res;
    try {
      res = await codeEngineService.replaceSecret(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.replace_secret(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-secret',
        if_match='testString',
        format='generic',
    )
    secret = response.get_result()
    
    print(json.dumps(secret, indent=2))
    

Response

Describes the model of a secret.

Status Code

  • OK

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Conflict

  • Internal Server Error

Example responses
  • {
      "name": "my-secret",
      "id": "36e3a621-4895-4bd1-b7e8-1163ab49a28f",
      "region": "us-east",
      "project_id": "230828b4-4f15-40a9-b183-1268c6ab88d5",
      "created_at": "2022-11-15T21:59:08+01:00",
      "resource_type": "secret_generic_v2",
      "href": "https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/secrets/my-secret",
      "format": "generic",
      "data": {
        "MY_PROPERTY": "VALUE"
      },
      "entity_tag": "2386255530"
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }

Delete a secret

Delete a secret.

DELETE /projects/{project_id}/secrets/{name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • codeengine.tenant.entities.delete

Auditing

Calling this method generates the following auditing event.

  • codeengine.secret.delete

Request

Path Parameters

  • The ID of the project.

    Possible values: length = 36, Value must match regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

    Example: 15314cc3-85b4-4338-903f-c28cdee6d005

  • The name of your secret.

    Possible values: 1 ≤ length ≤ 253, Value must match regular expression ^[a-z0-9]([\-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([\-a-z0-9]*[a-z0-9])?)*$

    Example: my-secret

  • curl -X DELETE   "https://api.${region}.codeengine.cloud.ibm.com/v2/projects/${project_id}/secrets/${name}"   -H "Authorization: ${token}" 
    
  • deleteSecretOptions := codeEngineService.NewDeleteSecretOptions(
      "15314cc3-85b4-4338-903f-c28cdee6d005",
      "my-secret",
    )
    
    response, err := codeEngineService.DeleteSecret(deleteSecretOptions)
    if err != nil {
      panic(err)
    }
    if response.StatusCode != 202 {
      fmt.Printf("\nUnexpected response status code received from DeleteSecret(): %d\n", response.StatusCode)
    }
    
  • DeleteSecretOptions deleteSecretOptions = new DeleteSecretOptions.Builder()
      .projectId("15314cc3-85b4-4338-903f-c28cdee6d005")
      .name("my-secret")
      .build();
    
    Response<Void> response = codeEngineService.deleteSecret(deleteSecretOptions).execute();
    
  • const params = {
      projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
      name: 'my-secret',
    };
    
    try {
      await codeEngineService.deleteSecret(params);
    } catch (err) {
      console.warn(err);
    }
    
  • response = code_engine_service.delete_secret(
        project_id='15314cc3-85b4-4338-903f-c28cdee6d005',
        name='my-secret',
    )
    

Response

Status Code

  • Accepted

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Internal Server Error

Example responses
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
  • {
      "errors": [
        {
          "code": "unauthorized",
          "message": "A meaningful explanation"
        }
      ],
      "trace": "codeengine-api-93ca4d5e39454d04b878ddb6b9bb82c4",
      "status_code": 503
    }
id=curlclassName=tab-item-selected