Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # this is an example of the Uber API
- # as a demonstration of an API spec in YAML
- swagger: '2.0'
- info:
- title: Policy Engine
- description: Invoke and lookup user defined policy functions.
- version: "1.0.0"
- # array of all schemes that your API supports
- schemes:
- - https
- # will be prefixed to all paths
- basePath: /policyengine/v1
- produces:
- - application/json
- paths:
- /functions:
- get:
- summary: Listing all User-Defined Policy Functions
- description: |
- This endpoint allows a user to lookup a list of user defined policy functions.
- ### Required Permissions
- Unsure, this was not in the email.
- tags:
- - Functions
- responses:
- 200:
- description: An array of functions
- schema:
- type: array
- items:
- $ref: '#/definitions/FunctionDefinition'
- post:
- summary: Execute a User-Defined Policy Functions
- description: |
- This endpoint allows a user to execute user defined policy functions.
- ### Required Permissions
- Unsure, this was not in the email.
- ### Limitations
- The only functions that are supported are ones that have the following properties:
- * User defined in SandScript
- * Have no writable parameters
- * Have any combination of:
- * Have no return type
- * Have no parameters
- * Have return type of:
- * Array
- * Boolean
- * Float
- * Integer
- * IP Address
- * Object
- * String
- * Have parameters of type:
- * Array
- * Boolean
- * Float
- * Integer
- * Object
- * String
- tags:
- - Functions
- parameters:
- - name: body
- in: body
- required: true
- type: array
- items:
- $ref: '#/definitions/ExecutionRequest'
- responses:
- 200:
- description: An array of execution results
- schema:
- type: array
- items:
- $ref: '#/definitions/ExecutionResult'
- definitions:
- ExecutionResult:
- type: object
- properties:
- jsonrpc:
- type: string
- description: The JSON RPC version being used.
- id:
- type: integer
- description: The id used to associate the input with the output
- result:
- type: map
- description: The returned object
- ExecutionRequest:
- type: object
- properties:
- jsonrpc:
- type: string
- description: The JSON RPC version being used.
- id:
- type: integer
- description: The id used to associate the input with the output
- method:
- type: string
- description: The name of the method
- parameters:
- type: map
- description: A map of parameter name to parameter value
- FunctionDefinition:
- type: object
- properties:
- method:
- type: string
- description: The name of the function.
- type:
- type: string
- description: The return type for the function
- params:
- type: array
- items:
- $ref: '#/definitions/FunctionParameterDefinition'
- description: The parameters for the function
- example:
- method: "methodName1"
- type: "string"
- params:
- -
- name: "arg1"
- type: "integer"
- optional: true
- default: 100
- -
- name: "arg2"
- type: "arg2type"
- optional: false
- FunctionParameterDefinition:
- type: object
- properties:
- name:
- type: string
- description: The parameter name
- type:
- type: string
- description: The type of the parameter
- required:
- type: boolean
- description: Whether or not the parameter is required.
- default:
- type: string
- description: The default value for the parameter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement