rc/common-integrations

Definition · Catalog README · Source

The everyday services most workloads depend on: web APIs, email, databases and caches. A Condition says what the workload needs, so the platform knows what to provide.

Choose the kind by what the workload does. Use api when it calls another service, with interface type http for a web API or smtp for sending email. Use datastore when it keeps data in a database, with relational for SQL databases such as PostgreSQL or MySQL, or document for databases such as MongoDB. Use cache when it keeps fast, temporary data in a key/value store such as Redis or Memcached.

Most details are optional. Leave a field out when any choice works for the workload, and the platform decides. Set it when the workload needs something specific: engine: postgres means only PostgreSQL will do. Two interfaces need a little more: http needs the API document, the list of calls, or both, and smtp needs the operations the workload performs, such as send.

To say how the workload finds what it depends on, for example which environment variable holds the database URL, add the env-configuration extension. When a more specific extension exists for a service, such as aws.s3 for Amazon S3 or nats.service for NATS, use that one instead.

Documentation

Status

Draft — Request for Comments

This document defines a first-party Runtime Conditions extension for common application runtime integrations.

The current machine-readable definition is common-integrations-v1alpha2.yaml. The previous v1alpha1 definition is preserved.

common-integrations-v1alpha3.yaml has the same vocabulary as v1alpha2 and adds documentation: a description of the extension and of every kind, interface type, field and allowed value, and JSON Schema descriptions of the validation rules. The generated language bindings show this text as Godoc, Javadoc, Python docstrings and JSDoc. The published bindings move to v1alpha3 in their next release.

common-integrations-v1alpha4.yaml has the same vocabulary again and adds example Conditions to the documentation. The generated bindings show each example as code in their docs and package README.

This extension is not part of the core Runtime Conditions Profile vocabulary. Profiles that use this extension MUST declare it in the top-level extensions list.


1. Extension Identity

extensions:
  - https://runtimeconditions.io/extensions/rc/common-integrations:v1alpha2

This extension defines:

  • Common Condition kinds
  • Common interface types
  • Common interface fields
  • Common engine values
  • Validation constraints for common integration declarations

This extension owns the unqualified vocabulary it defines within the scopes described in this document. Other extensions MAY depend on this extension and reference that vocabulary, but MUST NOT redefine the same unqualified vocabulary in the same ownership scope.


2. Condition Kinds

This extension defines the following Condition kinds:

Kind Description
api External service integrations such as APIs
datastore Persistent data storage systems
cache Volatile data storage optimized for fast access

These kinds are intentionally broad so that multiple interaction models or implementation families can be expressed within the same integration class through the interface block.


3. API Interfaces

API interfaces describe callable external services.

SMTP email submission

The api kind supports the smtp interface for sending email through a standard SMTP client. Provider selection and connection settings belong to the platform and environment configuration.

kind: api
interface:
  type: smtp
  operations: [send]

operations is required and must be a nonempty list without duplicates. This release supports only send. It describes mail submission, not inbox access or email receiving. No SMTP provider names or credentials appear in this interface.

NATS integrations continue to use the separate NATS service extension; this extension adds no NATS vocabulary.

3.1 HTTP Interface

The api kind supports the http interface type.

kind: api
interface:
  type: http
  spec:
    format: openapi
    uri: https://github.com/example-org/example-service/openapi.yaml
    version: ^1.2.0
  operations:
    - method: POST
      path: /charge
      requestBodySchema:
        amount: integer
        currency: string
      responseSchema:
        id: string
        status: string

3.2 HTTP Interface Fields

Field Required Description
type YES Interface type. Must be http
spec NO Reference to an external API specification document
operations NO Explicit list of operations the workload depends on

At least one of spec or operations MUST be present. Both MAY be declared together. When both are present and disagree, the operations declaration takes precedence over spec.

3.3 API Specification Fields

The spec block references an external API specification document.

spec:
  format: openapi
  uri: https://github.com/example-org/example-service/openapi.yaml
  version: ^1.2.0
