Jump to: navigation, search

Solum/API

< Solum
Revision as of 17:46, 3 October 2013 by Adrian Otto (talk | contribs)

Blueprint: https://blueprints.launchpad.net/solum/+spec/api

Proposed By: Adrian Otto

API

Synopsis

Verb URI Description
GET /{tenant_id} Get the root Platform resource
GET /{tenant_id}/assemblies Get a list of the Assembly resources for this tenant
POST /{tenant_id}/assemblies Create a new Assembly resource
GET /{tenant_id}/assemblies/{id} Get a specific Assembly resource
PUT /{tenant_id}/assemblies/{id} Update a complete Assembly resource
PATCH /{tenant_id}/assemblies/{id} Update select attributes of an Assembly resource
DELETE /{tenant_id}/assemblies/{id} Delete this Assembly resource.
GET /{tenant_id}/components Get a list of the Component resources for this tenant
POST /{tenant_id}/components Create a new Component resource
GET /{tenant_id}/components/{id} Get a specific Component resource
PUT /{tenant_id}/components/{id} Update a complete Component resource
PATCH /{tenant_id}/components/{id} Update select attributes of an Component resource
DELETE /{tenant_id}/components/{id} Delete this Component resource.
GET /{tenant_id}/services Get a list of the Service resources for this tenant
POST /{tenant_id}/services Create a new Service resource
GET /{tenant_id}/services/{id} Get a specific Service resource
PUT /{tenant_id}/services/{id} Update a complete Service resource
PATCH /{tenant_id}/services/{id} Update select attributes of an Service resource
DELETE /{tenant_id}/services/{id} Delete this Service resource.
GET /{tenant_id}/extensions Get a list of the Extension resources for this tenant
GET /{tenant_id}/extensions/{id} Get a specific Extension resource

API Concepts

This section provides an overview of the different aspects of the API, and what they represent.

Basics

Roles

Provider

The organization offering hosted platform services to its customers.

Consumer

The individual customer that uses the hosted Platform.

Platform

The Platform resource is the root level resource that refers to all the other resources owned by this tenant.

Assembly

The Assembly resource represents a group of components that make up a running instance of an application. You may casually refer to this as "the application" but we refer to it as an Assembly because most cloud applications are actually a system of multiple service instances that make up a system. For example, a three-tier web application may have a load balancer component, a group of application servers, and a database server all represented as Component resources that make up an Assembly resource. An Assembly resource has at least one Component resource associated with it.

Component

The Component resource represents one part of an Assembly needed by your application. For example, an instance of a database service may be a Component. A Component resource may also represent a static artifact, such as an archive file that contains data for initializing your application. An Assembly may have different components that represent different processes that run. For example, you may have one Component that represents an API service process, and another that represents a web UI process that consumes that API service. This simplest case is when an Assembly has only one component. For examaple your component may be named "PHP" and refers to the PHP Service offered by the platform for running a PHP application.

Service

The Service resource represents a networked service provided by a Platform Provider. You may create Component resources that refer to Service resources. The Component represents an instance of the Service. Your application connects to the Component that using a network protocol. For example, the Platform may offer a default Service named "mysql". You may create multiple Component resources that reference different instances of the "mysql" service. Each Component may be a multi-tenant instance of a MySQL database (perhaps a logical database) service offered by the Platform for a given Assembly.

Advanced

Extension

The Extension resource represents changes that the Provider has added onto a Platform in addition to the ones supplied by Solum by default. This may include additional protocol semantics, resource types, application lifecycle states, etc. Anything may be added, as long as it does not contradict the base functionality offered by Solum.

Operation

The Operation resource represents an action that can be taken on a resource. Operations can be added to Assembly, Component, or Service resources.

Sensor

The Sensor resource represents an dynamic data that can be collected from a resource. For example, statistics about the access rate of a resource (usually a Component). Sensors can be added to Assembly, Component, or Service resources.

Types

This section details the different data types used by the API.

Boolean

As defined by JSON [RFC4627], a token having a literal value of either true or false.

String

A UNICODE string as defined by JSON [RFC4627].

URI

A String (see above) that conforms to the syntax defined in [RFC3986].

Link

Relation used for a resource entity has attribute values that link to other resource entities. For example, a Platform resource entity attribute values points to assemblies. The “Link” type defined here is used for such attribute values. It is typically only used as an array of Link entities.

{
 "href": URI,
 "targetName": String
}

