You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2015/04/02 11:26:26 UTC

[2/3] jclouds-labs git commit: [JCLOUDS-842] provided support for traffic manager operations

[JCLOUDS-842] provided support for traffic manager operations


Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/4e3f19b9
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/4e3f19b9
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/4e3f19b9

Branch: refs/heads/master
Commit: 4e3f19b98ba11ea06c07bb47ef295934e0d280c1
Parents: d928dbc
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Mar 12 14:04:18 2015 +0100
Committer: Ignasi Barrera <na...@apache.org>
Committed: Thu Apr 2 11:18:23 2015 +0200

----------------------------------------------------------------------
 .../jclouds/azurecompute/AzureComputeApi.java   |  10 +
 .../binders/ProfileDefinitionParamsToXML.java   |  79 ++++++
 .../binders/ProfileParamsToXML.java             |  51 ++++
 .../domain/CreateProfileParams.java             |  91 +++++++
 .../jclouds/azurecompute/domain/Profile.java    |  81 ++++++
 .../azurecompute/domain/ProfileDefinition.java  | 199 ++++++++++++++
 .../domain/ProfileDefinitionEndpoint.java       | 148 +++++++++++
 .../domain/ProfileDefinitionEndpointParams.java | 180 +++++++++++++
 .../domain/ProfileDefinitionMonitor.java        | 121 +++++++++
 .../domain/ProfileDefinitionParams.java         | 161 ++++++++++++
 .../domain/UpdateProfileParams.java             |  86 +++++++
 .../features/TrafficManagerApi.java             | 184 +++++++++++++
 .../xml/ListProfileDefinitionsHandler.java      |  79 ++++++
 .../azurecompute/xml/ListProfilesHandler.java   |  79 ++++++
 .../xml/ProfileDefinitionEndpointHandler.java   | 110 ++++++++
 .../xml/ProfileDefinitionHandler.java           | 148 +++++++++++
 .../xml/ProfileDefinitionMonitorHandler.java    | 114 ++++++++
 .../azurecompute/xml/ProfileHandler.java        | 113 ++++++++
 .../jclouds/azurecompute/xml/ResultHandler.java |  64 +++++
 .../features/TrafficManagerApiLiveTest.java     | 183 +++++++++++++
 .../features/TrafficManagerApiMockTest.java     | 258 +++++++++++++++++++
 .../xml/ListProfileDefinitionsHandlerTest.java  |  75 ++++++
 .../xml/ListProfilesHandlerTest.java            |  57 ++++
 .../xml/ProfileDefinitionHandlerTest.java       |  71 +++++
 .../azurecompute/xml/ProfileHandlerTest.java    |  45 ++++
 .../resources/checkdnsprefixavailability.xml    |   4 +
 .../src/test/resources/createprofileparams.xml  |   1 +
 .../test/resources/listprofiledefinitions.xml   |  44 ++++
 .../src/test/resources/listprofiles.xml         |  23 ++
 azurecompute/src/test/resources/profile.xml     |  15 ++
 .../src/test/resources/profiledefinition.xml    |  42 +++
 .../resources/profiledefinitioncsparams.xml     |   1 +
 .../resources/profiledefinitiontmparams.xml     |  35 +++
 .../src/test/resources/updateprofileparams.xml  |   1 +
 34 files changed, 2953 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeApi.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeApi.java b/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeApi.java
index ab93cbe..19c364e 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeApi.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeApi.java
@@ -30,6 +30,7 @@ import org.jclouds.azurecompute.features.OSImageApi;
 import org.jclouds.azurecompute.features.OperationApi;
 import org.jclouds.azurecompute.features.StorageAccountApi;
 import org.jclouds.azurecompute.features.SubscriptionApi;
+import org.jclouds.azurecompute.features.TrafficManagerApi;
 import org.jclouds.azurecompute.features.VirtualMachineApi;
 import org.jclouds.azurecompute.features.VirtualNetworkApi;
 import org.jclouds.rest.annotations.Delegate;
@@ -139,4 +140,13 @@ public interface AzureComputeApi extends Closeable {
     */
    @Delegate
    NetworkSecurityGroupApi getNetworkSecurityGroupApi();
+
+   /**
+    * The Service Management API includes operations for creating, updating, listing, and deleting Azure Traffic Manager
+    * profiles and definitions.
+    *
+    * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758255.aspx">docs</a>
+    */
+   @Delegate
+   TrafficManagerApi getTrafficManaerApi();
 }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileDefinitionParamsToXML.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileDefinitionParamsToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileDefinitionParamsToXML.java