Field Required Description
format YES API specification format. Only openapi is currently supported
uri YES Location of the external specification document
version NO Required version of the referenced document, as an exact version or version constraint

Only the OpenAPI specification is currently supported. Other API specification formats MAY be supported by future extensions.

3.4 Version Constraint Syntax

interface.spec.version declares which version of the referenced specification document the workload requires. It accepts either an exact version or a version constraint expression.

Versions MUST follow Semantic Versioning, expressed as MAJOR.MINOR.PATCH.

Syntax Name Meaning
1.2.3 Exact Matches only 1.2.3
=1.2.3 Exact Equivalent to 1.2.3
>1.2.3 Greater than Matches any version higher than 1.2.3
>=1.2.3 Minimum Matches 1.2.3 and any higher version
<1.2.3 Less than Matches any version lower than 1.2.3
<=1.2.3 Maximum Matches 1.2.3 and any lower version
^1.2.3 Compatible Matches >=1.2.3 and <2.0.0
~1.2.3 Approximate Matches >=1.2.3 and <1.3.0

When version is omitted, no version constraint is applied.

3.5 Operation Fields

Field Required Description
method YES HTTP method
path YES Request path
requestBodySchema NO Minimum required request body fields and their types
responseSchema NO Minimum required response fields and their types

Allowed HTTP methods are:

  • GET
  • HEAD
  • POST
  • PUT
  • PATCH
  • DELETE
  • OPTIONS
  • TRACE

3.6 Schema Fields

requestBodySchema and responseSchema describe the data structures an operation depends on. Each is expressed as a map whose keys are field names and whose values declare the JSON Schema type of each field.

The declared fields represent the minimum set of fields that MUST be present in the external API. The external service MAY expose additional fields beyond those declared; only the declared fields participate in matching.

A type declaration is one of:

  • A JSON Schema type keyword: string, number, integer, boolean, or null
  • A nested object, declared by mapping field names to further type declarations
  • An array, declared as a single-element list containing the element type declaration

4. Datastore Interfaces

Datastore interfaces describe persistent storage systems.

4.1 Relational Interface

The datastore kind supports the relational interface type.

kind: datastore
interface:
  type: relational
  engine: postgres

Allowed engine values for type: relational:

  • postgres
  • mysql
  • mariadb
  • sqlserver
  • oracle
  • sqlite

4.2 Document Interface

The datastore kind supports the document interface type.

kind: datastore
interface:
  type: document
  engine: mongodb

Allowed engine values for type: document:

  • mongodb
  • couchbase

4.3 Datastore Interface Fields

Field Required Description
type YES Datastore interface type
engine NO Specific datastore engine

If engine is provided, it MUST be valid for the declared datastore interface type.


5. Cache Interfaces

Cache interfaces describe volatile key/value storage systems.

5.1 Key/Value Interface

The cache kind supports the key_value interface type.

kind: cache
interface:
  type: key_value
  engine: redis

Allowed engine values for type: key_value:

  • redis
  • memcached

5.2 Cache Interface Fields

Field Required Description
type YES Cache interface type
engine NO Specific caching engine

If engine is provided, it MUST be valid for the declared cache interface type.


6. Validation

A Condition that uses this extension is invalid if:

  • kind is api and interface.type is neither http nor smtp
  • interface.type is smtp and operations is missing, empty, contains duplicates, or contains a value other than send
  • kind is datastore and interface.type is not relational or document
  • kind is cache and interface.type is not key_value
  • kind is api, interface.type is http, and neither spec nor operations is present
  • kind is api, interface.type is http, and operations is present but empty
  • kind is api, interface.type is http, and any operation omits method or path
  • kind is api, interface.type is http, and any operation declares an unsupported HTTP method
  • kind is api, interface.type is http, and spec is present but omits format or uri
  • kind is api, interface.type is http, and spec.format is not openapi
  • kind is api, interface.type is http, and spec.version is present but is not a valid semantic version or supported version constraint expression
  • kind is datastore, interface.type is relational, and engine is present but not one of the allowed relational engine values
  • kind is datastore, interface.type is document, and engine is present but not one of the allowed document engine values
  • kind is cache, interface.type is key_value, and engine is present but not one of the allowed key/value cache engine values

