Apigee config maven plugin - Updating developer apps without creating new credentials

Hi,

I am attempting to use the Apigee config maven plugin to maintain our org specific config.

I'm starting out with setting up the config for products, developers, and developer apps. I am using a command argument of -Dapigee.config.options=update mainly because I don't want to drop and re-create the developer apps. This will cause new credentials to be created which is not what I want.

My intention is maintain the configs in the asssociated json files and to re-run this maven script when needed. If there are any changes, then it would update it.

It generally works as I expected it. However, when it processes the developer app configuration, it updates the existing developer app (as expected), but if I re-run the script, it seems to create a new set of credentials. See screenshot attached.

9390-apigeeconfigdevappissue.jpg

As you can see in the screenshot, I ran the maven script 3 times, but it's created 3 sets of credentials (even if the config is exactly the same). What I want it to do is if the highligted credentials requires a change in config eg a new product associated with it, it will edit the existing credentials by adding a new product. I don't want it to create a new set of credentials.If there is no change to the config, it shouldn't create a new set of credentials (like what it has done in the attachment above).

I can understand why it may be doing this. Maybe because I can't uniquely identify each set of credentials so it creates a new set. I did look at the JSON payload (for dev app creation) to see if i can uniquely identify a set of credentials, however, I couldn't see a way of doing this.

Can I use apigee config maven plugin to edit credentials in a developer app? Or will it always create a new set of credentials every time the script is executed?

Thanks!

Solved Solved
1 5 1,372
1 ACCEPTED SOLUTION

HI @Marlene Pecotich

Thats how the Management API works, it assumes there is a change and it creates a new credential. Check the docs here. Maven plugin is just orchestrating the Management APIs. The best option is to remove the developer app from your Maven build file (as you would not change that often). Or else call the Maven commands for these config individually. For example

mvn apigee-config:apiproducts apigee-config:developers -Ptest -Dapigee.config.options=update 

So only those configurations are pushed out.

Or the other option is - run the delete command for the app as the first step and then run the mvn install that pushes the config all over again. The only issue with that is that for every build, you will get a new client credential (which is good for tests as you create and delete them) but not good for actual clients.

Usually you include app setup if you want to test your API end to end, where your pipeline creates these config, tests the APIs and then you delete them. For actual client setup, just dont include the developerapp setup in your pom file

View solution in original post

5 REPLIES 5

I understand the question, and I understand why you don't like the behavior you're seeing.

I don't know the answer, but @Sai Saran Vaidyanathan might.

@Sai Saran Vaidyanathan

Thanks @Dino-at-Google!


HI @Marlene Pecotich

Thats how the Management API works, it assumes there is a change and it creates a new credential. Check the docs here. Maven plugin is just orchestrating the Management APIs. The best option is to remove the developer app from your Maven build file (as you would not change that often). Or else call the Maven commands for these config individually. For example

mvn apigee-config:apiproducts apigee-config:developers -Ptest -Dapigee.config.options=update 

So only those configurations are pushed out.

Or the other option is - run the delete command for the app as the first step and then run the mvn install that pushes the config all over again. The only issue with that is that for every build, you will get a new client credential (which is good for tests as you create and delete them) but not good for actual clients.

Usually you include app setup if you want to test your API end to end, where your pipeline creates these config, tests the APIs and then you delete them. For actual client setup, just dont include the developerapp setup in your pom file

Thanks @Sai Saran Vaidyanathan!

I missed that line in the documentation. I think that the documentation can be a bit clearer stating that existing credentials can not be updated with new products. Thanks though that link led me to this menagement api.

Add API Product to Key

This allows you to add products to existing credentials but it's not an update.

So I can't see anything available for me to automate the maintenance of my developers apps and keeping the credentials.

Since our dev app rarely changes, then I will remove it from my maven build and maintain it manually. It would have been nice to have that functionality though!

If the design has products and api proxies with a 1:1 relationship, the app needs to be updated each time a new product is added that uses the same consumer_key. This is why updating an App in config plugin makes sense. I am still rather challenged with automation this. I want Apps to be made in advance for each team, and I want my teams to freely create proxies using an automated tool that creates and adds a new product to same consumer key in an app.