package com.kryptnostic.directory.v1.http;

import java.util.UUID;

import retrofit.client.Response;
import retrofit.http.Body;
import retrofit.http.GET;
import retrofit.http.POST;
import retrofit.http.Path;

import com.codahale.metrics.annotation.Timed;
import com.google.common.base.Optional;
import com.kryptnostic.directory.v1.model.DomainUpdate;

/**
 * {@code Domain} management functionality.
 * 
 * @author Nick Hewitt
 *
 */
public interface DomainManagementApi {
    public static final String DOMAIN        = "/domain";
    public static final String NAME          = "name";
    public static final String NAME_PATH     = "/{" + NAME + "}";
    public static final String NAME_WITH_DOT = "/{" + NAME + ":.+}";

    /**
     * Update domain settings.
     * 
     * @param request
     * @return
     */
    @Timed
    @POST( DOMAIN )
    Response updateDomain( @Body DomainUpdate request );

    @Timed
    @GET( DOMAIN + NAME_PATH )
    Optional<UUID> getDomainId( @Path( NAME ) String domainName );

}

@@ -61,16 +61,159 @@
 .UUID;%0A%0A
+import com.codahale.metrics.annotation.Timed;%0Aimport com.google.common.base.Optional;%0Aimport com.kryptnostic.directory.v1.model.DomainUpdate;%0A%0A
 import r
@@ -264,16 +264,45 @@
 p.Body;%0A
+import retrofit.http.DELETE;%0A
 import r
@@ -346,16 +346,42 @@
 p.POST;%0A
+import retrofit.http.PUT;%0A
 import r
@@ -404,151 +404,8 @@
 h;%0A%0A
-import com.codahale.metrics.annotation.Timed;%0Aimport com.google.common.base.Optional;%0Aimport com.kryptnostic.directory.v1.model.DomainUpdate;%0A%0A
 /**%0A
@@ -475,16 +475,35 @@
  Hewitt%0A
+ * @author Yao Pan%0A
  *%0A */%0Ap
@@ -789,16 +789,78 @@
 :.+%7D%22;%0A%0A
+    public static final String WHITE_LIST    = %22/whitelist%22;%0A%0A
     /**%0A
@@ -1141,11 +1141,500 @@
 Name
- );%0A%0A%7D%0A
+);%0A%0A    /**%0A     * Update white list settings.%0A     * %0A     * @param domains%0A     * @return%0A     */%0A    @Timed%0A    @PUT( WHITE_LIST + NAME_PATH )%0A    Response addDomainWhiteList( @Path( NAME ) String domainName, @Body String%5B%5D domains);%0A%0A    @Timed%0A    @GET( WHITE_LIST + NAME_PATH )%0A    String%5B%5D getDomainWhiteList( @Path( NAME ) String domainName);%0A%0A    @Timed%0A    @DELETE( WHITE_LIST + NAME_PATH )%0A    Response deleteDomainWhiteList( @Path( NAME ) String domainName, @Body String%5B%5D domains);%0A%7D

add domain trusted white list api