# 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: - 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' - name: s3 description: s3 interface of multi-cloud 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: '200': description: Delete success '400': description: Invalid ID supplied '/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: listBackendTypes 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: '200': description: Delete success '400': description: Invalid ID supplied post: tags: - plan summary: Run a plan. operationId: runPlan responses: '200': description: Run success '400': description: Invalid ID supplied '/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: '200': description: Delete success '400': description: Invalid ID supplied '/v1/s3/{bucketName}': parameters: - name: bucketName in: path description: the name of bucket required: true schema: type: string put: tags: - s3 summary: create a bucket. operationId: bucketPut responses: '200': description: successful create bucket content: application/xml: schema: $ref: '#/components/schemas/BaseResponse' requestBody: content: application/xml: schema: $ref: '#/components/schemas/CreateBucketConfiguration' delete: tags: - s3 summary: delete a bucket. operationId: bucketdelete responses: '200': description: successful delete bucket content: application/xml: schema: $ref: '#/components/schemas/BaseResponse' get: tags: - s3 summary: list objects operationId: listObjects responses: '200': description: successful list objects content: application/xml: schema: $ref: '#/components/schemas/ListObjectResponse' /v1/s3/: parameters: - name: bucketName in: path description: the name of bucket required: true schema: type: string get: tags: - s3 summary: list buckets. operationId: listBuckets responses: '200': description: successful delete bucket content: application/xml: schema: $ref: '#/components/schemas/ListAllMyBucketsResult' '/v1/s3/{bucketName}/{object}': parameters: - name: bucketName in: path description: the name of bucket required: true schema: type: string - name: object in: path description: the name of object required: true schema: type: string - name: Range in: query description: >- the Header parameter Range value like "bytes:1-10",used for multipart download required: false schema: type: string - name: uploads in: query description: 'the format is ''/{object}?uploads'',used for init multipartupload' required: false schema: type: string - name: partNumber in: query description: >- the format is '/{object}?partNumber={partNumber}&uploadId={UploadId}',must be used with uploadId parameter ,used for upload a part required: false schema: type: string - name: uploadId in: query description: >- the format is '/{object}?uploadId={UploadId}',used for compelete multipart upload and abort multiparupload required: false schema: type: string put: tags: - s3 summary: upload object. operationId: objectPut responses: '200': description: successful upload a object content: application/xml: schema: $ref: '#/components/schemas/BaseResponse' get: tags: - s3 summary: download object operationId: objectGet responses: '200': description: successful download object delete: tags: - s3 summary: delete a object. operationId: objectdelete responses: '200': description: successful delete object content: application/xml: schema: $ref: '#/components/schemas/BaseResponse' '/v1/s3/storageClasses': get: tags: - s3 summary: get supported storage classes operationId: getStorageClasses responses: '200': description: 'Get storage classes succesfully. There is a map between storage class name and stroage tier, as default the storage classes are compatible with aws s3.' content: application/xml: schema: $ref: '#/components/schemas/ListStorageClasses' 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 PolicyEnabled: description: Enable policy or not. type: boolean PolicyId: description: >- Related policy id, plan will be scheduled automatically according this policy if PolicyEnabled is true. type: string 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. BaseResponse: type: object properties: ErrorCode: description: error code type: string Message: description: sucessfully or failure type: string CreateBucketConfiguration: type: object properties: LocationConstraint: description: The backend of Bucket type: string ListAllMyBucketsResult: type: object properties: Owner: description: '' type: object properties: ID: description: The owner id type: string DisplayName: description: '' type: string Buckets: description: '' type: object properties: name: description: The name of bucket type: string CreationDate: description: The date of create type: string LocationConstraint: description: The backend of logic bucket type: string ListObjectResponse: type: object properties: ListObjects: description: '' type: object properties: ObjectKey: description: The key of object type: string BucketName: description: The name of bucket type: string size: description: The size of object type: string Backend: description: The backend of object type: string ListStorageClasses: type: array xml: wrapped: true items: xml: name: Class type: object properties: Name: description: 'The storage class name, as default, it is compatible with aws s3.' type: string example: STANDARD Tier: description: 'The storage tier, used in OpenSDS. Each tier is mapped to a specific name.' type: integer example: 1 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