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

项目:aws-maven-plugin    文件:ApiGatewayDeployer.java   
public void deploy(AwsKeyPair keyPair, String region, final String restApiName, final String stage, Proxy proxy) {
    final AWSCredentialsProvider credentials = new AWSStaticCredentialsProvider(
            new BasicAWSCredentials(keyPair.key, keyPair.secret));

    ClientConfiguration cc = Util.createConfiguration(proxy);

    AmazonApiGateway ag = AmazonApiGatewayClientBuilder.standard().withCredentials(credentials) //
            .withClientConfiguration(cc) //
            .withRegion(region) //
            .build();
    GetRestApisResult apis = ag.getRestApis(new GetRestApisRequest().withLimit(10000));
    Optional<RestApi> api = apis.getItems().stream().filter(item -> item.getName().equals(restApiName)).findFirst();
    RestApi a = api.orElseThrow(() -> new RuntimeException("no rest api found with name='" + restApiName + "'"));
    String restApiId = a.getId();
    log.info("creating deployment of " + restApiId + " to stage " + stage);
    CreateDeploymentResult r = ag
            .createDeployment(new CreateDeploymentRequest().withRestApiId(restApiId).withStageName(stage));
    Map<String, Map<String, MethodSnapshot>> summary = r.getApiSummary();
    log.info("created deployment");
    log.info("summary=" + summary);
}
项目:ServerlessJavaMaven    文件:Tester.java   
public void run()
{
    String AWSAccessKey="AKIAJM7YMMLXKUH5EWRQ";
    String AWSSecretKey="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";

       BasicAWSCredentials awsCredentials = new BasicAWSCredentials(AWSAccessKey, AWSSecretKey);

       AmazonApiGatewayClient apiClient = new AmazonApiGatewayClient(awsCredentials);
       apiClient.setRegion(Region.getRegion(Regions.US_WEST_2));

       GetRestApisRequest graReq = new GetRestApisRequest();
    GetRestApisResult graRes = apiClient.getRestApis(graReq);
    RestApi theApi = null;
    for ( RestApi api : graRes.getItems() )
    {
        System.out.println("Found existing REST API: " + api.getName());
        if ( "TestAPI".equals(api.getName()))
        {
            theApi = api;



            GetExportRequest geReq = new GetExportRequest()
                    .withRestApiId(api.getId())
                    .withExportType("swagger")
                    .withStageName("TEST");
            GetExportResult geRes = apiClient.getExport(geReq);
            String f = new String(geRes.getBody().array());
            int x = 1;
            String from = "";
            PatchOperation po = new PatchOperation()
                    .withFrom(from)
                    .withOp(Op.Replace)
                    .withPath("");
        }
    }

}
项目:java-translatebot    文件:OauthHandlerDeployer.java   
private void deleteApi() {
    final GetRestApisRequest graprq = new GetRestApisRequest();

    final GetRestApisResult graprs = this.awsApiClient.getRestApis(graprq);

    graprs.getItems()
            .stream()
            .filter(ra -> ra.getName().equals(ApiName))
            .map(RestApi::getId)
            .map(id -> new DeleteRestApiRequest().withRestApiId(id))
            .forEach(this.awsApiClient::deleteRestApi);

}
项目:java-translatebot    文件:EventHandlerDeployer.java   
private void deleteApi() {
    final GetRestApisRequest graprq = new GetRestApisRequest();

    final GetRestApisResult graprs = this.awsApiClient.getRestApis(graprq);

    graprs.getItems()
            .stream()
            .filter(ra -> ra.getName().equals(ApiName))
            .map(RestApi::getId)
            .map(id -> new DeleteRestApiRequest().withRestApiId(id))
            .forEach(this.awsApiClient::deleteRestApi);

}
项目:java-translatebot    文件:CommandHandlerDeployer.java   
private void deleteApi() {
    final GetRestApisRequest graprq = new GetRestApisRequest();

    final GetRestApisResult graprs = this.awsApiClient.getRestApis(graprq);

    graprs.getItems()
            .stream()
            .filter(ra -> ra.getName().equals(ApiName))
            .map(RestApi::getId)
            .map(id -> new DeleteRestApiRequest().withRestApiId(id))
            .forEach(this.awsApiClient::deleteRestApi);

}