Document CreateAccount/PutAccount
Change-Id: Iab235c8c2890d3ca3ff08a7d9f4b61147dc40985 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
		@@ -62,6 +62,13 @@ import java.util.List;
 | 
				
			|||||||
import java.util.Set;
 | 
					import java.util.Set;
 | 
				
			||||||
import org.eclipse.jgit.errors.ConfigInvalidException;
 | 
					import org.eclipse.jgit.errors.ConfigInvalidException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * REST endpoint for creating a new account.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * <p>This REST endpoint handles {@code PUT /accounts/<account-identifier>} requests if the
 | 
				
			||||||
 | 
					 * specified account doesn't exist yet. If it already exists, the request is handled by {@link
 | 
				
			||||||
 | 
					 * PutAccount}.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
@RequiresCapability(GlobalCapability.CREATE_ACCOUNT)
 | 
					@RequiresCapability(GlobalCapability.CREATE_ACCOUNT)
 | 
				
			||||||
@Singleton
 | 
					@Singleton
 | 
				
			||||||
public class CreateAccount
 | 
					public class CreateAccount
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,6 +22,23 @@ import com.google.gerrit.extensions.restapi.RestModifyView;
 | 
				
			|||||||
import com.google.gerrit.server.account.AccountResource;
 | 
					import com.google.gerrit.server.account.AccountResource;
 | 
				
			||||||
import com.google.inject.Singleton;
 | 
					import com.google.inject.Singleton;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * REST endpoint for updating an existing account.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * <p>This REST endpoint handles {@code PUT /accounts/<account-identifier>} requests if the
 | 
				
			||||||
 | 
					 * specified account already exists. If it doesn't exist yet, the request is handled by {@link
 | 
				
			||||||
 | 
					 * CreateAccount}.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * <p>We do not support account updates via this path, hence this REST endpoint always throws a
 | 
				
			||||||
 | 
					 * {@link ResourceConflictException} which results in a {@code 409 Conflict} response. Account
 | 
				
			||||||
 | 
					 * properties can only be updated via the dedicated REST endpoints that serve {@code PUT} requests
 | 
				
			||||||
 | 
					 * on {@code /accounts/<account-identifier>/<account-view>}.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * <p>This REST endpoint solely exists to avoid user confusion if they create a new account with
 | 
				
			||||||
 | 
					 * {@code PUT /accounts/<account-identifier>} and then repeat the same request. Without this REST
 | 
				
			||||||
 | 
					 * endpoint the second request would fail with {@code 404 Not Found}, which would be surprising to
 | 
				
			||||||
 | 
					 * the user.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
@Singleton
 | 
					@Singleton
 | 
				
			||||||
public class PutAccount implements RestModifyView<AccountResource, AccountInput> {
 | 
					public class PutAccount implements RestModifyView<AccountResource, AccountInput> {
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user