Go client library to interact with the Code Engine API.
- Overview
- Prerequisites
- Breaking Changes in
codeenginev2(March 2026) - Installation
- Using the SDK
- Questions
- Issues
- Open source @ IBM
- Contributing
- License
The IBM Cloud Code Engine Go SDK allows developers to programmatically interact with the following IBM Cloud services:
| Service Name | Package name |
|---|---|
| Code Engine | codeenginev2 |
| Code Engine | ibmcloudcodeenginev1 |
- An IBM Cloud account.
- An IAM API key to allow the SDK to access your account. Create one here.
- Go version 1.24 or above.
For consistency, the March 2026 update introduces pluralized list APIs, new outbound destination types, and updated constructor/patch models. These changes require updates to existing client code.
-
Method renames (pluralization) Update all list calls and their context variants:
// before res, resp, err := ce.ListAllowedOutboundDestination(opts) res, resp, err := ce.ListAllowedOutboundDestinationWithContext(ctx, opts) // after res, resp, err := ce.ListAllowedOutboundDestinations(opts) res, resp, err := ce.ListAllowedOutboundDestinationsWithContext(ctx, opts)
// before res, resp, err := ce.ListPersistentDataStore(opts) res, resp, err := ce.ListPersistentDataStoreWithContext(ctx, opts) // after res, resp, err := ce.ListPersistentDataStores(opts) res, resp, err := ce.ListPersistentDataStoresWithContext(ctx, opts)
-
Options types and constructors renamed Replace option structs and their helpers:
// before opts := &codeenginev2.ListAllowedOutboundDestinationOptions{ ProjectID: core.StringPtr(pid) } opts := ce.NewListAllowedOutboundDestinationOptions(pid) // after opts := &codeenginev2.ListAllowedOutboundDestinationsOptions{ ProjectID: core.StringPtr(pid) } opts := ce.NewListAllowedOutboundDestinationsOptions(pid)
// before opts := &codeenginev2.ListPersistentDataStoreOptions{ ProjectID: core.StringPtr(pid) } opts := ce.NewListPersistentDataStoreOptions(pid) // after opts := &codeenginev2.ListPersistentDataStoresOptions{ ProjectID: core.StringPtr(pid) } opts := ce.NewListPersistentDataStoresOptions(pid)
-
Pager types and factories renamed Switch to the new pager names and factories:
// before pager, err := ce.NewAllowedOutboundDestinationPager(opts) // after pager, err := ce.NewAllowedOutboundDestinationsPager(opts)
// before pager, err := ce.NewPersistentDataStorePager(opts) // after pager, err := ce.NewPersistentDataStoresPager(opts)
-
Constructor signature changed for CIDR prototype
NewAllowedOutboundDestinationPrototypeCidrBlockDataPrototypeparameter order changed:// before: (type, cidrBlock, name) proto, err := ce.NewAllowedOutboundDestinationPrototypeCidrBlockDataPrototype( "cidr_block", "10.0.0.0/24", "allow-vpc-egress", ) // after: (type, name, cidrBlock) proto, err := ce.NewAllowedOutboundDestinationPrototypeCidrBlockDataPrototype( "cidr_block", "allow-vpc-egress", "10.0.0.0/24", )
-
Allowed outbound destination patch payloads changed Do not send
typein patch payloads anymore. Use the specific fields instead:// CIDR patch (remove Type; only patch fields that apply) patch := &codeenginev2.AllowedOutboundDestinationPatchCidrBlockDataPatch{ CidrBlock: core.StringPtr("10.0.1.0/24"), } // Private Path service gateway patch (new) patch := &codeenginev2.AllowedOutboundDestinationPatchPrivatePathServiceGatewayDataPatch{ IsolationPolicy: core.StringPtr(codeenginev2.AllowedOutboundDestinationPatchPrivatePathServiceGatewayDataPatch_IsolationPolicy_Dedicated), }
-
Allowed outbound destination prototypes now require
nameThe base prototypeAllowedOutboundDestinationPrototypeadds a requiredName. Ensure you set it for all create flows (already required for the CIDR-specific prototype, but now also applicable at the base type). For Private Path service gateway, use the new prototype:// New: Private Path prototype proto, err := ce.NewAllowedOutboundDestinationPrototypePrivatePathServiceGatewayDataPrototype( "private_path_service_gateway", "pps-to-service-x", "<private-path-service-gateway-crn>", ) // Optional: set isolation policy proto.IsolationPolicy = core.StringPtr( codeenginev2.AllowedOutboundDestinationPrototypePrivatePathServiceGatewayDataPrototype_IsolationPolicy_Shared, )
-
Probe.Typeis now required When providing probes (e.g., in app/job templates), you must set the protocol:// before probe := &codeenginev2.Probe{ InitialDelay: core.Int64Ptr(5) } // after (Type required) probe := &codeenginev2.Probe{ InitialDelay: core.Int64Ptr(5), Type: core.StringPtr(codeenginev2.Probe_Type_Http), // or Probe_Type_Tcp }
-
Secret.Formatis now required onSecretIf you constructSecretmodels in requests (e.g., replace flows), ensureFormatis set:secret := &codeenginev2.Secret{ EntityTag: core.StringPtr(etag), Format: core.StringPtr(codeenginev2.Secret_Format_Generic), // example; set appropriate format // ... }
-
Behavioral changes in response models (nullable → required) Several response fields are now marked
validate:"required"(e.g.,ComputedEnvVariables,RunServiceAccount,RunBuildParams,SourceType,StrategySize,StrategyType,FunctionRuntimes, etc.). While this mainly affects SDK-side validation of requests, if your code programmatically (re)uses these response structs as inputs to API calls, you must set the now-required fields before sending.
Action checklist:
- Rename the list methods, option types, and pagers as shown above.
- Adjust constructor argument order for
NewAllowedOutboundDestinationPrototypeCidrBlockDataPrototype.- Remove
typefrom allowed-outbound-destination patch payloads; use specific patch models/fields.- Ensure
nameis provided when creating allowed outbound destinations.- If using probes in requests, set
Probe.Type.- If constructing
Secretin requests, setSecret.Format.- Include the new
private_path_service_gatewaytype in any client-side branching/validation.
The current version of this SDK: 5.0.0
There are a few different ways to download and install the Code Engine Go SDK project for use by your Go application:
Use this command to download and install the SDK to allow your Go application to use it:
go get -u github.com/IBM/code-engine-go-sdkIf your application is using Go modules, you can add a suitable import to your Go application, like this:
import (
"github.com/IBM/code-engine-go-sdk/codeenginev2"
)then run go mod tidy to download and install the new dependency and update your Go application's go.mod file.
Examples are available here.
For general SDK usage information, please see this link
If you are having difficulties using this SDK or have a question about the IBM Cloud services, please ask a question at Stack Overflow.
If you encounter an issue with the project, you are welcome to submit a bug report. Before that, please search for similar issues. It's possible that someone has already reported the problem.
Find more open source projects on the IBM Github Page
See CONTRIBUTING.
This SDK project is released under the Apache 2.0 license. The license's full text can be found in LICENSE.