The revisions of proxies tend to grow, specifically in an Apigee org used as development environment. Cleaning old un-deployed revisions not only de-clutters the UI but also eliminates unnecessary storage. At times speeds up deployment process too.
Following is a simple perl script I use to automatically clean up un-deployed versions of the proxy. The perl script use the resty command line client to clean up the revisions it found in the org.
Following is a simple perl script I use to automatically clean up un-deployed versions of the proxy. The perl script use the resty command line client to clean up the revisions it found in the org.
#!/usr/bin/perl use strict; use JSON; use Data::Dumper; my @proxies=("apiproxy1","apiproxy2", "apiproxy3","apiproxy4"); $\ = "\n"; $user="username"; $passwd="password"; foreach my $p (@proxies) { print "Processing proxy: $p"; my $res=`curl -s https://api.enterprise.apigee.com/v1/o/<orgname>/apis/$p -u $user:$passwd`; my $json=decode_json $res; my @revs=@{$json->{'revision'}}; foreach my $rev (@revs) { print `curl -s -X DELETE https://api.enterprise.apigee.com/v1/o/<orgname>/apis/$p/revisions/$rev -u $user:$passwd`; } }
No comments:
Post a Comment