AWS Marketplace 使用 API for Java 2.x 的目錄 SDK 範例 - AWS SDK 程式碼範例

文件 AWS SDK AWS 範例 SDK 儲存庫中有更多可用的 GitHub 範例。

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

AWS Marketplace 使用 API for Java 2.x 的目錄 SDK 範例

下列程式碼範例示範如何透過 AWS SDK for Java 2.x 搭配 AWS Marketplace Catalog API 使用 來執行動作和實作常見案例。

每個範例都包含完整原始程式碼的連結,您可以在其中找到如何在內容中設定和執行程式碼的指示。

AMI 產品

下列程式碼範例示範如何將維度新增至現有的 AMI 產品,並更新優惠定價條件。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "AddDimensions", "Entity": { "Identifier": "prod-1111111111111", "Type": "AmiProduct@1.0" }, "DetailsDocument": [ { "Key": "m7g.8xlarge", "Description": "m7g.8xlarge", "Name": "m7g.8xlarge", "Types": [ "Metered" ], "Unit": "Hrs" } ] }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "offer-1111111111111" }, "DetailsDocument": { "PricingModel": "Usage", "Terms": [ { "Type": "UsageBasedPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "RateCard": [ { "DimensionKey": "m5.large", "Price": "0.15" }, { "DimensionKey": "m7g.4xlarge", "Price": "0.45" }, { "DimensionKey": "m7g.2xlarge", "Price": "0.45" }, { "DimensionKey": "m7g.8xlarge", "Price": "0.55" } ] } ] } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何新增部署 AMI 產品的區域。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "AddRegions", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "prod-1111111111111" }, "DetailsDocument": { "Regions": [ "us-east-2", "us-west-2" ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何建立公有或有限的 AMI 產品和每小時定價的公有優惠。此範例會建立標準或自訂 EULA。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateProduct", "ChangeName": "CreateProductChange", "Entity": { "Type": "AmiProduct@1.0" }, "DetailsDocument": {} }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "ProductTitle": "Sample product", "ShortDescription": "Brief description", "LongDescription": "Detailed description", "Highlights": [ "Sample highlight" ], "SearchKeywords": [ "Sample keyword" ], "Categories": [ "Operating Systems" ], "LogoUrl": "https://s3.amazonaws.com/logos/sample.png", "VideoUrls": [ "https://sample.amazonaws.com/awsmp-video-1" ], "AdditionalResources": [] } }, { "ChangeType": "AddRegions", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "Regions": [ "us-east-1" ] } }, { "ChangeType": "AddInstanceTypes", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "InstanceTypes": [ "t2.micro" ] } }, { "ChangeType": "AddDeliveryOptions", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "Version": { "VersionTitle": "Test AMI Version1.0", "ReleaseNotes": "Test AMI Version" }, "DeliveryOptions": [ { "Details": { "AmiDeliveryOptionDetails": { "AmiSource": { "AmiId": "ami-11111111111111111", "AccessRoleArn": "arn:aws:iam::111111111111:role/AWSMarketplaceAmiIngestion", "UserName": "ec2-user", "OperatingSystemName": "AMAZONLINUX", "OperatingSystemVersion": "10.0.14393", "ScanningPort": 22 }, "UsageInstructions": "Test AMI Version", "RecommendedInstanceType": "t2.micro", "SecurityGroups": [ { "IpProtocol": "tcp", "IpRanges": [ "0.0.0.0/0" ], "FromPort": 10, "ToPort": 22 } ] } } } ] } }, { "ChangeType": "AddDimensions", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": [ { "Key": "t2.micro", "Description": "t2.micro", "Name": "t2.micro", "Types": [ "Metered" ], "Unit": "Hrs" } ] }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111", "222222222222" ] } } }, { "ChangeType": "ReleaseProduct", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "CreateOffer", "ChangeName": "CreateOfferChange", "Entity": { "Type": "Offer@1.0" }, "DetailsDocument": { "ProductId": "$CreateProductChange.Entity.Identifier" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "Test public offer for AmiProduct using AWS Marketplace API Reference Code", "Description": "Test public offer with hourly-annual pricing for AmiProduct using AWS Marketplace API Reference Code" } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Usage", "Terms": [ { "Type": "UsageBasedPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "RateCard": [ { "DimensionKey": "t2.micro", "Price": "0.15" } ] } ] }, { "Type": "ConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P365D" }, "RateCard": [ { "DimensionKey": "t2.micro", "Price": "150" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2022-07-14" } ] } ] } }, { "ChangeType": "UpdateSupportTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "SupportTerm", "RefundPolicy": "Absolutely no refund, period." } ] } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何建立公有或有限的 AMI 產品和公有優惠,並按小時定價。此範例會建立標準或自訂 EULA。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateProduct", "ChangeName": "CreateProductChange", "Entity": { "Type": "AmiProduct@1.0" }, "DetailsDocument": {} }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "ProductTitle": "Sample product", "ShortDescription": "Brief description", "LongDescription": "Detailed description", "Highlights": [ "Sample highlight" ], "SearchKeywords": [ "Sample keyword" ], "Categories": [ "Operating Systems" ], "LogoUrl": "https://s3.amazonaws.com/logos/sample.png", "VideoUrls": [ "https://sample.amazonaws.com/awsmp-video-1" ], "AdditionalResources": [] } }, { "ChangeType": "AddRegions", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "Regions": [ "us-east-1" ] } }, { "ChangeType": "AddInstanceTypes", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "InstanceTypes": [ "t2.micro" ] } }, { "ChangeType": "AddDeliveryOptions", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "Version": { "VersionTitle": "Test AMI Version1.0", "ReleaseNotes": "Test AMI Version" }, "DeliveryOptions": [ { "Details": { "AmiDeliveryOptionDetails": { "AmiSource": { "AmiId": "ami-11111111111111111", "AccessRoleArn": "arn:aws:iam::111111111111:role/AWSMarketplaceAmiIngestion", "UserName": "ec2-user", "OperatingSystemName": "AMAZONLINUX", "OperatingSystemVersion": "10.0.14393", "ScanningPort": 22 }, "UsageInstructions": "Test AMI Version", "RecommendedInstanceType": "t2.micro", "SecurityGroups": [ { "IpProtocol": "tcp", "IpRanges": [ "0.0.0.0/0" ], "FromPort": 10, "ToPort": 22 } ] } } } ] } }, { "ChangeType": "AddDimensions", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": [ { "Key": "t2.micro", "Description": "t2.micro", "Name": "t2.micro", "Types": [ "Metered" ], "Unit": "Hrs" } ] }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111", "222222222222" ] } } }, { "ChangeType": "ReleaseProduct", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "CreateOffer", "ChangeName": "CreateOfferChange", "Entity": { "Type": "Offer@1.0" }, "DetailsDocument": { "ProductId": "$CreateProductChange.Entity.Identifier" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "Test public offer for AmiProduct using AWS Marketplace API Reference Code", "Description": "Test public offer with hourly-monthly pricing for AmiProduct using AWS Marketplace API Reference Code" } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Usage", "Terms": [ { "Type": "UsageBasedPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "RateCard": [ { "DimensionKey": "t2.micro", "Price": "0.15" } ] } ] }, { "Type": "RecurringPaymentTerm", "CurrencyCode": "USD", "BillingPeriod": "Monthly", "Price": "15.0" } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2022-07-14" } ] } ] } }, { "ChangeType": "UpdateSupportTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "SupportTerm", "RefundPolicy": "Absolutely no refund, period." } ] } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用每小時定價建立公有或有限的 AMI 產品和公有優惠。此範例會建立 和標準或自訂 EULA。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateProduct", "ChangeName": "CreateProductChange", "Entity": { "Type": "AmiProduct@1.0" }, "DetailsDocument": {} }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "ProductTitle": "Sample product", "ShortDescription": "Brief description", "LongDescription": "Detailed description", "Highlights": [ "Sample highlight" ], "SearchKeywords": [ "Sample keyword" ], "Categories": [ "Operating Systems" ], "LogoUrl": "https://s3.amazonaws.com/logos/sample.png", "VideoUrls": [ "https://sample.amazonaws.com/awsmp-video-1" ], "AdditionalResources": [] } }, { "ChangeType": "AddRegions", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "Regions": [ "us-east-1" ] } }, { "ChangeType": "AddInstanceTypes", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "InstanceTypes": [ "t2.micro" ] } }, { "ChangeType": "AddDeliveryOptions", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "Version": { "VersionTitle": "Test AMI Version1.0", "ReleaseNotes": "Test AMI Version" }, "DeliveryOptions": [ { "Details": { "AmiDeliveryOptionDetails": { "AmiSource": { "AmiId": "ami-11111111111111111", "AccessRoleArn": "arn:aws:iam::111111111111:role/AWSMarketplaceAmiIngestion", "UserName": "ec2-user", "OperatingSystemName": "AMAZONLINUX", "OperatingSystemVersion": "10.0.14393", "ScanningPort": 22 }, "UsageInstructions": "Test AMI Version", "RecommendedInstanceType": "t2.micro", "SecurityGroups": [ { "IpProtocol": "tcp", "IpRanges": [ "0.0.0.0/0" ], "FromPort": 10, "ToPort": 22 } ] } } } ] } }, { "ChangeType": "AddDimensions", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": [ { "Key": "t2.micro", "Description": "t2.micro", "Name": "t2.micro", "Types": [ "Metered" ], "Unit": "Hrs" } ] }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111", "222222222222" ] } } }, { "ChangeType": "ReleaseProduct", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "CreateOffer", "ChangeName": "CreateOfferChange", "Entity": { "Type": "Offer@1.0" }, "DetailsDocument": { "ProductId": "$CreateProductChange.Entity.Identifier" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "Test public offer for AmiProduct using AWS Marketplace API Reference Code", "Description": "Test public offer with hourly pricing for AmiProduct using AWS Marketplace API Reference Code" } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Usage", "Terms": [ { "Type": "UsageBasedPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "RateCard": [ { "DimensionKey": "t2.micro", "Price": "0.15" } ] } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2022-07-14" } ] } ] } }, { "ChangeType": "UpdateSupportTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "SupportTerm", "RefundPolicy": "Absolutely no refund, period." } ] } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用草擬公開要約建立草擬 AMI 產品。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateProduct", "ChangeName": "CreateProductChange", "Entity": { "Type": "AmiProduct@1.0" }, "DetailsDocument": { "ProductTitle": "Sample product" } }, { "ChangeType": "CreateOffer", "ChangeName": "CreateOfferChange", "Entity": { "Type": "Offer@1.0" }, "DetailsDocument": { "ProductId": "$CreateProductChange.Entity.Identifier", "Name": "Test Offer" } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何限制部署 AMI 產品的區域。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "RestrictRegions", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "prod-1111111111111" }, "DetailsDocument": { "Regions": [ "us-west-2" ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何限制產品可見性。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "UpdateVisibility", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "prod-1111111111111" }, "DetailsDocument": { "TargetVisibility": "Restricted" } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何指定 是否將 AMI 資產部署在 AWS 支援未來區域的新區域中。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "UpdateFutureRegionSupport", "Entity": { "Type": "AmiProduct@1.0", "Identifier": "prod-1111111111111" }, "DetailsDocument": { "FutureRegionSupport": { "SupportedRegions": [ "All" ] } } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

通路合作夥伴優惠

下列程式碼範例示範如何為任何產品類型建立 CPPO 草稿,以便在發佈給買方之前進行內部檢閱。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateOfferUsingResaleAuthorization", "Entity": { "Type": "Offer@1.0" }, "DetailsDocument": { "ResaleAuthorizationId": "11111111-1111-1111-1111-111111111111", "Name": "Test Offer", "Description": "Test product" } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何從具有合約定價的現有協議建立轉售授權替換私有優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType" : "CreateReplacementOfferUsingResaleAuthorization", "Entity": { "Type": "Offer@1.0" }, "ChangeName": "CreateReplacementOfferResaleAuth", "DetailsDocument": { "AgreementId": "agmt-1111111111111111111111111", "ResaleAuthorizationId": "resaleauthz-1111111111111" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateReplacementOfferResaleAuth.Entity.Identifier" }, "DetailsDocument": { "Name": "Test replacement offer for SaaSProduct using AWS Marketplace API Reference Codes", "Description": "Test private resale replacement offer with contract pricing for SaaSProduct" } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateReplacementOfferResaleAuth.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "FixedUpfrontPricingTerm", "CurrencyCode": "USD", "Price": "0.0", "Duration": "P12M", "Grants": [ { "DimensionKey": "BasicService", "MaxQuantity": 2 } ] } ] } }, { "ChangeType": "UpdateValidityTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateReplacementOfferResaleAuth.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "ValidityTerm", "AgreementEndDate": "2024-01-30" } ] } }, { "ChangeType": "UpdatePaymentScheduleTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateReplacementOfferResaleAuth.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "PaymentScheduleTerm", "CurrencyCode": "USD", "Schedule": [ { "ChargeDate": "2024-01-01", "ChargeAmount": "0" } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateReplacementOfferResaleAuth.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2022-07-14" } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateReplacementOfferResaleAuth.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-12-31" } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateReplacementOfferResaleAuth.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何列出頻道合作夥伴建立的所有 CPPOs。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

