com.amazonaws.services.apigateway.AmazonApiGatewayClient Java Examples
The following examples show how to use
com.amazonaws.services.apigateway.AmazonApiGatewayClient.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DeployAPIStep.java From pipeline-aws-plugin with Apache License 2.0 | 6 votes |
@Override protected Void run() throws Exception { TaskListener listener = this.getContext().get(TaskListener.class); AmazonApiGateway client = AWSClientFactory.create(AmazonApiGatewayClient.builder(), this.getContext()); String stage = this.step.getStage(); String api = this.step.getApi(); listener.getLogger().format("Deploying API %s to stage %s %n", api, stage); CreateDeploymentRequest request = new CreateDeploymentRequest(); request.withRestApiId(api); request.withStageName(stage); if (this.step.getDescription() != null) { request.withDescription(this.step.getDescription()); } if (this.step.getVariables() != null && this.step.getVariables().length > 0) { request.withVariables(this.parseVariables(this.step.getVariables())); } client.createDeployment(request); listener.getLogger().println("Deployment complete"); return null; }
Example #2
Source File: CheckForApiGatewayProtected.java From pacbot with Apache License 2.0 | 5 votes |
private List<Resource> getResourceList(String resourceId, AmazonApiGatewayClient apiGatewayClient) { GetResourcesRequest resourcesRequest = new GetResourcesRequest(); resourcesRequest.setRestApiId(resourceId); GetResourcesResult resourceResult = apiGatewayClient .getResources(resourcesRequest); return resourceResult.getItems(); }
Example #3
Source File: CheckForApiGatewayProtected.java From pacbot with Apache License 2.0 | 5 votes |
private GetMethodResult getGetMethodResult(Resource resource, String resourceId, Map.Entry<String, Method> httpMethod, AmazonApiGatewayClient apiGatewayClient) { GetMethodRequest methodRequest = new GetMethodRequest(); methodRequest.setResourceId(resource.getId()); methodRequest.setRestApiId(resourceId); methodRequest.setHttpMethod(httpMethod.getKey()); return apiGatewayClient.getMethod(methodRequest); }
Example #4
Source File: ApiGateway.java From lambadaframework with MIT License | 5 votes |
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; }
Example #5
Source File: CheckForApiGatewayProtectedTest.java From pacbot with Apache License 2.0 | 4 votes |
@Before public void setUp() throws Exception{ apiGatewayClient = PowerMockito.mock(AmazonApiGatewayClient.class); }