Skip to content

Commit

Permalink
Snowflake Rest Api Specification
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-zli committed Nov 14, 2023
1 parent 45f89c1 commit 6db3548
Show file tree
Hide file tree
Showing 6 changed files with 1,852 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Created by https://www.gitignore.io/api/c,c++,node,java,python,intellij,netbeans
# Edit at https://www.gitignore.io/?templates=c,c++,node,java,python,intellij,netbeans
.DS_Store

### C ###
# Prerequisites
Expand Down
310 changes: 310 additions & 0 deletions specification/private-preview/2023-11-13-private-preview/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,310 @@
components:
schemas:
description: If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.
Identifier:
type: string
pattern: '^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$'
ErrorResponse:
type: object
properties:
message:
type: string
description: "Error message returned by server"
error_code:
type: string
description: "Error code"
request_id:
type: string
description: "Unique request id"
example:
message: "Compilation error!"
error_code: "390189"
request_id: "01afef9d-0607-0550-0001-dd270c3902d7"
SuccessResponse:
type: object
description: "Schema for all the success response returned by server"
properties:
status:
type: string
description: "Message returned by server"
example:
status: "Request successfully completed"
Clone:
type: object
description: When cloning an obejct we need the source's name and a point of time that we want to clone at.
properties:
source:
$ref: './common.yaml#/components/schemas/Identifier'
point_of_time:
$ref: '#/components/schemas/PointOfTime'
required:
- "source"
PointOfTime:
type: object
required:
- point_of_time_type
properties:
point_of_time_type:
type: string
reference:
type: string
description: The relation to the point of time.
At the time of writing at and before are supported.
when:
type: string
description: The actual description of the point of time.
discriminator:
propertyName: point_of_time_type
mapping:
timestamp: PointOfTimeTimestamp
offset: PointOfTimeOffset
statement: PointOfTimeStatement
PointOfTimeTimestamp:
description: A point of time that is identified by a timestamp.
allOf:
- $ref: '#/components/schemas/PointOfTime'
PointOfTimeOffset:
description: A point of time that is identified by an offset in reference to right now.
allOf:
- $ref: '#/components/schemas/PointOfTime'
PointOfTimeStatement:
description: A point of time that is identified by when a statement was executed.
allOf:
- $ref: '#/components/schemas/PointOfTime'
parameters:
database:
name: database
required: true
in: 'path'
schema:
example: TEST_DB
$ref: './common.yaml#/components/schemas/Identifier'
schema:
name: schema
required: true
in: 'path'
schema:
example: TEST_SCHEMA
$ref: './common.yaml#/components/schemas/Identifier'
name:
name: name
required: true
in: 'path'
schema:
example: TEST_NAME
$ref: './common.yaml#/components/schemas/Identifier'
tag:
name: 'tag'
in: 'query'
schema:
type: object
example: TEST_TAG
additionalProperties: true
createMode:
name: 'createMode'
in: 'query'
schema:
type: string
enum: [errorIfExists, orReplace, ifNotExists]
example: errorIfExists
default: errorIfExists
ifExists:
name: 'ifExists'
in: 'query'
schema:
type: boolean
example: false
default: false
like:
name: 'like'
in: 'query'
schema:
type: string
example: "test_%"
startsWith:
name: 'startsWith'
in: 'query'
schema:
type: string
example: "test"
rootOnly:
name: 'rootOnly'
in: 'query'
schema:
type: boolean
example: false
default: false
showLimit:
name: 'showLimit'
in: 'query'
schema:
type: integer
example: 10
fromName:
name: 'fromName'
in: 'query'
schema:
type: string
example: "from_test"
sessionId:
name: 'sessionId'
required: true
in: path
schema:
type: integer
format: uuid
example: 524514326772799
content-type:
name: 'Content-Type'
in: header
schema:
type: string
enum: ['application/json']
accept:
name: 'Accept'
in: header
schema:
type: string
enum: ['application/json']
x-snowflake-authorization-token-type:
name: 'X-Snowflake-Authorization-Token-Type'
in: header
schema:
type: string
enum: ['KEYPAIR_JWT']
x-sfc-session:
name: 'X-Sfc-Session'
in: header
required: false
schema:
type: string
description: Snowflake Session Token
example: "ver:3-hint:1000-ABCD="
securitySchemes:
keyPair:
type: http
scheme: bearer
bearerFormat: JWT
description: Set X-Snowflake-Authorization-Token-Type to KEYPAIR_JWT if the token is a key pair authn JWT.
ExternalOAuth:
type: http
scheme: bearer
bearerFormat: JWT
description: Configure External Oauth with Snowflake (refer to docs). Set X-Snowflake-Authorization-Token-Type to OAUTH and set the Token to auth token received from the external Auth server.
snowflakeOAuth:
type: oauth2
flows:
implicit:
authorizationUrl: /oauth/authorize
scopes: {}
responses:
'200SuccessResponse':
description: Successful
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'

'201SuccessCreatedResponse':
description: Successfully create new resource on server.
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'

'202SuccessAcceptedResponse':
description: Successfully accept the request, but it is not completed yet.
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'

'400BadRequest':
description: >-
Bad Request. The request payload is invalid or malformed. This happens if the application didn't send the correct request payload. The response body may include the error code and message indicating the actual cause. The application must reconstruct the request body for retry.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401Unauthorized':
description: >-
Unauthorized. The request is not authorized. This happens if the attached access token is invalid or missing. The response body may include the error code and message indicating the actual cause, e.g., expired, invalid token. The application must obtain a new access token for retry.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403Forbidden':
description: >-
Forbidden. The request is forbidden. This can also happen if the request is made even if the API is not enabled.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404NotFound':
description: >-
Not Found. The request endpoint is not valid. This happens if the API endpoint does not exist, or if the API is not enabled.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'405MethodNotAllowed':
description: >-
Method Not Allowed. The request method doesn't match the supported API. This happens, for example, if the application calls the API with GET method but the endpoint accepts only POST.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'409Conflict':
description: >-
Conflict. The requested operation could not be performed due to a conflicting state that could not be resolved. This usually happens when a CREATE request was performed when there is a pre-existing resource with the same name, and also without one of the options orReplace/ifNotExists.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'410Gone':
description: >-
Gone. This error is primarily intended to assist the task of web maintenance by notifying the recipient that the resource is intentionally unavailable.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'415UnsupportedMediaType':
description: >-
The request header Content-Type includes an unsupported media type. The API supports application/json only. If none specified, the request payload is taken as JSON, but if any other media type is specified, this error is returned.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'429LimitExceeded':
description: >-
Limit Exceeded. The number of requests hit the rate limit. The application must slow down the frequency of hitting the API endpoints.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500InternalServerError':
description: >-
Internal Server Error. The server hit an unrecoverable system error. The response body may include the error code and message for further guidance. The application owner may need to reach out the customer support.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'503ServiceUnavailable':
description: >-
Service Unavailable. The request was not processed due to server side timeouts. The application may retry with backoff. The jittered backoff is recommended.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'504GatewayTimeout':
description: >-
Gateway Timeout. The request was not processed due to server side timeouts. The application may retry with backoff. The jittered backoff is recommended.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'

security:
- keyPair: []
- ExternalOAuth: []
- snowflakeOAuth: []
Loading

0 comments on commit 6db3548

Please sign in to comment.