Publikasikan draf CPPO dan perbarui markup harga menggunakan AWS SDK - AWS SDKContoh Kode

Ada lebih banyak AWS SDK contoh yang tersedia di GitHub repo SDKContoh AWS Dokumen.

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Publikasikan draf CPPO dan perbarui markup harga menggunakan AWS SDK

Contoh kode berikut menunjukkan cara mempublikasikan draf CPPO dan memperbarui markup harga.

Java
SDKuntuk Java 2.x
catatan

Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankan di repositori Perpustakaan Kode AWS Marketplace API Referensi.

Untuk menjalankan contoh ini, teruskan JSON changeset berikut ke RunChangesets dalam Utilities untuk memulai changeset dari bagian Utilities.

{ "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": {} } ] }
  • Untuk API detailnya, lihat StartChangeSetdi AWS SDK for Java 2.x APIReferensi.

Python
SDKuntuk Python (Boto3)
catatan

Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankan di repositori Perpustakaan Kode AWS Marketplace API Referensi.

{ "Catalog": "AWSMarketplace", "ChangeSet": [ { "ChangeType" : "CreateOfferUsingResaleAuthorization", "Entity": { "Type": "Offer@1.0" }, "ChangeName": "CreateCPPO", "DetailsDocument": { "ResaleAuthorizationId":"resaleauthz-1111111111111" } }, { "ChangeType": "UpdateInformation", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPO.Entity.Identifier" }, "DetailsDocument": { "Name": "Test Offer name", "Description":"Test Offer description" } }, { "ChangeType": "UpdateMarkup", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPO.Entity.Identifier" }, "DetailsDocument": { "Percentage" : "5.0" } }, { "ChangeType": "UpdateTargeting", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPO.Entity.Identifier" }, "DetailsDocument": { "PositiveTargeting": { "BuyerAccounts": ["111111111111"] } } }, { "ChangeType": "UpdateAvailability", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPO.Entity.Identifier" }, "DetailsDocument": { "AvailabilityEndDate": "2023-05-31" } }, { "ChangeType": "UpdateValidityTerms", "Entity": { "Type": "Offer@1.0", "Identifier": "$CreateCPPO.Entity.Identifier" }, "DetailsDocument": { "Terms": [ { "Type": "ValidityTerm", "AgreementDuration": "P450D" } ] } }, { "ChangeType":"ReleaseOffer", "Entity":{ "Type": "Offer@1.0", "Identifier": "$CreateCPPO.Entity.Identifier" }, "DetailsDocument": {} } ] }

Jalankan skrip ini untuk memulai changeset. Fungsi pembantu didefinisikan dalam Utilities untuk memulai changeset dari bagian Utilities.

# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 """ Purpose Shows how to use the AWS SDK for Python (Boto3) to publish “draft” CPPO for any product type (AMI/SaaS/Container) and update price markup CAPI-72 """ import os import utils.start_changeset as sc import utils.stringify_details as sd def main(change_set=None): if change_set is None: fname = "changeset.json" change_set_file = os.path.join(os.path.dirname(__file__), fname) stringified_change_set = sd.stringify_changeset(change_set_file) else: stringified_change_set = change_set response = sc.usage_demo( stringified_change_set, "Publish draft CPPO for any product type adn update price markup" ) return response if __name__ == "__main__": main()