This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new get metadata endpoint for admin tasks
- Loading branch information
Showing
17 changed files
with
1,032 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -474,4 +474,81 @@ Returns basic stats about each safe deposit box (name, owner, last updated ts). | |
} | ||
], | ||
"safe_deposit_box_total": 2 | ||
} | ||
|
||
# Group Metadata | ||
|
||
## SDB Metadata [/v1/metadata?limit={limit}&offset={offset}] | ||
|
||
### Get metadata [GET] | ||
|
||
Returns pageable metadata for all SDBs | ||
You can use has_next and next_offset from the response to paginate through all records | ||
|
||
+ Parameters | ||
+ limit (number) - OPTIONAL: The number of records to include in the metadata result. Defaults to 100 | ||
+ offset (number) - OPTIONAL: The offset to use when paginating records. Defaults to 0 | ||
|
||
+ Response 200 (application/json) | ||
|
||
+ Headers | ||
|
||
X-Vault-Token: 7f6808f1-ede3-2177-aa9d-45f507391310 | ||
|
||
+ Body | ||
|
||
{ | ||
"has_next": false, | ||
"next_offset": 0, | ||
"limit": 10, | ||
"offset": 0, | ||
"sdb_count_in_result": 3, | ||
"total_sdbcount": 3, | ||
"safe_deposit_box_meta_data": [ | ||
{ | ||
"name": "dev demo", | ||
"path": "app/dev-demo/", | ||
"category": "Applications", | ||
"owner": "Lst-Squad.Carebears", | ||
"description": "test", | ||
"created_ts": "2017-01-04T23:18:40-08:00", | ||
"created_by": "[email protected]", | ||
"last_updated_ts": "2017-01-04T23:18:40-08:00", | ||
"last_updated_by": "[email protected]", | ||
"user_group_permissions": { | ||
"Application.FOO.User": "read" | ||
}, | ||
"iam_role_permissions": { | ||
"arn:aws:iam::265866363820:role/asdf": "write" | ||
} | ||
}, | ||
{ | ||
"name": "nike dev foo bar", | ||
"path": "app/nike-dev-foo-bar/", | ||
"category": "Applications", | ||
"owner": "Lst-Squad.Carebears", | ||
"description": "adsfasdfadsfasdf", | ||
"created_ts": "2017-01-04T23:19:03-08:00", | ||
"created_by": "[email protected]", | ||
"last_updated_ts": "2017-01-04T23:19:03-08:00", | ||
"last_updated_by": "[email protected]", | ||
"user_group_permissions": { | ||
"Lst-FOO-bar": "read" | ||
}, | ||
"iam_role_permissions": {} | ||
}, | ||
{ | ||
"name": "IaM W d WASD", | ||
"path": "shared/iam-w-d-wasd/", | ||
"category": "Shared", | ||
"owner": "Lst-Squad.Carebears", | ||
"description": "CAREBERS", | ||
"created_ts": "2017-01-04T23:19:19-08:00", | ||
"created_by": "[email protected]", | ||
"last_updated_ts": "2017-01-04T23:19:19-08:00", | ||
"last_updated_by": "[email protected]", | ||
"user_group_permissions": {}, | ||
"iam_role_permissions": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
src/main/java/com/nike/cerberus/domain/SDBMetaData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
/* | ||
* Copyright (c) 2017 Nike, 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.nike.cerberus.domain; | ||
|
||
import java.time.OffsetDateTime; | ||
import java.util.Date; | ||
import java.util.Map; | ||
|
||
public class SDBMetaData { | ||
|
||
private String name; | ||
private String path; | ||
private String category; | ||
private String owner; | ||
private String description; | ||
private OffsetDateTime createdTs; | ||
private String createdBy; | ||
private OffsetDateTime lastUpdatedTs; | ||
private String lastUpdatedBy; | ||
private Map<String, String> userGroupPermissions; | ||
private Map<String, String> iamRolePermissions; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getPath() { | ||
return path; | ||
} | ||
|
||
public void setPath(String path) { | ||
this.path = path; | ||
} | ||
|
||
public String getCategory() { | ||
return category; | ||
} | ||
|
||
public void setCategory(String category) { | ||
this.category = category; | ||
} | ||
|
||
public String getOwner() { | ||
return owner; | ||
} | ||
|
||
public void setOwner(String owner) { | ||
this.owner = owner; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
public OffsetDateTime getCreatedTs() { | ||
return createdTs; | ||
} | ||
|
||
public void setCreatedTs(OffsetDateTime createdTs) { | ||
this.createdTs = createdTs; | ||
} | ||
|
||
public String getCreatedBy() { | ||
return createdBy; | ||
} | ||
|
||
public void setCreatedBy(String createdBy) { | ||
this.createdBy = createdBy; | ||
} | ||
|
||
public OffsetDateTime getLastUpdatedTs() { | ||
return lastUpdatedTs; | ||
} | ||
|
||
public void setLastUpdatedTs(OffsetDateTime lastUpdatedTs) { | ||
this.lastUpdatedTs = lastUpdatedTs; | ||
} | ||
|
||
public String getLastUpdatedBy() { | ||
return lastUpdatedBy; | ||
} | ||
|
||
public void setLastUpdatedBy(String lastUpdatedBy) { | ||
this.lastUpdatedBy = lastUpdatedBy; | ||
} | ||
|
||
public Map<String, String> getUserGroupPermissions() { | ||
return userGroupPermissions; | ||
} | ||
|
||
public void setUserGroupPermissions(Map<String, String> userGroupPermissions) { | ||
this.userGroupPermissions = userGroupPermissions; | ||
} | ||
|
||
public Map<String, String> getIamRolePermissions() { | ||
return iamRolePermissions; | ||
} | ||
|
||
public void setIamRolePermissions(Map<String, String> iamRolePermissions) { | ||
this.iamRolePermissions = iamRolePermissions; | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
src/main/java/com/nike/cerberus/domain/SDBMetaDataResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Copyright (c) 2017 Nike, 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.nike.cerberus.domain; | ||
|
||
import java.util.List; | ||
|
||
public class SDBMetaDataResult { | ||
|
||
private boolean hasNext = false; | ||
private int nextOffset = 0; | ||
private int limit = 0; | ||
private int offset = 0; | ||
private int sdbCountInResult; | ||
private int totalSDBCount; | ||
private List<SDBMetaData> safeDepositBoxMetaData; | ||
|
||
public boolean isHasNext() { | ||
return hasNext; | ||
} | ||
|
||
public void setHasNext(boolean hasNext) { | ||
this.hasNext = hasNext; | ||
} | ||
|
||
public int getNextOffset() { | ||
return nextOffset; | ||
} | ||
|
||
public void setNextOffset(int nextOffset) { | ||
this.nextOffset = nextOffset; | ||
} | ||
|
||
public int getLimit() { | ||
return limit; | ||
} | ||
|
||
public void setLimit(int limit) { | ||
this.limit = limit; | ||
} | ||
|
||
public int getOffset() { | ||
return offset; | ||
} | ||
|
||
public void setOffset(int offset) { | ||
this.offset = offset; | ||
} | ||
|
||
public int getSdbCountInResult() { | ||
return sdbCountInResult; | ||
} | ||
|
||
public void setSdbCountInResult(int sdbCountInResult) { | ||
this.sdbCountInResult = sdbCountInResult; | ||
} | ||
|
||
public int getTotalSDBCount() { | ||
return totalSDBCount; | ||
} | ||
|
||
public void setTotalSDBCount(int totalSDBCount) { | ||
this.totalSDBCount = totalSDBCount; | ||
} | ||
|
||
public List<SDBMetaData> getSafeDepositBoxMetaData() { | ||
return safeDepositBoxMetaData; | ||
} | ||
|
||
public void setSafeDepositBoxMetaData(List<SDBMetaData> safeDepositBoxMetaData) { | ||
this.safeDepositBoxMetaData = safeDepositBoxMetaData; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/main/java/com/nike/cerberus/endpoints/AdminStandardEndpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.