You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Francesco Chicchiriccò <no...@github.com> on 2015/03/12 14:04:53 UTC

[jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds-labs/pull/151

-- Commit Summary --

  * [JCLOUDS-842] provided support for traffic manager operations

-- File Changes --

    M azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeApi.java (10)
    A azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileDefinitionParamsToXML.java (79)
    A azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileParamsToXML.java (51)
    A azurecompute/src/main/java/org/jclouds/azurecompute/domain/CreateProfileParams.java (91)
    A azurecompute/src/main/java/org/jclouds/azurecompute/domain/Profile.java (81)
    A azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinition.java (163)
    A azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionEndpoint.java (138)
    A azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionEndpointParams.java (180)
    A azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionMonitor.java (121)
    A azurecompute/src/main/java/org/jclouds/azurecompute/domain/ProfileDefinitionParams.java (161)
    A azurecompute/src/main/java/org/jclouds/azurecompute/domain/UpdateProfileParams.java (86)
    A azurecompute/src/main/java/org/jclouds/azurecompute/features/TrafficManagerApi.java (187)
    A azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfileDefinitionsHandler.java (79)
    A azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfilesHandler.java (79)
    A azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionEndpointHandler.java (108)
    A azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionHandler.java (148)
    A azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionMonitorHandler.java (114)
    A azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileHandler.java (113)
    A azurecompute/src/main/java/org/jclouds/azurecompute/xml/ResultHandler.java (64)
    A azurecompute/src/test/java/org/jclouds/azurecompute/features/TrafficManagerApiLiveTest.java (183)
    A azurecompute/src/test/java/org/jclouds/azurecompute/features/TrafficManagerApiMockTest.java (258)
    A azurecompute/src/test/java/org/jclouds/azurecompute/xml/ListProfileDefinitionsHandlerTest.java (78)
    A azurecompute/src/test/java/org/jclouds/azurecompute/xml/ListProfilesHandlerTest.java (60)
    A azurecompute/src/test/java/org/jclouds/azurecompute/xml/ProfileDefinitionHandlerTest.java (74)
    A azurecompute/src/test/java/org/jclouds/azurecompute/xml/ProfileHandlerTest.java (46)
    A azurecompute/src/test/resources/checkdnsprefixavailability.xml (4)
    A azurecompute/src/test/resources/createprofileparams.xml (1)
    A azurecompute/src/test/resources/listprofiledefinitions.xml (44)
    A azurecompute/src/test/resources/listprofiles.xml (23)
    A azurecompute/src/test/resources/profile.xml (15)
    A azurecompute/src/test/resources/profiledefinition.xml (42)
    A azurecompute/src/test/resources/profiledefinitioncsparams.xml (1)
    A azurecompute/src/test/resources/profiledefinitiontmparams.xml (35)
    A azurecompute/src/test/resources/updateprofileparams.xml (1)

-- Patch Links --

https://github.com/jclouds/jclouds-labs/pull/151.patch
https://github.com/jclouds/jclouds-labs/pull/151.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151

Re: [jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

Posted by Ignasi Barrera <no...@github.com>.
> +   @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)
> +   @Fallback(NullOnNotFoundOr404.class)

Same here. Remove this fallback.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151/files#r27517065

Re: [jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

Posted by Ignasi Barrera <no...@github.com>.
Looks quite good. In general, use primitives for non nullable variables and use ImmutableList.copyOf in the constructors to set the lists.

Thanks @ilgrosso!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151#issuecomment-88229132

Re: [jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

Posted by Ignasi Barrera <no...@github.com>.
> +   @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)
> +   @Fallback(NullOnNotFoundOr404.class)

POST and PUT operations should not use these fallbacks. Remove it.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151/files#r27517017

Re: [jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

Posted by fmartelli <no...@github.com>.
Hi @nacx , I've just reviewed the PR as requested by you.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151#issuecomment-88430131

Re: [jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

Posted by Francesco Chicchiriccò <no...@github.com>.
@fmartelli can you take care of this?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151#issuecomment-88380048

Re: [jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

Posted by fmartelli <no...@github.com>.
> +   @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")

It seems so.
https://msdn.microsoft.com/en-us/library/azure/hh758248.aspx

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151/files#r27550448

Re: [jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

Posted by Ignasi Barrera <no...@github.com>.
> +package org.jclouds.azurecompute.domain;
> +
> +import com.google.auto.value.AutoValue;
> +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, Disabled;

Use  upper case or camel case in all elements.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151/files#r27516630

Re: [jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

Posted by Ignasi Barrera <no...@github.com>.
Pushed to [master](http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/4e3f19b9) and [1.9.x](http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/9fdfb4f2). Thanks!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151#issuecomment-88847911

Re: [jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

Posted by Ignasi Barrera <no...@github.com>.
> +            }
> +         }
> +         return UNRECOGNIZED;
> +      }
> +   }
> +
> +   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 Integer ttl();

Use primitive types if not nullable

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151/files#r27516683

Re: [jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

Posted by Ignasi Barrera <no...@github.com>.
> +   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 Integer port();

Same about primitives

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151/files#r27516814

Re: [jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

Posted by Ignasi Barrera <no...@github.com>.
> +   @ResponseParser(ParseRequestIdHeader.class)
> +   @Fallback(NullOnNotFoundOr404.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)
> +   @Fallback(NullOnNotFoundOr404.class)

Remove this.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151/files#r27517100

Re: [jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

Posted by Ignasi Barrera <no...@github.com>.
lgtm. Thanks @ilgrosso & @fmartelli!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151#issuecomment-88836666

Re: [jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

Posted by Ignasi Barrera <no...@github.com>.
> +    * Degraded, Inactive, Disabled, Stopped, CheckingEndpoint.
> +    *
> +    * @return endpoint health status.
> +    */
> +   public abstract ProfileDefinition.HealthStatus healthStatus();
> +
> +   public static ProfileDefinition create(
> +           final Integer 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, monitors, lb, endpoints, healthStatus);

Use ImmutableList.copyOf to make sure lists are also immutable.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151/files#r27516728

Re: [jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

Posted by Ignasi Barrera <no...@github.com>.
> +
> +import org.jclouds.azurecompute.domain.ProfileDefinition;
> +import org.jclouds.azurecompute.domain.ProfileDefinition.Status;
> +import org.jclouds.azurecompute.domain.ProfileDefinitionEndpoint;
> +
> +/**
> + * @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 ProfileDefinition.Status status;
> +
> +   ProfileDefinition.HealthStatus healthStatus;

Is there any reason to make this package private?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151/files#r27517156

Re: [jclouds-labs] [JCLOUDS-842] provided support for traffic manager operations (#151)

Posted by Ignasi Barrera <no...@github.com>.
> +   @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")

Should this leading "/1" be hardcoded?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/151/files#r27516971