Skip to content

Instantly share code, notes, and snippets.

Everett Toews etoews

Block or report user

Report or block etoews

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@etoews
etoews / Test.java
Created Aug 7, 2012
jclouds resize broken (Rackspace)
View Test.java
package com.rackspace;
import java.lang.Thread.UncaughtExceptionHandler;
import org.jclouds.ContextBuilder;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadata.Status;
import org.jclouds.compute.domain.NodeMetadataBuilder;
import org.jclouds.enterprise.config.EnterpriseConfigurationModule;
@etoews
etoews / install.sh
Created Aug 15, 2012
Getting started with jclouds
View install.sh
$ mkdir jclouds-test
$ cd jcloud-test
$ curl -o lein.sh https://raw.github.com/technomancy/leiningen/stable/bin/lein
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9905 100 9905 0 0 13005 0 --:--:-- --:--:-- --:--:-- 31444
$ chmod u+x lein.sh
$ echo '(defproject deps "1" :dependencies [[org.jclouds/jclouds-all "1.5.1"] [org.jclouds.driver/jclouds-sshj "1.5.1"]])' > project.clj
$ ./lein.sh deps
<output omitted>
@etoews
etoews / JCloudsTest.java
Created Aug 15, 2012
Getting started with jclouds
View JCloudsTest.java
import java.util.Set;
import java.lang.Thread.UncaughtExceptionHandler;
import org.jclouds.ContextBuilder;
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.ComputeMetadata;
public class JCloudsTest {
private ComputeService compute;
@etoews
etoews / compile.sh
Created Aug 15, 2012
Getting started with jclouds
View compile.sh
$ pwd
/Users/phymata/test/jclouds-test
$ ls
JCloudsTest.java lein.sh lib project.clj
$ javac -cp ".:lib/*" JCloudsTest.java
$ ls
JCloudsTest$1.class JCloudsTest.class JCloudsTest.java lein.sh lib project.clj
$ java -cp ".:lib/*" JCloudsTest
Calling listNodes...
Total Number of Nodes = 1
@etoews
etoews / token.sh
Created Aug 17, 2012
Get a token from the Rackspace Open Cloud
View token.sh
$ TOKEN=`curl -s -X POST https://identity.api.rackspacecloud.com/v2.0/tokens -d '{"auth": {"passwordCredentials": {"username":"MY_USERNAME", "password":"MY_PASSWORD"}}}' -H "Content-type: application/json" | python -c 'import json,sys; response=json.loads(sys.stdin.read()); print response["access"]["token"]["id"]'`
$ echo $TOKEN
9d1dc8da-d306-4e39-b9c2-f39a127341f1
View JCloudsLoggingExample.java
import java.lang.Thread.UncaughtExceptionHandler;
import java.util.Set;
import org.jclouds.ContextBuilder;
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
import com.google.common.collect.ImmutableSet;
@etoews
etoews / compile.sh
Created Aug 18, 2012
Logging with jclouds
View compile.sh
$ javac -cp ".:lib/*" JCloudsLoggingExample.java
$ java -cp ".:lib/*" JCloudsLoggingExample
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Calling listNodes...
Total Number of Nodes = 1
@etoews
etoews / logback.xml
Created Aug 18, 2012
Logging with jclouds
View logback.xml
<?xml version="1.0"?>
<configuration scan="false">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>- %m%n</pattern>
</encoder>
</appender>
<logger name="jclouds.wire">
<level value="DEBUG" />
@etoews
etoews / run.sh
Created Aug 18, 2012
Logging with jclouds
View run.sh
$ pwd
/Users/phymata/test/jclouds-test
$ ls
JCloudsLoggingExample$1.class JCloudsTest.java
JCloudsLoggingExample.class lein.sh
JCloudsLoggingExample.java lib
JCloudsTest$1.class logback.xml
JCloudsTest.class project.clj
View log.java
17:00:49,672 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
17:00:49,676 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
17:00:49,676 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/Users/ever5257/dev/everett-toews/jclouds/apis/openstack-keystone/target/test-classes/logback.xml]
17:00:49,682 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
17:00:49,682 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:/Users/ever5257/dev/everett-toews/jclouds/apis/openstack-keystone/target/test-classes/logback.xml]
17:00:49,682 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:/Users/ever5257/dev/everett-toews/jclouds/compute/target/test-classes/logback.xml]
17:00:49,770 |-INFO in ch.qos.logback.classic.joran.ac
You can’t perform that action at this time.