文档 AWS SDK 示例 GitHub 存储库中还有更多 S AWS DK 示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用适用于 SAP 的 SDK 的组织示例 ABAP
以下代码示例向您展示了如何使用适用于 SAP ABAP 的 SAP AWS SDK with Organizations 来执行操作和实现常见场景。
操作是大型程序的代码摘录,必须在上下文中运行。您可以通过操作了解如何调用单个服务函数,还可以通过函数相关场景的上下文查看操作。
每个示例都包含一个指向完整源代码的链接,您可以从中找到有关如何在上下文中设置和运行代码的说明。
主题
操作
以下代码示例演示了如何使用 AttachPolicy。
- 适用于 SAP ABAP 的 SDK
-
注意
还有更多相关信息 GitHub。在 AWS 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 TRY. lo_org->attachpolicy( iv_policyid = iv_policy_id iv_targetid = iv_target_id ). MESSAGE 'Policy attached to target.' TYPE 'I'. CATCH /aws1/cx_orgaccessdeniedex. MESSAGE 'You do not have permission to attach the policy.' TYPE 'E'. CATCH /aws1/cx_orgpolicynotfoundex. MESSAGE 'The specified policy does not exist.' TYPE 'E'. CATCH /aws1/cx_orgtargetnotfoundex. MESSAGE 'The specified target does not exist.' TYPE 'E'. CATCH /aws1/cx_orgduplicateplyatta00. MESSAGE 'The policy is already attached to the target.' TYPE 'E'. ENDTRY.-
有关 API 的详细信息,请参阅适用AttachPolicy于 S AP 的AWS SDK ABAP API 参考。
-
以下代码示例演示了如何使用 CreatePolicy。
- 适用于 SAP ABAP 的 SDK
-
注意
还有更多相关信息 GitHub。在 AWS 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 TRY. oo_result = lo_org->createpolicy( " oo_result is returned for testing purposes. " iv_name = iv_policy_name iv_description = iv_policy_description iv_content = iv_policy_content iv_type = iv_policy_type ). MESSAGE 'Policy created.' TYPE 'I'. CATCH /aws1/cx_orgaccessdeniedex. MESSAGE 'You do not have permission to create a policy.' TYPE 'E'. CATCH /aws1/cx_orgduplicatepolicyex. MESSAGE 'A policy with this name already exists.' TYPE 'E'. CATCH /aws1/cx_orgmalformedplydocex. MESSAGE 'The policy content is malformed.' TYPE 'E'. ENDTRY.-
有关 API 的详细信息,请参阅适用CreatePolicy于 S AP 的AWS SDK ABAP API 参考。
-
以下代码示例演示了如何使用 DeletePolicy。
- 适用于 SAP ABAP 的 SDK
-
注意
还有更多相关信息 GitHub。在 AWS 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 TRY. lo_org->deletepolicy( iv_policyid = iv_policy_id ). MESSAGE 'Policy deleted.' TYPE 'I'. CATCH /aws1/cx_orgaccessdeniedex. MESSAGE 'You do not have permission to delete the policy.' TYPE 'E'. CATCH /aws1/cx_orgpolicynotfoundex. MESSAGE 'The specified policy does not exist.' TYPE 'E'. CATCH /aws1/cx_orgpolicyinuseex. MESSAGE 'The policy is still attached to one or more targets.' TYPE 'E'. ENDTRY.-
有关 API 的详细信息,请参阅适用DeletePolicy于 S AP 的AWS SDK ABAP API 参考。
-
以下代码示例演示了如何使用 DescribePolicy。
- 适用于 SAP ABAP 的 SDK
-
注意
还有更多相关信息 GitHub。在 AWS 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 TRY. oo_result = lo_org->describepolicy( " oo_result is returned for testing purposes. " iv_policyid = iv_policy_id ). DATA(lo_policy) = oo_result->get_policy( ). MESSAGE 'Retrieved policy details.' TYPE 'I'. CATCH /aws1/cx_orgaccessdeniedex. MESSAGE 'You do not have permission to describe the policy.' TYPE 'E'. CATCH /aws1/cx_orgpolicynotfoundex. MESSAGE 'The specified policy does not exist.' TYPE 'E'. ENDTRY.-
有关 API 的详细信息,请参阅适用DescribePolicy于 S AP 的AWS SDK ABAP API 参考。
-
以下代码示例演示了如何使用 DetachPolicy。
- 适用于 SAP ABAP 的 SDK
-
注意
还有更多相关信息 GitHub。在 AWS 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 TRY. lo_org->detachpolicy( iv_policyid = iv_policy_id iv_targetid = iv_target_id ). MESSAGE 'Policy detached from target.' TYPE 'I'. CATCH /aws1/cx_orgaccessdeniedex. MESSAGE 'You do not have permission to detach the policy.' TYPE 'E'. CATCH /aws1/cx_orgpolicynotfoundex. MESSAGE 'The specified policy does not exist.' TYPE 'E'. CATCH /aws1/cx_orgtargetnotfoundex. MESSAGE 'The specified target does not exist.' TYPE 'E'. CATCH /aws1/cx_orgpolicynotattex. MESSAGE 'The policy is not attached to the target.' TYPE 'E'. ENDTRY.-
有关 API 的详细信息,请参阅适用DetachPolicy于 S AP 的AWS SDK ABAP API 参考。
-
以下代码示例演示了如何使用 ListPolicies。
- 适用于 SAP ABAP 的 SDK
-
注意
还有更多相关信息 GitHub。在 AWS 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 TRY. oo_result = lo_org->listpolicies( " oo_result is returned for testing purposes. " iv_filter = iv_filter ). DATA(lt_policies) = oo_result->get_policies( ). MESSAGE 'Retrieved list of policies.' TYPE 'I'. CATCH /aws1/cx_orgaccessdeniedex. MESSAGE 'You do not have permission to list policies.' TYPE 'E'. CATCH /aws1/cx_orgawsorgsnotinuseex. MESSAGE 'Your account is not a member of an organization.' TYPE 'E'. ENDTRY.-
有关 API 的详细信息,请参阅适用ListPolicies于 S AP 的AWS SDK ABAP API 参考。
-