Skip to content

Instantly share code, notes, and snippets.

@RyanJarv
Created December 4, 2020 03:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RyanJarv/f7fdc434b36c3545e006fe6c1eb5c555 to your computer and use it in GitHub Desktop.
Save RyanJarv/f7fdc434b36c3545e006fe6c1eb5c555 to your computer and use it in GitHub Desktop.
Count AWS API's by year
#!/usr/bin/env bash
#
# Count AWS API's on the closest commit before a specific date by year. This takes into account
# different versions of the same API and only uses the newest.
#
set -euo pipefail
day="12-01"
for y in $(seq 2020 2015); do
date="$y-${day}"
git checkout -q `git rev-list -1 --before="$date" master`
git show --no-patch --no-notes --pretty="%as"|tr -d '\n';
sleep 0.4 # checking stuff out this fast does weird things
for d in $(find -E botocore/data -type d -mindepth 1 -maxdepth 1); do
find $d -type f -regex '.*/[^/_]*service-2\.json'|sort -rn|head -n1;
done| xargs -n 1 cat |jq '.operations|.[]|.name'|wc -l
done
# decided to mix things up this year
date="${day} 2014"
git checkout -q `git rev-list -1 --before="$date" master`
git show --no-patch --no-notes --pretty="%as"|tr -d '\n';
sleep 0.4 # checking stuff out this fast does weird things
for d in $(find -E botocore/data/aws -type d -mindepth 1 -maxdepth 1); do
find $d -type f -regex '.*/[^/_]*api\.json'|sort -rn|head -n1;
done | xargs -n 1 cat |jq '.operations|.[]|.name'|wc -l
for y in $(seq 2013 2012); do
date="$y-${day}"
git checkout -q `git rev-list -1 --before="$date" master`
git show --no-patch --no-notes --pretty="%as"|tr -d '\n';
sleep 0.4 # checking stuff out this fast does weird things
find -E botocore/data/aws -type file -regex '.*/[^/_]*.json' -mindepth 1 -maxdepth 1 -exec cat \{\} \; |jq -r '.operations|.[]|.name'| wc -l
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment