与 AWS SDK或UpdateCampaign一起使用 CLI - AWS SDK代码示例

AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

与 AWS SDK或UpdateCampaign一起使用 CLI

以下代码示例显示了如何使用UpdateCampaign

Java
SDK适用于 Java 2.x
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

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 ""; }
  • 有关API详细信息,请参阅 “AWS SDK for Java 2.x API参考 UpdateCampaign” 中的。