Laravel WebSocket Clusters API

The WebSocket Clusters API from Laravel — 3 operation(s) for websocket clusters.

OpenAPI Specification

laravel-websocket-clusters-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Laravel Cloud Applications WebSocket Clusters API
  version: 0.0.1
servers:
- url: https://cloud.laravel.com/api
security:
- http: []
tags:
- name: WebSocket Clusters
paths:
  /websocket-servers:
    get:
      operationId: public.websocket-servers.index
      description: Get a list of all WebSocket clusters for the authenticated organization.
      summary: List WebSocket clusters
      tags:
      - WebSocket Clusters
      parameters:
      - name: filter[type]
        in: query
        schema:
          type: string
      - name: filter[region]
        in: query
        schema:
          type: string
      - name: filter[status]
        in: query
        schema:
          type: string
      - name: include
        in: query
        schema:
          type: array
          items:
            type: string
            enum:
            - applications
        explode: false
      responses:
        '200':
          description: Paginated set of `WebsocketServerResource`
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/WebsocketServerResource'
                  links:
                    type: object
                    properties:
                      first:
                        type: string
                      last:
                        type: string
                      prev:
                        type: string
                      next:
                        type: string
                  meta:
                    type: object
                    properties:
                      current_page:
                        type: integer
                        minimum: 1
                      from:
                        type:
                        - integer
                        - 'null'
                        minimum: 1
                      last_page:
                        type: integer
                        minimum: 1
                      links:
                        type: array
                        description: Generated paginator links.
                        items:
                          type: object
                          properties:
                            url:
                              type:
                              - string
                              - 'null'
                            label:
                              type: string
                            active:
                              type: boolean
                          required:
                          - url
                          - label
                          - active
                      path:
                        type:
                        - string
                        - 'null'
                        description: Base path for paginator generated URLs.
                      per_page:
                        type: integer
                        description: Number of items shown per page.
                        minimum: 0
                      to:
                        type:
                        - integer
                        - 'null'
                        description: Number of the last item in the slice.
                        minimum: 1
                      total:
                        type: integer
                        description: Total number of items being paginated.
                        minimum: 0
                    required:
                    - current_page
                    - from
                    - last_page
                    - links
                    - path
                    - per_page
                    - to
                    - total
                  included:
                    type: array
                    items:
                      $ref: '#/components/schemas/WebsocketApplicationResource'
                required:
                - data
                - links
                - meta
        '401':
          description: An error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error overview.
                    examples:
                    - ''
                required:
                - message
        '403':
          $ref: '#/components/responses/AuthorizationException'
    post:
      operationId: public.websocket-servers.store
      description: Create a new WebSocket cluster with a default application.
      summary: Create WebSocket cluster
      tags:
      - WebSocket Clusters
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StoreWebsocketServerRequest'
      responses:
        '201':
          description: '`WebsocketServerResource`'
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/WebsocketServerResource'
                  included:
                    type: array
                    items:
                      $ref: '#/components/schemas/WebsocketApplicationResource'
                required:
                - data
        '401':
          description: An error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error overview.
                    examples:
                    - ''
                required:
                - message
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
  /websocket-servers/{websocketServer}:
    get:
      operationId: public.websocket-servers.show
      description: Get a specific WebSocket cluster.
      summary: Get WebSocket cluster
      tags:
      - WebSocket Clusters
      parameters:
      - name: websocketServer
        in: path
        required: true
        description: The websocket server identifier
        schema:
          type: string
      - name: include
        in: query
        schema:
          type: array
          items:
            type: string
            enum:
            - applications
        explode: false
      responses:
        '200':
          description: '`WebsocketServerResource`'
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/WebsocketServerResource'
                  included:
                    type: array
                    items:
                      $ref: '#/components/schemas/WebsocketApplicationResource'
                required:
                - data
        '404':
          $ref: '#/components/responses/ModelNotFoundException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
    patch:
      operationId: public.websocket-servers.update
      description: Update a WebSocket cluster.
      summary: Update WebSocket cluster
      tags:
      - WebSocket Clusters
      parameters:
      - name: websocketServer
        in: path
        required: true
        description: The websocket server identifier
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWebsocketServerRequest'
      responses:
        '200':
          description: '`WebsocketServerResource`'
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/WebsocketServerResource'
                  included:
                    type: array
                    items:
                      $ref: '#/components/schemas/WebsocketApplicationResource'
                required:
                - data
        '404':
          $ref: '#/components/responses/ModelNotFoundException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
    delete:
      operationId: public.websocket-servers.destroy
      description: Delete a WebSocket cluster and all its applications.
      summary: Delete WebSocket cluster
      tags:
      - WebSocket Clusters
      parameters:
      - name: websocketServer
        in: path
        required: true
        description: The websocket server identifier
        schema:
          type: string
      responses:
        '204':
          description: No content
        '404':
          $ref: '#/components/responses/ModelNotFoundException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
  /websocket-servers/{websocketServer}/metrics:
    get:
      operationId: public.websocket-servers.metrics
      description: Get metrics for a specific WebSocket cluster.
      summary: Get WebSocket cluster metrics
      tags:
      - WebSocket Clusters
      parameters:
      - name: websocketServer
        in: path
        required: true
        description: The websocket server identifier
        schema:
          type: string
      - name: period
        in: query
        schema:
          anyOf:
          - $ref: '#/components/schemas/MetricPeriod'
          - type: 'null'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      connection_count:
                        type: object
                        properties:
                          labels:
                            type: array
                            items:
                              type: string
                          average:
                            type: array
                            items:
                              type: number
                          data:
                            type: array
                            items:
                              type: object
                              properties:
                                x:
                                  type: string
                                y:
                                  type: array
                                  items:
                                    type: number
                              required:
                              - x
                              - y
                        required:
                        - labels
                        - average
                        - data
                      message_rate:
                        type: object
                        properties:
                          labels:
                            type: array
                            items:
                              type: string
                          average:
                            type: array
                            items:
                              type: number
                          data:
                            type: array
                            items:
                              type: object
                              properties:
                                x:
                                  type: string
                                y:
                                  type: array
                                  items:
                                    type: number
                              required:
                              - x
                              - y
                        required:
                        - labels
                        - average
                        - data
                    required:
                    - connection_count
                    - message_rate
                  meta:
                    type: object
                    properties:
                      period:
                        type: string
                      available_periods:
                        type: array
                        items:
                          type: string
                    required:
                    - period
                    - available_periods
                required:
                - data
                - meta
        '404':
          $ref: '#/components/responses/ModelNotFoundException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    CloudRegion:
      type: string
      enum:
      - us-east-2
      - us-east-1
      - ca-central-1
      - eu-central-1
      - eu-west-1
      - eu-west-2
      - me-central-1
      - ap-southeast-1
      - ap-southeast-2
      - ap-northeast-1
      title: CloudRegion
    MetricPeriod:
      type: string
      enum:
      - 6h
      - 24h
      - 3d
      - 7d
      - 30d
      title: MetricPeriod
    WebsocketApplicationResource:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
          - websocketApplications
        attributes:
          type: object
          properties:
            name:
              type: string
            app_id:
              type: string
            allowed_origins:
              type: array
              items: {}
            ping_interval:
              type: integer
            activity_timeout:
              type: integer
            max_message_size:
              type: integer
            max_connections:
              type: integer
            created_at:
              type:
              - string
              - 'null'
              format: date-time
            ? ''
            : anyOf:
              - type: object
                properties:
                  key:
                    type: string
                  secret:
                    type: string
                required:
                - key
                - secret
              - type: array
                items:
                  type: string
                minItems: 0
                maxItems: 0
                additionalItems: false
          required:
          - name
          - app_id
          - allowed_origins
          - ping_interval
          - activity_timeout
          - max_message_size
          - max_connections
          - created_at
          - null
        relationships:
          type: object
          properties:
            server:
              type: object
              properties:
                data:
                  anyOf:
                  - $ref: '#/components/schemas/WebsocketServerResourceIdentifier'
                  - type: 'null'
              required:
              - data
      required:
      - id
      - type
      title: WebsocketApplicationResource
    WebsocketApplicationResourceIdentifier:
      type: object
      properties:
        type:
          type: string
          enum:
          - websocketApplications
        id:
          type: string
      required:
      - type
      - id
      title: WebsocketApplicationResourceIdentifier
    WebsocketServerStatus:
      type: string
      enum:
      - creating
      - updating
      - available
      - stopped
      - deleting
      - deleted
      - unknown
      title: WebsocketServerStatus
    WebsocketServerResourceIdentifier:
      type: object
      properties:
        type:
          type: string
          enum:
          - websocketServers
        id:
          type: string
      required:
      - type
      - id
      title: WebsocketServerResourceIdentifier
    WebsocketServerConnectionDistributionStrategy:
      type: string
      enum:
      - evenly
      - custom
      title: WebsocketServerConnectionDistributionStrategy
    UpdateWebsocketServerRequest:
      type: object
      properties:
        name:
          type: string
          pattern: ^[a-z0-9_-]+$
          minLength: 3
          maxLength: 40
        max_connections:
          description: The number of maximum connections allowed for the WebSocket server. If passed, the connection distribution strategy will be set to EVENLY.
          $ref: '#/components/schemas/WebsocketServerMaxConnection'
      title: UpdateWebsocketServerRequest
    WebsocketServerResource:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
          - websocketServers
        attributes:
          type: object
          properties:
            name:
              type: string
            type:
              $ref: '#/components/schemas/WebsocketServerType'
            region:
              $ref: '#/components/schemas/CloudRegion'
            status:
              $ref: '#/components/schemas/WebsocketServerStatus'
            max_connections:
              $ref: '#/components/schemas/WebsocketServerMaxConnection'
            connection_distribution_strategy:
              $ref: '#/components/schemas/WebsocketServerConnectionDistributionStrategy'
            hostname:
              type: string
            created_at:
              type:
              - string
              - 'null'
              format: date-time
          required:
          - name
          - type
          - region
          - status
          - max_connections
          - connection_distribution_strategy
          - hostname
          - created_at
        relationships:
          type: object
          properties:
            applications:
              type: object
              properties:
                data:
                  type: array
                  items:
                    $ref: '#/components/schemas/WebsocketApplicationResourceIdentifier'
              required:
              - data
      required:
      - id
      - type
      title: WebsocketServerResource
    WebsocketServerType:
      type: string
      enum:
      - reverb
      title: WebsocketServerType
    StoreWebsocketServerRequest:
      type: object
      properties:
        name:
          type: string
          pattern: ^[a-z0-9_-]+$
          minLength: 3
          maxLength: 40
        type:
          $ref: '#/components/schemas/WebsocketServerType'
        region:
          $ref: '#/components/schemas/CloudRegion'
        max_connections:
          type: integer
      required:
      - name
      - type
      - region
      - max_connections
      title: StoreWebsocketServerRequest
    WebsocketServerMaxConnection:
      type: integer
      enum:
      - 100
      - 200
      - 500
      - 2000
      - 5000
      - 10000
      title: WebsocketServerMaxConnection
  responses:
    ModelNotFoundException:
      description: Not found
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
            - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
            - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
            - message
            - errors
  securitySchemes:
    http:
      type: http
      description: The Bearer Token generated on the Cloud UI.
      scheme: bearer
      bearerFormat: bearer