7. Example Profile

apiVersion: runtimeconditions.io/v1alpha1
kind: RuntimeConditionsProfile

metadata:
  name: checkout-service

workload:
  uri: https://github.com/example-org/checkout-service
  version: v1.2.3

extensions:
  - https://runtimeconditions.io/extensions/rc/common-integrations:v1alpha2

conditions:
  - name: primary-db
    kind: datastore
    interface:
      type: relational
      engine: postgres

  - name: request-cache
    kind: cache
    interface:
      type: key_value
      engine: redis

  - name: payments-api
    kind: api
    interface:
      type: http
      operations:
        - method: POST
          path: /charge

8. Summary

The Common Integrations extension defines common application integration vocabulary while leaving the core Runtime Conditions Profile focused on document structure, extension resolution, and deterministic validation.

Packages

Install the package for your language to declare this extension's Conditions from your code.

Go

Package
runtimeconditions.io/x/rc/common
Version
0.4.0
go get runtimeconditions.io/x/rc/common@v0.4.0

Conditions

Every Condition part this package defines, with the fields you can set. Select a line to open it.

api · http: The API is reached over HTTP.

common.Http is the interface of an api Condition.

Field Type Required Description
Operations HttpOperations no The HTTP operations the workload calls. A platform can use them to allow only these calls. List at least one operation.
Operations[].Method Method yes HTTP method of the operation. Must be one of the defined methods.
Values:
DELETE: Delete a resource.
GET: Read a resource.
HEAD: Read only the headers of a resource.
OPTIONS: Ask which methods a resource supports.
PATCH: Change part of a resource.
POST: Create a resource or submit data.
PUT: Replace a resource.
TRACE: Echo the request back, for diagnostics.
Operations[].Path string yes Request path of the operation, for example /todos/{id}, with path parameters in braces. Must not be empty.
Operations[].RequestBodySchema RequestBodySchema no Shape of the request body that the workload sends.
Operations[].ResponseSchema ResponseSchema no Shape of the response body that the workload expects back.
Spec *Spec no A machine-readable description of the API that the workload depends on. Requires format and uri. No other properties are allowed.
Spec.Format Format yes Format of the API document. Must be openapi.
Values:
openapi: An OpenAPI document.
Spec.Uri string yes Where the API document can be found, for example catalog://api/default/todos-api. Must not be empty.
Spec.Version *string no The API version the workload is written against. Must be an exact version (1.2.0 or =1.2.0), a comparison (>1.2.0, >=1.2.0, <2.0.0, <=2.0.0), a caret range (^1.2.0) or a tilde range (~1.2.0).
api · smtp: An SMTP mail server that the workload uses to send email, such as sign-up confirmations, password resets or alerts.

common.Smtp is the interface of an api Condition.

Field Type Required Description
Operations SmtpOperations yes The SMTP operations the workload performs. List at least one operation, without repeats.
Values:
send: Submit an email for delivery.
cache · key_value: A key/value store, such as Redis or Memcached, for data the workload reads often and can afford to lose.

common.KeyValue is the interface of a cache Condition.

Field Type Required Description
Engine *KeyValueEngine no The cache engine the workload needs. Optional. When present, must be one of the defined engine values. Leave it out if any engine of this type works.
Values:
memcached: Memcached, a simple in-memory cache.
redis: Redis, an in-memory key/value store.
datastore · document: A document database that stores JSON-like records, such as MongoDB.

common.Document is the interface of a datastore Condition.

Field Type Required Description
Engine *DocumentEngine no The document database engine the workload needs. Optional. When present, must be one of the defined engine values. Leave it out if any engine of this type works.
Values:
couchbase: Couchbase.
mongodb: MongoDB.
datastore · relational: A relational (SQL) database, such as PostgreSQL or MySQL, where data lives in tables.

common.Relational is the interface of a datastore Condition.

Field Type Required Description
Engine *RelationalEngine no The relational database engine the workload needs. Optional. When present, must be one of the defined engine values. Leave it out if any engine of this type works.
Values:
mariadb: MariaDB.
mysql: MySQL.
oracle: Oracle Database.
postgres: PostgreSQL.
sqlite: SQLite, an embedded file-based database.
sqlserver: Microsoft SQL Server.

Api

common.Api declares a api Condition.

Example: a workload that reads todos from an HTTP API described by an OpenAPI document.

common.Api(
	common.Http{
		Operations: common.HttpOperations{
			common.HttpOperationsItem{
				Method: common.MethodGet,
				Path:   "/todos/{id}",
			},
		},
		Spec: &common.Spec{
			Format:  common.FormatOpenapi,
			Uri:     "catalog://api/default/todos-api",
			Version: &[]string{"1.0.0"}[0],
		},
	},
)

Example: a workload that sends email through an SMTP server.

common.Api(
	common.Smtp{
		Operations: common.SmtpOperations{
			common.SmtpOperationsItemSend,
		},
	},
)

Cache

common.Cache declares a cache Condition.

Example: a workload that needs Redis.

common.Cache(
	common.KeyValue{
		Engine: &[]common.KeyValueEngine{common.KeyValueEngineRedis}[0],
	},
)

Example: a workload that accepts any key/value cache.

common.Cache(
	common.KeyValue{},
)

Datastore

common.Datastore declares a datastore Condition.

Example: a workload that needs a PostgreSQL database.

common.Datastore(
	common.Relational{
		Engine: &[]common.RelationalEngine{common.RelationalEnginePostgres}[0],
	},
)

The full API, with every type, field and constant documented, is in the Go package documentation.

Python

Package
runtimeconditions-common-integrations
Version
0.3.0
pip install runtimeconditions-common-integrations

Conditions

Every Condition part this package defines, with the fields you can set. Select a line to open it.

api · http: The API is reached over HTTP.

Http is the interface of an api Condition.

Field Type Required Description
operations HttpOperations | None no The HTTP operations the workload calls. A platform can use them to allow only these calls. List at least one operation.
operations[].method Method yes HTTP method of the operation. Must be one of the defined methods.
Values:
DELETE: Delete a resource.
GET: Read a resource.
HEAD: Read only the headers of a resource.
OPTIONS: Ask which methods a resource supports.
PATCH: Change part of a resource.
POST: Create a resource or submit data.
PUT: Replace a resource.
TRACE: Echo the request back, for diagnostics.
operations[].path str yes Request path of the operation, for example /todos/{id}, with path parameters in braces. Must not be empty.
operations[].request_body_schema RequestBodySchema | None no Shape of the request body that the workload sends.
operations[].response_schema ResponseSchema | None no Shape of the response body that the workload expects back.
spec Spec | None no A machine-readable description of the API that the workload depends on. Requires format and uri. No other properties are allowed.
spec.format Format yes Format of the API document. Must be openapi.
Values:
openapi: An OpenAPI document.
spec.uri str yes Where the API document can be found, for example catalog://api/default/todos-api. Must not be empty.
spec.version str | None no The API version the workload is written against. Must be an exact version (1.2.0 or =1.2.0), a comparison (>1.2.0, >=1.2.0, <2.0.0, <=2.0.0), a caret range (^1.2.0) or a tilde range (~1.2.0).
api · smtp: An SMTP mail server that the workload uses to send email, such as sign-up confirmations, password resets or alerts.

Smtp is the interface of an api Condition.

Field Type Required Description
operations SmtpOperations yes The SMTP operations the workload performs. List at least one operation, without repeats.
Values:
send: Submit an email for delivery.
cache · key_value: A key/value store, such as Redis or Memcached, for data the workload reads often and can afford to lose.

KeyValue is the interface of a cache Condition.

