# Copyright (c) 2018 Huawei Technologies Co., Ltd. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. openapi: 3.0.0 servers: # Added by API Auto Mocking Plugin - description: SwaggerHub API Auto Mocking url: https://virtserver.swaggerhub.com/open83/multi-cloud/1.0.0 - url: 'http://virtserver.swaggerhub.com/opensds.io/OpenSDS-Multi-Cloud/1.0.0' info: description: | OpenSDS Multi-cloud API to manage multi-cloud backend storages. You can find out more about Swagger at [https://www.opensds.io](https://www.opensds.io) version: "1.0.0" title: OpenSDS Multi-Cloud API termsOfService: '://www.linuxfoundation.org/terms' contact: name: OpenSDS Support url: 'https://opensds.slack.com' email: support@opensds.io license: name: Apache 2.0 url: 'http://www.apache.org/licenses/LICENSE-2.0.html' tags: - name: backend description: Muli-cloud cloud storage backends externalDocs: description: Find out more url: 'https://opensds.io' - name: type description: Supported storage backends externalDocs: description: Find out more url: 'https://opensds.io' - name: plan description: Migration plan externalDocs: description: Find out more url: 'https://opensds.io' - name: job description: Migration job externalDocs: description: Find out more url: 'https://opensds.io' - name: policy description: Schedule policy of plan. externalDocs: description: Find out more url: 'https://opensds.io' paths: '/v1/{tenantId}/backends': parameters: - name: tenantId in: path description: The tenant UUID in a multi-tenancy environment. required: true schema: type: string post: tags: - backend summary: Create a backend. operationId: createBackend responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/Backend' requestBody: $ref: '#/components/requestBodies/Backend' get: tags: - backend summary: List all backends. operationId: listBackend parameters: - name: type in: query description: Filter the backend by backend type. schema: type: string enum: ["hw-obs", "aws-s3", "azure-blob"] - name: name in: query description: Filter the backend by name. schema: type: string - name: region in: query description: Filter the backend by region. schema: type: string - $ref: '#/components/parameters/offset' - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/sort' responses: '200': description: successful operation. content: application/json: schema: type: object properties: backends: type: array items: $ref: '#/components/schemas/Backend' next: type: integer example: 1 put: tags: - backend summary: Update a backend. operationId: updateBackend responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/Backend' requestBody: content: application/json: schema: type: object properties: Access: description: Updated the specified backend access Id type: string Security: description: Updated the specified backend security Id type: string delete: tags: - backend summary: Deletes a backend. operationId: deleteBackend responses: '400': description: Invalid ID supplied '200': description: Delete success '/v1/{tenantId}/backends/{backendId}': parameters: - name: tenantId in: path description: The tenantId UUID in a multi-tenancy environment. required: true schema: type: string get: tags: - backend summary: Qurey a backend information. operationId: getBackend parameters: - name: backendId in: path description: The backend ID. required: true schema: type: string responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/Backend' '/v1/{tenantId}/types': parameters: - name: tenantId in: path description: The tenantId UUID in a multi-tenancy environment. required: true schema: type: string get: tags: - types summary: List all supported storage backend type. operationId: listBackend parameters: - name: name in: query description: Filter the backend by name. schema: type: string - $ref: '#/components/parameters/offset' - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/sort' responses: '200': description: successful operation. content: application/json: schema: type: object properties: backends: type: array items: $ref: '#/components/schemas/Type' next: type: integer example: 1 '/v1/{tenantId}/plans': parameters: - name: tenantId in: path description: The tenant UUID in a multi-tenancy environment. required: true schema: type: string post: tags: - plan summary: Create a plan. operationId: createPlan responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/Plan' requestBody: $ref: '#/components/requestBodies/Plan' get: tags: - plan summary: List all plans. operationId: listPlans parameters: - name: type in: query description: Filter the plans by plan type. Only migration support currently. New type will be added in the future. schema: type: string enum: ["migration"] - name: name in: query description: Filter the plan by name. schema: type: string - $ref: '#/components/parameters/offset' - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/sort' responses: '200': description: successful operation. content: application/json: schema: type: object properties: backends: type: array items: $ref: '#/components/schemas/Plan' next: type: integer example: 1 '/v1/{tenantId}/plans/{planId}': parameters: - name: tenantId in: path description: The tenant UUID in a multi-tenancy environment. required: true schema: type: string - name: planId in: path description: The plan ID required: true schema: type: string get: tags: - plan summary: Get a plan. operationId: getPlan responses: '200': content: application/json: schema: $ref: '#/components/schemas/Plan' description: successful operation. '400': description: Bad Request '401': description: Unauthorized '403': description: Forbidden '404': description: The resource does not exist. put: tags: - plan summary: Update a plan. operationId: updatePlan responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/Plan' requestBody: $ref: '#/components/requestBodies/Plan' delete: tags: - plan summary: Delete a plan. operationId: deletePlan responses: '400': description: Invalid ID supplied '200': description: Delete success post: tags: - plan summary: Run a plan. operationId: runPlan responses: '400': description: Invalid ID supplied '200': description: Run success '/v1/{tenantId}/jobs': parameters: - name: tenantId in: path description: The tenant UUID in a multi-tenancy environment. required: true schema: type: string get: tags: - job summary: List all jobs. operationId: listJobs parameters: - name: type in: query description: Filter the jobs by job type. Only migration support currently. New type will be added in the future. schema: type: string enum: ["migration"] - $ref: '#/components/parameters/offset' - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/sort' responses: '200': description: successful operation. content: application/json: schema: type: object properties: backends: type: array items: $ref: '#/components/schemas/Job' next: type: integer example: 1 '/v1/{tenantId}/jobs/{jobId}': parameters: - name: tenantId in: path description: The tenant UUID in a multi-tenancy environment. required: true schema: type: string - name: jobId in: path description: The job ID required: true schema: type: string get: tags: - job summary: Get a job. operationId: getJob responses: '200': content: application/json: schema: $ref: '#/components/schemas/Job' description: successful operation. '400': description: Bad Request '401': description: Unauthorized '403': description: Forbidden '404': description: The resource does not exist. '/v1/{tenantId}/policies': parameters: - name: tenantId in: path description: The tenant UUID in a multi-tenancy environment. required: true schema: type: string post: tags: - policy summary: Create a policy. operationId: createPolicy responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/Policy' requestBody: $ref: '#/components/requestBodies/Policy' get: tags: - policy summary: List all policies. operationId: listPolicies parameters: - $ref: '#/components/parameters/offset' - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/sort' responses: '200': description: successful operation. content: application/json: schema: type: object properties: backends: type: array items: $ref: '#/components/schemas/Policy' next: type: integer example: 1 '/v1/{tenantId}/plans/{policyId}': parameters: - name: tenantId in: path description: The tenant UUID in a multi-tenancy environment. required: true schema: type: string - name: policyId in: path description: The policy ID required: true schema: type: string get: tags: - policy summary: Get a policy. operationId: getPolicy responses: '200': content: application/json: schema: $ref: '#/components/schemas/Policy' description: successful operation. '400': description: Bad Request '401': description: Unauthorized '403': description: Forbidden '404': description: The resource does not exist. put: tags: - policy summary: Update a policy. operationId: updatePolicy responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/Policy' requestBody: $ref: '#/components/requestBodies/Policy' delete: tags: - policy summary: Delete a policy. operationId: deletePolicy responses: '400': description: Invalid ID supplied '200': description: Delete success components: parameters: offset: in: query name: offset required: false schema: type: integer minimum: 0 default: 0 description: The number of items to skip before starting to collect the result set limit: in: query name: limit required: false schema: type: integer minimum: 1 default: 1000 description: The numbers of items to return sort: in: query name: sort required: false schema: type: string description: 'The sort key and direction of items to return, string must like:"id:asc,name:desc"' schemas: Backend: type: object properties: Id: description: The backend ID, generate by server type: string example: "5bd6f273b0bdf90001dc91c2" TenantId: description: The tenant UUID in a multi-tenancy environment. type: string example: "1ff92505-3efb-45bd-8e2d-764a1ce0fa6a" UserId: description: User Id. type: string Name: description: The backend name specified by user. type: string example: backend001 Type: description: The backend type. type: string example: "hw-obs" enum: - hw-obs - aws-s3 - azure-blob Region: type: string example: "ap-southeast-1" Endpoint: type: string example: "obs.ap-southeast-1.myhwclouds.com" BucketName: type: string example: "bucket001" Access: type: string example: "4X7JQDFTCYUNWFBRYZVC" Security: type: string example: "9hr0ekZgg0vZHulEekTVfWuu1lnPFvpVAJQNHXdn" Type: type: object properties: name: description: The backend type name. type: string example: hw-obs description: description: The backend type description. type: string example: 'Huawei Object Storage Service(OBS)' KV: type: object properties: key: description: Key of the Key-Value object. type: string Value: description: Value of the Key-Value object. type: string Connector: type: object properties: StorType: $ref: '#/components/schemas/ConnType' BucketName: type: string description: The name of bucket which is created in OpenSDS. When the type of connector is opensds-obj, this parameter should be provided. SelfConfig: description: When the type of connector is not opensds-obj, this parameter should be provided. It is used for self-define connector. type: array items: $ref: '#/components/schemas/KV' example: - key: region value: ap-southeast-1 - key: endpoint value: s3.amazonaws.com - key: bucketname value: test - key: access value: ABCDEFGHIJKLMNOPQRST - key: security value: ABCDEFGHIJKLMNOPQRSTABCDEFGHIJKLMNOPQRST ConnType: type: string description: Connector type. example: "opensds-obj" enum: - opensds-obj - aws-s3 - azure-blob - hw-obs Plan: type: object properties: Id: description: The plan ID, generate by server type: string example: "5bd6f273b0bdf90001dc91c3" TenantId: description: The tenant UUID in a multi-tenancy environment. type: string example: "1ff92505-3efb-45bd-8e2d-764a1ce0fa6b" UserId: description: User Id. type: string Description: description: Plan description. type: string Name: description: The plan name specified by user. type: string example: plan001 Type: description: The plan type. Till now only migration support. New types will be added in the future. type: string example: "migration" enum: - migration RemainSource: description: Remain the source objects or not. type: boolean SourceConn: $ref: '#/components/schemas/Connector' DestConn: $ref: '#/components/schemas/Connector' Filter: type: object properties: Prefix: type: string description: Prefix of object name, only those objects which name have this prefix will be choosed. Job: type: object properties: Id: description: The plan ID, generate by server type: string example: "5bd6f273b0bdf90001dc91c3" TenantId: description: The tenant UUID in a multi-tenancy environment. type: string example: "1ff92505-3efb-45bd-8e2d-764a1ce0fa6b" Type: description: The plan type. Till now only migration support. New types will be added in the future. type: string example: "migration" enum: - migration PlanName: description: The name of plan job belongs to. type: string PlanId: description: The id of plan job belongs to. type: string SourceLocation: description: The source data migrate or replicate from. type: string DestLocation: description: The target data migrate or replicate to. type: string CreateTime: description: The time job is created. type: integer StartTime: description: The time job started to run. type: integer EndTime: description: The time job ended. type: integer Status: description: The status of job. type: string enum: - "pending" - "rnning" - "succeed" - "failed" TotalCapacity: description: The total capacity that should be migrated. type: integer PassedCapacity: description: The capacity that have been migrated. type: integer TotalCount: description: The total count of objects that should be migrated. type: integer PassedCount: description: The count that have been migrated. type: integer Progress: description: The progress of job, represented by percentage. type: integer Policy: type: object properties: Id: description: The policy ID, generate by server type: string example: "5bd6f273b0bdf90001dc91c3" TenantId: description: The tenant UUID in a multi-tenancy environment. type: string example: "1ff92505-3efb-45bd-8e2d-764a1ce0fa6b" Name: description: Policy Name. type: string Description: description: Description of policy. type: string Schedule: description: Schedule rules. type: object properties: Type: type: string description: The type of scheduler, only cron support now. enum: - "cron" TriggerProperties: type: string description: Cron expression format. A cron expression represents a set of times, using 6 space-separated fields as follow. #Field name | Mandatory? | Allowed values | Allowed special characters #---------- | ---------- | -------------- | -------------------------- #Seconds | Yes | 0-59 | * / , - #Minutes | Yes | 0-59 | * / , - #Hours | Yes | 0-23 | * / , - #Day of month | Yes | 1-31 | * / , - ? #Month | Yes | 1-12 or JAN-DEC | * / , - #Day of week | Yes | 0-6 or SUN-SAT | * / , - ? #See https://godoc.org/github.com/robfig/cron for details. requestBodies: Backend: content: application/json: schema: $ref: '#/components/schemas/Backend' description: Cloud Backend configurations required: true Plan: content: application/json: schema: $ref: '#/components/schemas/Plan' description: Plan configurations required: true Policy: content: application/json: schema: $ref: '#/components/schemas/Policy' description: Policy configurations required: true