You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Trevor Flanagan <no...@github.com> on 2018/10/08 11:16:25 UTC
[jclouds/jclouds-examples] Added Dimension Data examples (#94)
Bumped version to 2.2.0-SNAPSHOT across all modules
Added three examples:
1. ```org.jclouds.examples.dimensiondata.cloudcontrol.DeployNetworkDomainVlanAndServer``` - deploys Network Domain, VLAN and a Server and waits for them to be state Normal and in the case of the Server for it also to be started.
2. ```org.jclouds.examples.dimensiondata.cloudcontrol.DeleteServerVlanAndNetworkDomain``` - deletes all of the assets deployed in 1.
3. ```org.jclouds.examples.dimensiondata.cloudcontrol.NetworkDomainTearDown``` - given a Network Domain - clean down all of the associated assets.
You can view, comment on, or merge this pull request online at:
https://github.com/jclouds/jclouds-examples/pull/94
-- Commit Summary --
* Example of Dimension Data CloudControl provider. Deploy - network domain, vlan and server with tags.
* Example of Dimension Data CloudControl provider. Deploy - network domain, vlan and server with tags.
* Example of Dimension Data CloudControl provider. Delete - network domain, vlan and server with tags.
* Example of Dimension Data CloudControl provider. Delete - network domain, vlan and server with tags.
* Example of Dimension Data CloudControl provider. Delete - network domain, vlan and server with tags.
* Example of Dimension Data CloudControl provider
* Example of Dimension Data CloudControl provider - Network Domain Tear Down
* Example of Dimension Data CloudControl provider - Network Domain Tear Down
* Example of Dimension Data CloudControl provider - Network Domain Tear Down
* Example of Dimension Data CloudControl provider - Network Domain Tear Down
* Creating executable jar
* Example of Dimension Data CloudControl provider
-- File Changes --
M blobstore-basics/pom.xml (2)
M blobstore-largeblob/pom.xml (2)
M blobstore-uploader/dependency-reduced-pom.xml (3)
M blobstore-uploader/pom.xml (2)
M chef-basics/pom.xml (2)
M compute-basics/pom.xml (7)
A dimensiondata/pom.xml (100)
A dimensiondata/src/main/assembly/jar-with-dependencies.xml (42)
A dimensiondata/src/main/java/org/jclouds/examples/dimensiondata/cloudcontrol/DeleteServerVlanAndNetworkDomain.java (132)
A dimensiondata/src/main/java/org/jclouds/examples/dimensiondata/cloudcontrol/DeployNetworkDomainVlanAndServer.java (112)
A dimensiondata/src/main/java/org/jclouds/examples/dimensiondata/cloudcontrol/NetworkDomainTearDown.java (166)
A dimensiondata/src/main/java/org/jclouds/examples/dimensiondata/cloudcontrol/WaitForUtils.java (98)
A dimensiondata/src/main/resources/logback.xml (89)
M glacier/pom.xml (2)
M google-lb/pom.xml (2)
M openstack/pom.xml (2)
M pom.xml (3)
M rackspace/pom.xml (2)
-- Patch Links --
https://github.com/jclouds/jclouds-examples/pull/94.patch
https://github.com/jclouds/jclouds-examples/pull/94.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Trevor Flanagan <no...@github.com>.
@trevorflanagan pushed 1 commit.
3e1290a Adding comments to the code, in order to prep for adding guide to https://jclouds.apache.org/guides
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94/files/f5cc1cda6d42378b9bbd4c390ce4004365e1d560..3e1290a9e81b651ffc4212a56884969bef2782e0
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Ignasi Barrera <no...@github.com>.
nacx commented on this pull request.
Thanks for the fixes. Just some minor comments and it will be ready to be merged!
> +```
+git clone https://github.com/jclouds/jclouds-examples.git
+cd jclouds-examples/dimensiondata/
+```
+
+To download all dependencies, run:
+
+```
+mvn dependency:copy-dependencies "-DoutputDirectory=./lib"
+```
+
+If you also want to download the source jars, run:
+
+```
+mvn dependency:copy-dependencies "-DoutputDirectory=./lib" "-Dclassifier=sources"
+```
This looks too complicated. Given that you already have an assembly that produces a jar with all required dependencies, the build and run instructions should simply be:
```bash
mvn package
java -jar target/dimensiondata-cloudcontrol-examples-jar-with-dependencies.jar <apiEndpoint> <username> <password>
```
> +import org.jclouds.dimensiondata.cloudcontrol.domain.Server;
+import org.jclouds.dimensiondata.cloudcontrol.domain.TagKey;
+import org.jclouds.dimensiondata.cloudcontrol.domain.Vlan;
+import org.jclouds.dimensiondata.cloudcontrol.options.DatacenterIdListFilters;
+import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
+import org.jclouds.rest.ApiContext;
+
+import static org.jclouds.examples.dimensiondata.cloudcontrol.WaitForUtils.*;
+
+/**
+ * This class will attempt to delete the assets created in org.jclouds.examples.dimensiondata.cloudcontrol.DeployNetworkDomainVlanAndServer:
+ * <ul>
+ * <li>Server</li>
+ * <li>Vlan</li>
+ * <li>Network Domain</li>
+ * <li>Tag Key</li>
End tag `</ul>`
> + *
+ * Internally the Dimension Data CloudControl Provider will use the org.jclouds.dimensiondata.cloudcontrol.features.AccountApi
+ * to lookup the organization identifier so that it is used as part of the requests.
+ *
+ */
+ String endpoint = args[0];
+ String username = args[1];
+ String password = args[2];
+ ApiContext<DimensionDataCloudControlApi> ctx = null;
+ try
+ {
+ ctx = ContextBuilder.newBuilder(DIMENSIONDATA_CLOUDCONTROL_PROVIDER)
+ .endpoint(endpoint)
+ .credentials(username, password)
+ .modules(ImmutableSet.of(new SLF4JLoggingModule()))
+ .build();
[minor] You could also use try-with-resources to save the finally block:
```java
try (ApiContext<DimensionDataCloudControlApi> ctx =
ContextBuilder.newBuilder(DIMENSIONDATA_CLOUDCONTROL_PROVIDER)
.endpoint(endpoint)
.credentials(username, password)
.modules(ImmutableSet.of(new SLF4JLoggingModule()))
.build())
{
...
}
```
> +import org.jclouds.dimensiondata.cloudcontrol.options.DatacenterIdListFilters;
+import org.jclouds.logging.Logger;
+import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
+import org.jclouds.rest.ApiContext;
+
+import static org.jclouds.examples.dimensiondata.cloudcontrol.WaitForUtils.*;
+
+/**
+ * This example shows how a Network Domain and all of it's associated assets are removed.
+ * Takes 4 Program Arguments:
+ * <ul>
+ * <ol>1 Endpoint URL</ol>
+ * <ol>2 Usernamme</ol>
+ * <ol>3 Password</ol>
+ * <ol>4 Network Domain Id</ol>
+ * </ul>
This should be
```html
<ol>
<li></li>
<li></li>
</ol>
```
> @@ -21,7 +21,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.jclouds.examples</groupId>
<artifactId>jclouds-examples</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0-SNAPSHOT</version>
Even if dimension data (in labs) uses the snapshot, keep this version as-is, please.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94#pullrequestreview-163681162
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Trevor Flanagan <no...@github.com>.
@trevorflanagan pushed 1 commit.
9f7b5cf Adding comments to the code, in order to prep for adding guide to https://jclouds.apache.org/guides
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94/files/3e1290a9e81b651ffc4212a56884969bef2782e0..9f7b5cff46d85aba4264e1d2a476667ae44ee956
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Trevor Flanagan <no...@github.com>.
@trevorflanagan pushed 1 commit.
2d46a4b Example of Dimension Data CloudControl provider. Code review comments.
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94/files/8bb536c8bc257e75377febb02c797e53b38fa3a2..2d46a4b589cf48a778d3b3070703bf0d2db4ac31
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Ignasi Barrera <no...@github.com>.
nacx requested changes on this pull request.
Thanks, @trevorflanagan! Examples and documentation contributions are super great and highly appreciated. Thanks!
Please, add also a README either linking to the jclouds guide or just explain how to set up an account, etc, so users landing here know what the requirements are to try them.
> @@ -22,7 +22,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.jclouds.examples</groupId>
<artifactId>blobstore-basics</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0-SNAPSHOT</version>
Do not use SNAPSHOT in jclouds-examples. If you need that for DimensionData, just us it for those ones.
> + 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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.jclouds.examples</groupId>
+ <artifactId>jclouds-examples</artifactId>
+ <version>2.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>dimensiondata-cloudcontrol-examples</artifactId>
+ <name>dimensiondata-cloudcontrol-examples</name>
+ <version>2.2.0-SNAPSHOT</version>
+
+ <properties>
+ <jclouds.version>2.1.0</jclouds.version>
This should probably pull 2.2.0-snapshot too, to make sure these examples don't have runtime issues.
> + </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-slf4j</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <!-- 3rd party dependencies -->
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.0.13</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-slf4j</artifactId>
+ <version>2.2.0-SNAPSHOT</version>
Use `jclouds.version` once changed.
> + <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-slf4j</artifactId>
+ <version>2.2.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ <source>1.6</source>
+ <target>1.6</target>
Let's move this to 1.7
> + <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2.1</version>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>
Can't you use the default descriptor from the maven assembly plugin? Why do we need a custom one?
> +import com.google.common.collect.ImmutableSet;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+import org.jclouds.ContextBuilder;
+import org.jclouds.dimensiondata.cloudcontrol.DimensionDataCloudControlApi;
+import org.jclouds.dimensiondata.cloudcontrol.domain.Server;
+import org.jclouds.dimensiondata.cloudcontrol.domain.TagKey;
+import org.jclouds.dimensiondata.cloudcontrol.domain.Vlan;
+import org.jclouds.dimensiondata.cloudcontrol.options.DatacenterIdListFilters;
+import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
+
+import static org.jclouds.examples.dimensiondata.cloudcontrol.WaitForUtils.*;
+
+/**
+ * This class will attempt to delete the assets created in org.jclouds.examples.dimensiondata.cloudcontrol.DeployNetworkDomainVlanAndServer:
+ * <ol>Server</ol>
Wrong HTML tags. `<ol>` should enclose `<li>` tags.
> +import org.jclouds.dimensiondata.cloudcontrol.domain.Vlan;
+import org.jclouds.dimensiondata.cloudcontrol.options.DatacenterIdListFilters;
+import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
+
+import static org.jclouds.examples.dimensiondata.cloudcontrol.WaitForUtils.*;
+
+/**
+ * This class will attempt to delete the assets created in org.jclouds.examples.dimensiondata.cloudcontrol.DeployNetworkDomainVlanAndServer:
+ * <ol>Server</ol>
+ * <ol>Vlan</ol>
+ * <ol>Network Domain</ol>
+ * <ol>Tag Key</ol>
+ */
+public class DeleteServerVlanAndNetworkDomain
+{
+ private static final String AU_9 = "AU9";
Better `private static final String REGION = System.getProperty("jclouds.region", "AU9")` to let users customize it?
> + */
+ String endpoint = args[0];
+ String username = args[1];
+ String password = args[2];
+ ContextBuilder contextBuilder = ContextBuilder.newBuilder(DIMENSIONDATA_CLOUDCONTROL_PROVIDER);
+ DimensionDataCloudControlApi api = contextBuilder
+ .endpoint(endpoint)
+ .credentials(username, password)
+ .modules(ImmutableSet.<Module>of(new SLF4JLoggingModule()))
+ .buildApi(DimensionDataCloudControlApi.class);
+
+ /*
+ * Retrieve the Guice injector from the context.
+ * We will use this for retrieving the some Predicates that are used by the following operations.
+ */
+ Injector injector = contextBuilder.buildInjector();
Don't do this, as you're building the context twice. Instead:
```java
ApiContext<DimensionDataCloudControlApi> ctx = contextBuilder
.endpoint(endpoint)
.credentials(username, password)
.modules(ImmutableSet.of(new SLF4JLoggingModule()))
.build();
Injector injector = ctx.utils().injector();
DimensionDataCloudControlApi api = ctx.getApi();
```
Also remember to always close the `ctx` in a `finally` clause.
> +import org.jclouds.ContextBuilder;
+import org.jclouds.dimensiondata.cloudcontrol.DimensionDataCloudControlApi;
+import org.jclouds.dimensiondata.cloudcontrol.domain.Disk;
+import org.jclouds.dimensiondata.cloudcontrol.domain.NIC;
+import org.jclouds.dimensiondata.cloudcontrol.domain.NetworkInfo;
+import org.jclouds.dimensiondata.cloudcontrol.domain.TagInfo;
+import org.jclouds.dimensiondata.cloudcontrol.options.DatacenterIdListFilters;
+import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
+
+import java.util.Collections;
+import java.util.List;
+
+import static org.jclouds.examples.dimensiondata.cloudcontrol.WaitForUtils.*;
+
+/**
+ * This class will attempt to Deploy:
Same comments about HTML tags and context creation. Apply everywhere.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94#pullrequestreview-163246263
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Ignasi Barrera <no...@github.com>.
Closed #94.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94#event-1897728163
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Trevor Flanagan <no...@github.com>.
@trevorflanagan pushed 1 commit.
99c618d Example of Dimension Data CloudControl provider. Code review comments.
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94/files/9f7b5cff46d85aba4264e1d2a476667ae44ee956..99c618d34a919ad9fd4e16dc60d6e7042c50be37
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Trevor Flanagan <no...@github.com>.
@trevorflanagan pushed 1 commit.
b3e54fb Example of Dimension Data CloudControl provider. Code review comments.
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94/files/2d46a4b589cf48a778d3b3070703bf0d2db4ac31..b3e54fb68ec087c402fa16710d0d07ab39cb54a3
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Trevor Flanagan <no...@github.com>.
@trevorflanagan pushed 1 commit.
8bb536c Example of Dimension Data CloudControl provider. Code review comments.
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94/files/7855306f5e1abba39a13031603a691999cfa169e..8bb536c8bc257e75377febb02c797e53b38fa3a2
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Trevor Flanagan <no...@github.com>.
@trevorflanagan pushed 1 commit.
20a5a65 Ignore any exceptions when deleting servers or vlans for best effort cleanup
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94/files/b2050be4d52458d3079c94ce87a2c66741095823..20a5a65ecfc0a15d49ed3acff009cabe468b99b9
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Ignasi Barrera <no...@github.com>.
merged to master as a145a8fd[](http://git-wip-us.apache.org/repos/asf/jclouds-examples/commit/a145a8fd). Thanks, @trevorflanagan!
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94#issuecomment-428892698
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Ignasi Barrera <no...@github.com>.
nacx approved this pull request.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94#pullrequestreview-163731854
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Trevor Flanagan <no...@github.com>.
@trevorflanagan pushed 1 commit.
7855306 Example of Dimension Data CloudControl provider. Code review comments.
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94/files/99c618d34a919ad9fd4e16dc60d6e7042c50be37..7855306f5e1abba39a13031603a691999cfa169e
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Trevor Flanagan <no...@github.com>.
trevorflanagan commented on this pull request.
> @@ -21,7 +21,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.jclouds.examples</groupId>
<artifactId>jclouds-examples</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0-SNAPSHOT</version>
Great thanks I wasnt sure what the correct approach was for the parent pom.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94#discussion_r224360452
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Trevor Flanagan <no...@github.com>.
Thanks for taking a look @nacx I will make the required changes.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94#issuecomment-428505174
Re: [jclouds/jclouds-examples] Added Dimension Data examples (#94)
Posted by Trevor Flanagan <no...@github.com>.
@trevorflanagan pushed 1 commit.
f5cc1cd Example of Dimension Data CloudControl provider
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/94/files/20a5a65ecfc0a15d49ed3acff009cabe468b99b9..f5cc1cda6d42378b9bbd4c390ce4004365e1d560