Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APIM CLI to check/skip already removed API #417

Closed
razvan4axway opened this issue Jul 21, 2023 · 7 comments
Closed

APIM CLI to check/skip already removed API #417

razvan4axway opened this issue Jul 21, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@razvan4axway
Copy link

Problem description

Issue:

Customer has a policy with API Manager that is event based and is called when an API is requested to be published.

They have automated the process.

As admin publishing is directly permitted, however as an Org admin this is forbidden. (No option in GUI)

Policy is doing the following: running validation and performing in place upgrade.

  1. reads the API to be published
  2. does validation
  3. Checks if API is in use
  4. If predecessor is in place, it will publish the new API, will grant access to it and publish it.
  5. when [Feature] Manually created API - Get API-Definition as Swagger 2.0 from Catalog API #4 is correctly finish it will unpublish the old API and delete it
    5b) If predecessor is unpublished, it will also delete it

Test case #1
Import unpublished API vs Currently published API - OK
When publishing the new API, the old is removed automatically

Test case #2
Import published API with changed path (breaking change) vs Unpublished API - KO

a)New API is created and published correctly
b)Unpublished API IS removed by the automation policy
c)APIM CLI tries to remove the previous API but as it is already deleted , it throws a 403 Response
d)APIM CLI next tries to rollback the new API but doesn't succeed to remove a published API because of the Org admin privileges(which is good)
This process raises some alarms on the client side

Feature request

Possible solutions:

  1. Implement a parameter/flag that skips deletion of old API
  2. Check if API is still present and skip deletion if not present
@razvan4axway razvan4axway added the enhancement New feature or request label Jul 21, 2023
@rathnapandi
Copy link
Member

Hi @razvan4axway
Instead of having a custom validation policy, can we do the following?

  1. get api details using command./apim.sh api get -n "petstore" -o json which will get the api and its dependency like associated organizations and applications as json file.
  2. Enforce required validation (validate state, check for consumer etc...)
  3. Based on validation status either import new api or skip.

Thanks
Rathna

@raffaelsta
Copy link

Hi Rathna,

keep the custom validation please out of scope, they're not relevant as it's anyway something custom. Nevertheless for each publication request there is an in place upgrade performed automatically directly after publication request on API Manager side which is creating conflicts with the procedure on CLI side. In theory this can also happen without such an automation so we would expect the APIM CLI to have a proper error handling:

  • in case an API proxy which has to be deleted is not existing anymore, proceed instead of rolling back the entire import. Anyway the objective of this step is already fulfilled, the proxy does not exist anymore (independent who has deleted it).
    An alternative as mentioned by razvan we could imagine to have a general flag can control if an predecessor should be deleted (as this is happening by our in place upgrade).

@rathnapandi rathnapandi self-assigned this Sep 18, 2023
@rathnapandi
Copy link
Member

Hi @raffaelsta / @razvan4axway,

Can you share the command line parameters used to deploy API?

rathnapandi added a commit that referenced this issue Sep 19, 2023
rathnapandi added a commit that referenced this issue Sep 19, 2023
@rathnapandi
Copy link
Member

rathnapandi commented Sep 19, 2023

Hi @raffaelsta / @razvan4axway,

The fix check for api availability before deleting exiting API. can you test with
axway-apimcli-1.14.3-SNAPSHOT.tar.gz

@raffaelsta
Copy link

raffaelsta commented Oct 7, 2023

Hi @rathnapandi,

thank you for this fix. From my end it's handling now the above mentioned issue in a proper way. Just thinking if the log level shouldn't be info/warning instead of error in such a case.

I will also let my colleagues test who initially raised this issue and let you know.

Anyway thanks for handling it!

@rathnapandi
Copy link
Member

Hi @raffaelsta,

Changed the log level to warning.

rathnapandi added a commit that referenced this issue Dec 7, 2023
@rathnapandi
Copy link
Member

Fixed as part of 1.14.3 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants