Skip to content

Instantly share code, notes, and snippets.

@brachi-wernick
Last active March 8, 2018 13:31
Show Gist options
  • Save brachi-wernick/2a548cba536cac5ad255dc038a1d07cc to your computer and use it in GitHub Desktop.
Save brachi-wernick/2a548cba536cac5ad255dc038a1d07cc to your computer and use it in GitHub Desktop.
findAwsRestApiByName
//prepare getway object
AmazonApiGateway gateway = AmazonApiGatewayClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(awsCreds)).withRegion(region).build();
//find all rest apis
GetRestApisResult restApis = gateway.getRestApis(new GetRestApisRequest());
//find our predefined api by name
RestApi targetRestApi = restApis.getItems().stream()
.filter(item -> item.getName().equals(targetRestApiName)).findFirst()
.orElseThrow(RuntimeException::new);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment