Change group creation to be PUT /groups/{name}
Now that the groups collection also accepts group names as identifiers for members, it makes sense to accept PUT for entity creation. The collection will check if the group already exists and fail as there is currently no binding for PUT on a GROUP_KIND. Creation can use the annotation to check the user has the correct capability. Accept most simple group properties as part of the creation request. Use HTTP If-None-Match: * to test for the group already existing and fail if it is present. This protects both the client and the server against a future binding of PUT on GROUP_KIND. Change-Id: If226274f873b32b0df5278cceab452e2a51c5536
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// Copyright (C) 2012 The Android Open Source Project
|
||||
//
|
||||
// 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.google.gerrit.extensions.restapi;
|
||||
|
||||
/**
|
||||
* Resource state does not match request state (HTTP 412 Precondition failed).
|
||||
*/
|
||||
public class PreconditionFailedException extends RestApiException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public PreconditionFailedException() {
|
||||
}
|
||||
|
||||
/** @param msg message to return to the client describing the error. */
|
||||
public PreconditionFailedException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user