Hi Ishara

On Fri, Aug 30, 2019 at 6:04 AM Ishara Cooray <[email protected]> wrote:

> Hi,
> In APIM 3.0.0 Publisher rest api , we have introduced separate two APIs to
> retrieve mediation policy content as files. Each for API specific custom
> mediation policy content and for global mediation policy content.
>
> Previously, mediation policy content was in the same Mediation resource as
> below.
>
> #-----------------------------------------------------
> # The Mediation resource
> #-----------------------------------------------------
> Mediation:
>   title: Mediation
>   required:
>     - name
>     - type
>     - config
>   properties:
>     id:
>       type: string
>       example: 01234567-0123-0123-0123-012345678901
>     name:
>       type: string
>       example: json_fault.xml
>     type:
>       type: string
>       enum:
>         - in
>         - out
>         - fault
>       example: in
>     config:
>       type: string
>       example: '<sequence xmlns="http://ws.apache.org/ns/synapse"; 
> name="log_in_message">
>                     <log level="full">
>                         <property name="IN_MESSAGE" 
> value="IN_MESSAGE_21133232"/>
>                     </log>
>                 </sequence>'
>
> *In APIM 3.0.0* this is changed to,
> #-----------------------------------------------------
> # The Mediation resource
> #-----------------------------------------------------
> Mediation:
>   title: Mediation
>   required:
>   - name
>   - type
>   properties:
>     id:
>       type: string
>       example: 01234567-0123-0123-0123-012345678901
>     name:
>       type: string
>       example: json_fault.xml
>     type:
>       type: string
>       enum:
>       - in
>       - out
>       - fault
>       example: in
>     sourceType:
>       type: string
>       enum:
>       - FILE
>       - INLINE
>
> ** config property has been removed and a new property sourceType is 
> introduced.
>
> sourceType will decide whether the mediation policy content is received as a 
> file or inline content.
> Because we are planing to give an inline editor in the future to edit the 
> mediation policies withing the publisher portal.
>
>
+1 for removing `config` from the payload.
But I doubt we still need, sourceType. We use sourceType: FILE/INLINE for
documents because we allow people to upload PDF etc which are binary and
not editable in a text editor. But for mediation policies, it is always
text so we can even allow people to update uploaded files as well via the
inline editor.

Thanks!

>
> So to get a content of a mediation policy we have introduced below two rest 
> apis.
>
> ###################################################################
> # 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
>     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:
>     - API Mediation Policy
>     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'
>
>
> ###################################################################
> # The "Individual Global mediation policy content" resource
> ###################################################################
> /mediation-policies/{mediationPolicyId}/content:
>
>   #---------------------------------------------------------------
>   # Retrieve a particular Global mediation sequence content
>   #---------------------------------------------------------------
>   get:
>     security:
>     - OAuth2Security:
>       - apim:api_view
>     summary: Downloadt specific global mediation policy
>     description: |
>       This operation can be used to download a particular global mediation 
> policy.
>     parameters:
>     - $ref: '#/parameters/mediationPolicyId'
>     - $ref: '#/parameters/If-None-Match'
>     tags:
>     - Global Mediation Policy
>
> 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