Move update versioning to query parameter, and fix up scope API tests (#244)
* Move update versioning to query parameter, and fix up scope API tests * Add version checks for update requests in other services
This commit is contained in:
1 parent
0d0660b061
commit
bbd200101f
16 files changed
+240
-102
No files matched your search
@@ -86,6 +86,7 @@ func (c *CreateScopeCommand) Run(args []string) int {
|
||||
}
|
||||
|
||||
scp, apiErr, err := scopes.NewScopesClient(client).Create(c.Context,
|
||||
client.ScopeId(),
|
||||
scopes.WithName(c.flagName),
|
||||
scopes.WithDescription(c.flagDescription))
|
||||
|
||||
|
||||
@@ -409,6 +409,9 @@ func validateUpdateRequest(req *pbs.UpdateGroupRequest) error {
|
||||
if req.GetUpdateMask() == nil {
|
||||
badFields["update_mask"] = "UpdateMask not provided but is required to update a group."
|
||||
}
|
||||
if req.GetVersion() == 0 {
|
||||
badFields["version"] = "Existing resource version is required for an update."
|
||||
}
|
||||
|
||||
item := req.GetItem()
|
||||
if item == nil {
|
||||
|
||||
@@ -574,6 +574,9 @@ func validateUpdateRequest(req *pbs.UpdateRoleRequest, scope *scopes.ScopeInfo)
|
||||
if req.GetUpdateMask() == nil {
|
||||
badFields["update_mask"] = "UpdateMask not provided but is required to update a role."
|
||||
}
|
||||
if req.GetVersion() == 0 {
|
||||
badFields["version"] = "Existing resource version is required for an update."
|
||||
}
|
||||
|
||||
item := req.GetItem()
|
||||
if item == nil {
|
||||
|
||||
@@ -364,6 +364,9 @@ func validateUpdateRequest(req *pbs.UpdateScopeRequest) error {
|
||||
if req.GetUpdateMask() == nil {
|
||||
badFields["update_mask"] = "UpdateMask not provided but is required to update a project."
|
||||
}
|
||||
if req.GetVersion() == 0 {
|
||||
badFields["version"] = "Existing resource version is required for an update."
|
||||
}
|
||||
|
||||
item := req.GetItem()
|
||||
if item == nil {
|
||||
|
||||
@@ -296,6 +296,9 @@ func validateUpdateRequest(req *pbs.UpdateUserRequest) error {
|
||||
if req.GetUpdateMask() == nil {
|
||||
badFields["update_mask"] = "UpdateMask not provided but is required to update a user."
|
||||
}
|
||||
if req.GetVersion() == 0 {
|
||||
badFields["version"] = "Existing resource version is required for an update."
|
||||
}
|
||||
|
||||
item := req.GetItem()
|
||||
if item == nil {
|
||||
|
||||
Reference in new issue
Block a user