API Connect

API Connect

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#API Connect
#Applicationintegration
#APIConnect
 View Only
  • 1.  Global policy is not visible under gateway services neither Assembly palette

    Posted Sun September 10, 2023 04:24 AM
    Edited by Kumar . Mon September 11, 2023 07:57 AM

    Dear All,

    I have created the Assembly Function as follows:
    https://www.ibm.com/docs/en/api-connect/10.0.5.x_lts?topic=apdag-defining-packaging-publishing-global-scoped-policy-api-gateway
     
    I opted the below step.
    Step 2, Option B: Package and publish a global-scoped policy as a gateway extension that API Connect manages.
     
    Now, when I import gateway-extension.zip, it's not visible in  Catalog settings--> Gateway services --> view extensions
     
    There's no mention of the config file in the following link; hence,  I didn't add it. Later, I added a config file inside gateway-extension.zip, Still
    It's not visible in the Catalog settings--> Gateway services --> view extensions
     
    I have a configued Assembly Function by adding a gateway script action inside the API rule.
    I wrote the config file as below:
     
    assembly-gatewayscript "test_1.0.0"
      gatewayscript-location "local:///test_dev_fi_routing_1.0.0/test_dev_fi_routing_1.0.0.js"
    exit
     
    I haven't defined any other objects inside the Assembly Function except for the configurable API rule with gateway script action.
    "test_1.0.0" is the name that I have used as a name for all the objects.
     
     
    gateway-extension.zip
      -- test.cfg
      -- manifest.json
      -- test_1.0.0.zip --> implementation(test.zip and test.yaml)
                        --> test.yaml
    Please acknowledge me where I went wrong.



    ------------------------------
    Kumar
    ------------------------------



  • 2.  RE: Global policy is not visible under gateway services neither Assembly palette

    Posted Mon September 11, 2023 08:00 AM

    Dears, 

    Please assist  me if you could see any mistakes.



    ------------------------------
    Kumar
    ------------------------------



  • 3.  RE: Global policy is not visible under gateway services neither Assembly palette

    Posted Mon September 11, 2023 09:22 AM

    Hi Kumar,
    Just for your information, if your user defined policy has only out of the box policies like your GatewayScript policy, then your test.yaml policy yaml can simply have an execute that specifies the GatewayScript as its policy.  In the manifest.json, you would reference the .yaml file with a type of user-defined-policy-yaml. Upon the publish of the Gateway Extension, the Gateway Director will automatically create the assembly function, assembly, rule, and GatewayScript action for you.  It's just another way of doing the same thing that is easier on the developer.  

    As for your specific problem, its difficult to say with just the information you provided.  The implementation should only contain your DataPower export that has your assembly function, assembly, rule, action etc. objects.  The policy yaml should be a peer of the implementation directory in your zip.  Please look at logtemp:///gwd-log files and specifically look for errors related to your test policy.  The Gateway Director should log any issues it has with your zip file that would prevent deployment or advertising of your policy to the API Manager.

    If that doesn't help you resolve your issue, please attach your manifest.json file and your policy zip file for a closer analysis.

    Best Regards,

    Steve



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------



  • 4.  RE: Global policy is not visible under gateway services neither Assembly palette

    Posted Sat September 16, 2023 02:03 PM

    Dear Steve,

    1) Could you Please share  how  the Valid folder structure should be to follow the first approach that you have suggested?

    2) Following below link, I have Implemented Gateway extension

    https://www.ibm.com/docs/en/api-connect/10.0.5.x_lts?topic=apdag-defining-packaging-publishing-global-scoped-policy-api-gateway

    Yet I couldn't able to see that extension in Palette. I have checked DataPower logs as well but I didn't see any error logs.

    Just assume that I have done everything correctly as per the knowledge information. But my question is, Does this gateway extension require a configuration file? If yes, why has it not been covered in the Info topic?

    3) Also, when I added the newly created assembly function under the API Connect Gateway Service as a user-defined policy, I could see that policy in all provider organizations and their catalogs, which are configured with the same API Gateway endpoint.  

    What is the difference between having one policy as a gateway extension and adding a created policy as a user-defined policy under API Connect Gateway Service?



    ------------------------------
    Kumar
    ------------------------------



  • 5.  RE: Global policy is not visible under gateway services neither Assembly palette

    Posted Mon September 18, 2023 09:18 AM

    Hi Kumar,
    Q1:) The approach I suggested was simply a yaml file that would be added to your gateway-extension.zip file, something like

    policy: 1.0.0
    
    info:
      title: Your policy title
      name: sample-policy
      version: 1.0.0
      description: Your policy title description
      contact: 
        name: Your name
        url: https://github.com/ibm-datapower/
        email: steve-product-manager@ibm.com
    
    attach:
      - rest
      - soap
    
    properties:
      $schema: "http://json-schema.org/draft-04/schema#"
      type: object
      properties:
        input:
          label: Input Message
          description: Where to read the input
          type: string
      required:
        - input
    
    gateways:
      - datapower-api-gateway
      
    assembly:
      execute:
        - gatewayscript:
            version: 2.0.0
            source: |
               console.info('executing a GatewayScript policy');

    and then in the files section of your manifest.json file, you'd have

        "files": [
          {
            "filename": "sample-policy.yaml",
            "deploy": "immediate",
            "type": "user-defined-policy-yaml"
          },
    ... other files
        ]

    Q2:) The link you provided is for the user-defined-policy type where you must have configuration for the DataPower assembly function, assembly, rule, action, etc in addition to your dependent files such as a gatewayscript.js file. Did you check the logtemp:///gwd-log files (not the default-log files) in your apiconnect application domain for errors?  The gateway director does not require a configuration file. What is in the export.xml file of your zip file must contain all of the files and configuration required for your user defined policy. Since you are not seeing your UDP visible in the API Manager, then the gateway director has not advertised the policy. If it finds any issue in the gateway extension, with your policy zip or other zip files in the extension zip, it will abort and will not advertise anything. Please first look at your API Gateway Service, and specifically at the user defined policy list in that service.  If you do not find your policy in that list, then there was an error in your extension zip and the API Gateway Service was not updated. If the policy is in that list, then this would be an issue advertising the policy to the manager, but again I'd expect to see errors in the gwd logs if that is the case.

    Q3:) I should have read on from Q2 :-) Since the policy is not in the API Gateway Service, that is why you are not seeing it advertised to the manager, but you're saying by manually adding it to this list, then the advertising of the policy is happening.  That would imply that the import of the implementation zip with your assembly function is being done by the Gateway Director? or did you manually import these DataPower objects yourself?  Regardless, I have to believe there are some logs in logtemp:///gwd-log* files that would tell what the issue is.
    Q4:) There should be no difference.  It appears you did manually what is normally done by the Gateway Director.  If the manifest.json file identifies the zip file as a type user-defined-policy, if there were no issues seen with this (or potentially other files in the zip) then your policy should have been added to the user defined policy list.  Again, I'd search through all of the gwd-log files looking specifically for your policy-name to find logs associated with your policy.
    Best Regards,

    Steve



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------



  • 6.  RE: Global policy is not visible under gateway services neither Assembly palette

    Posted Tue September 12, 2023 01:49 PM

    Hello Steve,

    Thank you. I will implement the first approach that you suggested.

     



    ------------------------------
    Kumar
    ------------------------------