package com.example.awsmarketplace.catalogapi; import java.util.ArrayList; import java.util.List; import static com.example.awsmarketplace.utils.ReferenceCodesConstants.*; import com.example.awsmarketplace.utils.ReferenceCodesUtils; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.core.document.Document; import software.amazon.awssdk.http.apache.ApacheHttpClient; import software.amazon.awssdk.services.marketplacecatalog.MarketplaceCatalogClient; import software.amazon.awssdk.services.marketplacecatalog.model.DescribeEntityRequest; import software.amazon.awssdk.services.marketplacecatalog.model.DescribeEntityResponse; import software.amazon.awssdk.services.marketplacecatalog.model.EntitySummary; import software.amazon.awssdk.services.marketplacecatalog.model.ListEntitiesRequest; import software.amazon.awssdk.services.marketplacecatalog.model.ListEntitiesResponse; public class ListAllCppoOffers { /* * List all CPPOs created by a channel partner */ public static void main(String[] args) { List<String> cppoOfferIds = getAllCppoOfferIds(); ReferenceCodesUtils.formatOutput(cppoOfferIds); } public static List<String> getAllCppoOfferIds() { MarketplaceCatalogClient marketplaceCatalogClient = MarketplaceCatalogClient.builder() .httpClient(ApacheHttpClient.builder().build()) .credentialsProvider(ProfileCredentialsProvider.create()) .build(); // get all offer entity ids List<String> entityIdList = new ArrayList<String>(); ListEntitiesRequest listEntitiesRequest = ListEntitiesRequest.builder() .catalog(AWS_MP_CATALOG) .entityType(ENTITY_TYPE_OFFER) .maxResults(10) .nextToken(null) .build(); ListEntitiesResponse listEntitiesResponse = marketplaceCatalogClient.listEntities(listEntitiesRequest); for (EntitySummary entitySummary : listEntitiesResponse.entitySummaryList()) { entityIdList.add(entitySummary.entityId()); } while (listEntitiesResponse.nextToken() != null) { listEntitiesRequest = ListEntitiesRequest.builder() .catalog(AWS_MP_CATALOG) .entityType(ENTITY_TYPE_OFFER) .maxResults(10) .nextToken(listEntitiesResponse.nextToken()) .build(); listEntitiesResponse = marketplaceCatalogClient.listEntities(listEntitiesRequest); for (EntitySummary entitySummary : listEntitiesResponse.entitySummaryList()) { entityIdList.add(entitySummary.entityId()); } } // filter for CPPO offers: ResaleAuthorizationId exists in Details List<String> cppoOfferIds = new ArrayList<String>(); for (String entityId : entityIdList) { DescribeEntityRequest describeEntityRequest = DescribeEntityRequest.builder() .catalog(AWS_MP_CATALOG) .entityId(entityId) .build(); DescribeEntityResponse describeEntityResponse = marketplaceCatalogClient.describeEntity(describeEntityRequest); Document resaleAuthorizationDocument = describeEntityResponse.detailsDocument().asMap().get(ATTRIBUTE_RESALE_AUTHORIZATION_ID); String resaleAuthorizationId = resaleAuthorizationDocument != null ? resaleAuthorizationDocument.asString() : ""; if (!resaleAuthorizationId.isEmpty()) { cppoOfferIds.add(resaleAuthorizationId); } } return cppoOfferIds; } }
  • 如需 API 詳細資訊,請參閱 ListEntities AWS SDK for Java 2.x 參考中的 API

下列程式碼範例說明如何列出頻道合作夥伴可用的所有共用轉售授權。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

package com.example.awsmarketplace.catalogapi; import java.util.ArrayList; import java.util.List; import static com.example.awsmarketplace.utils.ReferenceCodesConstants.*; import com.example.awsmarketplace.utils.ReferenceCodesUtils; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.http.apache.ApacheHttpClient; import software.amazon.awssdk.services.marketplacecatalog.MarketplaceCatalogClient; import software.amazon.awssdk.services.marketplacecatalog.model.ListEntitiesRequest; import software.amazon.awssdk.services.marketplacecatalog.model.ListEntitiesResponse; public class ListAllSharedResaleAuthorizations { /* * list all resale authorizations shared to an account */ public static void main(String[] args) { List<ListEntitiesResponse> responseList = getListEntityResponseList(); ReferenceCodesUtils.formatOutput(responseList); } public static List<ListEntitiesResponse> getListEntityResponseList() { MarketplaceCatalogClient marketplaceCatalogClient = MarketplaceCatalogClient.builder() .httpClient(ApacheHttpClient.builder().build()) .credentialsProvider(ProfileCredentialsProvider.create()) .build(); List<ListEntitiesResponse> responseList = new ArrayList<ListEntitiesResponse>(); ListEntitiesRequest listEntitiesRequest = ListEntitiesRequest.builder() .catalog(AWS_MP_CATALOG) .entityType(ENTITY_TYPE_RESALE_AUTHORIZATION) .maxResults(10) .ownershipType(OWNERSHIP_TYPE_SHARED) .nextToken(null) .build(); ListEntitiesResponse listEntitiesResponse = marketplaceCatalogClient.listEntities(listEntitiesRequest); responseList.add(listEntitiesResponse); while (listEntitiesResponse.nextToken() != null) { listEntitiesRequest = ListEntitiesRequest.builder() .catalog(AWS_MP_CATALOG) .entityType(ENTITY_TYPE_RESALE_AUTHORIZATION) .maxResults(10) .ownershipType(OWNERSHIP_TYPE_SHARED) .nextToken(listEntitiesResponse.nextToken()) .build(); listEntitiesResponse = marketplaceCatalogClient.listEntities(listEntitiesRequest); responseList.add(listEntitiesResponse); } return responseList; } }
  • 如需 API 詳細資訊,請參閱 ListEntities AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈 CPPO 並附加買方 EULA。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType" : "CreateOfferUsingResaleAuthorization", "Entity": { "Type": "Offer@1.0" }, "ChangeName": "CreateCPPOoffer", "DetailsDocument": { "ResaleAuthorizationId":"resaleauthz-1111111111111", "Name": "Test Offer", "Description":"Test product" } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPOoffer.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPOoffer.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": ["222222222222"] } } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPOoffer.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-07-31" } }, { "ChangeType": "UpdateValidityTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPOoffer.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "ValidityTerm", "AgreementDuration": "P450D" } ] } }, { "ChangeType":"ReleaseOffer", "Entity":{ "Type": "Offer@1.0", "Identifier": "$CreateCPPOoffer.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何在 CPPO、SaaS 或容器產品上使用一次性轉售授權發佈 AMI,並更新價格標記。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType" : "CreateOfferUsingResaleAuthorization", "Entity": { "Type": "Offer@1.0" }, "ChangeName": "CreateCPPOoffer", "DetailsDocument": { "ResaleAuthorizationId":"resaleauthz-1111111111111", "Name": "Test Offer", "Description":"Test product" } }, { "ChangeType": "UpdateMarkup", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPOoffer.Entity.Identifier" }, "DetailsDocument": { "Percentage" : "5.0" } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPOoffer.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": ["222222222222"] } } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPOoffer.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-07-31" } }, { "ChangeType": "UpdateValidityTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPOoffer.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "ValidityTerm", "AgreementDuration": "P450D" } ] } }, { "ChangeType":"ReleaseOffer", "Entity":{ "Type": "Offer@1.0", "Identifier": "$CreateCPPOoffer.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈 CPPO 草稿並更新價格標記。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType" : "CreateOfferUsingResaleAuthorization", "Entity": { "Type": "Offer@1.0" }, "ChangeName": "CreateCPPOoffer", "DetailsDocument": { "ResaleAuthorizationId":"resaleauthz-1111111111111", "Name": "Test Offer", "Description":"Test product" } }, { "ChangeType": "UpdateMarkup", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPOoffer.Entity.Identifier" }, "DetailsDocument": { "Percentage" : "5.0" } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPOoffer.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": ["222222222222"] } } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPOoffer.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-07-31" } }, { "ChangeType": "UpdateValidityTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPOoffer.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "ValidityTerm", "AgreementDuration": "P450D" } ] } }, { "ChangeType":"ReleaseOffer", "Entity":{ "Type": "Offer@1.0", "Identifier": "$CreateCPPOoffer.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何更新 CPPO 的過期日期,讓買家有更多時間評估並接受提議。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "offer-1111111111111" }, "DetailsDocument": { "AvailabilityEndDate": "2025-07-31" } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

容器產品

下列程式碼範例示範如何使用草擬公有優惠建立草擬容器產品。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog":"AWSMarketplace", "changeSet":[ { "ChangeType": "CreateProduct", "ChangeName": "CreateProductChange", "Entity": { "Type": "ContainerProduct@1.0" }, "DetailsDocument": { "ProductTitle": "Sample product" } }, { "ChangeType": "CreateOffer", "ChangeName": "CreateOfferChange", "Entity": { "Type": "Offer@1.0" }, "DetailsDocument": { "ProductId": "$CreateProductChange.Entity.Identifier", "Name": "Test Offer" } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用公開優惠、合約定價和標準 EULA 來建立有限的容器產品。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateProduct", "Entity": { "Type": "ContainerProduct@1.0" }, "DetailsDocument": {}, "ChangeName": "CreateProductChange" }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "ContainerProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "LogoUrl": "https://s3.amazonaws.com/logos/sample.png", "Categories": [ "Streaming solutions" ], "ProductTitle": "ContainerProduct", "AdditionalResources": [], "LongDescription": "Long description goes here", "SearchKeywords": [ "container streaming" ], "ShortDescription": "Description1", "Highlights": [ "Highlight 1", "Highlight 2" ], "SupportDescription": "No support available", "VideoUrls": [] } }, { "ChangeType": "AddDimensions", "Entity": { "Type": "ContainerProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": [ { "Key": "Cores", "Description": "Cores per cluster", "Name": "Cores", "Types": [ "Entitled" ], "Unit": "Units" } ] }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "ContainerProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111" ] } } }, { "ChangeType": "AddRepositories", "Entity": { "Type": "ContainerProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "Repositories": [ { "RepositoryName": "uniquerepositoryname", "RepositoryType": "ECR" } ] } }, { "ChangeType": "ReleaseProduct", "Entity": { "Type": "ContainerProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "CreateOffer", "Entity": { "Type": "Offer@1.0" }, "DetailsDocument": { "ProductId": "$CreateProductChange.Entity.Identifier" }, "ChangeName": "CreateOfferChange" }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "Constraints": { "MultipleDimensionSelection": "Disallowed", "QuantityConfiguration": "Disallowed" }, "RateCard": [ { "DimensionKey": "Cores", "Price": "0.25" } ] } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2022-07-14" } ] } ] } }, { "ChangeType": "UpdateSupportTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "SupportTerm", "RefundPolicy": "No refunds" } ] } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "Some container offer Name", "Description": "Some interesting container offer description" } }, { "ChangeType": "UpdateRenewalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "RenewalTerm" } ] } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

實體

下列程式碼範例示範如何在單一呼叫中描述所有實體。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package com.example.awsmarketplace.catalogapi; import static com.example.awsmarketplace.utils.ReferenceCodesConstants.*; import com.example.awsmarketplace.utils.ReferenceCodesUtils; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.http.apache.ApacheHttpClient; import software.amazon.awssdk.services.marketplacecatalog.MarketplaceCatalogClient; import software.amazon.awssdk.services.marketplacecatalog.model.BatchDescribeEntitiesRequest; import software.amazon.awssdk.services.marketplacecatalog.model.EntityRequest; import software.amazon.awssdk.services.marketplacecatalog.model.BatchDescribeEntitiesResponse; import software.amazon.awssdk.services.marketplacecatalog.model.EntityDetail; import software.amazon.awssdk.services.marketplacecatalog.model.BatchDescribeErrorDetail; import java.util.Arrays; import java.util.Map; public class BatchDescribeEntities { /* * BatchDescribe my entities in a single call and * check if it contains all the information I need to know about the entities. */ public static void main(String[] args) { MarketplaceCatalogClient marketplaceCatalogClient = MarketplaceCatalogClient.builder() .httpClient(ApacheHttpClient.builder().build()) .credentialsProvider(ProfileCredentialsProvider.create()) .build(); BatchDescribeEntitiesRequest batchDescribeEntitiesRequest = BatchDescribeEntitiesRequest.builder() .entityRequestList(Arrays.asList( EntityRequest.builder() .catalog(AWS_MP_CATALOG).entityId(OFFER_ID) .build(), EntityRequest.builder() .catalog(AWS_MP_CATALOG).entityId(PRODUCT_ID) .build())) .build(); BatchDescribeEntitiesResponse batchDescribeEntitiesResponse = marketplaceCatalogClient.batchDescribeEntities(batchDescribeEntitiesRequest); // Reading the successful entities response Map<String, EntityDetail> entityDetailsMap = batchDescribeEntitiesResponse.entityDetails(); for (Map.Entry<String, EntityDetail> entry : entityDetailsMap.entrySet()) { System.out.println("EntityId: " + entry.getKey()); ReferenceCodesUtils.formatOutput(entry.getValue()); } // Logging the failed entities error details Map<String, BatchDescribeErrorDetail> entityErrorsMap = batchDescribeEntitiesResponse.errors(); for (Map.Entry<String, BatchDescribeErrorDetail> entry : entityErrorsMap.entrySet()) { System.out.println(String.format("EntityId: %s, ErrorCode: %s, ErrorMessage: %s", entry.getKey(), entry.getValue().errorCode(), entry.getValue().errorMessage())); } } }

下列程式碼範例示範如何列出和描述與產品相關聯的所有優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

package com.example.awsmarketplace.catalogapi; import java.util.ArrayList; import java.util.List; import static com.example.awsmarketplace.utils.ReferenceCodesConstants.*; import com.example.awsmarketplace.utils.ReferenceCodesUtils; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.http.apache.ApacheHttpClient; import software.amazon.awssdk.services.marketplacecatalog.MarketplaceCatalogClient; import software.amazon.awssdk.services.marketplacecatalog.model.DescribeEntityRequest; import software.amazon.awssdk.services.marketplacecatalog.model.DescribeEntityResponse; import software.amazon.awssdk.services.marketplacecatalog.model.EntitySummary; import software.amazon.awssdk.services.marketplacecatalog.model.EntityTypeFilters; import software.amazon.awssdk.services.marketplacecatalog.model.ListEntitiesRequest; import software.amazon.awssdk.services.marketplacecatalog.model.ListEntitiesResponse; import software.amazon.awssdk.services.marketplacecatalog.model.OfferFilters; import software.amazon.awssdk.services.marketplacecatalog.model.OfferProductIdFilter; import software.amazon.awssdk.services.marketplacecatalog.model.OfferTargetingFilter; public class ListProductPrivateOffers { private static MarketplaceCatalogClient marketplaceCatalogClient = MarketplaceCatalogClient.builder() .httpClient(ApacheHttpClient.builder().build()) .credentialsProvider(ProfileCredentialsProvider.create()) .build(); /* * retrieve all private offer information related to a single product */ public static void main(String[] args) { List<EntitySummary> entitySummaryList = getEntitySummaryList(); // for each offer id, output the offer detail using DescribeEntity API for (EntitySummary entitySummary : entitySummaryList) { DescribeEntityRequest describeEntityRequest = DescribeEntityRequest.builder() .catalog(AWS_MP_CATALOG) .entityId(entitySummary.entityId()) .build(); DescribeEntityResponse describeEntityResponse = marketplaceCatalogClient.describeEntity(describeEntityRequest); ReferenceCodesUtils.formatOutput(describeEntityResponse); } } public static List<EntitySummary> getEntitySummaryList() { // define list entities filters EntityTypeFilters entityTypeFilters = EntityTypeFilters.builder() .offerFilters(OfferFilters.builder() .targeting(OfferTargetingFilter.builder() .valueListWithStrings(OFFER_TARGETING_BUYERACCOUNTS) .build()) .productId(OfferProductIdFilter.builder() .valueList(PRODUCT_ID) .build()) .build()) .build(); ListEntitiesRequest listEntitiesRequest = ListEntitiesRequest.builder() .catalog(AWS_MP_CATALOG) .entityType(ENTITY_TYPE_OFFER).maxResults(50) .entityTypeFilters(entityTypeFilters) .nextToken(null) .build(); ListEntitiesResponse listEntitiesResponse = marketplaceCatalogClient.listEntities(listEntitiesRequest); // save all entitySummary of the results into entitySummaryList List<EntitySummary> entitySummaryList = new ArrayList<EntitySummary>(); entitySummaryList.addAll(listEntitiesResponse.entitySummaryList()); while ( listEntitiesResponse.nextToken() != null && listEntitiesResponse.nextToken().length() > 0) { listEntitiesRequest = ListEntitiesRequest.builder() .catalog(AWS_MP_CATALOG) .entityType(ENTITY_TYPE_OFFER).maxResults(50) .entityTypeFilters(entityTypeFilters) .nextToken(listEntitiesResponse.nextToken()) .build(); listEntitiesResponse = marketplaceCatalogClient.listEntities(listEntitiesRequest); entitySummaryList.addAll(listEntitiesResponse.entitySummaryList()); } return entitySummaryList; } }

Offers

下列程式碼範例示範如何為 SaaS 產品建立自訂維度,以及建立私有優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "AddDimensions", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "prod-1111111111111" }, "DetailsDocument": [ { "Types": [ "Entitled" ], "Description": "Custom Pricing 4 w/ terms and coverage to be defined in Private Offer", "Unit": "Units", "Key": "Custom4", "Name": "Custom Pricing 4" } ] }, { "ChangeType": "CreateOffer", "Entity": { "Type": "Offer@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111" }, "ChangeName": "CreateOfferChange" }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "Private Test Offer - SaaS Contract Product", "Description": "Private Test Offer - SaaS Contract Product" } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111" ] } } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2022-07-14" } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-12-31" } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" }, "RateCard": [ { "DimensionKey": "Custom4", "Price": "300.0" } ], "Selector": { "Type": "Duration", "Value": "P36M" } } ] } ] } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ], "ChangeSetName": "PrivateOfferWithCustomDimension" }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何為 AMI 或 SaaS 產品建立私有優惠草稿,以便您可以在發佈給買方之前進行內部檢閱。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateOffer", "Entity": { "Type": "Offer@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "Test Private Offer" } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用 SaaS 產品的合約和 Pay-As-You-Go 定價建立私有優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateOffer", "Entity": { "Type": "Offer@1.0" }, "ChangeName": "CreateOfferChange", "DetailsDocument": { "ProductId": "prod-1111111111111" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "Test private offer for SaaSProduct using AWS Marketplace API Reference Code", "Description": "Test private offer with subscription pricing for SaaSProduct using AWS Marketplace API Reference Code" } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111", "222222222222" ] } } }, { "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" } } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-12-31" } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用合約定價和 SaaS 產品的彈性付款排程來建立私有優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateOffer", "Entity": { "Type": "Offer@1.0" }, "ChangeName": "CreateOfferChange", "DetailsDocument": { "ProductId": "prod-1111111111111" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "Test private offer for SaaSProduct using AWS Marketplace API Reference Code", "Description": "Test private offer with subscription pricing for SaaSProduct using AWS Marketplace API Reference Code" } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111", "222222222222" ] } } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "FixedUpfrontPricingTerm", "CurrencyCode": "USD", "Price": "0.0", "Grants": [ { "DimensionKey": "BasicService", "MaxQuantity": 1 }, { "DimensionKey": "PremiumService", "MaxQuantity": 1 } ] } ] } }, { "ChangeType": "UpdateValidityTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "ValidityTerm", "AgreementDuration": "P12M" } ] } }, { "ChangeType": "UpdatePaymentScheduleTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "PaymentScheduleTerm", "CurrencyCode": "USD", "Schedule": [ { "ChargeDate": "2024-01-01", "ChargeAmount": "200.00" }, { "ChargeDate": "2024-02-01", "ChargeAmount": "170.00" } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-12-31" } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用容器產品的合約定價建立私有優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateOffer", "Entity": { "Type": "Offer@1.0" }, "ChangeName": "CreateOfferChange", "DetailsDocument": { "ProductId": "prod-1111111111111" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "Test private offer for Container product using AWS Marketplace API Reference Code", "Description": "Test private offer for Container product with contract pricing using AWS Marketplace API Reference Code" } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111" ] } } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "Constraints": { "MultipleDimensionSelection": "Disallowed", "QuantityConfiguration": "Disallowed" }, "RateCard": [ { "DimensionKey": "ReqPerHour", "Price": "0.25" } ] } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2022-07-14" } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-12-31" } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用 AMI 產品的合約定價建立私有優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateOffer", "ChangeName": "CreateOfferChange", "Entity": { "Type": "Offer@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "Test private offer for AmiProduct using AWS Marketplace API Reference Code", "Description": "Test private offer with hourly annual pricing for AmiProduct using AWS Marketplace API Reference Code" } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111", "222222222222" ] } } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-12-31" } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "ReadOnlyUsers", "Price": "220.00" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何建立包含每小時年度定價的私有優惠,以及 AMI 產品的彈性付款排程。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateOffer", "ChangeName": "CreateOfferChange", "Entity": { "Type": "Offer@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "Test private offer for AmiProduct using AWS Marketplace API Reference Code", "Description": "Test private offer with hourly annual pricing for AmiProduct using AWS Marketplace API Reference Code" } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111", "222222222222" ] } } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-12-31" } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Usage", "Terms": [ { "Type": "UsageBasedPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "RateCard": [ { "DimensionKey": "t2.micro", "Price": "0.17" } ] } ] }, { "Type": "FixedUpfrontPricingTerm", "CurrencyCode": "USD", "Price": "0.0", "Duration": "P365D", "Grants": [ { "DimensionKey": "t2.micro", "MaxQuantity": 1 } ] } ] } }, { "ChangeType": "UpdateValidityTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "ValidityTerm", "AgreementDuration": "P650D" } ] } }, { "ChangeType": "UpdatePaymentScheduleTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "PaymentScheduleTerm", "CurrencyCode": "USD", "Schedule": [ { "ChargeDate": "2024-01-01", "ChargeAmount": "200.00" }, { "ChargeDate": "2024-02-01", "ChargeAmount": "170.00" } ] } ] } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用 AMI 產品的每小時年度定價來建立私有優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateOffer", "ChangeName": "CreateOfferChange", "Entity": { "Type": "Offer@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "Test private offer for AmiProduct using AWS Marketplace API Reference Code", "Description": "Test private offer with hourly annual pricing for AmiProduct using AWS Marketplace API Reference Code" } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111", "222222222222" ] } } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-12-31" } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Usage", "Terms": [ { "Type": "UsageBasedPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "RateCard": [ { "DimensionKey": "t2.micro", "Price": "0.17" } ] } ] }, { "Type": "ConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P365D" }, "RateCard": [ { "DimensionKey": "t2.micro", "Price": "220.00" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "UpdateValidityTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "ValidityTerm", "AgreementDuration": "P650D" } ] } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用 AMI 產品的每小時定價建立私有優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateOffer", "ChangeName": "CreateOfferChange", "Entity": { "Type": "Offer@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "Test private offer for AmiProduct using AWS Marketplace API Reference Code", "Description": "Test private offer with hourly pricing for AmiProduct using AWS Marketplace API Reference Code" } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111", "222222222222" ] } } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2022-07-14" } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2025-01-01" } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Usage", "Terms": [ { "Type": "UsageBasedPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "RateCard": [ { "DimensionKey": "t2.micro", "Price": "0.15" } ] } ] } ] } }, { "ChangeType": "UpdateValidityTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "ValidityTerm", "AgreementDuration": "P30D" } ] } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用 SaaS 產品的訂閱定價建立私有優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateOffer", "Entity": { "Type": "Offer@1.0" }, "ChangeName": "CreateOfferChange", "DetailsDocument": { "ProductId": "prod-1111111111111" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "Test private offer for SaaSProduct using AWS Marketplace API Reference Code", "Description": "Test private offer with subscription pricing for SaaSProduct using AWS Marketplace API Reference Code" } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111", "222222222222" ] } } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Usage", "Terms": [ { "Type": "UsageBasedPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "RateCard": [ { "DimensionKey": "WorkloadSmall", "Price": "0.13" }, { "DimensionKey": "WorkloadMedium", "Price": "0.22" } ] } ] } ] } }, { "ChangeType": "UpdateValidityTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "ValidityTerm", "AgreementDuration": "P30D" } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-12-31" } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用 SaaS 產品的分層合約定價建立私有優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateOffer", "Entity": { "Type": "Offer@1.0" }, "ChangeName": "CreateOfferChange", "DetailsDocument": { "ProductId": "prod-1111111111111" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "Test private offer for SaaSProduct using AWS Marketplace API Reference Code", "Description": "Test private offer with subscription pricing for SaaSProduct using AWS Marketplace API Reference Code" } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111", "222222222222" ] } } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "BasicService", "Price": "120.00" }, { "DimensionKey": "PremiumService", "Price": "200.00" } ], "Constraints": { "MultipleDimensionSelection": "Disallowed", "QuantityConfiguration": "Disallowed" } } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-12-31" } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用 SaaS 產品的訂閱定價建立公有免費試用方案。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateOffer", "Entity": { "Type": "Offer@1.0" }, "ChangeName": "CreateOfferChange", "DetailsDocument": { "ProductId": "prod-1111111111111" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "Test public free trial offer for SaaSProduct using AWS Marketplace API Reference Code", "Description": "Test public free trial offer with subscription pricing for SaaSProduct using AWS Marketplace API Reference Code" } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Free", "Terms": [ { "Type": "FreeTrialPricingTerm", "Duration": "P20D", "Grants": [ { "DimensionKey": "WorkloadSmall" }, { "DimensionKey": "WorkloadMedium" } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2022-07-14" } ] } ] } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何從具有合約定價的現有協議建立替代的私有要約。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType" : "CreateReplacementOffer", "Entity": { "Type": "Offer@1.0" }, "ChangeName": "CreateReplacementOffer", "DetailsDocument": { "AgreementId": "agmt-1111111111111111111111111" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateReplacementOffer.Entity.Identifier" }, "DetailsDocument": { "Name": "Test replacement offer for SaaSProduct using AWS Marketplace API Reference Codes", "Description": "Test private replacement offer with contract pricing for SaaSProduct" } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateReplacementOffer.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "FixedUpfrontPricingTerm", "CurrencyCode": "USD", "Price": "0.0", "Grants": [ { "DimensionKey": "BasicService", "MaxQuantity": 2 } ] } ] } }, { "ChangeType": "UpdateValidityTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateReplacementOffer.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "ValidityTerm", "AgreementEndDate": "2024-01-30" } ] } }, { "ChangeType": "UpdatePaymentScheduleTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateReplacementOffer.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "PaymentScheduleTerm", "CurrencyCode": "USD", "Schedule": [ { "ChargeDate": "2024-01-01", "ChargeAmount": "0" } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateReplacementOffer.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2022-07-14" } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateReplacementOffer.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-12-31" } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateReplacementOffer.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何描述公開優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package com.example.awsmarketplace.catalogapi; import static com.example.awsmarketplace.utils.ReferenceCodesConstants.*; import com.example.awsmarketplace.utils.ReferenceCodesUtils; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.http.apache.ApacheHttpClient; import software.amazon.awssdk.services.marketplacecatalog.MarketplaceCatalogClient; import software.amazon.awssdk.services.marketplacecatalog.model.DescribeEntityRequest; import software.amazon.awssdk.services.marketplacecatalog.model.DescribeEntityResponse; public class DescribeEntity { /* * Describe my AMI or SaaS or Container product and check if it contains all the information I need to know about the product */ public static void main(String[] args) { String offerId = args.length > 0 ? args[0] : OFFER_ID; DescribeEntityResponse describeEntityResponse = getDescribeEntityResponse(offerId); ReferenceCodesUtils.formatOutput(describeEntityResponse); } public static DescribeEntityResponse getDescribeEntityResponse(String offerId) { MarketplaceCatalogClient marketplaceCatalogClient = MarketplaceCatalogClient.builder() .httpClient(ApacheHttpClient.builder().build()) .credentialsProvider(ProfileCredentialsProvider.create()) .build(); DescribeEntityRequest describeEntityRequest = DescribeEntityRequest.builder() .catalog(AWS_MP_CATALOG) .entityId(offerId) .build(); DescribeEntityResponse describeEntityResponse = marketplaceCatalogClient.describeEntity(describeEntityRequest); return describeEntityResponse; } }
  • 如需 API 詳細資訊,請參閱 DescribeEntity AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何將私有優惠的過期日期設定為過去的日期,以便買家無法再看到優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "offer-1111111111111" }, "DetailsDocument": { "AvailabilityEndDate": "2023-01-01" } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何列出所有私有優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

package com.example.awsmarketplace.catalogapi; import java.util.ArrayList; import java.util.List; import static com.example.awsmarketplace.utils.ReferenceCodesConstants.*; import com.example.awsmarketplace.utils.ReferenceCodesUtils; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.http.apache.ApacheHttpClient; import software.amazon.awssdk.services.marketplacecatalog.MarketplaceCatalogClient; import software.amazon.awssdk.services.marketplacecatalog.model.DescribeEntityRequest; import software.amazon.awssdk.services.marketplacecatalog.model.DescribeEntityResponse; import software.amazon.awssdk.services.marketplacecatalog.model.EntitySummary; import software.amazon.awssdk.services.marketplacecatalog.model.EntityTypeFilters; import software.amazon.awssdk.services.marketplacecatalog.model.ListEntitiesRequest; import software.amazon.awssdk.services.marketplacecatalog.model.ListEntitiesResponse; import software.amazon.awssdk.services.marketplacecatalog.model.OfferAvailabilityEndDateFilter; import software.amazon.awssdk.services.marketplacecatalog.model.OfferAvailabilityEndDateFilterDateRange; import software.amazon.awssdk.services.marketplacecatalog.model.OfferBuyerAccountsFilter; import software.amazon.awssdk.services.marketplacecatalog.model.OfferFilters; import software.amazon.awssdk.services.marketplacecatalog.model.OfferReleaseDateFilter; import software.amazon.awssdk.services.marketplacecatalog.model.OfferReleaseDateFilterDateRange; import software.amazon.awssdk.services.marketplacecatalog.model.OfferTargetingFilter; public class ListAllPrivateOffers { /* * List all my private offers and sort or filter them by Offer Publish Date, Offer Expiry Date and Buyer IDs * * OfferTargetingFilter = BuyerAccounts (private offer); * OfferBuyerAccountsFilter: Buyer IDs filter * OfferAvailabilityEndDateFilter : Offer Expiry Date filter * OfferReleaseDateFilter : Offer Publish Date filter */ private static MarketplaceCatalogClient marketplaceCatalogClient = MarketplaceCatalogClient.builder() .httpClient(ApacheHttpClient.builder().build()) .credentialsProvider(ProfileCredentialsProvider.create()) .build(); public static void main(String[] args) { String offerReleaseDateAfterValue = "2023-01-01T23:59:59Z"; String offerAvailableEndDateAfterValue = "2040-12-24T23:59:59Z"; List<EntitySummary> entitySummaryList = getEntitySummaryList(offerReleaseDateAfterValue, offerAvailableEndDateAfterValue); // for each offer id, output the offer detail using DescribeEntity API for (EntitySummary entitySummary : entitySummaryList) { DescribeEntityRequest describeEntityRequest = DescribeEntityRequest.builder() .catalog(AWS_MP_CATALOG) .entityId(entitySummary.entityId()) .build(); DescribeEntityResponse describeEntityResponse = marketplaceCatalogClient.describeEntity(describeEntityRequest); ReferenceCodesUtils.formatOutput(describeEntityResponse); } } public static List<EntitySummary> getEntitySummaryList (String offerReleaseDateAfterValue, String offerAvailableEndDateAfterValue) { EntityTypeFilters entityTypeFilters = EntityTypeFilters.builder() .offerFilters(OfferFilters.builder() .targeting(OfferTargetingFilter.builder() .valueListWithStrings(OFFER_TARGETING_BUYERACCOUNTS) .build()) .buyerAccounts(OfferBuyerAccountsFilter.builder() .wildCardValue(BUYER_ACCOUNT_ID) .build()) .availabilityEndDate(OfferAvailabilityEndDateFilter.builder() .dateRange(OfferAvailabilityEndDateFilterDateRange.builder() .afterValue(offerAvailableEndDateAfterValue).build()) .build()) .releaseDate(OfferReleaseDateFilter.builder() .dateRange(OfferReleaseDateFilterDateRange.builder() .afterValue(offerReleaseDateAfterValue) .build()) .build()) .build()) .build(); ListEntitiesRequest listEntitiesRequest = ListEntitiesRequest.builder() .catalog(AWS_MP_CATALOG) .entityType(ENTITY_TYPE_OFFER).maxResults(10) .entityTypeFilters(entityTypeFilters) .nextToken(null) .build(); ListEntitiesResponse listEntitiesResponse = marketplaceCatalogClient.listEntities(listEntitiesRequest); List<EntitySummary> entitySummaryList = new ArrayList<EntitySummary>(); entitySummaryList.addAll(listEntitiesResponse.entitySummaryList()); while ( listEntitiesResponse.nextToken() != null && listEntitiesResponse.nextToken().length() > 0) { listEntitiesRequest = ListEntitiesRequest.builder() .catalog(AWS_MP_CATALOG) .entityType(ENTITY_TYPE_OFFER) .maxResults(10) .entityTypeFilters(entityTypeFilters) .nextToken(listEntitiesResponse.nextToken()) .build(); listEntitiesResponse = marketplaceCatalogClient.listEntities(listEntitiesRequest); entitySummaryList.addAll(listEntitiesResponse.entitySummaryList()); } return entitySummaryList; } }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何列出特定產品 ID 的發行公有和私有優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

package com.example.awsmarketplace.catalogapi; import java.util.ArrayList; import java.util.List; import static com.example.awsmarketplace.utils.ReferenceCodesConstants.*; import com.example.awsmarketplace.utils.ReferenceCodesUtils; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.http.apache.ApacheHttpClient; import software.amazon.awssdk.services.marketplacecatalog.MarketplaceCatalogClient; import software.amazon.awssdk.services.marketplacecatalog.model.EntitySummary; import software.amazon.awssdk.services.marketplacecatalog.model.EntityTypeFilters; import software.amazon.awssdk.services.marketplacecatalog.model.ListEntitiesRequest; import software.amazon.awssdk.services.marketplacecatalog.model.ListEntitiesResponse; import software.amazon.awssdk.services.marketplacecatalog.model.OfferFilters; import software.amazon.awssdk.services.marketplacecatalog.model.OfferProductIdFilter; import software.amazon.awssdk.services.marketplacecatalog.model.OfferStateFilter; import software.amazon.awssdk.services.marketplacecatalog.model.OfferTargetingFilter; public class ListProductPublicOrPrivateReleasedOffers { /* * List released Public/Private offers for a specific product id. * Example below is to list released public offers. * To change to released private offers, change OFFER_TARGETING_NONE (None) to OFFER_TARGETING_BUYERACCOUNTS(BuyerAccounts) */ public static void main(String[] args) { List<EntitySummary> entitySummaryList = getEntitySummaryLIst(); ReferenceCodesUtils.formatOutput(entitySummaryList); } public static List<EntitySummary> getEntitySummaryLIst() { MarketplaceCatalogClient marketplaceCatalogClient = MarketplaceCatalogClient.builder() .httpClient(ApacheHttpClient.builder().build()) .credentialsProvider(ProfileCredentialsProvider.create()) .build(); // define list entities filters EntityTypeFilters entityTypeFilters = EntityTypeFilters.builder() .offerFilters(OfferFilters.builder() .targeting(OfferTargetingFilter.builder() .valueListWithStrings(OFFER_TARGETING_NONE) .build()) .state(OfferStateFilter.builder() .valueListWithStrings(OFFER_STATE_RELEASED) .build()) .productId(OfferProductIdFilter.builder() .valueList(PRODUCT_ID) .build()) .build()) .build(); ListEntitiesRequest listEntitiesRequest = ListEntitiesRequest.builder() .catalog(AWS_MP_CATALOG) .entityType(ENTITY_TYPE_OFFER) .maxResults(10) .entityTypeFilters(entityTypeFilters) .nextToken(null) .build(); ListEntitiesResponse listEntitiesResponse = marketplaceCatalogClient.listEntities(listEntitiesRequest); // save all entitySummary of the results into entitySummaryList List<EntitySummary> entitySummaryList = new ArrayList<EntitySummary>(); entitySummaryList.addAll(listEntitiesResponse.entitySummaryList()); while ( listEntitiesResponse.nextToken() != null && listEntitiesResponse.nextToken().length() > 0) { listEntitiesRequest = ListEntitiesRequest.builder() .catalog(AWS_MP_CATALOG) .entityType(ENTITY_TYPE_OFFER) .maxResults(10) .entityTypeFilters(entityTypeFilters) .nextToken(listEntitiesResponse.nextToken()) .build(); listEntitiesResponse = marketplaceCatalogClient.listEntities(listEntitiesRequest); entitySummaryList.addAll(listEntitiesResponse.entitySummaryList()); } return entitySummaryList; } }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何更新要約,以使用 Pay-As-You-Go 定價來套用合約。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "offer-1111111111111" }, "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" } } ] } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何更新要約以套用每小時年度定價。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "offer-1111111111111" }, "DetailsDocument": { "PricingModel": "Usage", "Terms": [ { "Type": "UsageBasedPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "RateCard": [ { "DimensionKey": "m5.large", "Price": "0.13" } ] } ] }, { "Type": "ConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P365D" }, "RateCard": [ { "DimensionKey": "m5.large", "Price": "20.03" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何更新要約,以將目標套用至特定地理區域。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "UpdateTargeting", "Entity": { "Type": "Offer@1.0", "Identifier": "offer-1111111111111" }, "DetailsDocument": { "PositiveTargeting": { "CountryCodes": [ "US", "ES", "FR", "AU" ] } } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何更新公開優惠的名稱和描述。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "offer-1111111111111" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何更新要約的 EULA。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "offer-1111111111111" }, "DetailsDocument": { "Name": "New offer name", "Description": "New offer description" } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何將私有優惠的到期日更新為未來的日期,讓買家有更多時間評估並接受優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "offer-1111111111111" }, "DetailsDocument": { "AvailabilityEndDate": "2026-01-01" } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何更新 SaaS 產品的公有免費試用優惠的免費試用期間。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "offer-1111111111111" }, "DetailsDocument": { "PricingModel": "Usage", "Terms": [ { "Type": "FreeTrialPricingTerm", "Duration": "P21D", "Grants": [ { "DimensionKey": "WorkloadSmall" }, { "DimensionKey": "WorkloadMedium" } ] } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何更新優惠的退款政策。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "UpdateSupportTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "offer-1111111111111" }, "DetailsDocument": { "Terms": [ { "Type": "SupportTerm", "RefundPolicy": "Updated refund policy description" } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

產品

下列程式碼範例示範如何描述 AMI、SaaS 或容器產品,並檢查是否包含您想要知道的有關產品的所有資訊。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package com.example.awsmarketplace.catalogapi; import static com.example.awsmarketplace.utils.ReferenceCodesConstants.*; import com.example.awsmarketplace.utils.ReferenceCodesUtils; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.http.apache.ApacheHttpClient; import software.amazon.awssdk.services.marketplacecatalog.MarketplaceCatalogClient; import software.amazon.awssdk.services.marketplacecatalog.model.DescribeEntityRequest; import software.amazon.awssdk.services.marketplacecatalog.model.DescribeEntityResponse; public class DescribeEntity { /* * Describe my AMI or SaaS or Container product and check if it contains all the information I need to know about the product */ public static void main(String[] args) { String offerId = args.length > 0 ? args[0] : OFFER_ID; DescribeEntityResponse describeEntityResponse = getDescribeEntityResponse(offerId); ReferenceCodesUtils.formatOutput(describeEntityResponse); } public static DescribeEntityResponse getDescribeEntityResponse(String offerId) { MarketplaceCatalogClient marketplaceCatalogClient = MarketplaceCatalogClient.builder() .httpClient(ApacheHttpClient.builder().build()) .credentialsProvider(ProfileCredentialsProvider.create()) .build(); DescribeEntityRequest describeEntityRequest = DescribeEntityRequest.builder() .catalog(AWS_MP_CATALOG) .entityId(offerId) .build(); DescribeEntityResponse describeEntityResponse = marketplaceCatalogClient.describeEntity(describeEntityRequest); return describeEntityResponse; } }
  • 如需 API 詳細資訊,請參閱 DescribeEntity AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何列出所有 AMI、SaaS 或容器產品和相關聯的公開優惠。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

package com.example.awsmarketplace.catalogapi; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import static com.example.awsmarketplace.utils.ReferenceCodesConstants.*; import com.example.awsmarketplace.utils.ReferenceCodesUtils; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.http.apache.ApacheHttpClient; import software.amazon.awssdk.services.marketplacecatalog.MarketplaceCatalogClient; import software.amazon.awssdk.services.marketplacecatalog.model.EntitySummary; import software.amazon.awssdk.services.marketplacecatalog.model.EntityTypeFilters; import software.amazon.awssdk.services.marketplacecatalog.model.ListEntitiesRequest; import software.amazon.awssdk.services.marketplacecatalog.model.ListEntitiesResponse; import software.amazon.awssdk.services.marketplacecatalog.model.OfferFilters; import software.amazon.awssdk.services.marketplacecatalog.model.OfferProductIdFilter; import software.amazon.awssdk.services.marketplacecatalog.model.OfferStateFilter; import software.amazon.awssdk.services.marketplacecatalog.model.OfferTargetingFilter; public class ListEntities { /* * List all my AMI or SaaS or Container products and associated public offers */ public static void main(String[] args) { Map<String, List<EntitySummary>> allProductsWithOffers = getAllProductsWithOffers(); ReferenceCodesUtils.formatOutput(allProductsWithOffers); } public static Map<String, List<EntitySummary>> getAllProductsWithOffers() { MarketplaceCatalogClient marketplaceCatalogClient = MarketplaceCatalogClient.builder() .httpClient(ApacheHttpClient.builder().build()) .credentialsProvider(ProfileCredentialsProvider.create()) .build(); Map<String, List<EntitySummary>> allProductsWithOffers = new HashMap<String, List<EntitySummary>> (); // get all product entities List<EntitySummary> productEntityList = new ArrayList<EntitySummary>(); ListEntitiesRequest listEntitiesRequest = ListEntitiesRequest.builder() .catalog(AWS_MP_CATALOG) .entityType(PRODUCT_TYPE_AMI) .maxResults(10) .nextToken(null) .build(); ListEntitiesResponse listEntitiesResponse = marketplaceCatalogClient.listEntities(listEntitiesRequest); productEntityList.addAll(listEntitiesResponse.entitySummaryList()); while (listEntitiesResponse.nextToken() != null) { listEntitiesRequest = ListEntitiesRequest.builder() .catalog(AWS_MP_CATALOG) .entityType(PRODUCT_TYPE_AMI) .maxResults(10) .nextToken(listEntitiesResponse.nextToken()) .build(); listEntitiesResponse = marketplaceCatalogClient.listEntities(listEntitiesRequest); productEntityList.addAll(listEntitiesResponse.entitySummaryList()); } // loop through each product entity and get the public released offers associated using product id filter for ( EntitySummary productEntitySummary : productEntityList) { EntityTypeFilters entityTypeFilters = EntityTypeFilters.builder() .offerFilters(OfferFilters.builder() .targeting(OfferTargetingFilter.builder() .valueListWithStrings(OFFER_TARGETING_NONE) .build()) .state(OfferStateFilter.builder() .valueListWithStrings(OFFER_STATE_RELEASED) .build()) .productId(OfferProductIdFilter.builder() .valueList(productEntitySummary.entityId()) .build()) .build()) .build(); listEntitiesRequest = ListEntitiesRequest.builder() .catalog(AWS_MP_CATALOG) .entityType(ENTITY_TYPE_OFFER) .maxResults(10) .entityTypeFilters(entityTypeFilters) .nextToken(null) .build(); listEntitiesResponse = marketplaceCatalogClient.listEntities(listEntitiesRequest); // save all entitySummary of the results into entitySummaryList List<EntitySummary> offerEntitySummaryList = new ArrayList<EntitySummary>(); offerEntitySummaryList.addAll(listEntitiesResponse.entitySummaryList()); while ( listEntitiesResponse.nextToken() != null && listEntitiesResponse.nextToken().length() > 0) { listEntitiesRequest = ListEntitiesRequest.builder() .catalog(AWS_MP_CATALOG) .entityType(ENTITY_TYPE_OFFER) .maxResults(10) .entityTypeFilters(entityTypeFilters) .nextToken(listEntitiesResponse.nextToken()) .build(); listEntitiesResponse = marketplaceCatalogClient.listEntities(listEntitiesRequest); offerEntitySummaryList.addAll(listEntitiesResponse.entitySummaryList()); } // save final results into map; key = product id; value = offer entity summary list allProductsWithOffers.put(productEntitySummary.entityId(), offerEntitySummaryList); } return allProductsWithOffers; } }

轉售授權

下列程式碼範例示範如何為任何產品類型建立轉售授權草稿,以便在發佈至通路合作夥伴之前進行內部檢閱。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateResaleAuthorization", "ChangeName": "ResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "ResellerAccountId": "111111111111" } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何描述轉售授權。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package com.example.awsmarketplace.catalogapi; import static com.example.awsmarketplace.utils.ReferenceCodesConstants.*; import com.example.awsmarketplace.utils.ReferenceCodesUtils; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.http.apache.ApacheHttpClient; import software.amazon.awssdk.services.marketplacecatalog.MarketplaceCatalogClient; import software.amazon.awssdk.services.marketplacecatalog.model.DescribeEntityRequest; import software.amazon.awssdk.services.marketplacecatalog.model.DescribeEntityResponse; public class DescribeEntity { /* * Describe my AMI or SaaS or Container product and check if it contains all the information I need to know about the product */ public static void main(String[] args) { String offerId = args.length > 0 ? args[0] : OFFER_ID; DescribeEntityResponse describeEntityResponse = getDescribeEntityResponse(offerId); ReferenceCodesUtils.formatOutput(describeEntityResponse); } public static DescribeEntityResponse getDescribeEntityResponse(String offerId) { MarketplaceCatalogClient marketplaceCatalogClient = MarketplaceCatalogClient.builder() .httpClient(ApacheHttpClient.builder().build()) .credentialsProvider(ProfileCredentialsProvider.create()) .build(); DescribeEntityRequest describeEntityRequest = DescribeEntityRequest.builder() .catalog(AWS_MP_CATALOG) .entityId(offerId) .build(); DescribeEntityResponse describeEntityResponse = marketplaceCatalogClient.describeEntity(describeEntityRequest); return describeEntityResponse; } }
  • 如需 API 詳細資訊,請參閱 DescribeEntity AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用私有優惠發佈一次性轉售授權,讓通路合作夥伴可以使用它來建立通路合作夥伴私有優惠 (CPPO)。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateResaleAuthorization", "ChangeName": "ResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "ResellerAccountId": "111111111111" } }, { "ChangeType": "ReleaseResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ResaleConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "t2.small", "Price": "150" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerLegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "OffersMaxQuantity": 1 } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈 AMI 產品的多次使用轉售授權,其到期日為每小時定價,以便通路合作夥伴使用它來建立 CPPO。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateResaleAuthorization", "ChangeName": "ResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "ResellerAccountId": "111111111111" } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerLegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ResaleConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "t2.small", "Price": "150" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-05-31" } }, { "ChangeType": "ReleaseResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈任何產品類型的多用途轉售授權,並新增要傳送給買方的自訂 EULA。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateResaleAuthorization", "ChangeName": "ResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "ResellerAccountId": "111111111111" } }, { "ChangeType": "ReleaseResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-05-31" } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ResaleConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "t2.small", "Price": "150" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerLegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈任何產品類型的多用途轉售授權,以及新增 ISV 和 Channel Partner 之間的經銷商合約文件。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateResaleAuthorization", "ChangeName": "ResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "ResellerAccountId": "111111111111" } }, { "ChangeType": "ReleaseResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-05-31" } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerLegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] }, { "Type": "ResaleLegalTerm", "Documents": [ { "Type": "CustomResellerContract", "Url": "https://s3.amazonaws.com/aws-mp-standard-contracts/Standard-Contact-for-AWS-Marketplace-2022-07-14.pdf"} ] } ] } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ResaleConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "t2.small", "Price": "150" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈具有任何產品類型過期日期的多次使用轉售授權,以及為轉售新增特定買方帳戶。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateResaleAuthorization", "ChangeName": "ResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "ResellerAccountId": "111111111111" } }, { "ChangeType": "ReleaseResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-05-31" } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ResaleConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "t2.small", "Price": "150" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "UpdateBuyerTargetingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerTargetingTerm", "PositiveTargeting": { "BuyerAccounts": [ "111111111111" ] } } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerLegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈 AMI 產品的多次使用轉售授權,而不需要過期日期,且具有每小時年度定價,因此 CP 可以使用該授權來建立 CPPO。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateResaleAuthorization", "ChangeName": "ResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "ResellerAccountId": "111111111111" } }, { "ChangeType": "ReleaseResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ResaleConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "t2.small", "Price": "150" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerLegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈多次使用轉售授權,而不需要任何產品類型的過期日期,並新增要傳送給買方的自訂 EULA。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateResaleAuthorization", "ChangeName": "ResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "ResellerAccountId": "111111111111" } }, { "ChangeType": "ReleaseResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ResaleConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "t2.small", "Price": "150" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerLegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈多次使用轉售授權,而不需要任何產品類型的過期日期,並在 ISV 和 Channel Partner 之間新增經銷商合約文件。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateResaleAuthorization", "ChangeName": "ResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "ResellerAccountId": "111111111111" } }, { "ChangeType": "ReleaseResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ResaleConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "t2.small", "Price": "150" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerLegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] }, { "Type": "ResaleLegalTerm", "Documents": [ { "Type": "CustomResellerContract", "Url": "https://s3.amazonaws.com/aws-mp-standard-contracts/Standard-Contact-for-AWS-Marketplace-2022-07-14.pdf" } ] } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈多次使用轉售授權,而不需要任何產品類型的到期日,並新增轉售的特定買方帳戶。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateResaleAuthorization", "ChangeName": "ResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "ResellerAccountId": "111111111111" } }, { "ChangeType": "ReleaseResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ResaleConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "t2.small", "Price": "150" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "UpdateBuyerTargetingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerTargetingTerm", "PositiveTargeting": { "BuyerAccounts": [ "111111111111" ] } } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerLegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈任何產品類型的一次性轉售授權,並新增彈性付款排程。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateResaleAuthorization", "ChangeName": "ResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "ResellerAccountId": "111111111111" } }, { "ChangeType": "ReleaseResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ResaleFixedUpfrontPricingTerm", "CurrencyCode": "USD", "Price": "0.00", "Duration": "P12M", "Grants": [ { "DimensionKey": "Users", "MaxQuantity": 10 } ] } ] } }, { "ChangeType": "UpdatePaymentScheduleTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "ResalePaymentScheduleTerm", "CurrencyCode": "USD", "Schedule": [ { "ChargeDate": "2023-09-01", "ChargeAmount": "200.00" }, { "ChargeDate": "2023-12-01", "ChargeAmount": "250.00" } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-06-30", "OffersMaxQuantity": 1 } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerLegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈任何產品類型的一次性轉售授權,並新增要傳送給買方的自訂 EULA。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateResaleAuthorization", "ChangeName": "ResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "ResellerAccountId": "111111111111" } }, { "ChangeType": "ReleaseResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "OffersMaxQuantity": 1 } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ResaleConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "t2.small", "Price": "150" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerLegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈任何產品類型的一次性轉售授權,以及為轉售新增特定的買方帳戶。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateResaleAuthorization", "ChangeName": "ResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "ResellerAccountId": "111111111111" } }, { "ChangeType": "ReleaseResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ResaleConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "t2.small", "Price": "150" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerLegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "OffersMaxQuantity": "1" } }, { "ChangeType": "UpdateBuyerTargetingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerTargetingTerm", "PositiveTargeting": { "BuyerAccounts": [ "111111111111" ] } } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈任何產品類型的一次性轉售授權,以及在 ISV 和 Channel Partner 之間新增經銷商合約文件。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateResaleAuthorization", "ChangeName": "ResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "ResellerAccountId": "111111111111" } }, { "ChangeType": "ReleaseResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "OffersMaxQuantity": 1 } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ResaleConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "t2.small", "Price": "150" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerLegalTerm", "Documents": [ { "Type": "CustomEula", "Url": "https://s3.amazonaws.com/sample-bucket/custom-eula.pdf" } ] } ] } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈任何產品類型的一次性轉售授權,並新增是否為續約。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateResaleAuthorization", "ChangeName": "ResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0" }, "DetailsDocument": { "ProductId": "prod-1111111111111", "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "ResellerAccountId": "111111111111" } }, { "ChangeType": "UpdateBuyerTargetingTerms", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "BuyerTargetingTerm", "PositiveTargeting": { "BuyerAccounts": [ "222222222222" ] } } ] } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "OffersMaxQuantity": 1 } }, { "ChangeType":"UpdateInformation", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "$ResaleAuthorization.Entity.Identifier" }, "DetailsDocument": { "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product", "PreExistingBuyerAgreement": { "AcquisitionChannel": "AwsMarketplace", "PricingModel": "Contract" } } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何限制轉售授權。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "RestrictResaleAuthorization", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "resaleauthz-1111111111111" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何在發佈任何產品類型之前,更新一次性或多次使用轉售授權的名稱和描述。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType":"UpdateInformation", "Entity": { "Type": "ResaleAuthorization@1.0", "Identifier": "resaleauthz-1111111111111" }, "DetailsDocument": { "Name": "TestResaleAuthorization", "Description": "Worldwide ResaleAuthorization for Test Product" } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

SaaS 產品

下列程式碼範例示範如何使用草擬公有優惠建立草擬 SaaS 產品。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "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" } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用合約定價建立公有或有限 SaaS 產品和公有優惠。此範例會建立標準或自訂 EULA。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateProduct", "Entity": { "Type": "SaaSProduct@1.0" }, "ChangeName": "CreateProductChange", "DetailsDocument": {} }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "ProductTitle": "Sample product", "ShortDescription": "Brief description", "LongDescription": "Detailed description", "Highlights": [ "Sample highlight" ], "SearchKeywords": [ "Sample keyword" ], "Categories": [ "Data Catalogs" ], "LogoUrl": "https://s3.amazonaws.com/logos/sample.png", "VideoUrls": [ "https://sample.amazonaws.com/awsmp-video-1" ], "AdditionalResources": [] } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111", "222222222222" ] } } }, { "ChangeType": "AddDeliveryOptions", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "DeliveryOptions": [ { "Details": { "SaaSUrlDeliveryOptionDetails": { "FulfillmentUrl":"https://sample.amazonaws.com/sample-saas-fulfillment-url" } } } ] } }, { "ChangeType": "AddDimensions", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": [ { "Key": "BasicService", "Description": "Basic Service", "Name": "Basic Service", "Types": [ "Entitled" ], "Unit": "Units" }, { "Key": "PremiumService", "Description": "Premium Service", "Name": "Premium Service", "Types": [ "Entitled" ], "Unit": "Units" } ] }, { "ChangeType": "ReleaseProduct", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "CreateOffer", "Entity": { "Type": "Offer@1.0" }, "ChangeName": "CreateOfferChange", "DetailsDocument": { "ProductId": "$CreateProductChange.Entity.Identifier" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "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": "ConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P1M" }, "RateCard": [ { "DimensionKey": "BasicService", "Price": "20" }, { "DimensionKey": "PremiumService", "Price": "25" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } }, { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "BasicService", "Price": "150" }, { "DimensionKey": "PremiumService", "Price": "300" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2022-07-14" } ] } ] } }, { "ChangeType": "UpdateSupportTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "SupportTerm", "RefundPolicy": "Absolutely no refund, period." } ] } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用Word Pay-As-You-Go定價的合約建立公有或有限 SaaS 產品和公有優惠。此範例會建立標準或自訂 EULA。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateProduct", "Entity": { "Type": "SaaSProduct@1.0" }, "ChangeName": "CreateProductChange", "DetailsDocument": {} }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "ProductTitle": "Sample product", "ShortDescription": "Brief description", "LongDescription": "Detailed description", "Highlights": [ "Sample highlight" ], "SearchKeywords": [ "Sample keyword" ], "Categories": [ "Data Catalogs" ], "LogoUrl": "https://s3.amazonaws.com/logos/sample.png", "VideoUrls": [ "https://sample.amazonaws.com/awsmp-video-1" ], "AdditionalResources": [] } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111", "222222222222" ] } } }, { "ChangeType": "AddDeliveryOptions", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "DeliveryOptions": [ { "Details": { "SaaSUrlDeliveryOptionDetails": { "FulfillmentUrl":"https://sample.amazonaws.com/sample-saas-fulfillment-url" } } } ] } }, { "ChangeType": "AddDimensions", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": [ { "Key": "BasicService", "Description": "Basic Service", "Name": "Basic Service", "Types": [ "Entitled" ], "Unit": "Units" }, { "Key": "PremiumService", "Description": "Premium Service", "Name": "Premium Service", "Types": [ "Entitled" ], "Unit": "Units" }, { "Key": "WorkloadSmall", "Description": "Workload: Per medium instance", "Name": "Workload: Per medium instance", "Types": [ "ExternallyMetered" ], "Unit": "Units" }, { "Key": "WorkloadMedium", "Description": "Workload: Per large instance", "Name": "Workload: Per large instance", "Types": [ "ExternallyMetered" ], "Unit": "Units" } ] }, { "ChangeType": "ReleaseProduct", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "CreateOffer", "Entity": { "Type": "Offer@1.0" }, "ChangeName": "CreateOfferChange", "DetailsDocument": { "ProductId": "$CreateProductChange.Entity.Identifier" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "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" } } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2022-07-14" } ] } ] } }, { "ChangeType": "UpdateSupportTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "SupportTerm", "RefundPolicy": "Absolutely no refund, period." } ] } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何使用訂閱定價建立公有或有限 SaaS 產品和公有優惠。此範例會建立標準或自訂 EULA。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateProduct", "Entity": { "Type": "SaaSProduct@1.0" }, "ChangeName": "CreateProductChange", "DetailsDocument": {} }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "ProductTitle": "Sample product", "ShortDescription": "Brief description", "LongDescription": "Detailed description", "Highlights": [ "Sample highlight" ], "SearchKeywords": [ "Sample keyword" ], "Categories": [ "Data Catalogs" ], "LogoUrl": "https://s3.amazonaws.com/logos/sample.png", "VideoUrls": [ "https://sample.amazonaws.com/awsmp-video-1" ], "AdditionalResources": [] } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": [ "111111111111", "222222222222" ] } } }, { "ChangeType": "AddDeliveryOptions", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "DeliveryOptions": [ { "Details": { "SaaSUrlDeliveryOptionDetails": { "FulfillmentUrl":"https://sample.amazonaws.com/sample-saas-fulfillment-url" } } } ] } }, { "ChangeType": "AddDimensions", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": [ { "Key": "WorkloadSmall", "Description": "Workload: Per medium instance", "Name": "Workload: Per medium instance", "Types": [ "ExternallyMetered" ], "Unit": "Units" }, { "Key": "WorkloadMedium", "Description": "Workload: Per large instance", "Name": "Workload: Per large instance", "Types": [ "ExternallyMetered" ], "Unit": "Units" } ] }, { "ChangeType": "ReleaseProduct", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "CreateOffer", "Entity": { "Type": "Offer@1.0" }, "ChangeName": "CreateOfferChange", "DetailsDocument": { "ProductId": "$CreateProductChange.Entity.Identifier" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "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": "Usage", "Terms": [ { "Type": "UsageBasedPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "RateCard": [ { "DimensionKey": "WorkloadSmall", "Price": "0.15" }, { "DimensionKey": "WorkloadMedium", "Price": "0.25" } ] } ] } ] } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2022-07-14" } ] } ] } }, { "ChangeType": "UpdateSupportTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "SupportTerm", "RefundPolicy": "Absolutely no refund, period." } ] } }, { "ChangeType": "ReleaseOffer", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何發佈 SaaS 產品和相關聯的公開優惠。根據預設,產品將處於有限狀態。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog":"AWSMarketplace", "ChangeSet": [ { "ChangeType": "CreateProduct", "ChangeName": "CreateProductChange", "Entity": { "Type": "SaaSProduct@1.0" }, "DetailsDocument": {} }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "ProductTitle": "Sample product", "ShortDescription": "Brief description", "LongDescription": "Detailed description", "Highlights": [ "Sample highlight" ], "SearchKeywords": [ "Sample keyword" ], "Categories": [ "Data Catalogs" ], "LogoUrl": "https://bucketname.s3.amazonaws.com/logo.png", "VideoUrls": [ "https://sample.amazonaws.com/awsmp-video-1" ], "AdditionalResources": [] } }, { "ChangeType": "AddDimensions", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": [ { "Key": "BasicService", "Description": "Basic Service", "Name": "Basic Service", "Types": [ "Entitled" ], "Unit": "Units" }, { "Key": "PremiumService", "Description": "Premium Service", "Name": "Premium Service", "Types": [ "Entitled" ], "Unit": "Units" } ] }, { "ChangeType": "AddDeliveryOptions", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": { "DeliveryOptions": [ { "Details": { "SaaSUrlDeliveryOptionDetails": { "FulfillmentUrl": "https://www.aws.amazon.com/marketplace/management" } } } ] } }, { "ChangeType": "ReleaseProduct", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "$CreateProductChange.Entity.Identifier" }, "DetailsDocument": {} }, { "ChangeType": "CreateOffer", "ChangeName": "CreateOfferChange", "Entity": { "Type": "Offer@1.0" }, "DetailsDocument": { "ProductId": "$CreateProductChange.Entity.Identifier" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Name": "New Test Offer", "Description": "New offer description" } }, { "ChangeType": "UpdateLegalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "LegalTerm", "Documents": [ { "Type": "StandardEula", "Version": "2022-07-14" } ] } ] } }, { "ChangeType": "UpdateSupportTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "SupportTerm", "RefundPolicy": "Updated refund policy description" } ] } }, { "ChangeType": "UpdatePricingTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "PricingModel": "Contract", "Terms": [ { "Type": "ConfigurableUpfrontPricingTerm", "CurrencyCode": "USD", "RateCards": [ { "Selector": { "Type": "Duration", "Value": "P1M" }, "RateCard": [ { "DimensionKey": "BasicService", "Price": "20" }, { "DimensionKey": "PremiumService", "Price": "25" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } }, { "Selector": { "Type": "Duration", "Value": "P12M" }, "RateCard": [ { "DimensionKey": "BasicService", "Price": "150" }, { "DimensionKey": "PremiumService", "Price": "300" } ], "Constraints": { "MultipleDimensionSelection": "Allowed", "QuantityConfiguration": "Allowed" } } ] } ] } }, { "ChangeType": "UpdateRenewalTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "RenewalTerm" } ] } }, { "ChangeType":"ReleaseOffer", "Entity":{ "Type": "Offer@1.0", "Identifier": "$CreateOfferChange.Entity.Identifier" }, "DetailsDocument": {} } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何從現有草稿發佈 SaaS 產品和相關聯的公有優惠。根據預設,產品將處於有限狀態。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

{ "Catalog":"AWSMarketplace", "ChangeSet": [ { "ChangeType": "UpdateVisibility", "ChangeName": "CreateProductChange", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "prod-1111111111111" }, "DetailsDocument": { "TargetVisibility": "Public" } } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

下列程式碼範例示範如何更新 AMI 或 SaaS 產品的維度。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

若要執行此範例,請在公用程式RunChangesets中將下列 JSON 變更集傳遞至 ,從公用程式區段啟動變更集。

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType": "UpdateDimensions", "Entity": { "Type": "SaaSProduct@1.0", "Identifier": "prod-111111111111" }, "DetailsDocument": [ { "Key": "BasicService", "Types": [ "Entitled" ], "Name": "Some new name", "Description": "Some new description" } ] } ] }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API

公用程式

下列程式碼範例示範如何定義公用程式以啟動變更集。

Java 2.x 的 SDK
注意

還有更多 on GitHub。尋找完整的範例,並了解如何在 AWS Marketplace API 參考程式碼庫儲存庫中設定和執行。

從 JSON 檔案載入變更集並開始處理的公用程式。

package com.example.awsmarketplace.catalogapi; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.core.document.Document; import software.amazon.awssdk.http.apache.ApacheHttpClient; import software.amazon.awssdk.protocols.json.internal.unmarshall.document.DocumentUnmarshaller; import software.amazon.awssdk.protocols.jsoncore.JsonNodeParser; import software.amazon.awssdk.services.marketplacecatalog.MarketplaceCatalogClient; import software.amazon.awssdk.services.marketplacecatalog.model.Change; import software.amazon.awssdk.services.marketplacecatalog.model.Entity; import software.amazon.awssdk.services.marketplacecatalog.model.StartChangeSetRequest; import software.amazon.awssdk.services.marketplacecatalog.model.StartChangeSetResponse; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.ToNumberPolicy; import com.example.awsmarketplace.catalogapi.Entity.ChangeSet; import com.example.awsmarketplace.catalogapi.Entity.ChangeSetEntity; import com.example.awsmarketplace.catalogapi.Entity.Root; import com.example.awsmarketplace.utils.ReferenceCodesUtils; import com.example.awsmarketplace.utils.StringSerializer; /** * Before running this Java V2 code example, convert all Details attribute to DetailsDocument if any */ public class RunChangesets { private static final Gson GSON = new GsonBuilder() .setObjectToNumberStrategy(ToNumberPolicy.LAZILY_PARSED_NUMBER) .registerTypeAdapter(String.class, new StringSerializer()) .create(); public static void main(String[] args) { // input json can be specified here or passed from input parameter String inputChangeSetFile = "changeSets/offers/CreateReplacementOfferFromAGWithContractPricingDetailDocument.json"; if (args.length > 0) inputChangeSetFile = args[0]; // parse the input changeset file to string for process String changeSetsInput = readChangeSetToString(inputChangeSetFile); // process the changeset request try { StartChangeSetResponse result = getChangeSetRequestResult(changeSetsInput); ReferenceCodesUtils.formatOutput(result); } catch (Exception e) { e.printStackTrace(); } } public static StartChangeSetResponse getChangeSetRequestResult(String changeSetsInput) throws IOException { //set up AWS credentials MarketplaceCatalogClient marketplaceCatalogClient = MarketplaceCatalogClient.builder() .httpClient(ApacheHttpClient.builder().build()) .credentialsProvider(ProfileCredentialsProvider.create()) .build(); //changeset list to save all the changesets in the changesets file List<Change> changeSetLists = new ArrayList<Change>(); // read all changesets into object Root root = GSON.fromJson(changeSetsInput, Root.class); // process each changeset and add each changeset request to changesets list for (ChangeSet cs : root.changeSet) { ChangeSetEntity entity = cs.Entity; String entityType = entity.Type; String entityIdentifier = StringUtils.defaultIfBlank(entity.Identifier, null); Document detailsDocument = getDocumentFromObject(cs.DetailsDocument); Entity awsEntity = Entity.builder() .type(entityType) .identifier(entityIdentifier) .build(); Change inputChangeRequest = Change.builder() .changeType(cs.ChangeType) .changeName(cs.ChangeName) .entity(awsEntity) .detailsDocument(detailsDocument) .build(); changeSetLists.add(inputChangeRequest); } // process all changeset requests StartChangeSetRequest startChangeSetRequest = StartChangeSetRequest.builder() .catalog(root.catalog) .changeSet(changeSetLists) .build(); StartChangeSetResponse result = marketplaceCatalogClient.startChangeSet(startChangeSetRequest); return result; } public static Document getDocumentFromObject(Object detailsObject) { String detailsString = "{}"; try { detailsString = IOUtils.toString(new ByteArrayInputStream(GSON.toJson(detailsObject).getBytes()), "UTF-8"); } catch (IOException e) { e.printStackTrace(); } JsonNodeParser jsonNodeParser = JsonNodeParser.create(); Document doc = jsonNodeParser.parse(detailsString).visit(new DocumentUnmarshaller()); return doc; } public static String readChangeSetToString (String inputChangeSetFile) { InputStream changesetInputStream = RunChangesets.class.getClassLoader().getResourceAsStream(inputChangeSetFile); String changeSetsInput = null; try { changeSetsInput = IOUtils.toString(changesetInputStream, "UTF-8"); } catch (IOException e) { e.printStackTrace(); } return changeSetsInput; } }
  • 如需 API 詳細資訊,請參閱 StartChangeSet AWS SDK for Java 2.x 參考中的 API