karbor/doc/source/api/smaug_api.v1.yaml

807 lines
22 KiB
YAML

swagger: '2.0'
info:
title: Smaug API
description: Protect all you hold dear
version: 0.99.0
host: api.smaug.nowhere.com
schemes:
- https
basePath: /v1
produces:
- application/json
paths:
/providers:
get:
summary: Providers
description: |
The Providers endpoint returns information about the providers
offered at a given service. All providers need to be configuered
first by the admin.
parameters:
- $ref: '#/parameters/nameFilterParam'
- $ref: '#/parameters/sortParam'
- $ref: '#/parameters/limitParam'
- $ref: '#/parameters/markerParam'
tags:
- Protection Provider
responses:
'200':
description: An array of providers
schema:
type: array
items:
$ref: '#/definitions/Provider'
examples:
application/json: [
{
"id": "2220f8b1-975d-4621-a872-fa9afb43cb6c",
"name": "OS Infra Provider",
"description": "This provider uses OpenStack's own services (swift, cinder) as storage",
"extended_info_schema": {
"OS::Nova::Cinder": {
"type": "object",
"properties": {
"use_cbt": {
"type": "boolean",
"title": "Use CBT",
"description": "Use Changed Block Tracking when backin up this volume"
}
}
}
}
}
]
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/providers/{provider_id}/checkpoints:
get:
summary: List checkpoints
description: |
The checkpoints endpoint returns information about the checkpoints
offered at a given provider.
parameters:
- $ref: '#/parameters/provider_idParam'
- name: tenant_id
in: query
description: |
Specifies the ID of the tenant that owns this entity
type: string
format: uuid
required: false
- $ref: '#/parameters/sortParam'
- $ref: '#/parameters/limitParam'
- $ref: '#/parameters/markerParam'
tags:
- Protection Provider
- Checkpoint
responses:
'200':
description: An array of checkpoints
schema:
type: array
items:
$ref: '#/definitions/Checkpoint'
examples:
application/json: [
{
"id": "2220f8b1-975d-4621-a872-fa9afb43cb6c",
"status": "comitted",
"ptoection_plan": {
"id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
"name": "My 3 tier application",
"resources": [
{
"id": "64e51e85-4f31-441f-9a5d-6e93e3196628",
"type": "OS::Nova::Server"
},
{
"id": "61e51e85-4f31-441f-9a5d-6e93e3196628",
"type": "OS::Cinder::Volume"
},
{
"id": "62e51e85-4f31-441f-9a5d-6e93e3196628",
"type": "OS::Cinder::Volume"
}
]
}
}]
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: Checkpoints
description: |
The Checkpoints endpoint creates a checkpoint
at a given provider.
parameters:
- $ref: '#/parameters/provider_idParam'
- name: checkpoint
in: body
required: true
schema:
$ref: '#/definitions/Checkpoint'
tags:
- Protection Provider
- Checkpoint
responses:
'200':
description: Checkpoint created
schema:
$ref: '#/definitions/Checkpoint'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/providers/{provider_id}/checkpoints/{checkpoint_id}:
delete:
summary: Delete checkpoints
description: |
The checkpoint endpoint deletes a checkpoint
at a given provider.
parameters:
- $ref: '#/parameters/provider_idParam'
- $ref: '#/parameters/checkpoint_idParam'
tags:
- Protection Provider
- Checkpoint
responses:
'200':
description: Checkpoint deleted
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/{tenant_id}/plans:
get:
summary: Get protection plans
description: |
The Plans endpoint returns information about the protection plans
offered for the given tenant.
parameters:
- $ref: '#/parameters/tenantParam'
- $ref: '#/parameters/nameFilterParam'
- $ref: '#/parameters/sortParam'
- $ref: '#/parameters/limitParam'
- $ref: '#/parameters/markerParam'
tags:
- Tenant API
- Protection Plan
responses:
'200':
description: An array of protection plans
schema:
type: array
items:
$ref: '#/definitions/ProtectionPlan'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: Create a plan
description: |
Create a new plan. The update will create a new revision for
the plan.
tags:
- Tenant API
- Protection Plan
parameters:
- $ref: '#/parameters/tenantParam'
- name: plan
in: body
required: true
schema:
$ref: '#/definitions/ProtectionPlan'
responses:
'200':
description: The new checkpoint
schema:
$ref: '#/definitions/ProtectionPlan'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/{tenant_id}/plans/{plan_id}:
get:
summary: Protection Plan
description: |
The Plan endpoint returns information about a specific plan.
parameters:
- $ref: '#/parameters/tenantParam'
- $ref: '#/parameters/plan_idParam'
tags:
- Tenant API
- Protection Plan
responses:
'200':
description: the protection plan
schema:
$ref: '#/definitions/ProtectionPlan'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
delete:
summary: Protection Plan
description: |
The Plan endpoint deletes a specific plan.
parameters:
- $ref: '#/parameters/tenantParam'
- $ref: '#/parameters/plan_idParam'
tags:
- Tenant API
- Protection Plan
responses:
'200':
description: the protection plan
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/protectables:
get:
summary: Protectables
description: |
Return all the available protectable types.
parameters:
- $ref: '#/parameters/nameFilterParam'
- $ref: '#/parameters/sortParam'
- $ref: '#/parameters/limitParam'
- $ref: '#/parameters/markerParam'
tags:
- Protectable
responses:
'200':
description: The available protectable types
schema:
type: array
items:
$ref: '#/definitions/ProtectableType'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/protectables/{protectable_type}:
get:
summary: Protectables
description: |
Return the information of a given protectable type.
parameters:
- $ref: '#/parameters/protectable_typeParam'
tags:
- Protectable
responses:
'200':
description: The protectable information
schema:
$ref: '#/definitions/ProtectableInfo'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/protectables/{protectable_type}/instances:
get:
summary: Resource Instances
description: |
Return all the available instances for the given protectable type.
parameters:
- $ref: '#/parameters/protectable_typeParam'
- $ref: '#/parameters/nameFilterParam'
- $ref: '#/parameters/sortParam'
- $ref: '#/parameters/limitParam'
- $ref: '#/parameters/markerParam'
tags:
- Protectable
- Resource
responses:
'200':
description: The available instances for the protectable type.
schema:
type: array
items:
$ref: '#/definitions/Resource'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/{tenant_id}/scheduled_operations:
get:
summary: Scheduled Operations
description: |
Scheduled operations are operations that will be executed when
a specific trigger is triggered.
parameters:
- $ref: '#/parameters/tenantParam'
- $ref: '#/parameters/nameFilterParam'
- $ref: '#/parameters/sortParam'
- $ref: '#/parameters/limitParam'
- $ref: '#/parameters/markerParam'
tags:
- Tenant API
- Scheduled Operation
responses:
'200':
description: An array of scheduled operations
schema:
type: array
items:
$ref: '#/definitions/AutomaticOperation'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: Scheduled operation
description: |
Create a new scheduled operation.
tags:
- Tenant API
- Scheduled Operation
parameters:
- $ref: '#/parameters/tenantParam'
- name: scheduled_operation
in: body
required: true
schema:
$ref: '#/definitions/AutomaticOperation'
responses:
'200':
description: The new scheduled operation
schema:
$ref: '#/definitions/AutomaticOperation'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/{tenant_id}/operations:
get:
summary: Operations
description: |
List the history operations for a given tenant.
parameters:
- $ref: '#/parameters/tenantParam'
- $ref: '#/parameters/sortParam'
- $ref: '#/parameters/limitParam'
- $ref: '#/parameters/markerParam'
tags:
- Tenant API
- Operation
responses:
'200':
description: An array of operations.
schema:
type: array
items:
$ref: '#/definitions/OperationDefinition'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: Operations
description: |
Trigger an operations to execute manually.
parameters:
- $ref: '#/parameters/tenantParam'
- name: operation
in: body
required: true
schema:
$ref: '#/definitions/OperationDefinition'
tags:
- Tenant API
- Operation
responses:
'200':
description: An operation is excuting.
schema:
$ref: '#/definitions/OperationDefinition'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/{tenant_id}/triggers:
get:
summary: Triggers
description: |
List all of the triggers created by a given tenant.
parameters:
- $ref: '#/parameters/tenantParam'
- $ref: '#/parameters/nameFilterParam'
- $ref: '#/parameters/sortParam'
- $ref: '#/parameters/limitParam'
- $ref: '#/parameters/markerParam'
tags:
- Tenant API
- Trigger
responses:
'200':
description: An array of triggers
schema:
type: array
items:
$ref: '#/definitions/Trigger'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: Trigger
description: |
Create a new scheduled operation.
tags:
- Tenant API
- Trigger
parameters:
- $ref: '#/parameters/tenantParam'
- name: trigger_info
in: body
required: true
schema:
$ref: '#/definitions/Trigger'
responses:
'200':
description: The new created trigger
schema:
$ref: '#/definitions/Trigger'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/{tenant_id}/triggers/{trigger_id}:
delete:
summary: Trigger
description: |
Delete a trigger created by a given tenant.
parameters:
- $ref: '#/parameters/tenantParam'
- name: trigger_id
in: path
required: true
type: string
format: uuid
tags:
- Tenant API
- Trigger
responses:
'200':
description: Trigger deleted
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
definitions:
Provider:
type: object
required: [ name ]
properties:
id:
readOnly: true
type: string
format: UUID
description: |
Unique identifier representing a specific protection provider.
description:
type: string
description: Description of provider.
name:
type: string
description: Display name of provider.
Checkpoint:
type: object
properties:
id:
readOnly: true
type: string
format: UUID
description: |
Unique identifier representing a specific protection provider.
protection_plan:
readOnly: true
$ref: '#/definitions/ProtectionPlan'
status:
readOnly: true
type: string
Resource:
type: object
properties:
type:
$ref: '#/definitions/ProtectableType'
readOnly: true
id:
readOnly: true
type: string
ProtectionPlan:
type: object
required: [ name, protection_provider_id, resources ]
properties:
id:
readOnly: true
type: string
format: UUID
description: Unique identifier representing a specific protection protection plan.
name:
type: string
description: Display name of plan.
comments:
type: string
description: Comments about the plan.
resources:
type: array
items:
$ref: '#/definitions/Resource'
protection_provider_id:
type: string
format: UUID
description: |
Unique identifier representing a specific protection provider that
will store checkpoints for this protection plan.
parameters:
type: object
description: TODO
ProtectableType:
type: string
format: Heat Type String
example: "OS::Nova::Server"
description: |
Name of the resource type. When available the types that are defined by Heat
are used.
ProtectableInfo:
type: object
properties:
name:
$ref: '#/definitions/ProtectableType'
is_root:
type: boolean
description: |
Defines whether this type has any dependencies or not. Useful for
UIs.
dependent_types:
type: array
description: |
List of types that might depend on this type. For example an
"OS::Nova::Server" has "OS::Cinder::Volume" as a dependent type.
items:
$ref: '#/definitions/ProtectableType'
OperationDefinition:
type: object
discriminator: type
required: [ type ]
properties:
id:
type: string
format: UUID
description: |
Unique identifier representing a specific operation definition.
type:
type: string
description: |
Type of the operation. This defines what kind of operation this
object defines the arguments for.
ProtectOperationDefinition:
description: |
Operation definition for protect operation.
allOf:
- $ref: '#/definitions/OperationDefinition'
- type: object
properties:
protection_plan_id:
type: string
format: UUID
parameters:
type: object
format: dict
required: [ protection_plan_id ]
DeleteOperationDefinition:
description: |
Operation definition for delete operation.
allOf:
- $ref: '#/definitions/OperationDefinition'
- type: object
properties:
checkpoint_path:
type: string
provider_id:
type: string
format: UUID
required: [ checkpoint_path, provider_id ]
StartOperationDefinition:
description: |
Operation definition for start operation.
allOf:
- $ref: '#/definitions/OperationDefinition'
- type: object
properties:
protection_plan_id:
type: string
format: UUID
required: [ protection_plan_id ]
SuspendOperationDefinition:
description: |
Operation definition for suspend operation.
allOf:
- $ref: '#/definitions/OperationDefinition'
- type: object
properties:
protection_plan_id:
type: string
format: UUID
required: [ protection_plan_id ]
RestoreOperationDefinition:
description: |
Operation definition for restore operation.
allOf:
- $ref: '#/definitions/OperationDefinition'
- type: object
properties:
checkpoint_id:
type: string
format: UUID
provider_id:
type: string
format: UUID
restore_target:
type: string
format: UUID
parameters:
type: object
format: dict
required: [ checkpoint_id, provider_id ]
AutomaticOperation:
type: object
properties:
id:
type: string
format: UUID
description: |
Unique identifier representing a specific automatic operation.
name:
type: string
description: Display name of automatic operation.
comments:
type: string
description: Comments about the automatic operation.
ScheduledOperation:
type: object
allOf:
- $ref: '#/definitions/AutomaticOperation'
- type: object
properties:
trigger_id:
type: string
format: UUID
- $ref: '#/definitions/OperationDefinition'
OperationStatus:
type: object
properties:
status:
type: string
description:
type: string
Trigger:
type: object
discriminator: type
required: [ type ]
properties:
id:
type: string
format: UUID
description: |
Unique identifier representing a specific trigger.
name:
type: string
description: Display name of trigger.
description:
type: string
description: Description of trigger.
type:
type: string
description: |
Type of the trigger. This defines what kind of trigger this
object defines the arguments for.
TimeTrigger:
description: |
Trigger definition for time tigger.
allOf:
- $ref: '#/definitions/Trigger'
- type: object
properties:
start_time:
type: string
format: date-time
trigger_window:
type: integer
format: int32
recurrence:
type: string
required: [ start_time, trigger_window, recurrence ]
Error:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
fields:
type: string
parameters:
sortParam:
name: sort
in: query
description: |
Comma-separated list of sort keys and optional sort directions in the
form of '<key>[:<direction>]`. A valid direction is asc
(ascending) or desc (descending).
required: false
type: string
limitParam:
name: limit
in: query
description: |
Requests a specified page size of returned items from the query.
Returns a number of items up to the specified limit value.
Use the limit parameter to make an initial limited request and use the
ID of the last-seen item from the response as the marker parameter value
in a subsequent limited request.
type: integer
format: int64
markerParam:
name: marker
in: query
description: |
Specifies the ID of the last-seen item. Use the limit parameter to make
an initial limited request and use the ID of the last-seen item from the
response as the marker parameter value in a subsequent limited request.
type: string
tenantParam:
name: tenant_id
in: path
description: |
Specifies the ID of the tenant that owns this entity
type: string
format: uuid
required: true
nameFilterParam:
name: name
in: query
format: regex
description: name of the entity. Could be a regex pattern.
required: false
type: string
provider_idParam:
name: provider_id
type: string
format: uuid
required: true
in: path
description: id of the provider.
plan_idParam:
name: plan_id
type: string
format: uuid
required: true
in: path
description: id of the plan.
checkpoint_idParam:
name: checkpoint_id
type: string
format: uuid
required: true
in: path
description: id of the checkpoint.
protectable_typeParam:
name: protectable_type
type: string
format: Heat Type String
required: true
in: path
description: the resource type.