mirror of https://github.com/apache/jclouds.git
Use Java and Clojure syntax highlighting in the readme file.
This commit is contained in:
parent
72deb93570
commit
d658c30fe9
|
@ -40,6 +40,7 @@ Simplifies dealing with key-value providers such as Amazon S3. For example, Blob
|
|||
|
||||
BlobStore Example (Java):
|
||||
|
||||
```java
|
||||
// init
|
||||
context = new BlobStoreContextFactory().createContext(
|
||||
"aws-s3",
|
||||
|
@ -53,13 +54,16 @@ BlobStore Example (Java):
|
|||
// add blob
|
||||
blob = blobStore.blobBuilder("test").payload("testdata").build();
|
||||
blobStore.putBlob("mycontainer", blob);
|
||||
```
|
||||
|
||||
BlobStore Example (Clojure):
|
||||
|
||||
```clojure
|
||||
(use 'org.jclouds.blobstore2)
|
||||
(def *blobstore* (blobstore "azureblob" account encodedkey))
|
||||
(create-container *blobstore* "mycontainer")
|
||||
(put-blob *blobstore* "mycontainer" (blob "test" :payload "testdata"))
|
||||
```
|
||||
|
||||
ComputeService
|
||||
---------------
|
||||
|
@ -67,6 +71,7 @@ Simplifies the task of managing machines in the cloud. For example, you can use
|
|||
|
||||
Compute Example (Java):
|
||||
|
||||
```java
|
||||
// init
|
||||
context = new ComputeServiceContextFactory().createContext(
|
||||
"aws-ec2",
|
||||
|
@ -87,9 +92,11 @@ Compute Example (Java):
|
|||
|
||||
// you can now run ad-hoc commands on the nodes based on predicates
|
||||
responses = client.runScriptOnNodesMatching(inGroup("mycluster"), "uptime", wrapInInitScript(false));
|
||||
```
|
||||
|
||||
Compute Example (Clojure):
|
||||
|
||||
```clojure
|
||||
(use 'org.jclouds.compute2)
|
||||
|
||||
; create a compute service using sshj and log4j extensions
|
||||
|
@ -102,6 +109,7 @@ Compute Example (Clojure):
|
|||
; run a command on that group
|
||||
(run-script-on-nodes-matching *compute* (in-group? "mycluster") "uptime"
|
||||
(RunScriptOptions$Builder/wrapInInitScript false))
|
||||
```
|
||||
|
||||
Check out https://github.com/jclouds/jclouds-examples for more examples!
|
||||
|
||||
|
|
Loading…
Reference in New Issue