Last active
March 8, 2018 13:33
-
-
Save brachi-wernick/6134fe4de96982562a312a721f571bd4 to your computer and use it in GitHub Desktop.
AddAwsGatewayResource
This file contains hidden or 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
//find the root resource | |
List<Resource> resources = gateway | |
.getResources(new GetResourcesRequest().withRestApiId(targetRestApi.getId())).getItems(); | |
Resource rootResource = resources.stream().filter(resource -> resource.getPath().equals(File.separator)).findFirst().orElseThrow(RuntimeException::new); | |
// add our resource with a path and save its id | |
String resourceId=gateway.createResource(new CreateResourceRequest().withParentId(rootResourceId).withRestApiId(targetRestApiId) | |
.withPathPart(pathPart)).getId(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment