> +      }
> +   }
> +
> +   /**
> +    * Create and Update options - extend the domain class, passed to API 
> update and create calls.
> +    * Essentially the same as the domain class. Ensure validation and safe 
> typing.
> +    */
> +   public static class CreateOptions extends Rule {
> +      private CreateOptions(Rule rule) {
> +         super(rule);
> +         checkNotNull(rule.getDirection(), "direction should not be null");
> +         checkNotNull(rule.getSecurityGroupId(), "security group id should 
> not be null");
> +         checkState(rule.getPortRangeMax()>= rule.getPortRangeMin(),
> +               "port range max should be greater than or equal to port range 
> min");
> +         checkState(rule.getRemoteGroupId()==null || 
> rule.getRemoteIpPrefix()==null,
> +               "You can specify either remote_group_id or remote_ip_prefix 
> in the request body.");

[minor] After calling `super(rule)`, would it instead be possible to carry out 
the checks on `this.direction` rather than `rule.getDirection()` etc.? After 
all, it's **this** object that we're really trying to validate, not the input 
rule.

Regarding the naming: see the similar comment for FloatingIP. `CreateOptions` 
sounds to me like an "options" object which is used elsewhere in jclouds pretty 
much only to _modify_ a request...not as a domain object.

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

Reply via email to