scripts/deployment/openapi/openapi.yaml (520 lines of code) (raw):
# Copyright 2019 Google Inc.
#
# 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.
swagger: '2.0'
info:
title: Storage SDRS API Definition
version: '1.0.0'
# The API hostname
host: your-api.endpoints.your-project-id.cloud.goog
x-google-endpoints:
- # The endpoints name matches the 'host' value above
name: your-api.endpoints.your-project-id.cloud.goog
# Your target IP Address; Must be quoted
target: 'your_target_ip'
security:
- server_service_account: []
- api_key: []
paths:
/status:
get:
produces:
- text/plain
responses:
'200':
description: Application status
description: Get application status
operationId: getAppStatus
/stsjobpool:
post:
consumes:
- application/json
produces:
- application/json
parameters:
- description: The source projectId
in: query
name: sourceProject
required: true
type: string
- description: The source bucket
in: query
name: sourceBucket
required: true
type: string
- in: body
name: body
required: true
description: Collection of pooled jobs
schema:
type: object
responses:
'200':
description: Create Job Pool response
schema:
$ref: '#/definitions/PooledJobCreateResponse'
'400':
description: Validation error response
schema:
$ref: '#/definitions/ErrorResponse'
'500':
description: Internal server error
schema:
$ref: '#/definitions/ErrorResponse'
description: Create Job Pool
operationId: createByBatch
delete:
consumes:
- application/json
produces:
- application/json
parameters:
- description: The source projectId
in: query
name: sourceProject
required: true
type: string
- description: The source bucket
in: query
name: sourceBucket
required: true
type: string
responses:
'200':
description: Successful delete response
schema:
$ref: '#/definitions/BaseResponse'
'400':
description: Validation error response
schema:
$ref: '#/definitions/ErrorResponse'
'500':
description: Internal server error
schema:
$ref: '#/definitions/ErrorResponse'
description: Deletes all pooled jobs for the given bucket
operationId: delete
get:
produces:
- application/json
parameters:
- description: The sourceProject
in: query
name: sourceProject
required: true
type: string
- description: The sourceBucket
in: query
name: sourceBucket
required: true
type: string
responses:
'200':
description: Job Pool Response
schema:
type: array
items:
$ref: '#/definitions/PooledJobResponse'
'400':
description: Validation error response
schema:
$ref: '#/definitions/ErrorResponse'
'500':
description: Internal server error
schema:
$ref: '#/definitions/ErrorResponse'
description: Get job pool by source bucket and project
operationId: getPooledJobs
/retentionrules:
post:
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: Retention rule definition
schema:
$ref: '#/definitions/CreateRetentionRuleRequest'
responses:
'200':
description: Create retention rule response
schema:
$ref: '#/definitions/CreateRetentionRuleResponse'
'400':
description: Validation error response
schema:
$ref: '#/definitions/ErrorResponse'
'500':
description: Internal server error
schema:
$ref: '#/definitions/ErrorResponse'
description: Create retention rule
operationId: postRetentionRules
get:
produces:
- application/json
parameters:
- description: The rule's projectId
in: query
name: projectId
required: true
type: string
- description: The rule's dataStorageName
in: query
name: dataStorageName
required: true
type: string
- description: The rule's type
in: query
name: type
required: true
type: string
responses:
'200':
description: Matching retention rule
schema:
$ref: '#/definitions/RetentionRuleResponse'
'400':
description: Validation error response
schema:
$ref: '#/definitions/ErrorResponse'
'500':
description: Internal server error
schema:
$ref: '#/definitions/ErrorResponse'
description: Get retetion rule matching provided values
operationId: getByBusinessKey
delete:
produces:
- application/json
parameters:
- description: The rule's projectId
in: query
name: projectId
required: true
type: string
- description: The rule's dataStorageName
in: query
name: dataStorageName
required: true
type: string
- description: The rule's type
in: query
name: type
required: true
type: string
responses:
'200':
description: Successful delete response
schema:
$ref: '#/definitions/BaseResponse'
'400':
description: Validation error response
schema:
$ref: '#/definitions/ErrorResponse'
'500':
description: Internal server error
schema:
$ref: '#/definitions/ErrorResponse'
description: Delete retetion rule matching provided values
operationId: deleteByBusinessKey
'/retentionrules/{id}':
put:
consumes:
- application/json
produces:
- application/json
parameters:
- description: Rule primary key
in: path
name: id
required: true
type: integer
- description: Retention rule updates
in: body
name: body
required: true
schema:
$ref: '#/definitions/UpdateRetentionRuleRequest'
responses:
'200':
description: Updated retention rule
schema:
$ref: '#/definitions/RetentionRuleResponse'
'400':
description: Validation error response
schema:
$ref: '#/definitions/ErrorResponse'
'500':
description: Internal server error
schema:
$ref: '#/definitions/ErrorResponse'
description: Update retention rule by id
operationId: putRetentionRulesById
'/events/execution':
post:
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: Execution event definition
schema:
$ref: '#/definitions/ExecutionEventRequest'
responses:
'200':
description: Event execution response
schema:
$ref: '#/definitions/EventResponse'
'400':
description: Validation error response
schema:
$ref: '#/definitions/ErrorResponse'
'500':
description: Internal server error
schema:
$ref: '#/definitions/ErrorResponse'
description: Execute a policy or user rule
operationId: postExecutionEvent
'/events/notification':
post:
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: Notification event definition
schema:
$ref: '#/definitions/NotificationEventRequest'
responses:
'200':
description: Notification event response
schema:
$ref: '#/definitions/EventResponse'
'400':
description: Validation error response
schema:
$ref: '#/definitions/ErrorResponse'
'500':
description: Internal server error
schema:
$ref: '#/definitions/ErrorResponse'
description: Accepts a request to invoke a delete notification service
operationId: postNotificationEvent
'/events/validation':
post:
consumes:
- application/json
produces:
- application/json
responses:
'200':
description: Validation event response
schema:
$ref: '#/definitions/EventResponse'
'400':
description: Validation error response
schema:
$ref: '#/definitions/ErrorResponse'
'500':
description: Internal server error
schema:
$ref: '#/definitions/ErrorResponse'
description: Triggers a job to validate execution run status
operationId: postValidationEvent
definitions:
BaseResponse:
properties:
requestUuid:
type: string
type: object
ErrorResponse:
allOf:
- $ref: '#/definitions/BaseResponse'
- properties:
message:
type: string
type: object
EventResponse:
allOf:
- $ref: '#/definitions/BaseResponse'
- properties:
message:
type: string
type: object
CreateRetentionRuleRequest:
properties:
dataStorageName:
type: string
datasetName:
type: string
projectId:
type: string
retentionPeriod:
$ref: '#/definitions/RetentionPeriod'
retentionPeriodUnit:
$ref: '#/definitions/RetentionPeriodUnit'
type:
$ref: '#/definitions/RetentionRuleType'
required:
- type
- retentionPeriod
type: object
CreateRetentionRuleResponse:
allOf:
- $ref: '#/definitions/BaseResponse'
- properties:
ruleId:
type: integer
type: object
RetentionPeriod:
maximum: 1000
minimum: 0
type: integer
RetentionPeriodUnit:
enum:
- DAY
- MONTH
- VERSION
type: string
default: DAY
RetentionRuleResponse:
allOf:
- $ref: '#/definitions/BaseResponse'
- properties:
dataStorageName:
type: string
datasetName:
type: string
projectId:
type: string
retentionPeriod:
$ref: '#/definitions/RetentionPeriod'
retentionPeriodUnit:
$ref: '#/definitions/RetentionPeriodUnit'
ruleId:
type: integer
type:
$ref: '#/definitions/RetentionRuleType'
type: object
PooledJobCreateRequest:
properties:
name:
type: string
projectId:
type: string
schedule:
type: string
type:
type: string
sourceBucket:
type: string
sourceProject:
type: string
targetBucket:
type: string
targetProject:
type: string
status:
type: string
required:
- name
- projectId
- schedule
- type
- sourceBucket
- sourceProject
- targetBucket
- targetProject
- status
type: object
PooledJobCreateResponse:
allOf:
- $ref: '#/definitions/BaseResponse'
- properties:
id:
type: integer
success:
type: boolean
PooledJobResponse:
allOf:
- $ref: '#/definitions/BaseResponse'
- properties:
id:
type: integer
name:
type: string
projectId:
type: string
schedule:
type: string
type:
type: string
sourceBucket:
type: string
sourceProject:
type: string
targetProject:
type: string
targetBucket:
type: string
status:
type: string
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
type: object
UpdateRetentionRuleRequest:
properties:
retentionPeriod:
$ref: '#/definitions/RetentionPeriod'
required:
- retentionPeriod
type: object
ExecutionEventRequest:
properties:
type:
$ref: '#/definitions/ExecutionType'
projectId:
type: string
target:
type: string
required:
- type
type: object
NotificationEventRequest:
properties:
projectId:
type: string
deletedObject:
type: string
deletedAt:
type: string
format: date-time
type: object
RetentionRuleType:
enum:
- GLOBAL
- DATASET
- DEFAULT
type: string
ExecutionType:
enum:
- USER
- POLICY
type: string
securityDefinitions:
# This security definition will allow the app to call itself over HTTP/S
server_service_account:
authorizationUrl: ""
flow: implicit
type: oauth2
# The service account associated with this application should be used here
x-google-issuer: your-service-account-email-address
x-google-jwks_uri: https://www.googleapis.com/robot/v1/metadata/x509/your-service-account-email-address
api_key:
type: "apiKey"
name: "key"
in: "query"