The following attributes are present in a Link. Other attributes, not defined in this specification, may also be present.

href

This attribute is the URI [RFC3986] of the resource referenced by this Link. The value of this attribute may be changed by the Provider. Consumers may not change the value of this attribute.

targetName

This attribute echoes the value of the “name” attribute of the resource referenced by this Link. The value of this attribute may be changed by the Platform. Consumers may not change the value of this attribute.

Protocol and Resource Representations

This section shows the representation of each of the resources in JSON format, and how you interact with them through the REST API. Note: The Link[] type indicates an array of Links. A "?" character indicates the attribute is optional.

Platform

The Platform resource is the root level resource that refers to all the other resources owned by this tenant.

Verb URI Description
GET /{tenant_id} Get the root Platform resource
{
 "uri": URI,
 "name": String,
 "type": "platform",
 "description": String ?,
 "extensionsUri": "/extensions",
 "implementationVersion": String ?,
 "assemblies": Link[] ?,
 "components": Link[] ?,
 "services": Link[] ?,
 "parameterDefinitionsUri": URI
}

Assembly

The Assembly resource represents a group of components that make up a running instance of an application. You may casually refer to this as "the application" but we refer to it as an Assembly because most cloud applications are actually a system of multiple service instances that make up a system. For example, a three-tier web application may have a load balancer component, a group of application servers, and a database server all represented as Component resources that make up an Assembly resource. An Assembly resource has at least one Component resource associated with it.

Verb URI Description
GET /{tenant_id}/assemblies Get a list of the Assembly resources for this tenant
POST /{tenant_id}/assemblies Create a new Assembly resource
GET /{tenant_id}/assemblies/{id} Get a specific Assembly resource
PUT /{tenant_id}/assemblies/{id} Update a complete Assembly resource
PATCH /{tenant_id}/assemblies/{id} Update select attributes of an Assembly resource
DELETE /{tenant_id}/assemblies/{id} Delete this Assembly resource.
{
 "uri": URI,
 "name": String,
 "type": "assembly",
 "description": String ?,
 "Components": Link[] ?,
 "operationsUri": URI ?,
 "sensorsUri": URI ?
}

Component

The Component resource represents one part of an Assembly needed by your application. For example, an instance of a database service may be a Component. A Component resource may also represent a static artifact, such as an archive file that contains data for initializing your application. An Assembly may have different components that represent different processes that run. For example, you may have one Component that represents an API service process, and another that represents a web UI process that consumes that API service. This simplest case is when an Assembly has only one component. For exmaple your component may be named "PHP" and refers to the PHP Service offered by the platform for running a PHP application.

Verb URI Description
GET /{tenant_id}/components Get a list of the Component resources for this tenant
POST /{tenant_id}/components Create a new Component resource
GET /{tenant_id}/components/{id} Get a specific Component resource
PUT /{tenant_id}/components/{id} Update a complete Component resource
PATCH /{tenant_id}/components/{id} Update select attributes of an Component resource
DELETE /{tenant_id}/components/{id} Delete this Component resource.
{
 "uri": URI,
 "name": String,
 "type": "component",
 "description": String ?,
 "tags": String[] ?,
 "assembly": Link,
 "components": Link[] ?,
 "services": Link[] ?,
 "operationsUri": URI ?,
 "sensorsUri": URI ?
}

Service

The Service resource represents a networked service provided by a Platform Provider. You may create Component resources that refer to Service resources. The Component represents an instance of the Service. Your application connects to the Component that using a network protocol. For example, the Platform may offer a default Service named "mysql". You may create multiple Component resources that reference different instances of the "mysql" service. Each Component may be a multi-tenant instance of a MySQL database (perhaps a logical database) service offered by the Platform for a given Assembly.

Services Resource

Verb URI Description
GET /{tenant_id}/services Get a list of the Service resources for this tenant
POST /{tenant_id}/services Create a new Service resource

Plural representation (list):

Request: GET /{tenant_id}/services ...
Response:
{
 "uri": URI,
 "name": String,
 "type": "services",
 "description": String, ?
 "serviceLinks": Link[]
}

Service Resource

GET /{tenant_id}/services/{id} Get a specific Service resource
PUT /{tenant_id}/services/{id} Update a complete Service resource (subject to access control rules)
PATCH /{tenant_id}/services/{id} Update select attributes of an Service resource (subject to access control rules)
DELETE /{tenant_id}/services/{id} Delete this Service resource. (subject to access control rules)

