CloudFront contoh menggunakan SDK untuk SAP ABAP - AWS SDK untuk SAP ABAP

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

CloudFront contoh menggunakan SDK untuk SAP ABAP

Contoh kode berikut menunjukkan cara melakukan tindakan dan mengimplementasikan skenario umum dengan menggunakan AWS SDK untuk SAP ABAP dengan. CloudFront

Tindakan merupakan kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Sementara tindakan menunjukkan cara memanggil fungsi layanan individual, Anda dapat melihat tindakan dalam konteks dalam skenario terkait.

Setiap contoh menyertakan tautan ke kode sumber lengkap, di mana Anda dapat menemukan instruksi tentang cara mengatur dan menjalankan kode dalam konteks.

Tindakan

Contoh kode berikut menunjukkan cara menggunakanListDistributions.

SDK for SAP ABAP
catatan

Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di Repositori Contoh Kode 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.

Contoh kode berikut menunjukkan cara menggunakanUpdateDistribution.

SDK for SAP ABAP
catatan

Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di Repositori Contoh Kode 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.