Gunakan ListReceiptFilters dengan AWS SDK atau CLI - 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.

Gunakan ListReceiptFilters dengan AWS SDK atau CLI

Contoh kode berikut menunjukkan cara menggunakanListReceiptFilters.

C++
SDKuntuk C ++
catatan

Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode AWS.

//! List the receipt filters associated with this account. /*! \param filters; A vector of "ReceiptFilter" to receive the retrieved filters. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::listReceiptFilters(Aws::Vector<Aws::SES::Model::ReceiptFilter> &filters, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::ListReceiptFiltersRequest listReceiptFiltersRequest; Aws::SES::Model::ListReceiptFiltersOutcome outcome = sesClient.ListReceiptFilters( listReceiptFiltersRequest); if (outcome.IsSuccess()) { auto &retrievedFilters = outcome.GetResult().GetFilters(); if (!retrievedFilters.empty()) { filters.insert(filters.cend(), retrievedFilters.cbegin(), retrievedFilters.cend()); } } else { std::cerr << "Error retrieving IP address filters: " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
JavaScript
SDKuntuk JavaScript (v3)
catatan

Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode AWS.

import { ListReceiptFiltersCommand } from "@aws-sdk/client-ses"; import { sesClient } from "./libs/sesClient.js"; const createListReceiptFiltersCommand = () => new ListReceiptFiltersCommand({}); const run = async () => { const listReceiptFiltersCommand = createListReceiptFiltersCommand(); return await sesClient.send(listReceiptFiltersCommand); };
Python
SDKuntuk Python (Boto3)
catatan

Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode AWS.

class SesReceiptHandler: """Encapsulates Amazon SES receipt handling functions.""" def __init__(self, ses_client, s3_resource): """ :param ses_client: A Boto3 Amazon SES client. :param s3_resource: A Boto3 Amazon S3 resource. """ self.ses_client = ses_client self.s3_resource = s3_resource def list_receipt_filters(self): """ Gets the list of receipt filters for the current account. :return: The list of receipt filters. """ try: response = self.ses_client.list_receipt_filters() filters = response["Filters"] logger.info("Got %s receipt filters.", len(filters)) except ClientError: logger.exception("Couldn't get receipt filters.") raise else: return filters