Field Type Required Description
engine KeyValueEngine | None no The cache engine the workload needs. Optional. When present, must be one of the defined engine values. Leave it out if any engine of this type works.
Values:
memcached: Memcached, a simple in-memory cache.
redis: Redis, an in-memory key/value store.
datastore · document: A document database that stores JSON-like records, such as MongoDB.

Document is the interface of a datastore Condition.

Field Type Required Description
engine DocumentEngine | None no The document database engine the workload needs. Optional. When present, must be one of the defined engine values. Leave it out if any engine of this type works.
Values:
couchbase: Couchbase.
mongodb: MongoDB.
datastore · relational: A relational (SQL) database, such as PostgreSQL or MySQL, where data lives in tables.

Relational is the interface of a datastore Condition.

Field Type Required Description
engine RelationalEngine | None no The relational database engine the workload needs. Optional. When present, must be one of the defined engine values. Leave it out if any engine of this type works.
Values:
mariadb: MariaDB.
mysql: MySQL.
oracle: Oracle Database.
postgres: PostgreSQL.
sqlite: SQLite, an embedded file-based database.
sqlserver: Microsoft SQL Server.

api

api declares a api Condition.

Example: a workload that reads todos from an HTTP API described by an OpenAPI document.

from runtimeconditions_common_integrations import (
    Format,
    Http,
    HttpOperationsItem,
    Method,
    Spec,
    api,
)

api(
    Http(
        operations=[HttpOperationsItem(method=Method.GET, path="/todos/{id}")],
        spec=Spec(
            format=Format.OPENAPI,
            uri="catalog://api/default/todos-api",
            version="1.0.0",
        ),
    ),
)

Example: a workload that sends email through an SMTP server.

from runtimeconditions_common_integrations import Smtp, SmtpOperationsItem, api

api(Smtp(operations=[SmtpOperationsItem.SEND]))

cache

cache declares a cache Condition.

Example: a workload that needs Redis.

from runtimeconditions_common_integrations import KeyValue, KeyValueEngine, cache

cache(KeyValue(engine=KeyValueEngine.REDIS))

Example: a workload that accepts any key/value cache.

from runtimeconditions_common_integrations import KeyValue, cache

cache(KeyValue())

datastore

datastore declares a datastore Condition.

Example: a workload that needs a PostgreSQL database.

from runtimeconditions_common_integrations import (
    Relational,
    RelationalEngine,
    datastore,
)

datastore(Relational(engine=RelationalEngine.POSTGRES))

Every class, field and enum member is documented in the package's docstrings.

TypeScript

Package
@runtimeconditions/common-integrations
Version
0.4.0
npm install @runtimeconditions/common-integrations

Conditions

Every Condition part this package defines, with the fields you can set. Select a line to open it.

api · http: The API is reached over HTTP.

Http is the interface of an api Condition.

Field Type Required Description
operations HttpOperations no The HTTP operations the workload calls. A platform can use them to allow only these calls. List at least one operation.
operations[].method Method yes HTTP method of the operation. Must be one of the defined methods.
Values:
DELETE: Delete a resource.
GET: Read a resource.
HEAD: Read only the headers of a resource.
OPTIONS: Ask which methods a resource supports.
PATCH: Change part of a resource.
POST: Create a resource or submit data.
PUT: Replace a resource.
TRACE: Echo the request back, for diagnostics.
operations[].path string yes Request path of the operation, for example /todos/{id}, with path parameters in braces. Must not be empty.
operations[].requestBodySchema RequestBodySchema no Shape of the request body that the workload sends.
operations[].responseSchema ResponseSchema no Shape of the response body that the workload expects back.
spec Spec no A machine-readable description of the API that the workload depends on. Requires format and uri. No other properties are allowed.
spec.format Format yes Format of the API document. Must be openapi.
Values:
openapi: An OpenAPI document.
spec.uri string yes Where the API document can be found, for example catalog://api/default/todos-api. Must not be empty.
spec.version string no The API version the workload is written against. Must be an exact version (1.2.0 or =1.2.0), a comparison (>1.2.0, >=1.2.0, <2.0.0, <=2.0.0), a caret range (^1.2.0) or a tilde range (~1.2.0).
api · smtp: An SMTP mail server that the workload uses to send email, such as sign-up confirmations, password resets or alerts.

