@@ -0,0 +1,1763 @@
+//snippet-sourcedescription:%5BCreateDeployment.java demonstrates how to create a deployment.%5D%0A//snippet-keyword:%5BSDK for Java v2%5D%0A//snippet-keyword:%5BCode Sample%5D%0A//snippet-service:%5BAmazon API Gateway%5D%0A//snippet-sourcetype:%5Bfull-example%5D%0A//snippet-sourcedate:%5B01/21/2021%5D%0A//snippet-sourceauthor:%5Bscmacdon - aws%5D%0A%0A/*%0A   Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.%0A   SPDX-License-Identifier: Apache-2.0%0A*/%0Apackage com.example.gateway;%0A%0Aimport software.amazon.awssdk.regions.Region;%0Aimport software.amazon.awssdk.services.apigateway.ApiGatewayClient;%0Aimport software.amazon.awssdk.services.apigateway.model.*;%0A%0Apublic class CreateDeployment %7B%0A    public static void main(String%5B%5D args) %7B%0A%0A        Region region = Region.US_EAST_1;%0A        ApiGatewayClient apiGateway = ApiGatewayClient.builder()%0A                .region(region)%0A                .build();%0A%0A        String restApiId = %22inx399ewyg%22;%0A        createNewDeployment(apiGateway, restApiId);%0A        apiGateway.close();%0A%0A    %7D%0A%0A    public static String createNewDeployment(ApiGatewayClient apiGateway, String restApiId) %7B%0A%0A        try %7B%0A            CreateDeploymentRequest request = CreateDeploymentRequest.builder()%0A                    .restApiId(restApiId)%0A                    .description(%22Created using the AWS API Gateway Java API%22)%0A                    .stageName(%22MyStage%22)%0A                    .build();%0A%0A            CreateDeploymentResponse response = apiGateway.createDeployment(request);%0A            System.out.println(%22The id of the deployment is %22+response.id());%0A            return response.id();%0A%0A%0A        %7D catch (ApiGatewayException e) %7B%0A            System.err.println(e.awsErrorDetails().errorMessage());%0A            System.exit(1);%0A        %7D%0A        return %22%22  ;%0A    %7D%0A%7D%0A

Create CreateDeployment.java