new file mode 100644
index 0000000..413fe8a
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileDefinitionParamsToXML.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.binders;
+
+import static com.google.common.base.Throwables.propagate;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.Binder;
+
+import com.jamesmurty.utils.XMLBuilder;
+import org.jclouds.azurecompute.domain.ProfileDefinitionEndpointParams;
+import org.jclouds.azurecompute.domain.ProfileDefinitionParams;
+
+public final class ProfileDefinitionParamsToXML implements Binder {
+
+   @Override
+   @SuppressWarnings("unchecked")
+   public <R extends HttpRequest> R bindToRequest(final R request, final Object input) {
+      final ProfileDefinitionParams params = ProfileDefinitionParams.class.cast(input);
+      try {
+         XMLBuilder bld = XMLBuilder.create("Definition", "http://schemas.microsoft.com/windowsazure");
+         bld.e("DnsOptions").e("TimeToLiveInSeconds").t(params.ttl().toString()).up().up();
+
+         bld.e("Monitors").e("Monitor").e("IntervalInSeconds").t("30").up()
+                 .e("TimeoutInSeconds").t("10").up()
+                 .e("ToleratedNumberOfFailures").t("3").up()
+                 .e("Protocol").t(params.protocol().name()).up()
+                 .e("Port").t(params.port().toString()).up()
+                 .e("HttpOptions")
+                 .e("Verb").t("GET").up()
+                 .e("RelativePath").t(params.path()).up()
+                 .e("ExpectedStatusCode").t("200");
+
+         bld = bld.e("Policy").e("LoadBalancingMethod").t(params.lb().getValue()).up()
+                 .e("Endpoints");
+
+         for (ProfileDefinitionEndpointParams endpoint : params.endpoints()) {
+            bld = bld.e("Endpoint")
+                    .e("DomainName").t(endpoint.domain()).up()
+                    .e("Status").t(endpoint.status().getValue()).up();
+
+            if (endpoint.type() != null) {
+               bld = bld.e("Type").t(endpoint.type().getValue()).up();
+            }
+            if (endpoint.location() != null) {
+               bld = bld.e("Location").t(endpoint.location()).up();
+            }
+            if (endpoint.min() != null) {
+               bld = bld.e("MinChildEndpoints").t(endpoint.min().toString()).up();
+            }
+            if (endpoint.weight() != null) {
+               bld = bld.e("Weight").t(endpoint.weight().toString()).up();
+            }
+
+            bld = bld.up();
+         }
+
+         bld.up().up();
+
+         return (R) request.toBuilder().payload(bld.up().asString()).build();
+      } catch (Exception e) {
+         throw propagate(e);
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileParamsToXML.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileParamsToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileParamsToXML.java
new file mode 100644
index 0000000..eb6970d
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileParamsToXML.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.binders;
+
+import static com.google.common.base.Throwables.propagate;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.Binder;
+
+import com.jamesmurty.utils.XMLBuilder;
+import org.jclouds.azurecompute.domain.CreateProfileParams;
+import org.jclouds.azurecompute.domain.UpdateProfileParams;
+
+public final class ProfileParamsToXML implements Binder {
+
+   @Override
+   @SuppressWarnings("unchecked")
+   public <R extends HttpRequest> R bindToRequest(final R request, final Object input) {
+
+      try {
+         final XMLBuilder bld = XMLBuilder.create("Profile", "http://schemas.microsoft.com/windowsazure");
+         if (input instanceof CreateProfileParams) {
+            final CreateProfileParams params = CreateProfileParams.class.cast(input);
+            bld.e("DomainName").t(params.domain()).up();
+            bld.e("Name").t(params.name()).up().up();
+            return (R) request.toBuilder().payload(bld.up().asString()).build();
+         } else {
+            final UpdateProfileParams params = UpdateProfileParams.class.cast(input);
+            bld.e("Status").t(params.status().getValue()).up();
+            bld.e("StatusDetails").e("EnabledVersion").t("1").up().up().up();
+            return (R) request.toBuilder().payload(bld.up().asString()).build();
+         }
+      } catch (Exception e) {
+         throw propagate(e);
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/domain/CreateProfileParams.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/CreateProfileParams.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/CreateProfileParams.java
new file mode 100644
index 0000000..0f2a9a3
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/CreateProfileParams.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.domain;
+
+import com.google.auto.value.AutoValue;
+
+/**
+ * The Create Profile operation creates a new profile for a domain name, owned by the specified subscription.
+ *
+ * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758254.aspx">docs</a>
+ */
+@AutoValue
+public abstract class CreateProfileParams {
+
+   CreateProfileParams() {
+   } // For AutoValue only!
+
+   /**
+    * Specifies the name of the domain that the profile is being created for.
+    *
+    * A valid DNS name of the form &lt;subdomain name&gt;.trafficmanager.net, conforming to RFC 1123 specification.
+    *
+    * Total length of the domain name must be less than or equal to 253 characters. The &lt;subdomain name&gt; can
+    * contain periods and each label within the subdomain must be less or equal to 63 characters.
+    *
+    * @return profile domain name.
+    */
+   public abstract String domain();
+
+   /**
+    * Specifies the name of the profile.
+    *
+    * The name must be composed of letters, numbers, and hyphens. The maximum length of the profile name is 256
+    * characters. Hyphens cannot be the first or last character.
+    *
+    * @return profile name..
+    */
+   public abstract String name();
+
+   public Builder toBuilder() {
+      return builder().fromImageParams(this);
+   }
+
+   public static Builder builder() {
+      return new Builder();
+   }
+
+   public static final class Builder {
+
+      private String domain;
+      private String name;
+
+      public Builder domain(final String domain) {
+         this.domain = domain;
+         return this;
+      }
+
+      public Builder name(final String name) {
+         this.name = name;
+         return this;
+      }
+
+      public CreateProfileParams build() {
+         return CreateProfileParams.create(domain, name);
+      }
+
+      public Builder fromImageParams(final CreateProfileParams in) {
+         return domain(in.domain()).name(in.name());
+      }
+   }
+
+   private static CreateProfileParams create(
+           final String domain,
+           final String name) {
+      return new AutoValue_CreateProfileParams(domain, name);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Profile.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Profile.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Profile.java
new file mode 100644
index 0000000..7d166f8
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Profile.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.domain;
+
+import com.google.auto.value.AutoValue;
+import java.util.Map;
+import org.jclouds.javax.annotation.Nullable;
+
+/**
+ * Traffic Maager profile.
+ *
+ * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758255.aspx" >Traffic Manager operations</a>
+ */
+@AutoValue
+public abstract class Profile {
+
+   Profile() {
+   } // For AutoValue only!
+
+   /**
+    * Specifies the domain name, as specified during the creation of the profile.
+    *
+    * @return domain nae.
+    */
+   public abstract String domain();
+
+   /**
+    * Specifies the profile name.
+    *
+    * @return profile name.
+    */
+   public abstract String name();
+
+   /**
+    * Indicates whether a definition of the specified profile is enabled or disabled in Azure Traffic Manager. Possible
+    * values are: Enabled, Disabled.
+    *
+    * @return profile definition status.
+    */
+   public abstract ProfileDefinition.Status status();
+
+   /**
+    * Specifies the version of the enabled definition. This value is always 1.
+    *
+    * @return version.
+    */
+   @Nullable
+   public abstract String version();
+
+   /**
+    * Specifies the definition for the specified profile, along with the status. Only one definition version exists for
+    * a profile.
+    *
+    * @return profile definitions in terms of version-status pairs;
+    */
+   public abstract Map<String, ProfileDefinition.Status> definitions();
+
+   public static Profile create(
+           final String domain,
+           final String name,
+           final ProfileDefinition.Status status,
+           final String version,
+           final Map<String, ProfileDefinition.Status> definitions) {
+
+      return new AutoValue_Profile(domain, name, status, version, definitions);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinition.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinition.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinition.java
new file mode 100644
index 0000000..df0190f
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinition.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.domain;
+
+import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+
+/**
+ * Cloud service certifcate.
+ *
+ * @see <a href="https://msdn.microsoft.com/en-us/library/azure/ee795178.aspx" >ServiceCertificate</a>
+ */
+@AutoValue
+public abstract class ProfileDefinition {
+
+   public static enum Status {
+
+      UNRECOGNIZED(""),
+      ENABLED("Enabled"),
+      DISABLED("Disabled");
+
+      private final String value;
+
+      private Status(final String value) {
+         this.value = value;
+      }
+
+      public static Status fromString(final String value) {
+         for (Status status : Status.values()) {
+            if (status.value.equalsIgnoreCase(value)) {
+               return status;
+            }
+         }
+         return UNRECOGNIZED;
+      }
+
+      public String getValue() {
+         return value;
+      }
+   }
+
+   public static enum LBMethod {
+
+      UNRECOGNIZED(""),
+      PERFORMANCE("Performance"),
+      FAILOVER("Failover"),
+      ROUNDROBIN("RoundRobin");
+
+      private final String value;
+
+      private LBMethod(final String value) {
+         this.value = value;
+      }
+
+      public static LBMethod fromString(final String value) {
+         for (LBMethod lb : LBMethod.values()) {
+            if (lb.value.equalsIgnoreCase(value)) {
+               return lb;
+            }
+         }
+         return UNRECOGNIZED;
+      }
+
+      public String getValue() {
+         return value;
+      }
+   }
+
+   public static enum Protocol {
+
+      UNRECOGNIZED, HTTP, HTTPS;
+
+      public static Protocol fromString(final String value) {
+         for (Protocol protocol : Protocol.values()) {
+            if (protocol.name().equalsIgnoreCase(value)) {
+               return protocol;
+            }
+         }
+         return UNRECOGNIZED;
+      }
+   }
+
+   public static enum HealthStatus {
+
+      UNRECOGNIZED(""),
+      ONLINE("Online"),
+      DEGRADED("Degraded"),
+      INACTIVE("Inactive"),
+      DISABLED("Disabled"),
+      STOPPED("Stopped"),
+      CHECKINGENDPOINT("CheckingEndpoint");
+
+      private final String value;
+
+      private HealthStatus(final String value) {
+         this.value = value;
+      }
+
+      public static HealthStatus fromString(final String value) {
+         for (HealthStatus status : HealthStatus.values()) {
+            if (status.value.equalsIgnoreCase(value)) {
+               return status;
+            }
+         }
+         return UNRECOGNIZED;
+      }
+
+      public String getValue() {
+         return value;
+      }
+   }
+
+   ProfileDefinition() {
+   } // For AutoValue only!
+
+   /**
+    * Specifies the DNS Time-To-Live (TTL) that informs the Local DNS resolvers how long to cache DNS entries. The value
+    * is an integer from 30 through 999,999.
+    *
+    * @return DNS cache Time-To-Live (TTL)
+    */
+   public abstract int ttl();
+
+   /**
+    * Indicates whether this definition is enabled or disabled for the profile. Possible values are: Enabled, Disabled.
+    *
+    * @return profile definition status.
+    */
+   public abstract Status status();
+
+   /**
+    * Specifies the version of the definition. This value is always 1.
+    *
+    * @return version.
+    */
+   public abstract String version();
+
+   /**
+    * Encapsulates the list of Azure Traffic Manager endpoint monitors. You have to define just 1 monitor in the list.
+    *
+    * @return profile definition monitors;
+    */
+   public abstract List<ProfileDefinitionMonitor> monitors();
+
+   /**
+    * Specifies the load balancing method to use to distribute connection. Possible values are: Performance, Failover,
+    * RoundRobin
+    *
+    * @return load balancing method..
+    */
+   public abstract LBMethod lb();
+
+   /**
+    * Encapsulates the list of Azure Traffic Manager endpoints. You can define up to 100 endpoints in the list.
+    *
+    * @return endpoints.
+    * @see EndpointParams
+    */
+   public abstract List<ProfileDefinitionEndpoint> endpoints();
+
+   /**
+    * When defined as part of a policy, indicates the health status for the overall load balancing policy. Possible
+    * values are: Online, Degraded, Inactive, Disabled, CheckingEndpoints.
+    *
+    * When defined as part of an endpoint, indicates the health status for the endpoint. Possible values are: Online,
+    * Degraded, Inactive, Disabled, Stopped, CheckingEndpoint.
+    *
+    * @return endpoint health status.
+    */
+   public abstract ProfileDefinition.HealthStatus healthStatus();
+
+   public static ProfileDefinition create(
+           final int ttl,
+           final Status status,
+           final String version,
+           final List<ProfileDefinitionMonitor> monitors,
+           final LBMethod lb,
+           final List<ProfileDefinitionEndpoint> endpoints,
+           final ProfileDefinition.HealthStatus healthStatus) {
+
+      return new AutoValue_ProfileDefinition(
+              ttl, status, version, ImmutableList.copyOf(monitors), lb, ImmutableList.copyOf(endpoints), healthStatus);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionEndpoint.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionEndpoint.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionEndpoint.java
new file mode 100644
index 0000000..e846a79
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionEndpoint.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.domain;
+
+import com.google.auto.value.AutoValue;
+import org.jclouds.azurecompute.domain.ProfileDefinition.HealthStatus;
+import org.jclouds.javax.annotation.Nullable;
+
+/**
+ * Encapsulates the list of Azure Traffic Manager endpoints. You can define up to 100 endpoints in the list.
+ *
+ * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758257.aspx">docs</a>
+ */
+@AutoValue
+public abstract class ProfileDefinitionEndpoint {
+
+   public static enum Type {
+
+      UNRECOGNIZED(""),
+      CLOUDSERVICE("CloudService"),
+      AZUREWEBSITE("AzureWebsite"),
+      ANY("Any"),
+      TRAFFICMANAGER("TrafficManager");
+
+      private final String value;
+
+      private Type(final String value) {
+         this.value = value;
+      }
+
+      public static Type fromString(final String value) {
+         for (Type type : Type.values()) {
+            if (type.value.equalsIgnoreCase(value)) {
+               return type;
+            }
+         }
+         return UNRECOGNIZED;
+      }
+
+      public String getValue() {
+         return value;
+      }
+   }
+
+   ProfileDefinitionEndpoint() {
+   } // For AutoValue only!
+
+   /**
+    * Specifies the endpoint domain name. The value depends on endpoint type. If Type is CloudService, the value must be
+    * a fully qualified domain name (FQDN) of a cloud service that belongs to the subscription ID that owns the
+    * definition. If Type is AzureWebsite, the value must be an FQDN of an Azure web site that belongs to the
+    * subscription ID that owns the definition. If Type is Any, the value can be any FQDN for an Azure service or a
+    * service outside of Azure.
+    *
+    * @return endpoint domain name.
+    */
+   public abstract String domain();
+
+   /**
+    * Specifies the status of the monitoring endpoint. If set to Enabled, the endpoint is considered by the load
+    * balancing method and is monitored. Possible values are:Enabled, Disabled
+    *
+    * @return status of the monitoring endpoint.
+    */
+   public abstract ProfileDefinition.Status status();
+
+   /**
+    * When defined as part of a policy, indicates the health status for the overall load balancing policy. Possible
+    * values are: Online, Degraded, Inactive, Disabled, CheckingEndpoints.
+    *
+    * When defined as part of an endpoint, indicates the health status for the endpoint. Possible values are: Online,
+    * Degraded, Inactive, Disabled, Stopped, CheckingEndpoint.
+    *
+    * @return endpoint health status.
+    */
+   public abstract ProfileDefinition.HealthStatus healthStatus();
+
+   /**
+    * Optional. Specifies the type of endpoint being added to the definition. Possible values are: CloudService,
+    * AzureWebsite, Any, TrafficManager.
+    *
+    * If there is more than one AzureWebsite endpoint, they must be in different datacenters. This limitation doesn’t
+    * apply to cloud services. The default value is CloudService. Use the TrafficManager type when configuring nested
+    * profiles..
+    *
+    * @return endpoint type.
+    * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh744833.aspx">Traffic Manager Overview</a>
+    */
+   public abstract Type type();
+
+   /**
+    * Required when LoadBalancingMethod is set to Performance and Type is set to Any or TrafficManager. Specifies the
+    * name of the Azure region. The Location cannot be specified for endpoints of type CloudService or AzureWebsite, in
+    * which the locations are determined from the service.
+    *
+    * @return endpoint protocol.
+    * @see <a href="https://msdn.microsoft.com/en-us/library/gg441293.aspx">List Locations</a>
+    */
+   @Nullable
+   public abstract String location();
+
+   /**
+    * Optional. Specifies the priority of the endpoint in load balancing. The higher the weight, the more frequently the
+    * endpoint will be made available to the load balancer. The value must be greater than 0. For endpoints that do not
+    * specify a weight value, a default weight of 1 will be used.
+    *
+    * @return
+    */
+   @Nullable
+   public abstract Integer weight();
+
+   /**
+    * Optional. Can be specified when Type is set to TrafficManager. The minimum number of healthy endpoints within a
+    * nested profile that determines whether any of the endpoints within that profile can receive traffic. Default value
+    * is 1.
+    *
+    * @return minimum number of healthy endpoints.
+    */
+   @Nullable
+   public abstract Integer min();
+
+   public static ProfileDefinitionEndpoint create(
+           final String domain,
+           final ProfileDefinition.Status status,
+           final HealthStatus healthStatus,
+           final Type type,
+           final String location,
+           final Integer weight,
+           final Integer min) {
+
+      return new AutoValue_ProfileDefinitionEndpoint(
+              domain, status, healthStatus, type, location, weight, min);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionEndpointParams.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionEndpointParams.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionEndpointParams.java
new file mode 100644
index 0000000..34173f9
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionEndpointParams.java
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.domain;
+
+import com.google.auto.value.AutoValue;
+import org.jclouds.azurecompute.domain.ProfileDefinition.Status;
+import org.jclouds.azurecompute.domain.ProfileDefinitionEndpoint.Type;
+import org.jclouds.javax.annotation.Nullable;
+
+/**
+ * Encapsulates the list of Azure Traffic Manager endpoints. You can define up to 100 endpoints in the list.
+ *
+ * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758257.aspx">docs</a>
+ */
+@AutoValue
+public abstract class ProfileDefinitionEndpointParams {
+
+   ProfileDefinitionEndpointParams() {
+   } // For AutoValue only!
+
+   /**
+    * Specifies the endpoint domain name. The value depends on endpoint type. If Type is CloudService, the value must be
+    * a fully qualified domain name (FQDN) of a cloud service that belongs to the subscription ID that owns the
+    * definition. If Type is AzureWebsite, the value must be an FQDN of an Azure web site that belongs to the
+    * subscription ID that owns the definition. If Type is Any, the value can be any FQDN for an Azure service or a
+    * service outside of Azure.
+    *
+    * @return endpoint domain name.
+    */
+   public abstract String domain();
+
+   /**
+    * Specifies the status of the monitoring endpoint. If set to Enabled, the endpoint is considered by the load
+    * balancing method and is monitored. Possible values are:Enabled, Disabled
+    *
+    * @return status of the monitoring endpoint.
+    */
+   public abstract Status status();
+
+   /**
+    * Optional. Specifies the type of endpoint being added to the definition. Possible values are: CloudService,
+    * AzureWebsite, Any, TrafficManager.
+    *
+    * If there is more than one AzureWebsite endpoint, they must be in different datacenters. This limitation doesn’t
+    * apply to cloud services. The default value is CloudService. Use the TrafficManager type when configuring nested
+    * profiles..
+    *
+    * @return endpoint type.
+    * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh744833.aspx">Traffic Manager Overview</a>
+    */
+   @Nullable
+   public abstract Type type();
+
+   /**
+    * Required when LoadBalancingMethod is set to Performance and Type is set to Any or TrafficManager. Specifies the
+    * name of the Azure region. The Location cannot be specified for endpoints of type CloudService or AzureWebsite, in
+    * which the locations are determined from the service.
+    *
+    * @return endpoint protocol.
+    * @see <a href="https://msdn.microsoft.com/en-us/library/gg441293.aspx">List Locations</a>
+    */
+   @Nullable
+   public abstract String location();
+
+   /**
+    * Optional. Can be specified when Type is set to TrafficManager. The minimum number of healthy endpoints within a
+    * nested profile that determines whether any of the endpoints within that profile can receive traffic. Default value
+    * is 1.
+    *
+    * @return minimum number of healthy endpoints.
+    */
+   @Nullable
+   public abstract Integer min();
+
+   /**
+    * Optional. Specifies the priority of the endpoint in load balancing. The higher the weight, the more frequently the
+    * endpoint will be made available to the load balancer. The value must be greater than 0. For endpoints that do not
+    * specify a weight value, a default weight of 1 will be used.
+    *
+    * @return endpoint priority.
+    */
+   @Nullable
+   public abstract Integer weight();
+
+   public Builder toBuilder() {
+      return builder().fromImageParams(this);
+   }
+
+   public static Builder builder() {
+      return new Builder();
+   }
+
+   public static final class Builder {
+
+      private String domain;
+
+      private Status status;
+
+      private Type type;
+
+      private String location;
+
+      private Integer min;
+
+      private Integer weight;
+
+      public Builder domain(final String domain) {
+         this.domain = domain;
+         return this;
+      }
+
+      public Builder status(final Status status) {
+         this.status = status;
+         return this;
+      }
+
+      public Builder type(final Type type) {
+         this.type = type;
+         return this;
+      }
+
+      public Builder location(final String location) {
+         this.location = location;
+         return this;
+      }
+
+      public Builder min(final Integer min) {
+         this.min = min;
+         return this;
+      }
+
+      public Builder weight(final Integer weight) {
+         this.weight = weight;
+         return this;
+      }
+
+      public ProfileDefinitionEndpointParams build() {
+         return ProfileDefinitionEndpointParams.create(
+                 domain,
+                 status,
+                 type,
+                 location,
+                 min,
+                 weight);
+      }
+
+      public Builder fromImageParams(final ProfileDefinitionEndpointParams in) {
+         return domain(in.domain())
+                 .status(in.status())
+                 .type(in.type())
+                 .location(in.location())
+                 .min(in.min())
+                 .weight(in.weight());
+      }
+   }
+
+   private static ProfileDefinitionEndpointParams create(
+           final String domain,
+           final Status status,
+           final Type type,
+           final String location,
+           final Integer min,
+           final Integer weight) {
+      return new AutoValue_ProfileDefinitionEndpointParams(domain, status, type, location, min, weight);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionMonitor.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionMonitor.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionMonitor.java
new file mode 100644
index 0000000..50dc800
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionMonitor.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.domain;
+
+import com.google.auto.value.AutoValue;
+import org.jclouds.javax.annotation.Nullable;
+
+/**
+ * Azure Traffic Manager endpoint monitor.
+ *
+ * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758257.aspx">docs</a>
+ */
+@AutoValue
+public abstract class ProfileDefinitionMonitor {
+
+   public static final int DEFAULT_INTERVAL = 30;
+   public static final int DEFAULT_TIMEOUT = 10;
+   public static final int DEFAULT_TOLERAION = 3;
+   public static final int DEFAULT_EXPECTED = 200;
+   public static final String DEFAULT_VERB = "GET";
+
+   ProfileDefinitionMonitor() {
+   } // For AutoValue only!
+
+   /**
+    * Specifies the number of seconds between consecutive attempts to check the status of a monitoring endpoint. The
+    * value must be set to 30.
+    *
+    * @return intervall in seconds.
+    */
+   @Nullable
+   public abstract Integer intervall();
+
+   /**
+    * Specifies the time to wait for response from the monitoring endpoint. The value must be set to 10.
+    *
+    * @return timeout in seconds.
+    */
+   @Nullable
+   public abstract Integer timeout();
+
+   /**
+    * Specifies the number of consecutive failures to probe an endpoint before taking the endpoint out of rotation. The
+    * value must be set to 3.
+    *
+    * @return tolerated number of failures.
+    */
+   @Nullable
+   public abstract Integer toleration();
+
+   /**
+    * Specifies the protocol to use to monitor endpoint health. Possible values are: HTTP, HTTPS.
+    *
+    * @return endpoint protocol.
+    */
+   public abstract ProfileDefinition.Protocol protocol();
+
+   /**
+    * Specifies the port used to monitor endpoint health. Accepted values are integer values greater than 0 and less or
+    * equal to 65,535.
+    *
+    * @return endpoint port.
+    */
+   public abstract int port();
+
+   /**
+    * Specifies the verb to use when making an HTTP request to monitor endpoint health. The value must be set to GET.
+    *
+    * @return verb to use when making an HTTP request.
+    */
+   @Nullable
+   public abstract String verb();
+
+   /**
+    * Specifies the path relative to the endpoint domain name to probe for health state. Restrictions are: The path must
+    * be from 1 through 1000 characters. It must start with a forward slash /. It must contain no brackets &lt;&gt;. It
+    * must contain no double slashes //. It must be a well-formed URI string.
+    *
+    * @return endpoint relative path.
+    * @see <a href="https://msdn.microsoft.com/en-us/library/system.uri.iswellformeduristring.aspx">
+    * Uri.IsWellFormedUriString Method</a>
+    */
+   public abstract String path();
+
+   /**
+    * Specifies the HTTP status code expected from a healthy endpoint. The endpoint is considered unhealthy otherwise.
+    * The value must be set to 200.
+    *
+    * @return expected status code.
+    */
+   @Nullable
+   public abstract Integer expected();
+
+   public static ProfileDefinitionMonitor create(
+           final Integer intervall,
+           final Integer timeout,
+           final Integer toleration,
+           final ProfileDefinition.Protocol protocol,
+           final int port,
+           final String verb,
+           final String path,
+           final Integer expected) {
+
+      return new AutoValue_ProfileDefinitionMonitor(
+              intervall, timeout, toleration, protocol, port, verb, path, expected);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionParams.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionParams.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionParams.java
new file mode 100644
index 0000000..fdd8b20
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionParams.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.domain;
+
+import com.google.auto.value.AutoValue;
+import java.util.List;
+import org.jclouds.azurecompute.domain.ProfileDefinition.LBMethod;
+import org.jclouds.azurecompute.domain.ProfileDefinition.Protocol;
+
+/**
+ * The Create Definition operation creates a new definition for a specified profile. This definition will be assigned a
+ * version number by the service. For more information about creating a profile, see Create Profile.
+ *
+ * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758257.aspx">docs</a>
+ */
+@AutoValue
+public abstract class ProfileDefinitionParams {
+
+   ProfileDefinitionParams() {
+   } // For AutoValue only!
+
+   /**
+    * Specifies the DNS Time-To-Live (TTL) that informs the Local DNS resolvers how long to cache DNS entries. The value
+    * is an integer from 30 through 999,999.
+    *
+    * @return DNS cache Time-To-Live (TTL)
+    */
+   public abstract Integer ttl();
+
+   /**
+    * Specifies the protocol to use to monitor endpoint health. Possible values are: HTTP, HTTPS.
+    *
+    * @return endpoint protocol.
+    */
+   public abstract Protocol protocol();
+
+   /**
+    * Specifies the port used to monitor endpoint health. Accepted values are integer values greater than 0 and less or
+    * equal to 65,535.
+    *
+    * @return endpoint port.
+    */
+   public abstract Integer port();
+
+   /**
+    * Specifies the path relative to the endpoint domain name to probe for health state. Restrictions are: The path must
+    * be from 1 through 1000 characters. It must start with a forward slash /. It must contain no brackets &lt;&gt;. It
+    * must contain no double slashes //. It must be a well-formed URI string.
+    *
+    * @return endpoint relative path.
+    * @see <a href="https://msdn.microsoft.com/en-us/library/system.uri.iswellformeduristring.aspx">
+    * Uri.IsWellFormedUriString Method</a>
+    */
+   public abstract String path();
+
+   /**
+    * Specifies the load balancing method to use to distribute connection. Possible values are: Performance, Failover,
+    * RoundRobin
+    *
+    * @return load balancing method..
+    */
+   public abstract LBMethod lb();
+
+   /**
+    * Encapsulates the list of Azure Traffic Manager endpoints. You can define up to 100 endpoints in the list.
+    *
+    * @return endpoints.
+    * @see ProfileDefinitionEndpointParams
+    */
+   public abstract List<ProfileDefinitionEndpointParams> endpoints();
+
+   public Builder toBuilder() {
+      return builder().fromImageParams(this);
+   }
+
+   public static Builder builder() {
+      return new Builder();
+   }
+
+   public static final class Builder {
+
+      private Integer ttl;
+
+      private Protocol protocol;
+
+      private Integer port;
+
+      private String path;
+
+      private LBMethod lb;
+
+      private List<ProfileDefinitionEndpointParams> endpoints;
+
+      public Builder ttl(final Integer ttl) {
+         this.ttl = ttl;
+         return this;
+      }
+
+      public Builder protocol(final Protocol protocol) {
+         this.protocol = protocol;
+         return this;
+      }
+
+      public Builder port(final Integer port) {
+         this.port = port;
+         return this;
+      }
+
+      public Builder path(final String path) {
+         this.path = path;
+         return this;
+      }
+
+      public Builder lb(final LBMethod lb) {
+         this.lb = lb;
+         return this;
+      }
+
+      public Builder endpoints(final List<ProfileDefinitionEndpointParams> endpoints) {
+         this.endpoints = endpoints;
+         return this;
+      }
+
+      public ProfileDefinitionParams build() {
+         return ProfileDefinitionParams.create(ttl, protocol, port, path, lb, endpoints);
+      }
+
+      public Builder fromImageParams(final ProfileDefinitionParams in) {
+         return ttl(in.ttl())
+                 .protocol(in.protocol())
+                 .port(in.port())
+                 .path(in.path())
+                 .lb(in.lb())
+                 .endpoints(in.endpoints());
+      }
+   }
+
+   private static ProfileDefinitionParams create(
+           final Integer ttl,
+           final Protocol protocol,
+           final Integer port,
+           final String path,
+           final LBMethod lb,
+           final List<ProfileDefinitionEndpointParams> endpoints) {
+      return new AutoValue_ProfileDefinitionParams(ttl, protocol, port, path, lb, endpoints);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/domain/UpdateProfileParams.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/UpdateProfileParams.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/UpdateProfileParams.java
new file mode 100644
index 0000000..8fc9242
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/UpdateProfileParams.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.domain;
+
+import com.google.auto.value.AutoValue;
+import org.jclouds.javax.annotation.Nullable;
+
+/**
+ * The Create Profile operation creates a new profile for a status version, owned by the specified subscription.
+ *
+ * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758254.aspx">docs</a>
+ */
+@AutoValue
+public abstract class UpdateProfileParams {
+
+   UpdateProfileParams() {
+   } // For AutoValue only!
+
+   /**
+    * Specifies whether the profile should be enabled or disabled. If there is a currently enabled profile, it is
+    * disabled. Possible values are: Enabled, Disabled;
+    *
+    * @return profile status.
+    */
+   public abstract ProfileDefinition.Status status();
+
+   /**
+    * This element is not used.
+    *
+    * @return profile definition version.
+    */
+   @Nullable
+   public abstract String version();
+
+   public Builder toBuilder() {
+      return builder().fromImageParams(this);
+   }
+
+   public static Builder builder() {
+      return new Builder();
+   }
+
+   public static final class Builder {
+
+      private ProfileDefinition.Status status;
+      private String version;
+
+      public Builder status(final ProfileDefinition.Status status) {
+         this.status = status;
+         return this;
+      }
+
+      public Builder version(final String version) {
+         this.version = version;
+         return this;
+      }
+
+      public UpdateProfileParams build() {
+         return UpdateProfileParams.create(status, version);
+      }
+
+      public Builder fromImageParams(final UpdateProfileParams in) {
+         return status(in.status()).version(in.version());
+      }
+   }
+
+   private static UpdateProfileParams create(
+           final ProfileDefinition.Status status,
+           final String version) {
+      return new AutoValue_UpdateProfileParams(status, version);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/features/TrafficManagerApi.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/features/TrafficManagerApi.java b/azurecompute/src/main/java/org/jclouds/azurecompute/features/TrafficManagerApi.java
new file mode 100644
index 0000000..d41cda1
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/features/TrafficManagerApi.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.features;
+
+import java.util.List;
+import static javax.ws.rs.core.MediaType.APPLICATION_XML;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import org.jclouds.Fallbacks;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.azurecompute.binders.ProfileDefinitionParamsToXML;
+import org.jclouds.azurecompute.binders.ProfileParamsToXML;
+import org.jclouds.azurecompute.domain.Profile;
+import org.jclouds.azurecompute.domain.ProfileDefinition;
+import org.jclouds.azurecompute.domain.ProfileDefinitionParams;
+import org.jclouds.azurecompute.domain.CreateProfileParams;
+import org.jclouds.azurecompute.domain.UpdateProfileParams;
+import org.jclouds.azurecompute.functions.ParseRequestIdHeader;
+import org.jclouds.azurecompute.xml.ListProfileDefinitionsHandler;
+import org.jclouds.azurecompute.xml.ListProfilesHandler;
+import org.jclouds.azurecompute.xml.ProfileDefinitionHandler;
+import org.jclouds.azurecompute.xml.ProfileHandler;
+import org.jclouds.azurecompute.xml.ResultHandler;
+
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Headers;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.XMLResponseParser;
+
+/**
+ * The Service Management API includes operations for creating, updating, listing, and deleting Azure Traffic Manager
+ * profiles and definitions.
+ *
+ * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758255.aspx">docs</a>
+ */
+@Path("/services/WATM")
+@Headers(keys = "x-ms-version", values = "{jclouds.api-version}")
+@Consumes(APPLICATION_XML)
+@Produces(APPLICATION_XML)
+public interface TrafficManagerApi {
+
+   /**
+    * The List Definitions operation returns all definitions of a profile.
+    *
+    * @param profile profile name.
+    * @return profile definitions.
+    */
+   @Named("ListProfileDefinitions")
+   @GET
+   @Path("/profiles/{profile}/definitions")
+   @XMLResponseParser(ListProfileDefinitionsHandler.class)
+   @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
+   List<ProfileDefinition> listDefinitions(@PathParam("profile") String profile);
+
+   /**
+    * The Get Definition operation returns an existing profile definition.
+    *
+    * @param profile profile name.
+    * @return profile definition.
+    */
+   @Named("GetProfileDefinition")
+   @GET
+   @Path("/profiles/{profile}/definitions/1")
+   @XMLResponseParser(ProfileDefinitionHandler.class)
+   @Fallback(NullOnNotFoundOr404.class)
+   ProfileDefinition getDefinition(@PathParam("profile") String profile);
+
+   /**
+    * The Create Profile operation creates a new profile for a domain name, owned by the specified subscription.
+    *
+    * @return traffic manager profiles.
+    */
+   @Named("ListProfiles")
+   @GET
+   @Path("/profiles")
+   @XMLResponseParser(ListProfilesHandler.class)
+   @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
+   List<Profile> listProfiles();
+
+   /**
+    * The Get Profile operation returns profile details, including all definition versions and their statuses.
+    *
+    * @param profile profile name.
+    * @return traffic manager profile.
+    */
+   @Named("GetProfile")
+   @GET
+   @Path("/profiles/{profile}")
+   @XMLResponseParser(ProfileHandler.class)
+   @Fallback(NullOnNotFoundOr404.class)
+   Profile getProfile(@PathParam("profile") String profile);
+
+   /**
+    * The Check DNS Prefix Availability operation checks whether the specified DNS prefix is available for creating a
+    * profile.
+    *
+    * @param name DNS name that you want to use. You must include .trafficmanager.net in the name.
+    * @return DNS name availability.
+    */
+   @Named("CheckDNSPrefixAvailability")
+   @GET
+   @Path("/operations/isavailable/{name}")
+   @XMLResponseParser(ResultHandler.class)
+   @Fallback(NullOnNotFoundOr404.class)
+   boolean checkDNSPrefixAvailability(@PathParam("name") String name);
+
+   /**
+    * The Create Definition operation creates a new definition for a specified profile. This definition will be assigned
+    * a version number by the service. For more information about creating a profile, see Create Profile.
+    *
+    * @param name profile name.
+    * @param params profile definition details to be sent as request body.
+    * @return request id.
+    */
+   @Named("CreateProfileDefinition")
+   @POST
+   @Path("/profiles/{name}/definitions")
+   @ResponseParser(ParseRequestIdHeader.class)
+   String createDefinition(
+           @PathParam("name") String name,
+           @BinderParam(ProfileDefinitionParamsToXML.class) ProfileDefinitionParams params);
+
+   /**
+    * The Delete Profile operation deletes a profile and all of its definitions. This operation cannot be reverted.
+    *
+    * @param profile traffic manager profile name.
+    * @return request id.
+    */
+   @Named("DeleteProfile")
+   @DELETE
+   @Path("/profiles/{profile}")
+   @Fallback(NullOnNotFoundOr404.class)
+   @ResponseParser(ParseRequestIdHeader.class)
+   String delete(@PathParam("profile") String profile);
+
+   /**
+    * The Create Profile operation creates a new profile for a domain name, owned by the specified subscription.
+    *
+    * @param params profile parameters.
+    * @return request id.
+    */
+   @Named("CreateProfile")
+   @POST
+   @Path("/profiles")
+   @ResponseParser(ParseRequestIdHeader.class)
+   String createProfile(@BinderParam(ProfileParamsToXML.class) CreateProfileParams params);
+
+   /**
+    * The Update Profile operation enables or disables a profile.
+    *
+    * @param profile traffic manager profile name.
+    * @param params update profile params.
+    * @return request id.
+    */
+   @Named("UpdateProfile")
+   @PUT
+   @Path("/profiles/{profile}")
+   @ResponseParser(ParseRequestIdHeader.class)
+   String updateProfile(
+           @PathParam("profile") String profile, @BinderParam(ProfileParamsToXML.class) UpdateProfileParams params);
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfileDefinitionsHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfileDefinitionsHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfileDefinitionsHandler.java
new file mode 100644
index 0000000..1851532
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfileDefinitionsHandler.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.xml;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.xml.sax.Attributes;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+import org.jclouds.azurecompute.domain.ProfileDefinition;
+
+/**
+ * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758252.aspx">Response body description</a>
+ */
+public final class ListProfileDefinitionsHandler extends
+        ParseSax.HandlerForGeneratedRequestWithResult<List<ProfileDefinition>> {
+
+   private boolean inDefinition;
+
+   private final ProfileDefinitionHandler profileDefinitionHandler;
+
+   private final Builder<ProfileDefinition> definitions = ImmutableList.builder();
+
+   @Inject
+   ListProfileDefinitionsHandler(ProfileDefinitionHandler profileDefinitionHandler) {
+      this.profileDefinitionHandler = profileDefinitionHandler;
+   }
+
+   @Override
+   public List<ProfileDefinition> getResult() {
+      return definitions.build();
+   }
+
+   @Override
+   public void startElement(final String url, final String name, final String qName, final Attributes attributes) {
+      if (qName.equals("Definition")) {
+         inDefinition = true;
+      }
+
+      if (inDefinition) {
+         profileDefinitionHandler.startElement(url, name, qName, attributes);
+      }
+   }
+
+   @Override
+   public void endElement(final String uri, final String name, final String qName) {
+      if (qName.equals("Definition")) {
+         inDefinition = false;
+         definitions.add(profileDefinitionHandler.getResult());
+      } else if (inDefinition) {
+         profileDefinitionHandler.endElement(uri, name, qName);
+      }
+   }
+
+   @Override
+   public void characters(final char ch[], final int start, final int length) {
+      if (inDefinition) {
+         profileDefinitionHandler.characters(ch, start, length);
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfilesHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfilesHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfilesHandler.java
new file mode 100644
index 0000000..7987564
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfilesHandler.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.xml;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.xml.sax.Attributes;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+import org.jclouds.azurecompute.domain.Profile;
+
+/**
+ * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758249.aspx">Response body description</a>
+ */
+public final class ListProfilesHandler extends
+        ParseSax.HandlerForGeneratedRequestWithResult<List<Profile>> {
+
+   private boolean inProfile;
+
+   private final ProfileHandler profileHandler;
+
+   private final Builder<Profile> profiles = ImmutableList.builder();
+
+   @Inject
+   ListProfilesHandler(ProfileHandler profileHandler) {
+      this.profileHandler = profileHandler;
+   }
+
+   @Override
+   public List<Profile> getResult() {
+      return profiles.build();
+   }
+
+   @Override
+   public void startElement(final String url, final String name, final String qName, final Attributes attributes) {
+      if (qName.equals("Profile")) {
+         inProfile = true;
+      }
+
+      if (inProfile) {
+         profileHandler.startElement(url, name, qName, attributes);
+      }
+   }
+
+   @Override
+   public void endElement(final String uri, final String name, final String qName) {
+      if (qName.equals("Profile")) {
+         inProfile = false;
+         profiles.add(profileHandler.getResult());
+      } else if (inProfile) {
+         profileHandler.endElement(uri, name, qName);
+      }
+   }
+
+   @Override
+   public void characters(final char ch[], final int start, final int length) {
+      if (inProfile) {
+         profileHandler.characters(ch, start, length);
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionEndpointHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionEndpointHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionEndpointHandler.java
new file mode 100644
index 0000000..3c634ac
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionEndpointHandler.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.xml;
+
+import static org.jclouds.util.SaxUtils.currentOrNull;
+
+import org.jclouds.azurecompute.domain.ProfileDefinition;
+import org.jclouds.azurecompute.domain.ProfileDefinitionEndpoint;
+import org.jclouds.azurecompute.domain.ProfileDefinition.HealthStatus;
+import org.jclouds.azurecompute.domain.ProfileDefinition.Status;
+
+import org.jclouds.http.functions.ParseSax;
+
+import org.xml.sax.Attributes;
+
+/**
+ * @see <a href="http://msdn.microsoft.com/en-us/library/gg441293" >Response body description</a>
+ */
+public final class ProfileDefinitionEndpointHandler
+        extends ParseSax.HandlerForGeneratedRequestWithResult<ProfileDefinitionEndpoint> {
+
+   private String domain;
+
+   private Status status;
+
+   private HealthStatus healthStatus;
+
+   private ProfileDefinitionEndpoint.Type type;
+
+   private String location;
+
+   private Integer weight;
+
+   private Integer min;
+
+   private final StringBuilder currentText = new StringBuilder();
+
+   @Override
+   public ProfileDefinitionEndpoint getResult() {
+      final ProfileDefinitionEndpoint result = ProfileDefinitionEndpoint.create(
+              domain, status, healthStatus, type, location, weight, min);
+      resetState(); // handler is called in a loop.
+      return result;
+   }
+
+   private void resetState() {
+      domain = location = null;
+      min = null;
+      status = null;
+      type = null;
+   }
+
+   @Override
+   public void startElement(
+           final String ignoredUri,
+           final String ignoredLocalName,
+           final String qName,
+           final Attributes ignoredAttributes) {
+   }
+
+   @Override
+   public void endElement(final String ignoredUri, final String ignoredName, final String qName) {
+      if (qName.equals("DomainName")) {
+         domain = currentOrNull(currentText);
+      } else if (qName.equals("Status")) {
+         final String value = currentText.toString().trim();
+         status = value.isEmpty()
+                 ? null
+                 : Status.fromString(value);
+      } else if (qName.equals("MonitorStatus")) {
+         final String value = currentText.toString().trim();
+         healthStatus = value.isEmpty()
+                 ? null
+                 : ProfileDefinition.HealthStatus.fromString(value);
+      } else if (qName.equals("Type")) {
+         final String value = currentText.toString().trim();
+         type = value.isEmpty()
+                 ? ProfileDefinitionEndpoint.Type.CLOUDSERVICE
+                 : ProfileDefinitionEndpoint.Type.fromString(value);
+      } else if (qName.equals("Location")) {
+         location = currentOrNull(currentText);
+      } else if (qName.equals("Weight")) {
+         final String value = currentText.toString().trim();
+         weight = value.isEmpty() ? 1 : Integer.parseInt(value);
+      } else if (qName.equals("MinChildEndpoints")) {
+         final String value = currentText.toString().trim();
+         min = value.isEmpty() ? 1 : Integer.parseInt(value);
+      }
+      currentText.setLength(0);
+   }
+
+   @Override
+   public void characters(final char ch[], final int start, final int length) {
+      currentText.append(ch, start, length);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionHandler.java
new file mode 100644
index 0000000..c4d9d24
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionHandler.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.xml;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+import static org.jclouds.util.SaxUtils.currentOrNull;
+
+import org.jclouds.http.functions.ParseSax;
+import org.xml.sax.Attributes;
+
+import javax.inject.Inject;
+import org.jclouds.azurecompute.domain.ProfileDefinition;
+import org.jclouds.azurecompute.domain.ProfileDefinitionEndpoint;
+import org.jclouds.azurecompute.domain.ProfileDefinitionMonitor;
+
+/**
+ * @see <a href="http://msdn.microsoft.com/en-us/library/gg441293" >Response body description</a>
+ */
+public final class ProfileDefinitionHandler extends ParseSax.HandlerForGeneratedRequestWithResult<ProfileDefinition> {
+
+   private Integer ttl;
+
+   private ProfileDefinition.Status status;
+
+   private String version;
+
+   private Builder<ProfileDefinitionMonitor> monitors = ImmutableList.<ProfileDefinitionMonitor>builder();
+
+   private ProfileDefinition.LBMethod lb;
+
+   private Builder<ProfileDefinitionEndpoint> endpoints = ImmutableList.<ProfileDefinitionEndpoint>builder();
+
+   private ProfileDefinition.HealthStatus healthStatus;
+
+   private final StringBuilder currentText = new StringBuilder();
+
+   private final ProfileDefinitionMonitorHandler monitorHandler;
+
+   private final ProfileDefinitionEndpointHandler endpointHandler;
+
+   private boolean inMonitor = false;
+   private boolean inEndpoint = false;
+
+   @Inject
+   public ProfileDefinitionHandler(
+           ProfileDefinitionMonitorHandler monitorHandler, ProfileDefinitionEndpointHandler endpointHandler) {
+      this.monitorHandler = monitorHandler;
+      this.endpointHandler = endpointHandler;
+   }
+
+   @Override
+   public ProfileDefinition getResult() {
+      final ProfileDefinition result = ProfileDefinition.create(
+              ttl, status, version, monitors.build(), lb, endpoints.build(), healthStatus);
+      resetState(); // handler is called in a loop.
+      return result;
+   }
+
+   private void resetState() {
+      ttl = null;
+      status = null;
+      version = null;
+      monitors = ImmutableList.<ProfileDefinitionMonitor>builder();
+      lb = null;
+      endpoints = ImmutableList.<ProfileDefinitionEndpoint>builder();
+      inMonitor = false;
+      inEndpoint = false;
+   }
+
+   @Override
+   public void startElement(
+           final String url,
+           final String name,
+           final String qName,
+           final Attributes attributes) {
+
+      if (!inEndpoint && qName.equals("Monitor")) {
+         inMonitor = true;
+      }
+
+      if (!inMonitor && qName.equals("Endpoint")) {
+         inEndpoint = true;
+      }
+
+      if (inMonitor) {
+         monitorHandler.startElement(url, name, qName, attributes);
+      } else if (inEndpoint) {
+         endpointHandler.startElement(url, name, qName, attributes);
+      }
+   }
+
+   @Override
+   public void endElement(final String uri, final String name, final String qName) {
+      if (!inEndpoint && qName.equals("Monitor")) {
+         inMonitor = false;
+         monitors.add(monitorHandler.getResult());
+      } else if (!inMonitor && qName.equals("Endpoint")) {
+         inEndpoint = false;
+         endpoints.add(endpointHandler.getResult());
+      } else if (inMonitor) {
+         monitorHandler.endElement(uri, name, qName);
+      } else if (inEndpoint) {
+         endpointHandler.endElement(uri, name, qName);
+      } else {
+         if (qName.equals("TimeToLiveInSeconds")) {
+            ttl = Integer.parseInt(currentOrNull(currentText));
+         } else if (qName.equals("Status")) {
+            status = ProfileDefinition.Status.fromString(currentOrNull(currentText));
+         } else if (qName.equals("Version")) {
+            version = currentOrNull(currentText);
+         } else if (qName.equals("LoadBalancingMethod")) {
+            lb = ProfileDefinition.LBMethod.fromString(currentOrNull(currentText));
+         } else if (qName.equals("MonitorStatus")) {
+            final String value = currentText.toString().trim();
+            healthStatus = value.isEmpty()
+                    ? null
+                    : ProfileDefinition.HealthStatus.fromString(value);
+         }
+         currentText.setLength(0);
+      }
+   }
+
+   @Override
+   public void characters(final char ch[], final int start, final int length) {
+      if (inMonitor) {
+         monitorHandler.characters(ch, start, length);
+      } else if (inEndpoint) {
+         endpointHandler.characters(ch, start, length);
+      } else {
+         currentText.append(ch, start, length);
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionMonitorHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionMonitorHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionMonitorHandler.java
new file mode 100644
index 0000000..5415107
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionMonitorHandler.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.xml;
+
+import static org.jclouds.util.SaxUtils.currentOrNull;
+
+import org.jclouds.http.functions.ParseSax;
+import org.xml.sax.Attributes;
+
+import org.jclouds.azurecompute.domain.ProfileDefinition;
+import org.jclouds.azurecompute.domain.ProfileDefinitionMonitor;
+
+/**
+ * @see <a href="http://msdn.microsoft.com/en-us/library/gg441293" >Response body description</a>
+ */
+public final class ProfileDefinitionMonitorHandler
+        extends ParseSax.HandlerForGeneratedRequestWithResult<ProfileDefinitionMonitor> {
+
+   private Integer intervall;
+
+   private Integer timeout;
+
+   private Integer toleration;
+
+   private ProfileDefinition.Protocol protocol;
+
+   private Integer port;
+
+   private String verb;
+
+   private String path;
+
+   private Integer expected;
+
+   private final StringBuilder currentText = new StringBuilder();
+
+   @Override
+   public ProfileDefinitionMonitor getResult() {
+      final ProfileDefinitionMonitor result = ProfileDefinitionMonitor.create(
+              intervall, timeout, toleration, protocol, port, verb, path, expected);
+      resetState(); // handler is called in a loop.
+      return result;
+   }
+
+   private void resetState() {
+      intervall = timeout = toleration = port = expected = null;
+      protocol = null;
+      verb = path = null;
+   }
+
+   @Override
+   public void startElement(
+           final String ignoredUri,
+           final String ignoredLocalName,
+           final String qName,
+           final Attributes ignoredAttributes) {
+   }
+
+   @Override
+   public void endElement(final String ignoredUri, final String ignoredName, final String qName) {
+      if (qName.equals("IntervalInSeconds")) {
+         final String value = currentText.toString().trim();
+         intervall = value.isEmpty()
+                 ? ProfileDefinitionMonitor.DEFAULT_INTERVAL
+                 : Integer.parseInt(value);
+      } else if (qName.equals("TimeoutInSeconds")) {
+         final String value = currentText.toString().trim();
+         timeout = value.isEmpty()
+                 ? ProfileDefinitionMonitor.DEFAULT_TIMEOUT
+                 : Integer.parseInt(value);
+      } else if (qName.equals("ToleratedNumberOfFailures")) {
+         final String value = currentText.toString().trim();
+         toleration = value.isEmpty()
+                 ? ProfileDefinitionMonitor.DEFAULT_TOLERAION
+                 : Integer.parseInt(value);
+      } else if (qName.equals("Protocol")) {
+         protocol = ProfileDefinition.Protocol.fromString(currentOrNull(currentText));
+      } else if (qName.equals("Port")) {
+         port = Integer.parseInt(currentOrNull(currentText));
+      } else if (qName.equals("Verb")) {
+         final String value = currentText.toString().trim();
+         verb = value.isEmpty()
+                 ? ProfileDefinitionMonitor.DEFAULT_VERB
+                 : value;
+      } else if (qName.equals("RelativePath")) {
+         path = currentOrNull(currentText);
+      } else if (qName.equals("ExpectedStatusCode")) {
+         final String value = currentText.toString().trim();
+         expected = value.isEmpty()
+                 ? ProfileDefinitionMonitor.DEFAULT_EXPECTED
+                 : Integer.parseInt(value);
+      }
+      currentText.setLength(0);
+   }
+
+   @Override
+   public void characters(final char ch[], final int start, final int length) {
+      currentText.append(ch, start, length);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileHandler.java
new file mode 100644
index 0000000..1a8825b
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileHandler.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.xml;
+
+import com.google.common.collect.ImmutableMap;
+import static org.jclouds.util.SaxUtils.currentOrNull;
+
+import org.jclouds.http.functions.ParseSax;
+import org.xml.sax.Attributes;
+
+import org.jclouds.azurecompute.domain.Profile;
+import org.jclouds.azurecompute.domain.ProfileDefinition;
+
+/**
+ * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758251.aspx" >Response body description</a>
+ */
+public final class ProfileHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Profile> {
+
+   private String domain;
+
+   private String name;
+
+   private ProfileDefinition.Status status;
+
+   private String version;
+
+   private ImmutableMap.Builder<String, ProfileDefinition.Status> definitions
+           = ImmutableMap.<String, ProfileDefinition.Status>builder();
+
+   private final StringBuilder currentText = new StringBuilder();
+
+   private boolean inDefinition = false;
+
+   private String definitionVersion = null;
+   private ProfileDefinition.Status definitionStatus = null;
+
+   @Override
+   public Profile getResult() {
+      final Profile result = Profile.create(domain, name, status, version, definitions.build());
+      resetState(); // handler is called in a loop.
+      return result;
+   }
+
+   private void resetState() {
+      domain = name = version = null;
+      status = null;
+      definitions = ImmutableMap.<String, ProfileDefinition.Status>builder();
+      inDefinition = false;
+   }
+
+   @Override
+   public void startElement(
+           final String url,
+           final String name,
+           final String qName,
+           final Attributes attributes) {
+
+      if (qName.equals("Definition")) {
+         inDefinition = true;
+      }
+   }
+
+   @Override
+   public void endElement(final String ignoredURI, final String ignoredName, final String qName) {
+      if (qName.equals("Definition")) {
+         inDefinition = false;
+         definitions.put(definitionVersion, definitionStatus);
+      } else if (inDefinition) {
+         if (qName.equals("Status")) {
+            final String value = currentText.toString().trim();
+            definitionStatus = value.isEmpty()
+                    ? null
+                    : ProfileDefinition.Status.fromString(value);
+         } else if (qName.equals("Version")) {
+            definitionVersion = currentOrNull(currentText);
+         }
+      } else {
+         if (qName.equals("DomainName")) {
+            domain = currentOrNull(currentText);
+         } else if (qName.equals("Name")) {
+            name = currentOrNull(currentText);
+         } else if (qName.equals("Status")) {
+            final String value = currentText.toString().trim();
+            status = value.isEmpty()
+                    ? null
+                    : ProfileDefinition.Status.fromString(value);
+         } else if (qName.equals("EnabledVersion")) {
+            version = currentOrNull(currentText);
+         }
+      }
+      currentText.setLength(0);
+
+   }
+
+   @Override
+   public void characters(final char ch[], final int start, final int length) {
+      currentText.append(ch, start, length);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4e3f19b9/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ResultHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ResultHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ResultHandler.java
new file mode 100644
index 0000000..fa1ed06
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ResultHandler.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.xml;
+
+import org.jclouds.http.functions.ParseSax;
+import org.xml.sax.Attributes;
+
+/**
+ * @see for example <a href="https://msdn.microsoft.com/en-us/library/azure/dn510368.aspx">Check DNS Prefix
+ * Availability</a>
+ */
+public final class ResultHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Boolean> {
+
+   private boolean result = false;
+   private final StringBuilder currentText = new StringBuilder();
+
+   @Override
+   public Boolean getResult() {
+      final boolean res = result;
+      resetState(); // handler is called in a loop.
+      return res;
+   }
+
+   private void resetState() {
+      result = false;
+   }
+
+   @Override
+   public void startElement(
+           final String url,
+           final String name,
+           final String qName,
+           final Attributes attributes) {
+   }
+
+   @Override
+   public void endElement(final String ignoredURI, final String ignoredName, final String qName) {
+      if (qName.equals("Result")) {
+         final String value = currentText.toString().trim();
+         result = value.isEmpty() ? false : Boolean.parseBoolean(value);
+      }
+      currentText.setLength(0);
+
+   }
+
+   @Override
+   public void characters(final char ch[], final int start, final int length) {
+      currentText.append(ch, start, length);
+   }
+}