• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AmazonApiGateway类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.amazonaws.services.apigateway.AmazonApiGateway的典型用法代码示例。如果您正苦于以下问题:Java AmazonApiGateway类的具体用法?Java AmazonApiGateway怎么用?Java AmazonApiGateway使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AmazonApiGateway类属于com.amazonaws.services.apigateway包,在下文中一共展示了AmazonApiGateway类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: deploy

import com.amazonaws.services.apigateway.AmazonApiGateway; //导入依赖的package包/类
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);
}
 
开发者ID:davidmoten,项目名称:aws-maven-plugin,代码行数:22,代码来源:ApiGatewayDeployer.java


示例2: createTopLevelResourceOnApi

import com.amazonaws.services.apigateway.AmazonApiGateway; //导入依赖的package包/类
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);
}
 
开发者ID:robinsteel,项目名称:Sqawsh,代码行数:36,代码来源:ApiGatewayCustomResourceLambda.java


示例3: getApiGatewayClient

import com.amazonaws.services.apigateway.AmazonApiGateway; //导入依赖的package包/类
protected AmazonApiGateway getApiGatewayClient() {
    if (apiGatewayClient != null) {
        return apiGatewayClient;
    }

    RetryPolicy.RetryCondition retryCondition = new RetryPolicy.RetryCondition() {

        @Override
        public boolean shouldRetry(AmazonWebServiceRequest amazonWebServiceRequest, AmazonClientException amazonClientException, int i) {
            if (amazonClientException instanceof TooManyRequestsException) {
                return true;
            }
            return PredefinedRetryPolicies.DEFAULT_RETRY_CONDITION.shouldRetry(amazonWebServiceRequest,
                    amazonClientException, i);
        }
    };

    RetryPolicy retryPolicy = new RetryPolicy(retryCondition,
            PredefinedRetryPolicies.DEFAULT_BACKOFF_STRATEGY,
            10, true);

    ClientConfiguration clientConfig = new ClientConfiguration()
            .withRetryPolicy(retryPolicy);

    apiGatewayClient = new AmazonApiGatewayClient(getAWSCredentialsProvideChain(), clientConfig).withRegion(Region.getRegion(Regions.fromName(deployment.getRegion())));
    return apiGatewayClient;
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:28,代码来源:ApiGateway.java


示例4: provideAmazonApiGateway

import com.amazonaws.services.apigateway.AmazonApiGateway; //导入依赖的package包/类
@Provides
protected ApiGateway provideAmazonApiGateway(AWSCredentialsProvider credsProvider,
                                             RetryPolicy.BackoffStrategy backoffStrategy,
                                             @Named("region") String region) {

    final RetryPolicy retrypolicy = new RetryPolicy(PredefinedRetryPolicies.DEFAULT_RETRY_CONDITION, backoffStrategy, 5, true);

    final ClientConfiguration clientConfig = new ClientConfiguration().withUserAgent(USER_AGENT).withRetryPolicy(retrypolicy);

    return new AmazonApiGateway(getEndpoint(region)).with(credsProvider).with(clientConfig).getApiGateway();
}
 
开发者ID:awslabs,项目名称:aws-apigateway-importer,代码行数:12,代码来源:ApiImporterDefaultModule.java



注:本文中的com.amazonaws.services.apigateway.AmazonApiGateway类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RelBuilderFactory类代码示例发布时间:2022-05-23
下一篇:
Java DnsManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap