mirror of
https://github.com/apache/jclouds.git
synced 2025-02-16 06:56:45 +00:00
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):
|
BlobStore Example (Java):
|
||||||
|
|
||||||
|
```java
|
||||||
// init
|
// init
|
||||||
context = new BlobStoreContextFactory().createContext(
|
context = new BlobStoreContextFactory().createContext(
|
||||||
"aws-s3",
|
"aws-s3",
|
||||||
@ -53,13 +54,16 @@ BlobStore Example (Java):
|
|||||||
// add blob
|
// add blob
|
||||||
blob = blobStore.blobBuilder("test").payload("testdata").build();
|
blob = blobStore.blobBuilder("test").payload("testdata").build();
|
||||||
blobStore.putBlob("mycontainer", blob);
|
blobStore.putBlob("mycontainer", blob);
|
||||||
|
```
|
||||||
|
|
||||||
BlobStore Example (Clojure):
|
BlobStore Example (Clojure):
|
||||||
|
|
||||||
|
```clojure
|
||||||
(use 'org.jclouds.blobstore2)
|
(use 'org.jclouds.blobstore2)
|
||||||
(def *blobstore* (blobstore "azureblob" account encodedkey))
|
(def *blobstore* (blobstore "azureblob" account encodedkey))
|
||||||
(create-container *blobstore* "mycontainer")
|
(create-container *blobstore* "mycontainer")
|
||||||
(put-blob *blobstore* "mycontainer" (blob "test" :payload "testdata"))
|
(put-blob *blobstore* "mycontainer" (blob "test" :payload "testdata"))
|
||||||
|
```
|
||||||
|
|
||||||
ComputeService
|
ComputeService
|
||||||
---------------
|
---------------
|
||||||
@ -67,6 +71,7 @@ Simplifies the task of managing machines in the cloud. For example, you can use
|
|||||||
|
|
||||||
Compute Example (Java):
|
Compute Example (Java):
|
||||||
|
|
||||||
|
```java
|
||||||
// init
|
// init
|
||||||
context = new ComputeServiceContextFactory().createContext(
|
context = new ComputeServiceContextFactory().createContext(
|
||||||
"aws-ec2",
|
"aws-ec2",
|
||||||
@ -87,9 +92,11 @@ Compute Example (Java):
|
|||||||
|
|
||||||
// you can now run ad-hoc commands on the nodes based on predicates
|
// you can now run ad-hoc commands on the nodes based on predicates
|
||||||
responses = client.runScriptOnNodesMatching(inGroup("mycluster"), "uptime", wrapInInitScript(false));
|
responses = client.runScriptOnNodesMatching(inGroup("mycluster"), "uptime", wrapInInitScript(false));
|
||||||
|
```
|
||||||
|
|
||||||
Compute Example (Clojure):
|
Compute Example (Clojure):
|
||||||
|
|
||||||
|
```clojure
|
||||||
(use 'org.jclouds.compute2)
|
(use 'org.jclouds.compute2)
|
||||||
|
|
||||||
; create a compute service using sshj and log4j extensions
|
; create a compute service using sshj and log4j extensions
|
||||||
@ -102,6 +109,7 @@ Compute Example (Clojure):
|
|||||||
; run a command on that group
|
; run a command on that group
|
||||||
(run-script-on-nodes-matching *compute* (in-group? "mycluster") "uptime"
|
(run-script-on-nodes-matching *compute* (in-group? "mycluster") "uptime"
|
||||||
(RunScriptOptions$Builder/wrapInInitScript false))
|
(RunScriptOptions$Builder/wrapInInitScript false))
|
||||||
|
```
|
||||||
|
|
||||||
Check out https://github.com/jclouds/jclouds-examples for more examples!
|
Check out https://github.com/jclouds/jclouds-examples for more examples!
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user