### Getting Started with Systems Manager Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_ssm_code_examples.html This section provides the foundational steps and code examples required to initialize and start using the AWS Systems Manager service with the Java 2.x SDK. ```APIDOC ## GET /systems-manager/get-started ### Description Provides the entry point and initial configuration required to integrate the AWS Systems Manager service into a Java application using the SDK for Java 2.x. ### Method GET ### Endpoint /systems-manager/get-started ### Parameters None ### Request Example N/A ### Response #### Success Response (200) - **status** (string) - Indicates successful initialization of the Systems Manager client. #### Response Example { "status": "success", "message": "Systems Manager client initialized" } ``` -------------------------------- ### Get Started with CloudWatch using SDK for Java 2.x Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_cloudwatch_code_examples.html This code example demonstrates how to initialize and get started with the AWS SDK for Java 2.x for CloudWatch. It serves as a basic entry point for interacting with the service. ```java import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.cloudwatch.CloudWatchClient; public class CloudWatchGetStarted { public static void main(String[] args) { // Initialize the CloudWatch client with a specific region CloudWatchClient cw = CloudWatchClient.builder() .region(Region.US_EAST_1) .build(); // You can now use the 'cw' client to perform CloudWatch operations. // For example, listing dashboards (though this requires permissions): // ListDashboardsResponse response = cw.listDashboards(); // System.out.println("Dashboards: " + response.dashboardEntries()); System.out.println("CloudWatch client initialized successfully."); // Close the client when done cw.close(); } } ``` -------------------------------- ### Get Started with IAM using AWS SDK for Java 2.x Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_iam_code_examples.html This code example demonstrates how to initialize the IAM client and list available policies using the AWS SDK for Java 2.x. It requires AWS credentials to be configured in the environment. The output includes the names of all IAM policies. ```java import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.iam.IamClient; import software.amazon.awssdk.services.iam.model.ListPoliciesResponse; import software.amazon.awssdk.services.iam.model.Policy; import java.util.List; /** * Before running this Java V2 code example, set up your development * environment, including your credentials. * * For more information, see the following documentation topic: * * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html */ public class HelloIAM { public static void main(String[] args) { Region region = Region.AWS_GLOBAL; IamClient iam = IamClient.builder() .region(region) .build(); listPolicies(iam); } public static void listPolicies(IamClient iam) { ListPoliciesResponse response = iam.listPolicies(); List polList = response.policies(); polList.forEach(policy -> { System.out.println("Policy Name: " + policy.policyName()); }); } } ``` -------------------------------- ### Get Started with AWS Glue using Java SDK Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_glue_code_examples.html This code example demonstrates how to initialize the AWS Glue client and list available jobs in a specified region. It requires the AWS SDK for Java 2.x and sets up a GlueClient to interact with the AWS Glue service. The output includes the names of the jobs found. ```java package com.example.glue; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.glue.GlueClient; import software.amazon.awssdk.services.glue.model.ListJobsRequest; import software.amazon.awssdk.services.glue.model.ListJobsResponse; import java.util.List; public class HelloGlue { public static void main(String[] args) { GlueClient glueClient = GlueClient.builder() .region(Region.US_EAST_1) .build(); listJobs(glueClient); } public static void listJobs(GlueClient glueClient) { ListJobsRequest request = ListJobsRequest.builder() .maxResults(10) .build(); ListJobsResponse response = glueClient.listJobs(request); List jobList = response.jobNames(); jobList.forEach(job -> { System.out.println("Job Name: " + job); }); } } ``` -------------------------------- ### Get Started with Geospatial Jobs and Pipelines Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_sagemaker_code_examples.html Example code demonstrating how to set up resources, create, execute, and monitor a SageMaker pipeline for geospatial jobs using the AWS SDK for Java 2.x. ```APIDOC ## Get started with geospatial jobs and pipelines The following code example shows how to: * Set up resources for a pipeline. * Set up a pipeline that executes a geospatial job. * Start a pipeline execution. * Monitor the status of the execution. * View the output of the pipeline. * Clean up resources. For more information, see Create and run SageMaker pipelines using AWS SDKs on Community.aws. **SDK for Java 2.x** ``` -------------------------------- ### Get Started with Amazon Location Service using Java SDK Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_location_code_examples.html This code example demonstrates the initial steps required to get started with Amazon Location Service using the AWS SDK for Java 2.x. It serves as a foundational example for interacting with the service. ```Java /* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ package com.example.location; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.location.LocationClient; import software.amazon.awssdk.services.location.model.ListGeofencesRequest; import software.amazon.awssdk.services.location.model.ListGeofencesResponse; import software.amazon.awssdk.services.location.model.LocationException; /** * Before running this Java V2 example, make sure to have your AWS credentials, * region, and a geofence collection created. *

