Clojure in the Cloud Everett Toews Developer JavaOne Sept. 29, 12:30 pm.

Slides:



Advertisements
Similar presentations
LiNC Developer Meetup Welcome!. Our job is to make your life easier APIs Tools and workflow Documentation Stay in touch: developers.lithium.com Join the.
Advertisements

Outline 1/3 PHA Client 1.Overall Architecture 2.Client PHA Setup 1.Open ADT 2.Edit Android Properties Android API 17 3.Setup Android Virtual Device.
Microsoft Confidential. An incubation effort to: Support client -> server communication in native code with a modern C++ API design Support writing Azure-based.
Overview of Twitter API Nathan Liu. Twitter API Essentials Twitter API is a Representational State Transfer(REST) style web services exposed over HTTP(S).
Social Channels Cat Lee Program Manager, Developer Relations facebook.com/cat Driving traffic to your app.
OAuth 2.0 By “PJ” (JP on meetup.com) iOS and PHP developer, and occasional lawyer Contact me via:
Building RESTful Interfaces
1Proprietary and Confidential AirVantage API – Getting started David SCIAMMA – June 13th 2014.
Web Programming in Clojure Barry Demchak CSE294 November 12, 2010.
1 Trillion Azure AD authentications since the release of the service 50 M Office 365 users active every month >1 Billion authentications every.
Google App Engine Google APIs OAuth Facebook Graph API
OAuth 2.0 in Depth By Rohit Ghatol SynerzipSynerzip Passionate about TechNextTechNext.
Google Cloud Messaging for Android (GCM) is a free service that helps developers send data from servers to their Android.
AIRNow Web Services Data to Go! Prepared by Steven A. Ludewig, Timothy S. Dye Sonoma Technology, Inc. Petaluma, CA John E. White U.S. Environmental Protection.
CollectionSpace Service REST-based APIs June 2009 Face-to-face Aron Roberts U.C. Berkeley IST/Data Services.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
© 2012 Autodesk Implementing Cloud-Based Productivity Solutions with the AutoCAD® ObjectARX® API Ravi Krishnaswamy Senior Software Architect.
T Sponsors Stephen Siciliano Senior Program Manager, Microsoft Inside Logic Apps BizTalk Summit 2015 – London ExCeL London | April 13th & 14th.
Intro to WCF From the beginning and uses Steve AppRochester.
Enabling High-Quality Printing in Web Applications
Clojure 4 Sequences 20-Oct-15. Clojure errors (NO_SOURCE_FILE:12) Useless--just means you’re running from the REPL shell java.lang.Exception: EOF while.
1 Cisco Unified Application Environment Developers Conference 2008© 2008 Cisco Systems, Inc. All rights reserved.Cisco Public Introduction to Etch Scott.
Random Logic l Forum.NET l AJAX Behind the buzz word Forum.NET ● January 23, 2006.
Introduction to the SharePoint 2013 REST API. 2 About Me SharePoint Solutions Architect at Sparkhound in Baton Rouge
DM_PPT_NP_v01 SESIP_0715_JR HDF Server HDF for the Web John Readey The HDF Group Champaign Illinois USA.
API Crash Course CWU Startup Club. OUTLINE What is an API? Why are API’s useful? What is HTTP? JSON? XML? What is a RESTful API? How do we consume an.
PROGRAMMING LANGUAGES: PROLOG, CLOJURE, F# Jared Wheeler.
1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd
The Basics of HTTP Jason Dean
1 © Donald F. Ferguson, All rights reserved.Modern Internet Service Oriented Application Development – Lecture 2: REST Details and Patterns Some.
WORKING WITH THE “CALL HTTP WEB SERVICE” WORKFLOW ACTIVITY Derek Nishino Nishino Consulting
06 | HTTP Services with Web API Bruno Terkaly | Technical Evangelist Bret Stateham | Technical Evangelist.
RESTful Web Services What is RESTful?
Basic Introduction to Lisp
Security Considerations
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
JavaScript, Sixth Edition Chapter 11 Updating Web Pages with Ajax.
Modern Development Technologies in SharePoint SHAREPOINT SATURDAY OMAHA APRIL, 2016.
Developing for Chromecast Cast Companion Library & Custom Receiver Application.
Redmond Protocols Plugfest 2016 Tarun Chopra Accessing APIs through Add-Ins Sr. Escalation Engineer.
The Alfresco iOS SDK Gi Lee (Zia Consulting) Peter Schmidt (Alfresco)
Real-Time Dashboards on Power BI
Clojure Macros. Homoiconicity All versions of Lisp, including Clojure, are homoiconic This means that there is no difference between the form of the data.
Feb 17, 2015 Clojure 4. Macros Code is data We have heard this before. It is what makes Lisp so amenable to the use of macros. Examples from Mastering.
The Mechanics of HTTP Requests and Responses and network connections.
Autodesk Dev Days 2015 The road ahead DevDays 2015
ONAP CLI (Command-Line Interface ) Architecture
Open-O CLI (Command-Line Interface ) Architecture
WWU Hackathon May 6 & 7.
Embed Power BI in your Web application
Node.js Express Web Applications
Swagger-SDK CLI PTL ONAP Paris Developer Event 25 –
Node.js Express Web Services
Next Generation SSIS Tasks and data Connection Series
Addressing the Beast: Single Sign-On II
Twitter & NoSQL Integration with MVC4 Web API
WEB API.
Clojure 4 Sequences 27-Nov-18.
Functions and Macros.
Clojure 4 Sequences 5-Dec-18.
Cloud Web Filtering Platform
Module P3 Practical: Building a webapp in nodejs and
3.4 Local Binding Recall Scheme's let: > (let ((x 5)‏ (y 6))
1/16/2019 8:14 PM SAC-863T Delivering notifications with the Windows Push Notification Service and Windows Azure Darren Louie, Nick Harris Program Manager,
Building production-ready APIs with ASP.NET Core 2.2
Clojure 3 1-Jun-19.
Computer Network Information Center, Chinese Academy of Sciences
Erik Porter Program Manager ASP.NET Microsoft Corporation
Restful APIs 101 Laura
Presentation transcript:

