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

548 lines
15 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'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/providers/{provider_id}/checkpoints:
get:
summary: 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: object
properties:
checkpoints:
type: array
items:
$ref: '#/definitions/Checkpoint'
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: Checkpoints
description: |
The Checkpoints 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: object
properties:
plans:
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'
/resource_types:
get:
summary: Resource Types
description: |
The returns all the available resource types.
parameters:
- $ref: '#/parameters/nameFilterParam'
- $ref: '#/parameters/sortParam'
- $ref: '#/parameters/limitParam'
- $ref: '#/parameters/markerParam'
tags:
- Resource
responses:
'200':
description: The available resource types
schema:
type: object
properties:
resource_types:
type: array
items:
$ref: '#/definitions/ResourceTypeInfo'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/resource_types/{resource_type}:
get:
summary: Resource Type
description: |
The returns all the available resource types.
parameters:
- $ref: '#/parameters/resource_typeParam'
tags:
- Resource
responses:
'200':
description: The resource type
schema:
$ref: '#/definitions/ResourceTypeInfo'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/resource_types/{resource_type}/instances:
get:
summary: Resource Instances
description: |
The returns all the available instances for the resource type.
parameters:
- $ref: '#/parameters/resource_typeParam'
- $ref: '#/parameters/nameFilterParam'
- $ref: '#/parameters/sortParam'
- $ref: '#/parameters/limitParam'
- $ref: '#/parameters/markerParam'
tags:
- Resource
responses:
'200':
description: The available instances for the resource type.
schema:
type: object
properties:
resources:
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: object
properties:
scheduled_operations:
type: array
items:
$ref: '#/definitions/ScheduledOperation'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: Create an scheduled operation
description: |
Create a new scheduled operation.
tags:
- Tenant API
- Scheduled Operation
parameters:
- $ref: '#/parameters/tenantParam'
- name: schedlued_operation
in: body
required: true
schema:
$ref: '#/definitions/ScheduledOperation'
responses:
'200':
description: The new scheduled operation
schema:
$ref: '#/definitions/ScheduledOperation'
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.
description:
type: string
description: Description of provider.
Resource:
type: object
properties:
type:
$ref: '#/definitions/ResourceType'
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
ResourceType:
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.
ResourceTypeInfo:
type: object
properties:
name:
$ref: '#/definitions/ResourceType'
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/ResourceType'
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: |
Opration definition for protect operation.
allOf:
- $ref: '#/definitions/OperationDefinition'
- type: object
properties:
protection_plan_id:
type: string
format: UUID
required: [ protection_plan_id ]
ScheduledOperation:
type: object
properties:
id:
type: string
format: UUID
description: |
Unique identifier representing a specific scheduled operation.
name:
type: string
description: Display name of scheduled operation.
comments:
type: string
description: Comments about the scheduled operation.
trigger_id:
type: string
format: UUID
operation_definition:
$ref: '#/definitions/OperationDefinition'
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.
resource_typeParam:
name: resource_type
type: string
format: Heat Type String
required: true
in: path
description: the resource type.