Hi Ishara,

+1 for the overall approach.

For viewing, shall we use a single scope: apim:mediation_policy_view

Also for the tag: shall we simplify as "Mediation Policies"

Thanks!


On Tue, Aug 13, 2019 at 1:18 PM Ishara Cooray <[email protected]> wrote:

> Hi,
> I have started working on the $Subject and below is the rest api
> definitions.
>
>
>    - To avoid string manipulations, Mediation policy post is done as a
>    file upload. Hence we can provide the sequence file(xml content) as an
>    input in the form of multipart/form-data
>    ex:
>
>    curl -X POST 
> https://localhost:9443/api/am/publisher/v1.0/apis/2a3d5469-5394-4576-974a-5f8bf7e400bd/mediation-policies
>    -H "Authorization: Bearer 5cbc7d4f-d4f1-33c9-87e4-68a22ae7e602"
>    -F [email protected]
>    -H "Content-Type: multipart/form-data"
>    -F "type=in"
>
>    - To retrieve a mediation sequence, a new REST api has been introduced
>    which will download sequence as a file. Where as in APIM 2.x REST API it
>    was returning as a string.
>    Please refer
>    /apis/{apiId}/mediation-policies/{mediationPolicyId}/content:
>
>
> ######################################################
> # The "specific mediation policy" resource APIs
> ######################################################
> '/apis/{apiId}/mediation-policies':
>
>   
> #-----------------------------------------------------------------------------------------
>   # Retrieving the list of all API specific mediation sequences under a given 
> search condition
>   
> #-----------------------------------------------------------------------------------------
>   get:
>     security:
>       - OAuth2Security:
>         - apim:mediation_policy_view
>     x-examples:
>         $ref: docs/examples/apis/apis_id_mediationpolicies_get.yaml
>     summary: |
>       Get all mediation policies of an API
>     operationid:  apisApiIdMediationPoliciesGet
>     description: |
>       This operation provides you a list of available mediation policies of 
> an API.
>     parameters:
>       - $ref: '#/parameters/apiId'
>       - $ref : '#/parameters/limit'
>       - $ref : '#/parameters/offset'
>       - name : query
>         in: query
>         description: "-Not supported yet-"
>         type: string
>       - $ref : "#/parameters/If-None-Match"
>     tags:
>       - Mediation Policies of an API
>     responses:
>       200:
>         description: |
>           OK.
>           List of qualifying APIs is returned.
>         schema:
>           $ref: '#/definitions/MediationList'
>         headers:
>           Content-Type:
>             description: The content type of the body.
>             type: string
>           ETag:
>             description: |
>               Entity Tag of the response resource. Used by caches, or in 
> conditional requests (Will be supported in future).
>             type: string
>       304:
>         description: |
>           Not Modified.
>           Empty body because the client has already the latest version of the 
> requested resource (Will be supported in future).
>       406:
>         description: |
>           Not Acceptable.
>           The requested media type is not supported
>         schema:
>           $ref: '#/definitions/Error'
>
>   
> #----------------------------------------------------------------------------
>   # Upload an API specific mediation policy
>   
> #----------------------------------------------------------------------------
>   post:
>     consumes:
>     - multipart/form-data
>     security:
>       - OAuth2Security:
>         - apim:mediation_policy_create
>     x-examples:
>       $ref: docs/examples/apis/apis_id_mediationpolicies_post.yaml
>     summary: Add an API specific mediation policy
>     operationid: apisApiIdMediationPoliciesPost
>     description: |
>       This operation can be used to add an API specifc mediation policy.
>     parameters:
>       - in: formData
>         name: file
>         description: Mediation Policy to upload
>         type: file
>         required: false
>       - in: formData
>         name: inlineContent
>         description: Inline content of the Mediation Policy
>         type: string
>         required: false
>       - in: formData
>         name: type
>         description: Type of the mediation sequence
>         required: true
>         type: string
>       - $ref: '#/parameters/apiId'
>       - $ref: '#/parameters/If-Match'
>     tags:
>       - Mediation Policies of an API
>     responses:
>       201:
>         description: |
>           OK.
>           mediation policy uploaded
>         schema:
>           $ref : '#/definitions/Mediation'
>         headers:
>           Location:
>             description: |
>               The URL of the uploaded mediation policy of the API.
>             type: string
>           Content-Type:
>             description: |
>               The content type of the body.
>             type: string
>           ETag:
>             description: |
>               Entity Tag of the response resource.
>               Used by caches, or in conditional requests (Will be supported 
> in future).
>             type: string
>           Last-Modified:
>             description: |
>               Date and time the resource has been modifed the last time.
>               Used by caches, or in conditional requests (Will be supported 
> in future).
>             type: string
>       400:
>         description: |
>           Bad Request.
>           Invalid request or validation error.
>         schema:
>           $ref: '#/definitions/Error'
>       404:
>         description: |
>           Not Found.
>           The resource to be updated does not exist.
>         schema:
>           $ref: '#/definitions/Error'
>       412:
>         description: |
>           Precondition Failed.
>           The request has not been performed because one of the preconditions 
> is not met.
>         schema:
>           $ref: '#/definitions/Error'
>
> ######################################################
> # The "Individual API specific mediation sequence" resource
> ######################################################
> /apis/{apiId}/mediation-policies/{mediationPolicyId}:
>
>   #-----------------------------------------------------
>   # Retrieve a particular API specific mediation squence
>   #-----------------------------------------------------
>   get:
>     security:
>       - OAuth2Security:
>         - apim:api_view
>     x-examples:
>       $ref: docs/examples/apis/apis_id_mediationpolicies_id_get.yaml
>     summary: Get an API specific mediation policy
>     operationid:  apisApiIdMediationPoliciesMediationPolicyIdGet
>     description: |
>       This operation can be used to retrieve a particular API specific 
> mediation policy.
>     parameters:
>       - $ref: '#/parameters/apiId'
>       - $ref: '#/parameters/mediationPolicyId'
>       - $ref: '#/parameters/If-None-Match'
>     tags:
>       - Mediation Policy of an API
>     responses:
>       200:
>         description: |
>           OK.
>           Mediation policy returned.
>         schema:
>           $ref: '#/definitions/Mediation'
>         headers:
>           Content-Type:
>             description: |
>               The content type of the body.
>             type: string
>           ETag:
>             description: |
>               Entity Tag of the response resource.
>               Used by caches, or in conditional requests (Will be supported 
> in future).
>             type: string
>           Last-Modified:
>             description: |
>               Date and time the resource has been modifed the last time.
>               Used by caches, or in conditional requests (Will be supported 
> in future).
>             type: string
>       304:
>         description: |
>           Not Modified.
>           Empty body because the client has already the latest version of the 
> requested resource (Will be supported in future).
>       404:
>         description: |
>           Not Found.
>           Requested Document does not exist.
>         schema:
>           $ref: '#/definitions/Error'
>       406:
>         description: |
>           Not Acceptable.
>           The requested media type is not supported
>         schema:
>           $ref: '#/definitions/Error'
>
>   #-----------------------------------------------------
>   # Delete the mediation policy
>   #-----------------------------------------------------
>   delete:
>     security:
>       - OAuth2Security:
>         - apim:mediation_policy_manage
>     x-examples:
>       $ref: docs/examples/apis/apis_id_mediationpolicies_id_delete.yaml
>     summary: Delete an API specific mediation policy
>     operationid:  apisApiIdMediationPoliciesMediationPolicyIdDelete
>     description: |
>       This operation can be used to delete an existing API specific mediation 
> policy providing the Id of the API and the Id of the mediation policy.
>     parameters:
>       - $ref: '#/parameters/apiId'
>       - $ref: '#/parameters/mediationPolicyId'
>       - $ref: '#/parameters/If-Match'
>     tags:
>       - Mediation Policy of an API
>     responses:
>       200:
>         description: |
>           OK.
>           Resource successfully deleted.
>       403:
>         description: |
>           Forbidden.
>           The request must be conditional but no condition has been specified.
>         schema:
>           $ref: '#/definitions/Error'
>       404:
>         description: |
>           Not Found.
>           Resource to be deleted does not exist.
>         schema:
>           $ref: '#/definitions/Error'
>       412:
>         description: |
>           Precondition Failed.
>           The request has not been performed because one of the preconditions 
> is not met.
>         schema:
>           $ref: '#/definitions/Error'
>
>   #-----------------------------------------------------
>   # Update a mediation policy
>   #-----------------------------------------------------
>   put:
>     consumes:
>     - multipart/form-data
>     security:
>       - OAuth2Security:
>         - apim:mediation_policy_manage
>     x-examples:
>       $ref: docs/examples/apis/apis_id_mediationpolicies_id_put.yaml
>     summary: Update an API specific mediation policy
>     operationid:  apisApiIdMediationPoliciesMediationPolicyIdPut
>     description: |
>       This operation can be used to update an existing mediation policy of an 
> API.
>     parameters:
>       - in: formData
>         name: file
>         description: Mediation Policy to upload
>         type: file
>         required: false
>       - in: formData
>         name: inlineContent
>         description: Inline content of the Mediation Policy
>         type: string
>         required: false
>       - in: formData
>         name: type
>         description: Type of the mediation sequence(in/out/fault)
>         required: true
>         type: string
>       - $ref: '#/parameters/apiId'
>       - $ref: '#/parameters/mediationPolicyId'
>       - $ref: '#/parameters/If-Match'
>     tags:
>       - Mediation Policy of an API
>     responses:
>       200:
>         description: |
>           OK.
>           Successful response with updated API object
>         schema:
>           $ref: '#/definitions/Mediation'
>         headers:
>           Location:
>             description: |
>               The URL of the newly created resource.
>             type: string
>           Content-Type:
>             description: |
>               The content type of the body.
>             type: string
>           ETag:
>             description: |
>               Entity Tag of the response resource. Used by caches, or in 
> conditional requests (Will be supported in future).
>             type: string
>           Last-Modified:
>             description: |
>               Date and time the resource has been modifed the last time.
>               Used by caches, or in conditional requests (Will be supported 
> in future).
>             type: string
>       400:
>         description: |
>           Bad Request.
>           Invalid request or validation error
>         schema:
>           $ref: '#/definitions/Error'
>       403:
>         description: |
>           Forbidden.
>           The request must be conditional but no condition has been specified.
>         schema:
>           $ref: '#/definitions/Error'
>       404:
>         description: |
>           Not Found.
>           The resource to be updated does not exist.
>         schema:
>           $ref: '#/definitions/Error'
>       412:
>         description: |
>           Precondition Failed.
>           The request has not been performed because one of the preconditions 
> is not met.
>         schema:
>           $ref: '#/definitions/Error'
> ###################################################################
> # The "Individual API specific mediation sequence content" resource
> ###################################################################
> /apis/{apiId}/mediation-policies/{mediationPolicyId}/content:
>
>   #---------------------------------------------------------------
>   # Retrieve a particular API specific mediation sequence content
>   #---------------------------------------------------------------
>   get:
>     security:
>     - OAuth2Security:
>       - apim:api_view
>     x-examples:
>       $ref: docs/examples/apis/apis_id_mediationpolicies_id_content_get.yaml
>     summary: Downloadt an API specific mediation policy
>     operationid:  apisApiIdMediationPoliciesMediationPolicyIdContentGet
>     description: |
>       This operation can be used to download a particular API specific 
> mediation policy.
>     parameters:
>     - $ref: '#/parameters/apiId'
>     - $ref: '#/parameters/mediationPolicyId'
>     - $ref: '#/parameters/If-None-Match'
>     tags:
>     - Mediation Policy content of an API
>     responses:
>       200:
>         description: |
>           OK.
>           Mediation policy returned.
>         headers:
>           Content-Type:
>             description: |
>               The content type of the body.
>             type: string
>           ETag:
>             description: |
>               Entity Tag of the response resource.
>               Used by caches, or in conditional requests (Will be supported 
> in future).
>             type: string
>           Last-Modified:
>             description: |
>               Date and time the resource has been modifed the last time.
>               Used by caches, or in conditional requests (Will be supported 
> in future).
>             type: string
>       304:
>         description: |
>           Not Modified.
>           Empty body because the client has already the latest version of the 
> requested resource (Will be supported in future).
>       404:
>         description: |
>           Not Found.
>           Requested file does not exist.
>         schema:
>           $ref: '#/definitions/Error'
>
>
> Thanks & Regards,
> Ishara Cooray
> Associate Technical Lead
> Mobile : +9477 262 9512
> WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
> _______________________________________________
> Architecture mailing list
> [email protected]
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>


-- 
Malintha Amarasinghe
*WSO2, Inc. - lean | enterprise | middleware*
http://wso2.com/

Mobile : +94 712383306
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to