Java 类com.amazonaws.services.apigateway.model.GetResourcesRequest 实例源码

项目:java-translatebot    文件:OauthHandlerDeployer.java   
private CreateResourceResult createResource(final CreateRestApiResult createApiResult) {

        final String rootId = this.awsApiClient
                .getResources(new GetResourcesRequest().withRestApiId(createApiResult.getId()))
                .getItems()
                .stream()
                .filter(r -> r.getPath().equals("/"))
                .findAny()
                .map(r -> r.getId())
                .get(); // root better exist

        final CreateResourceRequest crrq = new CreateResourceRequest().withParentId("")
                .withParentId(rootId)
                .withPathPart(Path)
                .withRestApiId(createApiResult.getId());
        return this.awsApiClient.createResource(crrq);
    }
项目:java-translatebot    文件:EventHandlerDeployer.java   
private CreateResourceResult createResource(final CreateRestApiResult createApiResult) {

        final String rootId = this.awsApiClient
                .getResources(new GetResourcesRequest().withRestApiId(createApiResult.getId()))
                .getItems()
                .stream()
                .filter(r -> r.getPath().equals("/"))
                .findAny()
                .map(r -> r.getId())
                .get(); // root better exist

        final CreateResourceRequest crrq = new CreateResourceRequest().withParentId("")
                .withParentId(rootId)
                .withPathPart(Path)
                .withRestApiId(createApiResult.getId());
        return this.awsApiClient.createResource(crrq);
    }
项目:java-translatebot    文件:CommandHandlerDeployer.java   
private CreateResourceResult createResource(final CreateRestApiResult createApiResult) {

        final String rootId = this.awsApiClient
                .getResources(new GetResourcesRequest().withRestApiId(createApiResult.getId()))
                .getItems()
                .stream()
                .filter(r -> r.getPath().equals("/"))
                .findAny()
                .map(r -> r.getId())
                .get(); // root better exist

        final CreateResourceRequest crrq = new CreateResourceRequest().withParentId("")
                .withParentId(rootId)
                .withPathPart(Path)
                .withRestApiId(createApiResult.getId());
        return this.awsApiClient.createResource(crrq);
    }
项目:Sqawsh    文件:ApiGatewayCustomResourceLambda.java   
CreateResourceResult createTopLevelResourceOnApi(String resourceName, String restApiId,
    AmazonApiGateway client, LambdaLogger logger) {
  logger.log("Creating top-level resource: " + resourceName);
  // Short sleep - this avoids the Too Many Requests error in this
  // custom resource when creating the cloudformation stack.
  pause(logger);
  CreateResourceRequest createResourceRequest = new CreateResourceRequest();
  createResourceRequest.setRestApiId(restApiId);
  if (resourceName.equals("bookings")) {
    createResourceRequest.setPathPart("bookings");
  } else if (resourceName.equals("bookingrules")) {
    createResourceRequest.setPathPart("bookingrules");
  } else if (resourceName.equals("validdates")) {
    createResourceRequest.setPathPart("validdates");
  } else if (resourceName.equals("reservationform")) {
    createResourceRequest.setPathPart("reservationform");
  } else if (resourceName.equals("cancellationform")) {
    createResourceRequest.setPathPart("cancellationform");
  } else {
    throw new InvalidParameterException("Invalid resource name: " + resourceName);
  }

  // Get the id of the parent resource
  GetResourcesRequest getResourcesRequest = new GetResourcesRequest();
  // High enough limit for now
  getResourcesRequest.setLimit(10);
  getResourcesRequest.setRestApiId(restApiId);
  GetResourcesResult resourcesResult = client.getResources(getResourcesRequest);
  String rootResourceId = resourcesResult.getItems().stream()
      .filter(resource -> resource.getPath().equals("/")).findFirst().get().getId();
  logger.log("Parent(root) resource id: " + rootResourceId);
  createResourceRequest.setParentId(rootResourceId);

  return client.createResource(createResourceRequest);
}