Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add return_url negotiation #21

Closed
wants to merge 11 commits into from
243 changes: 222 additions & 21 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ paths:
'400':
$ref: '#/components/responses/ErrorResponse'

/list_locations:
/locations:
get:
description: Lists all the visible locations to the caller.
parameters:
- name: asn
in: query
description: List avaible locations for peering with the given ASN
description: List available locations for peering with the given server ASN
required: true
schema:
type: integer
Expand All @@ -50,58 +51,124 @@ paths:
required: false
schema:
$ref: '#/components/schemas/LocationType'
- name: max_results
in: query
description: Hint to paginate the request with the maximum number of results the caller is able to process.
required: false
schema:
type: integer
default: 0
minimum: 0
maximum: 100
- name: next_token
in: query
description: Indication of the offset to retrieve the next page on a previously initiated paginated request.
required: false
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Location'

$ref: '#/components/responses/ListLocationsResponse'
'400':
$ref: '#/components/responses/ErrorResponse'
'403':
$ref: '#/components/responses/ErrorResponse'

/add_sessions:
/sessions:
post:
description: Request peering
description: Requests a new set of sessions to be created.
requestBody:
description: Request to create peering sessions
content:
application/json:
schema:
$ref: '#/components/schemas/SessionArray'
$ref: '#/components/schemas/CreateSessionsRequest'
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/SessionArray'
'300':
description: Request modified or partially accepted
content:
application/json:
schema:
$ref: '#/components/schemas/SessionArray'
$ref: '#/components/responses/CreateSessionsResponse'
'400':
$ref: '#/components/responses/ErrorResponse'
# Forbidden
'403':
$ref: '#/components/responses/ErrorResponse'
# Please contact, requires human interverntion
'422':
$ref: '#/components/responses/ErrorResponse'

/get_status:
get:
description: Lists a set of sessions visible to the caller. Each session in the set contains a summary of its current status.
parameters:
- name: asn
in: query
description: asn of requester
required: true
schema:
type: integer
- name: request_id
- name: max_results
in: query
description: request identifier
description: Hint to paginate the request with the maximum number of results the caller is able to process.
required: false
schema:
type: integer
default: 0
minimum: 0
maximum: 100
- name: next_token
in: query
description: Indication of the offset to retrieve the next page on a previously initiated paginated request.
required: false
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/responses/ListSessionsResponse'
'400':
$ref: '#/components/responses/ErrorResponse'
'403':
$ref: '#/components/responses/ErrorResponse'

delete:
description: Requests to turn the session down and delete it from the server.
requestBody:
description: Request to delete peering sessions
content:
application/json:
schema:
$ref: '#/components/schemas/SessionReferenceArray'
required: true
responses:
'200':
description: Sessions are scheduled for deletion and no longer usable
content:
application/json:
schema:
$ref: '#/components/responses/DeleteSessionsResponse'
'400':
$ref: '#/components/responses/ErrorResponse'
'403':
$ref: '#/components/responses/ErrorResponse'

/sessions/{session_id}:
get:
description: Retrieves a given session by it server-generated ID provided on creation.
parameters:
- name: session_id
in: path
description: Server-generated stable identifier for the session.
required: true
schema:
type: string
responses:
Expand All @@ -110,9 +177,36 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/SessionArray'
$ref: '#/components/schemas/Session'
'400':
$ref: '#/components/responses/ErrorResponse'
'403':
$ref: '#/components/responses/ErrorResponse'
'404':
$ref: '#/components/responses/ErrorResponse'

delete:
description: Requests to turn the session down and delete it from the server.
parameters:
- name: session_id
in: path
description: Server-generated stable identifier for the session.
required: true
schema:
type: string
responses:
'200':
description: Session is scheduled for deletion and no longer usable
content:
application/json:
schema:
$ref: '#/components/schemas/Session'
'400':
$ref: '#/components/responses/ErrorResponse'
'403':
$ref: '#/components/responses/ErrorResponse'
'404':
$ref: '#/components/responses/ErrorResponse'

components:
schemas:
Expand All @@ -138,6 +232,40 @@ components:
Add choices
type: string

LocationArray:
title: Locations
description: Array of peering locations
type: array
items:
$ref: '#/components/schemas/Location'

SessionRequestArray:
title: BGP Sessions requested
description: Array of BGP Sessions requested
type: array
items:
$ref: '#/components/schemas/SessionRequestItem'

SessionRequestItem:
title: BGP Session Request
description: BGP Session Request
type: object
properties:
local_asn:
type: integer
local_ip:
type: string
peer_asn:
type: integer
peer_ip:
type: string
peer_type:
type: string
md5: # TODO or auth: md5: $key?
type: string
location:
$ref: '#/components/schemas/Location'

SessionArray:
title: BGP Sessions
description: Array of BGP Sessions
Expand Down Expand Up @@ -166,11 +294,30 @@ components:
$ref: '#/components/schemas/Location'
status:
$ref: '#/components/schemas/SessionStatus'
uuid:
session_id:
type: string
description: |-
unique identifier (also serves as request id)
Could separate into local_ and peer_?

SessionReferenceArray:
title: BGP Session References
description: Array of BGP Session References
type: array
items:
$ref: '#/components/schemas/SessionReference'

SessionReference:
title: BGP Session Reference
description: Reference to univocally identify a BGP Session
type: object
properties:
session_id:
type: string
description: |-
unique identifier (also serves as request id)
Could separate into local_ and peer_?

Error:
title: Error
type: object
Expand All @@ -187,6 +334,7 @@ components:
readOnly: true
required:
- field_errors

FieldError:
title: FieldError
type: object
Expand All @@ -206,7 +354,60 @@ components:
- name
- errors

CreateSessionsRequest:
title: CreateSessionsRequest
description: Response to a request to create sessions
type: object
properties:
return_url:
description: URL to requestor's endpoint to negotiate the session creation
type: string
sessions:
$ref: '#/components/schemas/SessionRequestArray'
required:
- sessions

responses:
ListLocationsResponse:
title: ListLocationsResponse
description: Response to a list for locations
type: object
properties:
next_token:
type: string
locations:
$ref: '#/components/schemas/LocationArray'

CreateSessionsResponse:
title: CreateSessionsResponse
description: Response to a request to create sessions
type: object
properties:
sessions:
$ref: '#/components/schemas/SessionArray'
errors:
$ref: '#/components/schemas/Error'

ListSessionsResponse:
title: ListSessionsResponse
description: Response to a list for sessions
type: object
properties:
next_token:
type: string
sessions:
$ref: '#/components/schemas/SessionArray'

DeleteSessionsResponse:
title: DeleteSessionsResponse
description: Response to a request to delete sessions
type: object
properties:
sessions:
$ref: '#/components/schemas/SessionArray'
errors:
$ref: '#/components/schemas/Error'

ErrorResponse:
description: API Error response
content:
Expand Down
Loading