Skip to content

Commit bc60529

Browse files
author
Ignasi Barrera
committed
Datacenter creation
0 parents  commit bc60529

File tree

6 files changed

+147
-0
lines changed

6 files changed

+147
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lib
2+
.project

LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2011 Ignasi Barrera
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

README.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Abiquo API Jython client
2+
========================
3+
4+
This project groups a collection of examples of the Abiquo Cloud
5+
Platform API, using Jython as a wrapper to the official Java client.
6+
7+
8+
Building
9+
---------
10+
11+
The only required step to build the Jython client is to configure
12+
the classpath properly with all necessary dependencies. To do so,
13+
you can just run:
14+
15+
mvn compile
16+
17+
This will generate a *lib* directory with all needed dependencies and a
18+
*CLASSPATH* file containing the CLASSPATH variable needed to run the Jython
19+
client.
20+
21+
Once the classpath has been generated, you can run the Jython code by invoking
22+
the wrapper script:
23+
24+
sh wrapper.sh
25+
26+
27+
Note on patches/pull requests
28+
-----------------------------
29+
30+
* Fork the project.
31+
* Make your feature addition or bug fix.
32+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
33+
* Commit.
34+
* Send me a pull request. Bonus points for topic branches.
35+
36+
37+
Issue Tracking
38+
--------------
39+
40+
f you find any issue, please submit it to the [Bug tracking system](https://github.com/nacx/abijy/issues) and we
41+
will do our best to fix it.
42+
43+
44+
License
45+
-------
46+
47+
This sowftare is licensed under the MIT license. See LICENSE file for details.
48+

pom.xml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>abijython</groupId>
5+
<artifactId>abijython</artifactId>
6+
<version>0.1-SNAPSHOT</version>
7+
8+
<properties>
9+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
10+
</properties>
11+
12+
<repositories>
13+
<repository>
14+
<id>abiquo-repo</id>
15+
<name>Abiquo Maven Repository</name>
16+
<url>http://repo.community.abiquo.com/repo</url>
17+
</repository>
18+
</repositories>
19+
20+
<dependencies>
21+
<dependency>
22+
<groupId>com.abiquo</groupId>
23+
<artifactId>api-client</artifactId>
24+
<version>2.0-SNAPSHOT</version>
25+
</dependency>
26+
</dependencies>
27+
28+
<build>
29+
<plugins>
30+
<plugin>
31+
<groupId>org.apache.maven.plugins</groupId>
32+
<artifactId>maven-dependency-plugin</artifactId>
33+
<configuration>
34+
<prefix>lib</prefix>
35+
<outputDirectory>lib</outputDirectory>
36+
<outputFile>lib/CLASSPATH</outputFile>
37+
</configuration>
38+
<executions>
39+
<execution>
40+
<id>copy</id>
41+
<phase>process-resources</phase>
42+
<goals><goal>copy-dependencies</goal></goals>
43+
</execution>
44+
<execution>
45+
<id>build-classpath</id>
46+
<phase>process-resources</phase>
47+
<goals><goal>build-classpath</goal></goals>
48+
</execution>
49+
</executions>
50+
</plugin>
51+
</plugins>
52+
</build>
53+
</project>

src/datacenter.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env jython
2+
3+
from com.apiclient.wrapper.admin import *
4+
from com.apiclient.connection.constants import *
5+
6+
# Datacenter configuration
7+
DC_NAME = "Jython"
8+
DC_LOCATION = "Honolulu"
9+
DC_ADDRESS = "10.60.1.222"
10+
11+
12+
def create_datacenter():
13+
dc = Datacenter(DC_NAME, DC_LOCATION, DC_ADDRESS, AbiquoKeyWords.AbiquoEdition.ENTERPRISE)
14+
dc.save()
15+
16+
17+
if __name__ == '__main__':
18+
create_datacenter();
19+

wrapper.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
export CLASSPATH=`cat lib/CLASSPATH`
4+
5+
jython src/datacenter.py
6+

0 commit comments

Comments
 (0)