Clojure in the Cloud Everett Toews Developer JavaOne Sept. 29, 12:30 pm

Intro Developer

PMC and Committer on Apache jclouds

Intro Advocate

Operations

Co-author of The OpenStack Ops Guide docs.openstack.org/ops

Clojure

List

(2 3)

Clojure Vector

[2 3]

Clojure Map

{:key1 "value1" :key2 "value2"} :key2 "value2"}

Clojure Parens

(fn arg1 arg2) (sf arg1 arg2)

Clojure Prefix

(+ 2 3) ; 5

Clojure Functional

(defn add-7 [x] [x] (+ x 7)) (+ x 7))

(add-7 3) ; 10

(map add-7 [2 3]) ; (9 10)

Clojure Types

(add-7 "3") ; ClassCastException java.lang.String cannot be cast to java.lang.Number

Clojure Destructuring

1 (defn print-args 2 [f & rest] 3 (println f) 4 (println 5 (apply sorted-map rest)))

(print-args "first" :k3 "v3" :k1 "v1" :k3 "v3" :k1 "v1" :k2 "v2") :k2 "v2") ; first ; {:k1 v1, :k2 v2, :k3 v3}

Clojure Lambda

(map (fn [x] (+ x 7)) (fn [x] (+ x 7)) [2 3]) [2 3]) ; (9 10)

Clojure Macro

(defmacro when [test & body] [test & body] (list 'if test (list 'if test (cons 'do body))) (cons 'do body)))

(when true (+ 2 3)) ; 5

Clojure lein

lein new app github-comment-clj lein clean lein install lein test lein run lein repl

Clojure REPL

PrintEvalRead Loop

Cloud

SaaS

IaaS

Resources Accessible Via HTTP API

HTTP APIs

Documentation

Logging

Auth

Endpoint

Environment

Connect!

Request

Response

Headers

Body

JSON

Clojure in the Cloud

Conjecture in the Cloud ClojectureConjecture

Clojure in the Cloud Clojure > Java

Clojure in the Cloud Domain Modeling vsMaps

Example ExampleSurprise!

"""" {"key": "value"} Map Map

"" {"key": {BLAH}}ParseException

Example Example Changing Objects

"""" {"obj": "BLAH"} "" {"obj": {BLAH}} "" {"obj": [BLAH]}

Clojure in the Cloud Example Huge Objects

Clojure in the Cloud Maps

WARNING Demos Ahead

Clojure in the Cloud Compile/Run/printlnvsREPL

Demo lein repl

Clojure in the Cloud pom.xml/mvn/Classvs lein try

Clojure in the Cloud Demo lein try