Smtp is the interface of an api Condition.

Field Type Required Description
operations SmtpOperations yes The SMTP operations the workload performs. List at least one operation, without repeats.
Values:
send: Submit an email for delivery.
cache · key_value: A key/value store, such as Redis or Memcached, for data the workload reads often and can afford to lose.

KeyValue is the interface of a cache Condition.

Field Type Required Description
engine KeyValueEngine no The cache engine the workload needs. Optional. When present, must be one of the defined engine values. Leave it out if any engine of this type works.
Values:
memcached: Memcached, a simple in-memory cache.
redis: Redis, an in-memory key/value store.
datastore · document: A document database that stores JSON-like records, such as MongoDB.

Document is the interface of a datastore Condition.

Field Type Required Description
engine DocumentEngine no The document database engine the workload needs. Optional. When present, must be one of the defined engine values. Leave it out if any engine of this type works.
Values:
couchbase: Couchbase.
mongodb: MongoDB.
datastore · relational: A relational (SQL) database, such as PostgreSQL or MySQL, where data lives in tables.

Relational is the interface of a datastore Condition.

Field Type Required Description
engine RelationalEngine no The relational database engine the workload needs. Optional. When present, must be one of the defined engine values. Leave it out if any engine of this type works.
Values:
mariadb: MariaDB.
mysql: MySQL.
oracle: Oracle Database.
postgres: PostgreSQL.
sqlite: SQLite, an embedded file-based database.
sqlserver: Microsoft SQL Server.

api

api declares a api Condition.

Example: a workload that reads todos from an HTTP API described by an OpenAPI document.

import { Format, Http, HttpOperationsItem, Method, Spec, api } from "@runtimeconditions/common-integrations";

api(
  new Http({
    operations: [new HttpOperationsItem({ method: Method.Get, path: "/todos/{id}" })],
    spec: new Spec({
      format: Format.Openapi,
      uri: "catalog://api/default/todos-api",
      version: "1.0.0",
    }),
  }),
);

Example: a workload that sends email through an SMTP server.

import { Smtp, SmtpOperationsItem, api } from "@runtimeconditions/common-integrations";

api(new Smtp({ operations: [SmtpOperationsItem.Send] }));

cache

cache declares a cache Condition.

Example: a workload that needs Redis.

import { KeyValue, KeyValueEngine, cache } from "@runtimeconditions/common-integrations";

cache(new KeyValue({ engine: KeyValueEngine.Redis }));

Example: a workload that accepts any key/value cache.

import { KeyValue, cache } from "@runtimeconditions/common-integrations";

cache(new KeyValue());

datastore

datastore declares a datastore Condition.

Example: a workload that needs a PostgreSQL database.

import { Relational, RelationalEngine, datastore } from "@runtimeconditions/common-integrations";

datastore(new Relational({ engine: RelationalEngine.Postgres }));

Every class, field and enum member is documented in the package's type declarations.

Java

Package
io.runtimeconditions.bindings:runtimeconditions-common-integrations
Version
0.2.0
<dependency>
  <groupId>io.runtimeconditions.bindings</groupId>
  <artifactId>runtimeconditions-common-integrations</artifactId>
  <version>0.2.0</version>
</dependency>

Conditions

Every Condition part this package defines, with the fields you can set. Select a line to open it.

api · http: The API is reached over HTTP.

Http is the interface of an api Condition.

Field Type Required Description
operations HttpOperations no The HTTP operations the workload calls. A platform can use them to allow only these calls. List at least one operation.
operations[].method Method yes HTTP method of the operation. Must be one of the defined methods.
Values:
DELETE: Delete a resource.
GET: Read a resource.
HEAD: Read only the headers of a resource.
OPTIONS: Ask which methods a resource supports.
PATCH: Change part of a resource.
POST: Create a resource or submit data.
PUT: Replace a resource.
TRACE: Echo the request back, for diagnostics.
operations[].path String yes Request path of the operation, for example /todos/{id}, with path parameters in braces. Must not be empty.
operations[].requestBodySchema RequestBodySchema no Shape of the request body that the workload sends.
operations[].responseSchema ResponseSchema no Shape of the response body that the workload expects back.
spec Spec no A machine-readable description of the API that the workload depends on. Requires format and uri. No other properties are allowed.
spec.format Format yes Format of the API document. Must be openapi.
Values:
openapi: An OpenAPI document.
spec.uri String yes Where the API document can be found, for example catalog://api/default/todos-api. Must not be empty.
spec.version String no The API version the workload is written against. Must be an exact version (1.2.0 or =1.2.0), a comparison (>1.2.0, >=1.2.0, <2.0.0, <=2.0.0), a caret range (^1.2.0) or a tilde range (~1.2.0).
api · smtp: An SMTP mail server that the workload uses to send email, such as sign-up confirmations, password resets or alerts.

Smtp is the interface of an api Condition.

Field Type Required Description
operations SmtpOperations yes The SMTP operations the workload performs. List at least one operation, without repeats.
Values:
send: Submit an email for delivery.
cache · key_value: A key/value store, such as Redis or Memcached, for data the workload reads often and can afford to lose.

KeyValue is the interface of a cache Condition.

Field Type Required Description
engine KeyValueEngine no The cache engine the workload needs. Optional. When present, must be one of the defined engine values. Leave it out if any engine of this type works.
Values:
memcached: Memcached, a simple in-memory cache.
redis: Redis, an in-memory key/value store.
datastore · document: A document database that stores JSON-like records, such as MongoDB.

Document is the interface of a datastore Condition.

Field Type Required Description
engine DocumentEngine no The document database engine the workload needs. Optional. When present, must be one of the defined engine values. Leave it out if any engine of this type works.
Values:
couchbase: Couchbase.
mongodb: MongoDB.
datastore · relational: A relational (SQL) database, such as PostgreSQL or MySQL, where data lives in tables.

Relational is the interface of a datastore Condition.

Field Type Required Description
engine RelationalEngine no The relational database engine the workload needs. Optional. When present, must be one of the defined engine values. Leave it out if any engine of this type works.
Values:
mariadb: MariaDB.
mysql: MySQL.
oracle: Oracle Database.
postgres: PostgreSQL.
sqlite: SQLite, an embedded file-based database.
sqlserver: Microsoft SQL Server.

Bindings.api

Bindings.api declares a api Condition.

Example: a workload that reads todos from an HTTP API described by an OpenAPI document.

import io.runtimeconditions.bindings.commonintegrations.Bindings;
import io.runtimeconditions.bindings.commonintegrations.Format;
import io.runtimeconditions.bindings.commonintegrations.Http;
import io.runtimeconditions.bindings.commonintegrations.HttpOperations;
import io.runtimeconditions.bindings.commonintegrations.HttpOperationsItem;
import io.runtimeconditions.bindings.commonintegrations.Method;
import io.runtimeconditions.bindings.commonintegrations.Spec;
import java.util.List;

Bindings.api(
    new Http(
        new HttpOperations(List.of(new HttpOperationsItem(Method.GET, "/todos/{id}", null, null))),
        new Spec(Format.OPENAPI, "catalog://api/default/todos-api", "1.0.0")));

Example: a workload that sends email through an SMTP server.

import io.runtimeconditions.bindings.commonintegrations.Bindings;
import io.runtimeconditions.bindings.commonintegrations.Smtp;
import io.runtimeconditions.bindings.commonintegrations.SmtpOperations;
import io.runtimeconditions.bindings.commonintegrations.SmtpOperationsItem;
import java.util.List;

Bindings.api(new Smtp(new SmtpOperations(List.of(SmtpOperationsItem.SEND))));

Bindings.cache

Bindings.cache declares a cache Condition.

Example: a workload that needs Redis.

import io.runtimeconditions.bindings.commonintegrations.Bindings;
import io.runtimeconditions.bindings.commonintegrations.KeyValue;
import io.runtimeconditions.bindings.commonintegrations.KeyValueEngine;

Bindings.cache(new KeyValue(KeyValueEngine.REDIS));

Example: a workload that accepts any key/value cache.

import io.runtimeconditions.bindings.commonintegrations.Bindings;
import io.runtimeconditions.bindings.commonintegrations.KeyValue;

Bindings.cache(new KeyValue(null));

Bindings.datastore

Bindings.datastore declares a datastore Condition.

Example: a workload that needs a PostgreSQL database.

import io.runtimeconditions.bindings.commonintegrations.Bindings;
import io.runtimeconditions.bindings.commonintegrations.Relational;
import io.runtimeconditions.bindings.commonintegrations.RelationalEngine;

Bindings.datastore(new Relational(RelationalEngine.POSTGRES));

Every record, component and enum constant is documented in the Javadoc.

Kinds

api

The workload calls another service through a network API, such as an HTTP API or an SMTP mail server.

Example: a workload that reads todos from an HTTP API described by an OpenAPI document.

kind: api
interface:
  type: http
  spec:
    format: openapi
    uri: catalog://api/default/todos-api
    version: 1.0.0
  operations:
    - method: GET
      path: /todos/{id}

Example: a workload that sends email through an SMTP server.

kind: api
interface:
  type: smtp
  operations: [send]

Interface types

datastore

The workload stores and reads persistent data in a database.

Example: a workload that needs a PostgreSQL database.

kind: datastore
interface:
  type: relational
  engine: postgres

Interface types

cache

The workload keeps frequently used data in a cache for fast access.

Example: a workload that needs Redis.

kind: cache
interface:
  type: key_value
  engine: redis

Example: a workload that accepts any key/value cache.

kind: cache
interface:
  type: key_value

Interface types

Interface types

http api

The API is reached over HTTP. It is described by an API document, by the operations the workload calls, or by both.

Fields

interface.spec

A machine-readable description of the API that the workload depends on.

interface.operations

The HTTP operations the workload calls. A platform can use them to allow only these calls.

Allowed values for interface.spec.format
ValueDescription
openapiAn OpenAPI document.
Allowed values for interface.operations[].method
ValueDescription
GETRead a resource.
HEADRead only the headers of a resource.
POSTCreate a resource or submit data.
PUTReplace a resource.
PATCHChange part of a resource.
DELETEDelete a resource.
OPTIONSAsk which methods a resource supports.
TRACEEcho the request back, for diagnostics.

relational datastore

A relational (SQL) database, such as PostgreSQL or MySQL, where data lives in tables. Set engine when the workload needs one specific database.

Fields

interface.engine

The relational database engine the workload needs.

Allowed values for interface.engine
ValueDescription
postgresPostgreSQL.
mysqlMySQL.
mariadbMariaDB.
sqlserverMicrosoft SQL Server.
oracleOracle Database.
sqliteSQLite, an embedded file-based database.

document datastore

A document database that stores JSON-like records, such as MongoDB. Set engine when the workload needs one specific database.

Fields

interface.engine

The document database engine the workload needs.

Allowed values for interface.engine
ValueDescription
mongodbMongoDB.
couchbaseCouchbase.

key_value cache

A key/value store, such as Redis or Memcached, for data the workload reads often and can afford to lose. Set engine when the workload needs one specific store.

Fields

interface.engine

The cache engine the workload needs.

Allowed values for interface.engine
ValueDescription
redisRedis, an in-memory key/value store.
memcachedMemcached, a simple in-memory cache.

smtp api

An SMTP mail server that the workload uses to send email, such as sign-up confirmations, password resets or alerts.

Fields

interface.operations

The SMTP operations the workload performs.

Allowed values for interface.operations[]
ValueDescription
sendSubmit an email for delivery.