Use UpdateCampaign with an AWS SDK - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use UpdateCampaign with an AWS SDK

The following code example shows how to use UpdateCampaign.

Java
SDK for Java 2.x
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

public static String updateCampaign(PersonalizeClient personalizeClient, String campaignArn, String solutionVersionArn, Integer minProvisionedTPS) { try { // build the updateCampaignRequest UpdateCampaignRequest updateCampaignRequest = UpdateCampaignRequest.builder() .campaignArn(campaignArn) .solutionVersionArn(solutionVersionArn) .minProvisionedTPS(minProvisionedTPS) .build(); // update the campaign personalizeClient.updateCampaign(updateCampaignRequest); DescribeCampaignRequest campaignRequest = DescribeCampaignRequest.builder() .campaignArn(campaignArn) .build(); DescribeCampaignResponse campaignResponse = personalizeClient.describeCampaign(campaignRequest); Campaign updatedCampaign = campaignResponse.campaign(); System.out.println("The Campaign status is " + updatedCampaign.status()); return updatedCampaign.status(); } catch (PersonalizeException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } return ""; }
  • For API details, see UpdateCampaign in AWS SDK for Java 2.x API Reference.