Clojure in the Cloud Works For Me vs I Feel Your Pain

Clojure in the Cloud Demo lein repl :connect

Use Case

GitHubTwitter Rackspace Jenkins Developer 1.PR 2. Webhook 4. Comment 3. Status 5. Save

Talkin’ HTTP

HTTP Library

clj-http

Talkin’ HTTP Java SDK

Hosebird Client (hbc)

Talkin’ HTTP Clojure Bindings for Java SDK

Clojure Bindings for Java SDK Apache jclouds

Talkin’ HTTP Clojure SDK

twitter-apitentacles

twitter-api

:dependencies

1 [org.clojure/clojure "1.4.0"] ;; Clojure 2 [org.clojure/data.json "0.2.1"] ;; JSON 3 [http.async.client "0.5.2"] ;; HTTP 4 [clj-oauth "1.4.0"]] ;; OAuth

twitter-api Macros

1 (defmacro def-twitter-restful-method 2 [verb resource-path & rest] 3 (let [json-path (str resource-path ".json") 4 dashed-name (...) 5 clean-name (...) 6 fn-name (symbol clean-name)] 7 `(def-twitter-method ~fn-name ~verb ~json-path :api ~*rest-api* :callbacks (get- default-callbacks :sync :single)

1 (defmacro def-twitter-method 2 [fn-name default-verb resource-path & rest] 3 (let [rest-map (apply sorted-map rest)] 4 `(defn ~fn-name 5 [& {:as args#}] 6 (let [...] 7 (http-request verb# uri# arg-map#))))

1 (def-twitter-restful-method :get "statuses/home_timeline") 2 (statuses-home-timeline :oauth-creds twitter ‑ creds :params {:count 3}) ; {:headers {:content-length "7558",...} ; :status {:code 200,...} ; :body ; [{:text "Untappd but for Pho",...}...]}

1 (def-twitter-restful-method :post "statuses/update") 2 (statuses-update :oauth-creds twitter ‑ creds :params {:status ”Hi!"}) ; {:headers {:content-length ”1904",...} ; :status {:code 200,...} ; :body ; [{:text "Hi!",...}...]}

twitter-api Documentation

Logging

tentacles

:dependencies

1 [org.clojure/clojure "1.5.1"] ;; Clojure 2 [org.clojure/data.codec "0.1.0"] ;; Base64 3 [clj-http "0.4.0"] ;; HTTP 4 [cheshire "4.0.0"] ;; JSON 5 [com.cemerick/url "0.0.6"] ;; URLs 6 [environ "0.4.0"] ;; Env

tentacles Functions

1 (defn api-call 2 [method end-point positional query] 3 (let [query (query-map query) 4 all-pages? (query "all_pages") 5 req (make-request...) 6 exec-request-one (fn...(request req)) 7 exec-request (fn...)] 8 (exec-request req)))

1 (issues/create-comment "everett-toews” "github-comment-clj" 6 "Hi!" github-creds) ; {:url " ; :id , ; :user {:id ,...} ; :body "Hi!"}

tentacles Documentation

Logging

jclouds

:dependencies

1 [org.clojure/clojure "1.3.0"] ;; Clojure 2 [org.clojure/tools.logging "0.2.3"] ;; Log 3 [org.clojure/core.incubator "0.1.0"];; Inc 4 [org.apache.jclouds.labs/ rackspace-cloudfiles-us 1.8.0"] ;; BlobStore rackspace-cloudfiles-us 1.8.0"] ;; BlobStore

jclouds JavaClasses/Methods

1 (defn create-container 2 [^BlobStore blobstore container-name & 3 {:keys [location public-read?]}] 4 (let [cco (CreateContainerOptions.) 5 cco (if public-read?...)] 6 (.createContainerInLocation blobstore location container-name cco)))

1 (defn put-blob 2 [^BlobStore blobstore container-name blob & 3 {:keys [multipart?]}] 4 (let [options (if multipart?...)] 5 (.putBlob blobstore container-name blob options)))

1 (def my-blob (blob "my-file.log" :payload "my-file-contents")) ; #'blobstore.core/blob 2 (create-container blobstore "my-container") ; true 3 (put-blob blobstore "my-container" my-blob) ; "60e46aeaed dd7ae99858f03"

jclouds Documentation

Logging

Clojure in the Cloud

Thank You Clojure Made Simple Intro to Apache jclouds Everett Toews Developer