/*
 * Copyright 2012-2014, Continuuity, Inc.
 *
 * Licensed 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 com.continuuity.loom.http.request;

import com.continuuity.loom.spec.TenantSpecification;
import com.google.common.base.Objects;

/**
 * A request to add a tenant.
 */
public class AddTenantRequest {
  private final TenantSpecification tenant;
  private final boolean bootstrap;

  public AddTenantRequest(TenantSpecification tenant, Boolean bootstrap) {
    this.tenant = tenant;
    this.bootstrap = bootstrap == null ? false : bootstrap;
  }

  public TenantSpecification getTenant() {
    return tenant;
  }

  public boolean isBootstrap() {
    return bootstrap;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof AddTenantRequest)) {
      return false;
    }

    AddTenantRequest that = (AddTenantRequest) o;

    return Objects.equal(tenant, that.tenant) && bootstrap == that.bootstrap;
  }

  @Override
  public int hashCode() {
    return Objects.hashCode(tenant, bootstrap);
  }
}

@@ -736,16 +736,61 @@
 Objects;
+%0Aimport com.google.common.base.Preconditions;
 %0A%0A/**%0A *
@@ -1004,24 +1004,112 @@
 ootstrap) %7B%0A
+    Preconditions.checkArgument(tenant != null, %22Tenant specification must be given.%22);%0A
     this.ten

make sure a tenant specification is given in the request to add tenants.