github.com/iron-io/functions@v0.0.0-20180820112432-d59d7d1c40b2/docs/swagger.yml (about)

     1  # This is the IronFunctions API spec
     2  # If you make changes here, remember to run `go generate` in api/models/ and
     3  # api/server to make sure you use the changes.
     4  
     5  swagger: '2.0'
     6  info:
     7    title: IronFunctions
     8    description: The open source serverless platform.
     9    version: "0.1.29"
    10  # the domain of the service
    11  host: "127.0.0.1:8080"
    12  # array of all schemes that your API supports
    13  schemes:
    14    - https
    15    - http
    16  # will be prefixed to all paths
    17  basePath: /v1
    18  consumes:
    19    - application/json
    20  produces:
    21    - application/json
    22  paths:
    23    /version:
    24      get:
    25        summary: "Get daemon version."
    26        tags:
    27          - Version
    28        responses:
    29          200:
    30            description: Daemon version.
    31            schema:
    32              $ref: '#/definitions/Version'
    33    /apps:
    34      get:
    35        summary: "Get all app names."
    36        description: "Get a list of all the apps in the system."
    37        tags:
    38          - Apps
    39        responses:
    40          200:
    41            description: List of apps.
    42            schema:
    43              $ref: '#/definitions/AppsWrapper'
    44          default:
    45            description: Unexpected error
    46            schema:
    47              $ref: '#/definitions/Error'
    48      post:
    49        summary: "Post new app"
    50        description: "Insert a new app"
    51        tags:
    52          - Apps
    53        parameters:
    54          - name: body
    55            in: body
    56            description: App to post.
    57            required: true
    58            schema:
    59              $ref: '#/definitions/AppWrapper'
    60        responses:
    61          200:
    62            description: App details and stats.
    63            schema:
    64              $ref: '#/definitions/AppWrapper'
    65          400:
    66            description: Parameters are missing or invalid.
    67            schema:
    68              $ref: '#/definitions/Error'
    69          409:
    70            description: App already exists.
    71            schema:
    72              $ref: '#/definitions/Error'
    73          default:
    74            description: Unexpected error
    75            schema:
    76              $ref: '#/definitions/Error'
    77  
    78  
    79    /apps/{app}:
    80      delete:
    81        summary: "Delete an app."
    82        description: "Delete an app."
    83        tags:
    84          - Apps
    85        parameters:
    86          - name: app
    87            in: path
    88            description: Name of the app.
    89            required: true
    90            type: string
    91        responses:
    92          200:
    93            description: Apps successfully deleted.
    94          404:
    95            description: App does not exist.
    96            schema:
    97              $ref: '#/definitions/Error'
    98          default:
    99            description: Unexpected error
   100            schema:
   101              $ref: '#/definitions/Error'
   102      get:
   103        summary: "Get information for a app."
   104        description: "This gives more details about a app, such as statistics."
   105        tags:
   106          - Apps
   107        parameters:
   108          - name: app
   109            in: path
   110            description: name of the app.
   111            required: true
   112            type: string
   113        responses:
   114          200:
   115            description: App details and stats.
   116            schema:
   117              $ref: '#/definitions/AppWrapper'
   118          404:
   119            description: App does not exist.
   120            schema:
   121              $ref: '#/definitions/Error'
   122          default:
   123            description: Unexpected error
   124            schema:
   125              $ref: '#/definitions/Error'
   126      patch:
   127        summary: "Updates an app."
   128        description: "You can set app level settings here. "
   129        tags:
   130          - Apps
   131        parameters:
   132          - name: app
   133            in: path
   134            description: name of the app.
   135            required: true
   136            type: string
   137          - name: body
   138            in: body
   139            description: App to post.
   140            required: true
   141            schema:
   142              $ref: '#/definitions/AppWrapper'
   143        responses:
   144          200:
   145            description: App details and stats.
   146            schema:
   147              $ref: '#/definitions/AppWrapper'
   148          400:
   149            description: Parameters are missing or invalid.
   150            schema:
   151              $ref: '#/definitions/Error'
   152          404:
   153            description: App does not exist.
   154            schema:
   155              $ref: '#/definitions/Error'
   156          default:
   157            description: Unexpected error
   158            schema:
   159              $ref: '#/definitions/Error'
   160  
   161    /apps/{app}/routes:
   162      post:
   163        summary: Create new Route
   164        description: Create a new route in an app, if app doesn't exists, it creates the app
   165        tags:
   166          - Routes
   167        parameters:
   168          - name: app
   169            in: path
   170            description: name of the app.
   171            required: true
   172            type: string
   173          - name: body
   174            in: body
   175            description: One route to post.
   176            required: true
   177            schema:
   178              $ref: '#/definitions/RouteWrapper'
   179        responses:
   180          200:
   181            description: Route created
   182            schema:
   183              $ref: '#/definitions/RouteWrapper'
   184          400:
   185            description: Invalid route due to parameters being missing or invalid.
   186            schema:
   187              $ref: '#/definitions/Error'
   188          409:
   189            description: Route already exists.
   190            schema:
   191              $ref: '#/definitions/Error'
   192          default:
   193            description: Unexpected error
   194            schema:
   195              $ref: '#/definitions/Error'
   196  
   197      get:
   198        summary: Get route list by app name.
   199        description: This will list routes for a particular app.
   200        tags:
   201          - Routes
   202        parameters:
   203          - name: app
   204            in: path
   205            description: Name of app for this set of routes.
   206            required: true
   207            type: string
   208        responses:
   209          200:
   210            description: Route information
   211            schema:
   212              $ref: '#/definitions/RoutesWrapper'
   213          404:
   214            description: App does not exist.
   215            schema:
   216              $ref: '#/definitions/Error'
   217          default:
   218            description: Unexpected error
   219            schema:
   220              $ref: '#/definitions/Error'
   221  
   222    /apps/{app}/routes/{route}:
   223      patch:
   224        summary: Update a Route
   225        description: Update a route
   226        tags:
   227          - Routes
   228        parameters:
   229          - name: app
   230            in: path
   231            description: name of the app.
   232            required: true
   233            type: string
   234          - name: route
   235            in: path
   236            description: route path.
   237            required: true
   238            type: string
   239          - name: body
   240            in: body
   241            description: One route to post.
   242            required: true
   243            schema:
   244              $ref: '#/definitions/RouteWrapper'
   245        responses:
   246          200:
   247            description: Route updated
   248            schema:
   249              $ref: '#/definitions/RouteWrapper'
   250          400:
   251            description: Invalid route due to parameters being missing or invalid.
   252            schema:
   253              $ref: '#/definitions/Error'
   254          404:
   255            description: App does not exist.
   256            schema:
   257              $ref: '#/definitions/Error'
   258          default:
   259            description: Unexpected error
   260            schema:
   261              $ref: '#/definitions/Error'
   262      get:
   263        summary: Gets route by name
   264        description: Gets a route by name.
   265        tags:
   266          - Routes
   267        parameters:
   268          - name: app
   269            in: path
   270            description: Name of app for this set of routes.
   271            required: true
   272            type: string
   273          - name: route
   274            in: path
   275            description: Route name
   276            required: true
   277            type: string
   278        responses:
   279          200:
   280            description: Route information
   281            schema:
   282              $ref: '#/definitions/RouteWrapper'
   283          404:
   284            description: Route does not exist.
   285            schema:
   286              $ref: '#/definitions/Error'
   287          default:
   288            description: Unexpected error
   289            schema:
   290              $ref: '#/definitions/Error'
   291  
   292      delete:
   293        summary: Deletes the route
   294        tags:
   295          - Routes
   296        description: Deletes the route.
   297        parameters:
   298          - name: app
   299            in: path
   300            description: Name of app for this set of routes.
   301            required: true
   302            type: string
   303          - name: route
   304            in: path
   305            description: Route name
   306            required: true
   307            type: string
   308        responses:
   309          200:
   310            description: Route successfully deleted.
   311          404:
   312            description: Route does not exist.
   313            schema:
   314              $ref: '#/definitions/Error'
   315          default:
   316            description: Unexpected error
   317            schema:
   318              $ref: '#/definitions/Error'
   319  
   320    /tasks:
   321      get:
   322        summary: Get next task.
   323        description: Gets the next task in the queue, ready for processing. Consumers should start processing tasks in order. No other consumer can retrieve this task.
   324        tags:
   325          - Tasks
   326        responses:
   327          200:
   328            description: Task information
   329            schema:
   330              $ref:  '#/definitions/TaskWrapper'
   331          default:
   332            description: Unexpected error
   333            schema:
   334              $ref: '#/definitions/Error'
   335  
   336  
   337  definitions:
   338    Route:
   339      type: object
   340      properties:
   341        path:
   342          type: string
   343          description: URL path that will be matched to this route
   344          readOnly: true
   345        image:
   346          description: Name of Docker image to use in this route. You should include the image tag, which should be a version number, to be more accurate. Can be overridden on a per route basis with route.image.
   347          type: string
   348        headers:
   349          type: object
   350          description: Map of http headers that will be sent with the response
   351          additionalProperties:
   352            type: array
   353            items:
   354              type: string
   355        memory:
   356          type: integer
   357          format: int64
   358          description: Max usable memory for this route (MiB).
   359        type:
   360          enum:
   361            - sync
   362            - async
   363          description: Route type
   364        format:
   365          enum:
   366            - default
   367            - http
   368            - json
   369          description: Payload format sent into function.
   370        max_concurrency:
   371          type: integer
   372          format: int32
   373          description: Maximum number of hot functions concurrency
   374        config:
   375          type: object
   376          description: Route configuration - overrides application configuration
   377          additionalProperties:
   378            type: string
   379        timeout:
   380          type: integer
   381          default: 30
   382          description: Timeout for executions of this route. Value in Seconds
   383        idle_timeout:
   384          type: integer
   385          default: 30
   386          description: Hot functions idle timeout before termination. Value in Seconds
   387        jwt_key:
   388          description: Signing key for JWT
   389          type: string
   390  
   391    App:
   392      type: object
   393      properties:
   394        name:
   395          type: string
   396          description: "Name of this app. Must be different than the image name. Can ony contain alphanumeric, -, and _."
   397          readOnly: true
   398        config:
   399          type: object
   400          description: Application configuration
   401          additionalProperties:
   402            type: string
   403  
   404    Version:
   405      type: object
   406      properties:
   407        version:
   408          type: string
   409          readOnly: true
   410  
   411    RoutesWrapper:
   412      type: object
   413      required:
   414        - routes
   415      properties:
   416        routes:
   417          type: array
   418          items:
   419            $ref: '#/definitions/Route'
   420        error:
   421          $ref: '#/definitions/ErrorBody'
   422  
   423    RouteWrapper:
   424      type: object
   425      required:
   426        - route
   427      properties:
   428        message:
   429          type: string
   430        error:
   431          $ref: '#/definitions/ErrorBody'
   432        route:
   433          $ref: '#/definitions/Route'
   434  
   435    AppsWrapper:
   436      type: object
   437      required:
   438        - apps
   439      properties:
   440        apps:
   441          type: array
   442          items:
   443            $ref: '#/definitions/App'
   444        error:
   445          $ref: '#/definitions/ErrorBody'
   446  
   447    AppWrapper:
   448      type: object
   449      required:
   450        - app
   451      properties:
   452        app:
   453          $ref: '#/definitions/App'
   454        error:
   455          $ref: '#/definitions/ErrorBody'
   456  
   457    Task:
   458      allOf:
   459        - $ref: "#/definitions/NewTask"
   460        - type: object
   461          properties:
   462            group_name:
   463              type: string
   464              description: "Group this task belongs to."
   465              readOnly: true
   466            error:
   467              type: string
   468              description: "The error message, if status is 'error'. This is errors due to things outside the task itself. Errors from user code will be found in the log."
   469            reason:
   470              type: string
   471              description: |
   472                Machine usable reason for task being in this state.
   473                Valid values for error status are `timeout | killed | bad_exit`.
   474                Valid values for cancelled status are `client_request`.
   475                For everything else, this is undefined.
   476              enum:
   477                - timeout
   478                - killed
   479                - bad_exit
   480                - client_request
   481            created_at:
   482              type: string
   483              format: date-time
   484              description: Time when task was submitted. Always in UTC.
   485              readOnly: true
   486            started_at:
   487              type: string
   488              format: date-time
   489              description: Time when task started execution. Always in UTC.
   490            completed_at:
   491              type: string
   492              format: date-time
   493              description: Time when task completed, whether it was successul or failed. Always in UTC.
   494            # We maintain a doubly linked list of the retried task to the
   495            # original task.
   496            retry_of:
   497              type: string
   498              description: If this field is set, then this task is a retry of the ID in this field.
   499              readOnly: true
   500            retry_at:
   501              type: string
   502              description: If this field is set, then this task was retried by the task referenced in this field.
   503              readOnly: true
   504            env_vars:
   505              # this is a map: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#model-with-mapdictionary-properties
   506              type: object
   507              description: Env vars for the task. Comes from the ones set on the Group.
   508              additionalProperties:
   509                type: string
   510  
   511    ErrorBody:
   512      type: object
   513      properties:
   514        message:
   515          type: string
   516          readOnly: true
   517        fields:
   518          type: string
   519          readOnly: true
   520  
   521    Error:
   522      type: object
   523      properties:
   524        error:
   525          $ref: '#/definitions/ErrorBody'
   526  
   527    NewTask:
   528      type: object
   529      required:
   530        - image
   531      properties:
   532        image:
   533          type: string
   534          description: Name of Docker image to use. This is optional and can be used to override the image defined at the group level.
   535        payload:
   536          type: string
   537          # 256k
   538          # maxLength breaks ruby generator too: https://github.com/iron-io/worker_ruby/blob/0aa9236ce5060af3f15758937712973f80dd54fe/lib/iron_titan/models/task.rb#L272
   539          # maxLength: 268435456
   540          description: Payload for the task. This is what you pass into each task to make it do something.
   541  
   542    TaskWrapper:
   543      type: object
   544      required:
   545        - task
   546      properties:
   547        task:
   548          $ref: '#/definitions/Task'