* For more information, see: * https://docs.aws.amazon.com/location-services/latest/userguide/getting-started.html */ public class GetStartedLocation { public static void main(String[] args) { final String USAGE = "\n" + "Usage: " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; if (args.length != 11) { System.out.println(USAGE); System.exit(1); } String collectionName = args[0]; String trackerName = args[1]; String mapName = args[2]; String routeCalculatorName = args[3]; String identityPoolId = args[4]; String userPoolId = args[5]; String appClientId = args[6]; String domainName = args[7]; String placeIndexName = args[8]; String apiKey = args[9]; Region region = Region.US_EAST_1; LocationClient locationClient = LocationClient.builder() .region(region) .build(); try { System.out.println("Getting started with Amazon Location Service."); // Example: List geofences in a collection System.out.println("\nListing geofences in collection: " + collectionName); listGeofences(locationClient, collectionName); // You can add more examples here for trackers, maps, route calculators, etc. // For example: // createTracker(locationClient, trackerName, region); // createMap(locationClient, mapName, region); // createRouteCalculator(locationClient, routeCalculatorName, region); // createIdentityPool(identityPoolId, region); // createUserPool(userPoolId, region); // createAppClient(appClientId, region); // createDomain(domainName, region); // createPlaceIndex(locationClient, placeIndexName, region); // createApiKey(apiKey, region); System.out.println("\nFinished getting started with Amazon Location Service."); } catch (LocationException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } } public static void listGeofences(LocationClient locationClient, String collectionName) { try { ListGeofencesRequest listGeofencesRequest = ListGeofencesRequest.builder() .collectionName(collectionName) .maxResults(10) .build(); ListGeofencesResponse response = locationClient.listGeofences(listGeofencesRequest); response.geofenceSummaries().forEach(geofence -> { System.out.println(" Geofence ID: " + geofence.geofenceId() + ", Status: " + geofence.status()); }); System.out.println("Successfully listed geofences."); } catch (LocationException e) { System.err.println("Error listing geofences: " + e.awsErrorDetails().errorMessage()); throw e; } } // Add other methods for creating resources like trackers, maps, etc. // public static void createTracker(LocationClient locationClient, String trackerName, Region region) { ... } // public static void createMap(LocationClient locationClient, String mapName, Region region) { ... } // public static void createRouteCalculator(LocationClient locationClient, String routeCalculatorName, Region region) { ... } // public static void createIdentityPool(String identityPoolId, Region region) { ... } // public static void createUserPool(String userPoolId, Region region) { ... } // public static void createAppClient(String clientId, Region region) { ... } // public static void createDomain(String domainName, Region region) { ... } // public static void createPlaceIndex(LocationClient locationClient, String placeIndexName, Region region) { ... } // public static void createApiKey(String apiKey, Region region) { ... } } ``` -------------------------------- ### Get Started with Amazon S3 Control in Java Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_s3-control_code_examples.html This Java code example provides a starting point for using Amazon S3 Control with the AWS SDK for Java 2.x. It outlines the initial setup and basic usage patterns for interacting with S3 Control features. ```Java ## Hello Amazon S3 Control The following code example shows how to get started using Amazon S3 Control. **SDK for Java 2.x** ``` -------------------------------- ### Getting Started with EventBridge Scheduler Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_scheduler_code_examples.html This section outlines the initial setup and basic usage of the EventBridge Scheduler service using the AWS SDK for Java 2.x. ```APIDOC ## GET /eventbridge/scheduler/get-started ### Description This endpoint or process demonstrates the initial configuration required to start using the EventBridge Scheduler service within a Java 2.x application. ### Method GET ### Endpoint /eventbridge/scheduler/get-started ### Parameters #### Path Parameters - None #### Query Parameters - region (string) - Required - The AWS region where the scheduler is deployed. ### Request Example GET /eventbridge/scheduler/get-started?region=us-east-1 ### Response #### Success Response (200) - status (string) - Indicates successful initialization of the Scheduler client. #### Response Example { "status": "success", "message": "EventBridge Scheduler client initialized successfully." } ``` -------------------------------- ### Get Started with EventBridge Scheduler using AWS SDK for Java 2.x Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_scheduler_code_examples.html This code example demonstrates the initial setup and usage for EventBridge Scheduler with the AWS SDK for Java 2.x. It serves as a starting point for developers to integrate EventBridge Scheduler functionalities into their Java applications. The example focuses on basic initialization and configuration. ```java /* * Copyright Amazon.com, Inc. and its affiliates. * AWS LLC licenses this file to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.scheduler; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.scheduler.SchedulerClient; /** * Before running this Java code example, refer to the following: * 1. Create a Java project with your IDE, and then add the following Maven dependency to your project: * * software.amazon.awssdk.services * scheduler * 2.x.x * * * software.amazon.awssdk.regions * regions * 2.x.x * * * 2. Set up the AWS credentials. For more information, see "Configure AWS Credentials" in the * AWS SDK for Java 2.x Developer Guide. */ public class SchedulerHelloWorld { public static void main(String[] args) { // Replace 'your-region' with the desired AWS Region, e.g., "us-east-1" Region region = Region.US_EAST_1; SchedulerClient schedulerClient = SchedulerClient.builder() .region(region) .build(); System.out.println("Scheduler client created successfully."); // You can now use the schedulerClient to perform operations. // For example, to list schedules (requires appropriate permissions): // ListSchedulesRequest listSchedulesRequest = ListSchedulesRequest.builder().build(); // ListSchedulesResponse listSchedulesResponse = schedulerClient.listSchedules(listSchedulesRequest); // listSchedulesResponse.schedules().forEach(schedule -> System.out.println(schedule.name())); schedulerClient.close(); } } ``` -------------------------------- ### Create SaaS Product and Offer with Subscription Pricing (Java) Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_marketplace-catalog_code_examples.html This Java code example illustrates the process of creating a SaaS product and a public offer with subscription-based pricing. It covers defining product details, setting up rate cards for pricing, and associating legal and support terms. Dependencies include the AWS SDK for Java 2.x. The input is a structured object defining the offer details, and the output is the creation of the offer within AWS Marketplace. ```java { "ChangeType": "Add", "Entity": { "Type": "Product@1.0", "Identifier": "example/SaaS/Product/1.0" }, "DetailsDocument": { "ProductTitle": "My SaaS Product", "Category": "Software", "Visibility": "Public", "Dimensions": [ { "Key": "UsageType", "Name": "Usage", "Description": "Standard usage fee" } ] } } , { "ChangeType": "Add", "Entity": { "Type": "Offer@1.0", "Identifier": "example/SaaS/Offer/1.0" }, "DetailsDocument": { "OfferTitle": "My SaaS Offer", "ProductIdentifier": "example/SaaS/Product/1.0", "Pricing": { "CurrencyCode": "USD", "RateCards": [ { "RateCard": [ { "DimensionKey": "WorkloadSmall", "Price": "0.15" }, { "DimensionKey": "WorkloadMedium", "Price": "0.25" } ] } ] } } } , { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "example/SaaS/Offer/1.0" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2022-07-14" } ] } ] } } , { "ChangeType": "UpdateSupportTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "example/SaaS/Offer/1.0" }, "DetailsDocument": { "Terms": [ { "Type": "SupportTerm", "RefundPolicy": "Absolutely no refund, period." } ] } } , { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "example/SaaS/Offer/1.0" }, "DetailsDocument": {} } ] ``` -------------------------------- ### Getting Started with Amazon S3 Control Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_s3-control_code_examples.html This section provides a basic introduction and code example for getting started with Amazon S3 Control using the AWS SDK for Java 2.x. ```APIDOC ## Hello Amazon S3 Control ### Description This example demonstrates the initial setup and a basic interaction with Amazon S3 Control using the AWS SDK for Java 2.x. ### Method GET (or equivalent SDK operation for initial setup/listing) ### Endpoint Not directly applicable to SDK methods, but relates to S3 Control API. ### Parameters None directly in this snippet, but the underlying SDK client would be configured. ### Request Example ```java // Example of initializing the S3ControlClient // See AWS SDK for Java 2.x API Reference for full details S3ControlClient s3ControlClient = S3ControlClient.builder() .region(Region.US_EAST_1) // Specify your desired region .build(); // Further operations would follow, e.g., listJobs(s3ControlClient); ``` ### Response #### Success Response (200) - **Initialization** - Successful creation of an S3ControlClient instance. #### Response Example ```java // No direct response for initialization, but successful execution means the client is ready. System.out.println("S3ControlClient initialized successfully."); ``` ``` -------------------------------- ### POST /StartChangeSet - Create SaaS Product and Offer Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_marketplace-catalog_code_examples.html Creates a draft SaaS product and an associated draft public offer. ```APIDOC ## POST /StartChangeSet ### Description Creates a new SaaS product and a corresponding draft offer in the AWS Marketplace catalog. ### Method POST ### Endpoint /StartChangeSet ### Request Body - **Catalog** (string) - Required - Must be "AWSMarketplace" - **ChangeSet** (array) - Required - List of changes including CreateProduct and CreateOffer ### Request Example { "Catalog":"AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateProduct", "ChangeName": "CreateProductChange", "Entity": { "Type": "SaaSProduct@1.0" }, "DetailsDocument": { "ProductTitle": "Sample product" } }, { "ChangeType": "CreateOffer", "ChangeName": "CreateOfferChange", "Entity": { "Type": "Offer@1.0" }, "DetailsDocument": { "ProductId": "$CreateProductChange.Entity.Identifier", "Name": "Test Offer" } } ] } ``` -------------------------------- ### POST /vpc/setup Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_s3-directory-buckets_code_examples.html Asynchronously creates a new VPC, waits for it to become available, and retrieves the associated route table. ```APIDOC ## POST /vpc/setup ### Description Initiates the creation of a VPC with a default CIDR block (10.0.0.0/16), waits for the resource to be available, and identifies the primary route table. ### Method POST ### Endpoint /vpc/setup ### Parameters None ### Request Body None ### Request Example {} ### Response #### Success Response (200) - **vpcId** (string) - The ID of the newly created VPC. - **routeTableId** (string) - The ID of the primary route table associated with the VPC. #### Response Example { "vpcId": "vpc-0a1b2c3d4e5f6g7h8", "routeTableId": "rtb-0a1b2c3d4e5f6g7h8" } ``` -------------------------------- ### List SageMaker Notebook Instances with Java 2.x Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_sagemaker_code_examples.html This example demonstrates how to initialize a SageMakerClient and retrieve a list of notebook instances. It includes error handling for SageMaker exceptions and proper client resource management. ```java /** * Before running this Java V2 code example, set up your development * environment, including your credentials. * * For more information, see the following documentation topic: * * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html */ public class HelloSageMaker { public static void main(String[] args) { Region region = Region.US_WEST_2; SageMakerClient sageMakerClient = SageMakerClient.builder() .region(region) .build(); listBooks(sageMakerClient); sageMakerClient.close(); } public static void listBooks(SageMakerClient sageMakerClient) { try { ListNotebookInstancesResponse notebookInstancesResponse = sageMakerClient.listNotebookInstances(); List items = notebookInstancesResponse.notebookInstances(); for (NotebookInstanceSummary item : items) { System.out.println("The notebook name is: " + item.notebookInstanceName()); } } catch (SageMakerException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } } } ``` -------------------------------- ### StartChangeSet - Create Offer Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_marketplace-catalog_code_examples.html This snippet demonstrates how to initiate a change set to create a new offer, including details for pricing and legal terms. ```APIDOC ## POST /offers ### Description Initiates a change set to create or update an offer. This includes defining pricing, legal terms, and support policies. ### Method POST ### Endpoint /offers ### Parameters #### Request Body - **Name** (string) - Required - The name of the offer. - **Description** (string) - Required - A description of the offer. - **ChangeType** (string) - Required - The type of change to be made (e.g., `UpdatePricingTerms`, `UpdateLegalTerms`, `ReleaseOffer`). - **Entity** (object) - Required - The entity to which the change applies (e.g., `Offer@1.0`). - **Type** (string) - Required - The type of the entity. - **Identifier** (string) - Required - The unique identifier of the entity. - **DetailsDocument** (object) - Required - A document containing the specific details of the change. - **PricingModel** (string) - Optional - The pricing model for the offer (e.g., `Contract`, `UsageBased`). - **Terms** (array) - Optional - A list of pricing or legal terms. - **Type** (string) - Required - The type of term (e.g., `UsageBasedPricingTerm`, `ConfigurableUpfrontPricingTerm`, `LegalTerm`, `SupportTerm`). - **CurrencyCode** (string) - Required for pricing terms - The currency code (e.g., `USD`). - **RateCards** (array) - Optional for pricing terms - A list of rate cards. - **RateCard** (array) - Required for rate cards - A list of pricing dimensions and their rates. - **DimensionKey** (string) - Required - The key for the pricing dimension. - **Price** (string) - Required - The price for the dimension. - **Selector** (object) - Optional for pricing terms - Defines conditions for the pricing term (e.g., duration). - **Type** (string) - Required - The type of selector (e.g., `Duration`). - **Value** (string) - Required - The value for the selector (e.g., `P12M`). - **Constraints** (object) - Optional for pricing terms - Constraints for the pricing term. - **MultipleDimensionSelection** (string) - Optional - Whether multiple dimensions can be selected. - **QuantityConfiguration** (string) - Optional - Whether quantity is configurable. - **Documents** (array) - Optional for legal terms - A list of legal documents. - **Type** (string) - Required - The type of document (e.g., `StandardEula`). - **Version** (string) - Optional - The version of the document. - **RefundPolicy** (string) - Optional for support terms - The refund policy. ### Request Example ```json { "Name": "Test public offer for SaaSProduct using AWS Marketplace API Reference Code", "Description": "Test public offer with contract pricing for SaaSProduct using AWS Marketplace API Reference Code", "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "UsageBasedPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "RateCard": [ { "DimensionKey": "WorkloadSmall", "Price": "0.15" }, { "DimensionKey": "WorkloadMedium", "Price": "0.25" } ] } ] }, { "Type": "ConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "BasicService", "Price": "150" }, { "DimensionKey": "PremiumService", "Price": "300" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } } ``` ### Response #### Success Response (200) - **OfferId** (string) - The unique identifier of the created or updated offer. - **Status** (string) - The status of the offer change request. #### Response Example ```json { "OfferId": "offer-abcdef1234567890", "Status": "PENDING_REVIEW" } ``` ``` -------------------------------- ### Get Agreement Terms Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_marketplace-agreement_code_examples.html This code example demonstrates how to retrieve the terms of a specific agreement using the AWS SDK for Java. It shows the setup of the client, the creation of the request with an agreement ID, and the execution of the GetAgreementTerms operation. ```APIDOC ## GET /agreements/{agreementId}/terms ### Description Retrieves the terms associated with a specific AWS Marketplace agreement. ### Method GET ### Endpoint /agreements/{agreementId}/terms ### Parameters #### Path Parameters - **agreementId** (string) - Required - The unique identifier of the agreement. ### Request Example ```json { "agreementId": "example-agreement-id" } ``` ### Response #### Success Response (200) - **agreementTerms** (object) - Contains the terms of the agreement. - **termMeta** (object) - Metadata about the terms. - **termInfo** (object) - Information about the specific terms. #### Response Example ```json { "agreementTerms": { "termMeta": { "effectiveDate": "2023-01-01T00:00:00Z", "expirationDate": "2024-01-01T00:00:00Z" }, "termInfo": { "type": "RECURRING_USAGE_TERMS", "recurringUsageTerms": { "billingPeriod": { "periodType": "MONTHLY" } } } } } ``` ``` -------------------------------- ### Initialize AWS Glue Client and Scenario Workflow Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_glue_code_examples.html This snippet demonstrates the entry point for the Glue scenario, including the initialization of the GlueClient and the orchestration of resource creation steps like databases and crawlers. ```java Region region = Region.US_EAST_1; GlueClient glueClient = GlueClient.builder() .region(region) .build(); try { createDatabase(glueClient, dbName, locationUri); } catch (GlueException e) { if (e.awsErrorDetails().errorMessage().equals("Database already exists.")) { System.out.println("Database " + dbName + " already exists. Skipping creation."); } else { System.err.println(e.awsErrorDetails().errorMessage()); return; } } try { createGlueCrawler(glueClient, iam, s3Path, cron, dbName, crawlerName); } catch (GlueException e) { if (e.awsErrorDetails().errorMessage().contains("already exists")) { System.out.println("Crawler " + crawlerName + " already exists. Skipping creation."); } else { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } } ``` -------------------------------- ### Create AMI Product and Offer with Hourly Pricing (Java) Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_marketplace-catalog_code_examples.html This code example demonstrates how to use the AWS SDK for Java 2.x to create an AMI product and a public offer with hourly pricing. It includes steps for defining pricing, legal terms, and support terms. ```APIDOC ## POST /ChangeSet API ### Description This endpoint is used to create or update a change set for an AWS Marketplace product or offer. The provided JSON structure defines a series of changes to be applied. ### Method POST ### Endpoint /ChangeSet ### Parameters #### Request Body - **ChangeType** (string) - Required - The type of change to perform (e.g., `CreateProduct`, `CreateOffer`, `UpdateInformation`). - **Entity** (object) - Required - Specifies the entity to which the change applies. - **Type** (string) - Required - The type of the entity (e.g., `AmiProduct@1.0`, `Offer@1.0`). - **Identifier** (string) - Optional - The unique identifier of the entity. - **DetailsDocument** (object) - Optional - Contains specific details for the change, varying by `ChangeType`. ### Request Example ```json { "ChangeType": "CreateProduct", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "example-product-id" }, "DetailsDocument": { "Title": "Example AMI Product", "Description": "A sample AMI product for demonstration.", "Categories": [ "ExampleCategory" ], "Visibility": "PUBLIC", "ProductType": "AMI", "EulaId": "example-eula-id" } } ``` ### Response #### Success Response (200) - **ChangeSetId** (string) - The ID of the created or updated change set. - **Status** (string) - The status of the change set (e.g., `APPLIED`, `PENDING`). #### Response Example ```json { "ChangeSetId": "cs-abcdef1234567", "Status": "APPLIED" } ``` ## StartChangeSet in AWS SDK for Java 2.x API Reference ### Description The `StartChangeSet` operation in the AWS SDK for Java 2.x allows you to initiate a change set for managing AWS Marketplace listings. This is typically used to create or update products, offers, pricing, and legal terms. ### Method POST ### Endpoint (This is an SDK operation, not a direct HTTP endpoint. The SDK handles the underlying API calls.) ### Parameters (Parameters are passed as Java objects to the SDK method. Refer to the SDK documentation for specific parameter details.) ### Request Example (Conceptual Java SDK Usage) ```java // This is a conceptual example. Actual SDK usage may vary. MarketplaceClient marketplaceClient = MarketplaceClient.builder().build(); List changes = new ArrayList<>(); // Example: Create Product Change changes.add(Change.builder() .changeType("CreateProduct") .entity(Entity.builder() .type("AmiProduct@1.0") .identifier("example-product-id") .build()) .detailsDocument("{\"Title\": \"Example AMI Product\", \"Description\": \"A sample AMI product for demonstration.\"}") // JSON string for details .build()); // Example: Create Offer Change changes.add(Change.builder() .changeType("CreateOffer") .entity(Entity.builder() .type("Offer@1.0") .build()) .detailsDocument("{\"ProductId\": \"example-product-id\"}") // JSON string for details .build()); StartChangeSetRequest startChangeSetRequest = StartChangeSetRequest.builder() .changeSet(changes) .build(); StartChangeSetResponse response = marketplaceClient.startChangeSet(startChangeSetRequest); System.out.println("Change Set ID: " + response.changeSetId()); ``` ### Response #### Success Response (200) - **changeSetId** (string) - The unique identifier for the initiated change set. #### Response Example (Conceptual SDK Response) ```java // Conceptual response object from SDK StartChangeSetResponse { changeSetId: "cs-abcdef1234567" } ``` ``` -------------------------------- ### Create a public or limited SaaS product and public offer with contract with Pay-As-You-Go pricing Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_marketplace-catalog_code_examples.html This example demonstrates how to create a public or limited SaaS product and a public offer with contract and Pay-As-You-Go pricing, including standard or custom EULA. ```APIDOC ## POST /products/{productId}/offers ### Description Creates a public or limited SaaS product and a public offer with contract and Pay-As-You-Go pricing. This example includes the creation of a standard or custom EULA. ### Method POST ### Endpoint /products/{productId}/offers ### Parameters #### Path Parameters - **productId** (string) - Required - The unique identifier of the product. #### Request Body - **Name** (string) - Required - The name of the offer. - **Description** (string) - Required - A description of the offer. - **PricingModel** (string) - Required - The pricing model for the offer (e.g., `Contract`, `UsageBased`). - **Terms** (array) - Required - A list of pricing or legal terms. - **Type** (string) - Required - The type of term (e.g., `UsageBasedPricingTerm`, `ConfigurableUpfrontPricingTerm`, `LegalTerm`, `SupportTerm`). - **CurrencyCode** (string) - Required for pricing terms - The currency code (e.g., `USD`). - **RateCards** (array) - Optional for pricing terms - A list of rate cards. - **RateCard** (array) - Required for rate cards - A list of pricing dimensions and their rates. - **DimensionKey** (string) - Required - The key for the pricing dimension. - **Price** (string) - Required - The price for the dimension. - **Selector** (object) - Optional for pricing terms - Defines conditions for the pricing term (e.g., duration). - **Type** (string) - Required - The type of selector (e.g., `Duration`). - **Value** (string) - Required - The value for the selector (e.g., `P12M`). - **Constraints** (object) - Optional for pricing terms - Constraints for the pricing term. - **MultipleDimensionSelection** (string) - Optional - Whether multiple dimensions can be selected. - **QuantityConfiguration** (string) - Optional - Whether quantity is configurable. - **Documents** (array) - Optional for legal terms - A list of legal documents. - **Type** (string) - Required - The type of document (e.g., `StandardEula`). - **Version** (string) - Optional - The version of the document. - **RefundPolicy** (string) - Optional for support terms - The refund policy. ### Request Example ```json { "Name": "Example SaaS Offer", "Description": "A sample offer with Pay-As-You-Go pricing and a 12-month contract term.", "PricingModel": "Contract", "Terms": [ { "Type": "UsageBasedPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "RateCard": [ { "DimensionKey": "SmallInstance", "Price": "0.05" }, { "DimensionKey": "LargeInstance", "Price": "0.10" } ] } ] }, { "Type": "ConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "BasicSupport", "Price": "100" } ], "Constraints": { "MultipleDimensionSelection": "Disallowed", "QuantityConfiguration": "Disallowed" } } ] }, { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2023-01-01" } ] }, { "Type": "SupportTerm", "RefundPolicy": "No refunds allowed." } ] } ``` ### Response #### Success Response (200) - **OfferId** (string) - The unique identifier of the created offer. - **Status** (string) - The status of the offer creation request. #### Response Example ```json { "OfferId": "offer-xyz789abc123def456", "Status": "ACTIVE" } ``` ``` -------------------------------- ### AWS Glue Scenario Execution (Java) Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_glue_code_examples.html This Java code orchestrates a series of AWS Glue operations. It covers getting specific crawlers, starting crawlers, getting databases, getting tables, creating jobs, starting job runs, listing jobs, getting job runs, deleting jobs, deleting databases, and deleting crawlers. It includes error handling for GlueExceptions and uses a scanner for user input to proceed through the steps. ```java System.out.println(DASHES); System.out.println("3. Get a crawler."); try { getSpecificCrawler(glueClient, crawlerName); } catch (GlueException e) { System.err.println(e.awsErrorDetails().errorMessage()); return; } waitForInputToContinue(scanner); System.out.println(DASHES); System.out.println(DASHES); System.out.println("4. Start a crawler."); try { startSpecificCrawler(glueClient, crawlerName); } catch (GlueException e) { System.err.println(e.awsErrorDetails().errorMessage()); return; } waitForInputToContinue(scanner); System.out.println(DASHES); System.out.println(DASHES); System.out.println("5. Get a database."); try { getSpecificDatabase(glueClient, dbName); } catch (GlueException e) { System.err.println(e.awsErrorDetails().errorMessage()); return; } waitForInputToContinue(scanner); System.out.println(DASHES); System.out.println(DASHES); System.out.println("*** Wait 5 min for the tables to become available"); TimeUnit.MINUTES.sleep(5); System.out.println("6. Get tables."); String myTableName; try { myTableName = getGlueTables(glueClient, dbName); } catch (GlueException e) { System.err.println(e.awsErrorDetails().errorMessage()); return; } waitForInputToContinue(scanner); System.out.println(DASHES); System.out.println(DASHES); System.out.println("7. Create a job."); try { createJob(glueClient, jobName, iam, scriptLocation); } catch (GlueException e) { System.err.println(e.awsErrorDetails().errorMessage()); return; } waitForInputToContinue(scanner); System.out.println(DASHES); System.out.println(DASHES); System.out.println("8. Start a Job run."); try { startJob(glueClient, jobName, dbName, myTableName, bucketNameSc); } catch (GlueException e) { System.err.println(e.awsErrorDetails().errorMessage()); return; } waitForInputToContinue(scanner); System.out.println(DASHES); System.out.println(DASHES); System.out.println("9. List all jobs."); try { getAllJobs(glueClient); } catch (GlueException e) { System.err.println(e.awsErrorDetails().errorMessage()); return; } waitForInputToContinue(scanner); System.out.println(DASHES); System.out.println(DASHES); System.out.println("10. Get job runs."); try { getJobRuns(glueClient, jobName); } catch (GlueException e) { System.err.println(e.awsErrorDetails().errorMessage()); return; } waitForInputToContinue(scanner); System.out.println(DASHES); System.out.println(DASHES); System.out.println("11. Delete a job."); try { deleteJob(glueClient, jobName); } catch (GlueException e) { System.err.println(e.awsErrorDetails().errorMessage()); return; } System.out.println("*** Wait 5 MIN for the " + crawlerName + " to stop"); TimeUnit.MINUTES.sleep(5); waitForInputToContinue(scanner); System.out.println(DASHES); System.out.println(DASHES); System.out.println("12. Delete a database."); try { deleteDatabase(glueClient, dbName); } catch (GlueException e) { System.err.println(e.awsErrorDetails().errorMessage()); return; } waitForInputToContinue(scanner); System.out.println(DASHES); System.out.println(DASHES); System.out.println("Delete a crawler."); try { deleteSpecificCrawler(glueClient, crawlerName); } catch (GlueException e) { System.err.println(e.awsErrorDetails().errorMessage()); return; } waitForInputToContinue(scanner); System.out.println(DASHES); System.out.println(DASHES); System.out.println("Successfully completed the AWS Glue Scenario"); System.out.println(DASHES); ``` -------------------------------- ### Setup VPC Async Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_s3-directory-buckets_code_examples.html Asynchronously sets up a new VPC, including creating the VPC, finding its associated route table, and creating a VPC endpoint for the S3 service. ```APIDOC ## Setup VPC Async ### Description This method asynchronously creates a new Virtual Private Cloud (VPC) with a specified CIDR block. It then waits for the VPC to become available, finds its associated route table, and prepares for S3 VPC endpoint creation. ### Method `CompletableFuture> setupVPCAsync()` ### Endpoint N/A (Client-side operation) ### Parameters None ### Request Example N/A ### Response #### Success Response (200) - **AbstractMap.SimpleEntry** - A map containing the VPC ID and the Route Table ID. #### Response Example ```json { "key": "vpc-0123456789abcdef0", "value": "rtb-0123456789abcdef0" } ``` #### Error Response - **CompletionException** - Thrown if no route tables are found for the created VPC or if any EC2 API call fails. ``` -------------------------------- ### GET /getLabelDetection Source: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_rekognition_code_examples.html Retrieves the results of a previously started label detection job. ```APIDOC ## GET /getLabelDetection ### Description Retrieves the status and results of a video label detection job identified by a JobId. ### Method GET ### Endpoint /getLabelDetection ### Parameters #### Query Parameters - **jobId** (String) - Required - The ID returned from the startLabelDetection call. - **maxResults** (Integer) - Optional - Maximum number of results to return. ### Response #### Success Response (200) - **jobStatus** (String) - The current status of the job (e.g., IN_PROGRESS, SUCCEEDED, FAILED). - **labels** (Array) - List of detected labels and timestamps. #### Response Example { "jobStatus": "SUCCEEDED", "labels": [] } ```