CloudFront 使用适用于 SAP 的 SDK 的示例 - AWS 适用于 SAP 的 SDK ABA

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

CloudFront 使用适用于 SAP 的 SDK 的示例

以下代码示例向您展示了如何使用适用于 SAP ABAP 的 AWS SDK 来执行操作和实现常见场景。 CloudFront

操作是大型程序的代码摘录,必须在上下文中运行。您可以通过操作了解如何调用单个服务函数,还可以通过函数相关场景的上下文查看操作。

每个示例都包含一个指向完整源代码的链接,您可以从中找到有关如何在上下文中设置和运行代码的说明。

主题

操作

以下代码示例演示了如何使用 ListDistributions

适用于 SAP ABAP 的 SDK
注意

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

TRY. oo_result = lo_fnt->listdistributions( ). " oo_result is returned for testing purposes. " MESSAGE 'Retrieved list of CloudFront distributions.' TYPE 'I'. CATCH /aws1/cx_fntinvalidargument. MESSAGE 'Invalid argument provided.' TYPE 'E'. ENDTRY.
  • 有关 API 的详细信息,请参阅适用ListDistributions于 S AP 的AWS SDK ABAP API 参考

以下代码示例演示了如何使用 UpdateDistribution

适用于 SAP ABAP 的 SDK
注意

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

TRY. " Get the current distribution configuration and ETag " DATA(lo_distribution_config_result) = lo_fnt->getdistributionconfig( iv_id = iv_distribution_id ). DATA(lo_old_config) = lo_distribution_config_result->get_distributionconfig( ). DATA(lv_etag) = lo_distribution_config_result->get_etag( ). " Create a new distribution config with the updated comment " " Since the config object is immutable, we need to create a new one with all existing values " DATA(lo_new_config) = NEW /aws1/cl_fntdistributionconfig( iv_callerreference = lo_old_config->get_callerreference( ) io_aliases = lo_old_config->get_aliases( ) iv_defaultrootobject = lo_old_config->get_defaultrootobject( ) io_origins = lo_old_config->get_origins( ) io_origingroups = lo_old_config->get_origingroups( ) io_defaultcachebehavior = lo_old_config->get_defaultcachebehavior( ) io_cachebehaviors = lo_old_config->get_cachebehaviors( ) io_customerrorresponses = lo_old_config->get_customerrorresponses( ) iv_comment = iv_comment io_logging = lo_old_config->get_logging( ) iv_priceclass = lo_old_config->get_priceclass( ) iv_enabled = lo_old_config->get_enabled( ) io_viewercertificate = lo_old_config->get_viewercertificate( ) io_restrictions = lo_old_config->get_restrictions( ) iv_webaclid = lo_old_config->get_webaclid( ) iv_httpversion = lo_old_config->get_httpversion( ) iv_isipv6enabled = lo_old_config->get_isipv6enabled( ) ). " Update the distribution with the modified configuration " lo_fnt->updatedistribution( io_distributionconfig = lo_new_config iv_id = iv_distribution_id iv_ifmatch = lv_etag ). MESSAGE 'CloudFront distribution updated successfully.' TYPE 'I'. CATCH /aws1/cx_fntnosuchdistribution. MESSAGE 'Distribution does not exist.' TYPE 'E'. CATCH /aws1/cx_fntpreconditionfailed. MESSAGE 'Precondition failed - ETag mismatch.' TYPE 'E'. CATCH /aws1/cx_fntinvalidifmatchvrs. MESSAGE 'Invalid If-Match version.' TYPE 'E'. ENDTRY.
  • 有关 API 的详细信息,请参阅适用UpdateDistribution于 S AP 的AWS SDK ABAP API 参考