Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Where's My DevOps API

Where's My DevOps API

We love APIs, they are the living breathing soul of our solutions. An integral step to delivering an working API, is moving it through the deployment pipeline and monitoring its health once it arrives. We love to craft our APIs and make sure they are easily consumable for consumers. But what about our DevOps tooling that delivers these solutions time and again to production? How can we apply our learnings from the APIs we have built to the APIs we consume when deploying and monitoring our solutions?

Presented at API Days Melbourne 2016

http://au.apidays.io/

Matthew Erbs

March 01, 2016
Tweet

More Decks by Matthew Erbs

Other Decks in Technology

Transcript

  1. What do we do?? 4 Build an app 4 Deploy

    an app 4 Monitor an app 4 Do it ALL again!
  2. Ingredients for an Application Pipeline 4 A smattering of Tools

    4 A sticky Deployment 4 A lumpy Hosting Platform 4 A serve of Operational Tooling 4 An API or App to deploy
  3. Commits GET /repos/merbla/api-days-au/git/commits/xxx { "url": "https://api.github.com/repos/merbla/api-days-au/git/commits/XXX", "author": { "name": "Matthew

    Erbs", "email": "[email protected]" ... }, ... "message": "How good was the keynote at API Days Oz! #banksy", "tree": { "url": "https://api.github.com/repos/merbla/api-days-au/git/trees/YYY", ... } ... }
  4. Discoverability import "github.com/octokit/go-octokit/octokit" func main() { client := octokit.NewClient(nil) url,

    err := octokit.UserURL.Expand(octokit.M{"user": "merbla"}) ... user, result := client.Users(url).One() ... fmt.Println(user.ReposURL) // https://api.github.com/users/merbla/repos }
  5. Event Streams curl -I https://api.github.com/users/merbla/events HTTP/1.1 200 OK X-Poll-Interval: 60

    ETag: "a18c3bded88eb5dbb5c849a489412bf3" curl -I https://api.github.com/users/merbla/events \ -H 'If-None-Match: "a18c3bded88eb5dbb5c849a489412bf3"' HTTP/1.1 304 Not Modified X-Poll-Interval: 60
  6. Every API needs Em!jis GET /emojis { "+1": "https://github.global.ssl.fastly.net/images/icons/emoji/+1.png?v5", "-1":

    "https://github.global.ssl.fastly.net/images/icons/emoji/-1.png?v5", "100": "https://github.global.ssl.fastly.net/images/icons/emoji/100.png?v5", ... } !
  7. Create Stack (AWS) $ curl https://cloudformation.us-east-1.amazonaws.com/ ?Action=CreateStack &StackName=MyStack &TemplateBody=[Template Document]

    &NotificationARNs.member.1=arn:aws:sns:us-east-1:1234567890:my-topic &Parameters.member.1.ParameterKey=AvailabilityZone &Parameters.member.1.ParameterValue=us-east-1a &Version=2010-05-15 &SignatureVersion=2 &Timestamp=2010-07-27T22%3A26%3A28.000Z &AWSAccessKeyId=[AWS Access KeyID] &Signature=[Signature]
  8. OOOPS! 4 AlreadyExists: HTTP Status Code: 400 4 InsufficientCapabilities: HTTP

    Status Code: 400 4 LimitExceeded: HTTP Status Code: 400
  9. Create Stack (OpenStack) $ curl -s -H "X-Auth-Token: $OS_TOKEN" -XPOST

    https://mystack/v1/{tenant_id}/stacks -d '{ "stack": "mystack" "template":"mytemplate", "parameters": { "a": "Value", "b": "3" } }' Error Codes - 400, 401, 409, 500
  10. Create Stack (OpenStack) Response { "stack": { "id": "xxx-stackid", "links":

    [ { "href": "http://mystack/v1/my-tenant/stacks/teststack/xxx-stackid", "rel": "self" } ] } }
  11. Data In (Elastic) $ curl -XPUT -l "http://myelastic/git/event/xxx-eventid" -d '{

    "commit": "7638417db6d59f3c431d3e1f2ff33637155684cd", "message": "Matthew commited some code!", "user": "merbla" }'
  12. Data In (Splunk) $ curl -XPOST -k https://mysplunk:8088/services/collector -H 'Authorization:

    Splunk mytoken' -d '{ "source": "github", "index": "git", "event": { "commit": "7638417db6d59f3c431d3e1f2ff33637155684cd" "message": "Matthew commited some code!", "user": "merbla" } }'
  13. Post a message (Web Hook) curl -XPOST -k https://hooks.slack.com/services/merbla/apidays/token -H

    'Content-type: application/json' -d '{ "text":"Is this talk nearly over? I need lunch!" }'