nacx commented on this pull request.
> +
+{% highlight java %}
+/*
+ * Deploy Network Domain to the Zone / Datacenter we wish to operate on. The
response from this API is the Network Domain Identifier.
+ */
+String networkDomainId = api.getNetworkApi().deployNetworkDomain(AU9,
"jclouds-example", "jclouds-example", "ESSENTIALS");
+{% endhighlight %}
+
+A Network Domain deployment is an asynchronous process. We need to wait for it
to complete. The Dimension Data provider
+has built in google guice predicates that will block execution and check that
the Network Domain's State has moved from `PENDING_ADD` to `NORMAL`.
+
+The following is some example code that shows how the to use predicate
suitable for asserting a Network Domain state has transitioned to the `NORMAL`
state. The predicate uses the Network Domain Identifier we wish to check the
state of.
+{% highlight java %}
+Predicate<String> networkDomainNormalPredicate =
injector.getInstance(Key.get(new TypeLiteral<Predicate<String>>()
+{
+}, Names.named(NETWORK_DOMAIN_NORMAL_PREDICATE)));
My intention with the comment was to make this more usable by extracting the
whole `Key` object into a constant, not just the string. This way users
wouldn't need to build this ugly construct.
However, if it makes sense to expose this predicate to users, then it's better
to add the following method to the `NetworkApi` interface:
```java
@Provides
@Named("NETWORK_DOMAIN_NORMAL_PREDICATE")
Predicate<String> networkDomainNormalPredicate();
```
This way useres can jsut get it with `api.
getNetworkApi().networkDomainNormalPredicate()` (the `@Provides` annotation
does the magic here), which makes much more sense and is more usable. Apply the
same pattern to the other user-facing predicates and their corresponding API
interfaces.
Feel free to open a PR in the provider to add these methods, but let's change
the docs now and move forward.
--
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-site/pull/220#pullrequestreview-163828272