Singular representation:

Request: GET /{tenant_id}/service/{id} ...
Response:
{
 "uri": URI,
 "name": String,
 "type": "service",
 "description": String ?,
 "tags": String[] ?,
 "operationsUri": URI ?,
 "sensorsUri": URI ?,
 "readOnly": Boolean
}

Note: Solum prohibits PUT, PATCH, and DELETE calls on the Services provided as part of the base configuration offered by the Provider. In this case the readOnly attribute will be set to TRUE. Services added by a tenant will have a readOnly attribute set to FALSE, and may be modified or deleted by that same tenant.

Extension

The Extension resource represents changes that the Provider has added onto a Platform in addition to the ones supplied by Solum by default. This may include additional protocol semantics, resource types, application lifecycle states, resource attributes, etc. Anything may be added, as long as it does not contradict the base functionality offered by Solum.

Extensions Resource

Verb URI Description
GET /{tenant_id}/extensions Get a list of the Extension resources for this tenant

Plural representation (list):

{
 "uri": URI,
 "name": String,
 "type": "extensions",
 "description": String, ?
 "extensionLinks": Link[]
}

Extension Resource

Verb URI Description
GET /{tenant_id}/extensions/{id} Get a specific Extension resource

Singular representation:

{
 "uri": URI,
 "name": String,
 "type": "extension",
 "description": String,
 "version": String,
 "documentation": URI ?
}

Operation

An Operation resource represents an operation or action available on a target resource. This is for defining actions that may change the state of the resource they are related to. For example, the API already provides ways to register, start, and stop your application (POST an Assembly to register+start, and DELETE an Assembly to stop) but Operations provide a way to extend the system to add your own actions such as "pause" and "resume", or "scale_up" and "scale_down". It has the following representation:

Operations Resource

Verb URI Description
GET /{tenant_id}/operations Get a list of the Operation resources for this tenant
POST /{tenant_id}/operations Create a new Operation resource

The plural representation (list):

Request: GET /{tenant_id}/operations ...
Response:
{
 "uri": URI,
 "name": String,
 "type": "operations",
 "description": String ?,
 "targetResource": URI,
 "operationLinks": Link[]
}

Operation Resource

Verb URI Description
GET /{tenant_id}/operations/{id} Get a specific Operation resource
PUT /{tenant_id}/operations/{id} Update a complete Operation resource
PATCH /{tenant_id}/operations/{id} Update an attribute of an Operation resource
DELETE /{tenant_id}/operations/{id} Delete a specific Operation resource

The singular representation:

Request: GET /{tenant_id}/operations/{id} ...
Response:
{
 "uri": URI,
 "name": String,
 "type": "operation",
 "description": String ?,
 "documentation": URI,
 "targetResource": URI
}

Note that the documentation attribute is a link to (probably a PDF) document that explains the semantics of the operation you are defining. This is a lightweight method of allowing the API to be extensible without requiring a markup language.

Sensor

A Sensor resource represents exactly one supported sensor on one or more resources. Sensor resources represent dynamic data about resources, such as metrics or state. Sensor resources are useful for exposing data that changes rapidly, or that may need to be fetched from a secondary system. It has the following representation:

Sensors Resource

Verb URI Description
GET /{tenant_id}/sensors Get a a list of Sensor resources for this tenant
POST /{tenant_id}/sensors Create a new Sensor resource

The plural representation (list):

Request: GET /{tenant_id}/sensors ...
Response:
{
 "uri": URI,
 "name": String,
 "type": "sensors",
 "description": String ?,
 "targetResource": URI,
 "sensorLinks": Link[]
}

Sensor Resource

Verb URI Description
GET /{tenant_id}/sensors/{id} Get a specific Sensor resource
PUT /{tenant_id}/sensors/{id} Update a complete Sensor resource
PATCH /{tenant_id}/sensors/{id} Update an attribute of an Sensor resource
DELETE /{tenant_id}/sensors/{id} Delete a specific Sensor resource

The singular representation:

Request: GET /{tenant_id}/sensors/{id} ...
Response:
{
 "uri": URI,
 "name": String,
 "type": "sensor",
 "description": String ?,
 "documentation": URI,
 "targetResource": URI,
 "sensorType": String,
 "value": <sensorType> ?,
 "timestamp": Timestamp ?,
 "operationsUri": URI ?
}