

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

# Mendapatkan informasi tentang kebijakan organisasi Anda
<a name="orgs_manage_policies_info-operations"></a>

Topik ini menjelaskan berbagai cara untuk mendapatkan detail tentang kebijakan di organisasi Anda. Prosedur ini berlaku untuk *semua* jenis kebijakan. Anda harus mengaktifkan sebuah jenis kebijakan pada root organisasi sebelum Anda dapat melampirkan jenis kebijakan tersebut ke entitas apa pun di root organisasi tersebut. 

**Topics**
+ [Mencantumkan semua kebijakan](#list-all-pols-in-org)
+ [Melampirkan kebijakan terlampir](#list-all-pols-in-entity)
+ [Mencantumkan semua lampiran](#list-all-entities-attached-to-pol)
+ [Mendapatkan detail tentang sebuah kebijakan](#get-details-about-pol)

## Mencantumkan semua kebijakan
<a name="list-all-pols-in-org"></a>

**Izin minimum**  
Untuk mencantumkan kebijakan dalam organisasi Anda, Anda harus memiliki izin berikut:  
`organizations:ListPolicies`

Anda dapat melihat kebijakan di organisasi Anda di Konsol Manajemen AWS atau dengan menggunakan perintah AWS Command Line Interface (AWS CLI) atau operasi AWS SDK.

### Konsol Manajemen AWS
<a name="list-all-pols-in-org-console"></a><a name="proc-list-all-pols-in-org"></a>

**Untuk mencantumkan semua kebijakan di organisasi Anda**

1. Masuk ke [konsol AWS Organizations](https://console.aws.amazon.com/organizations/v2). Anda harus masuk sebagai pengguna IAM, mengambil IAM role, atau masuk sebagai pengguna root ([tidak direkomendasikan](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) di akun pengelolaan organisasi.

1. Pada halaman **[Kebijakan](https://console.aws.amazon.com/organizations/v2/home/policies)**, pilih nama jenis kebijakan yang ingin Anda cantumkan.

   Jika jenis kebijakan tertentu diaktifkan, maka konsol akan menampilkan daftar semua jenis kebijakan yang saat ini tersedia dalam organisasi.

1. Kembali ke halaman **[Kebijakan](https://console.aws.amazon.com/organizations/v2/home/policies)** dan ulangi untuk setiap jenis kebijakan.

### AWS CLI & AWS SDKs
<a name="list-all-pols-in-org-cli-sdk"></a>

Contoh kode berikut menunjukkan cara menggunakan`ListPolicies`.

------
#### [ .NET ]

**SDK untuk .NET**  
 Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di [Repositori Contoh Kode AWS](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/dotnetv3/Organizations#code-examples). 

```
    using System;
    using System.Threading.Tasks;
    using Amazon.Organizations;
    using Amazon.Organizations.Model;

    /// <summary>
    /// Shows how to list the AWS Organizations policies associated with an
    /// organization.
    /// </summary>
    public class ListPolicies
    {
        /// <summary>
        /// Initializes an Organizations client object, and then calls its
        /// ListPoliciesAsync method.
        /// </summary>
        public static async Task Main()
        {
            // Create the client object using the default account.
            IAmazonOrganizations client = new AmazonOrganizationsClient();

            // The value for the Filter parameter is required and must must be
            // one of the following:
            //     AISERVICES_OPT_OUT_POLICY
            //     BACKUP_POLICY
            //     SERVICE_CONTROL_POLICY
            //     TAG_POLICY
            var request = new ListPoliciesRequest
            {
                Filter = "SERVICE_CONTROL_POLICY",
                MaxResults = 5,
            };

            var response = new ListPoliciesResponse();
            try
            {
                do
                {
                    response = await client.ListPoliciesAsync(request);
                    response.Policies.ForEach(p => DisplayPolicies(p));
                    if (response.NextToken is not null)
                    {
                        request.NextToken = response.NextToken;
                    }
                }
                while (response.NextToken is not null);
            }
            catch (AWSOrganizationsNotInUseException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }

        /// <summary>
        /// Displays information about the Organizations policies associated
        /// with an organization.
        /// </summary>
        /// <param name="policy">An Organizations policy summary to display
        /// information on the console.</param>
        private static void DisplayPolicies(PolicySummary policy)
        {
            string policyInfo = $"{policy.Id} {policy.Name}\t{policy.Description}";

            Console.WriteLine(policyInfo);
        }
    }
```
+  Untuk detail API, lihat [ListPolicies](https://docs.aws.amazon.com/goto/DotNetSDKV3/organizations-2016-11-28/ListPolicies)di *Referensi AWS SDK untuk .NET API*. 

------
#### [ CLI ]

**AWS CLI**  
**Untuk mengambil daftar semua kebijakan dalam organisasi dari jenis tertentu**  
Contoh berikut menunjukkan cara untuk mendapatkan daftar SCPs, seperti yang ditentukan oleh parameter filter:  

```
aws organizations list-policies --filter SERVICE_CONTROL_POLICY
```
Outputnya mencakup daftar kebijakan dengan informasi ringkasan:  

```
{
        "Policies": [
                {
                        "Type": "SERVICE_CONTROL_POLICY",
                        "Name": "AllowAllS3Actions",
                        "AwsManaged": false,
                        "Id": "p-examplepolicyid111",
                        "Arn": "arn:aws:organizations::111111111111:policy/service_control_policy/p-examplepolicyid111",
                        "Description": "Enables account admins to delegate permissions for any S3 actions to users and roles in their accounts."
                },
                {
                        "Type": "SERVICE_CONTROL_POLICY",
                        "Name": "AllowAllEC2Actions",
                        "AwsManaged": false,
                        "Id": "p-examplepolicyid222",
                        "Arn": "arn:aws:organizations::111111111111:policy/service_control_policy/p-examplepolicyid222",
                        "Description": "Enables account admins to delegate permissions for any EC2 actions to users and roles in their accounts."
                },
                {
                        "AwsManaged": true,
                        "Description": "Allows access to every operation",
                        "Type": "SERVICE_CONTROL_POLICY",
                        "Id": "p-FullAWSAccess",
                        "Arn": "arn:aws:organizations::aws:policy/service_control_policy/p-FullAWSAccess",
                        "Name": "FullAWSAccess"
                }
        ]
}
```
+  Untuk detail API, lihat [ListPolicies](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/organizations/list-policies.html)di *Referensi AWS CLI Perintah*. 

------
#### [ Python ]

**SDK untuk Python (Boto3)**  
 Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di [Repositori Contoh Kode AWS](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/organizations#code-examples). 

```
def list_policies(policy_filter, orgs_client):
    """
    Lists the policies for the account, limited to the specified filter.

    :param policy_filter: The kind of policies to return.
    :param orgs_client: The Boto3 Organizations client.
    :return: The list of policies found.
    """
    try:
        response = orgs_client.list_policies(Filter=policy_filter)
        policies = response["Policies"]
        logger.info("Found %s %s policies.", len(policies), policy_filter)
    except ClientError:
        logger.exception("Couldn't get %s policies.", policy_filter)
        raise
    else:
        return policies
```
+  Untuk detail API, lihat [ListPolicies](https://docs.aws.amazon.com/goto/boto3/organizations-2016-11-28/ListPolicies)di *AWS SDK for Python (Boto3) Referensi* API. 

------
#### [ SAP ABAP ]

**SDK for SAP ABAP**  
 Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di [Repositori Contoh Kode AWS](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/sap-abap/services/org#code-examples). 

```
    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.
```
+  Untuk detail API, lihat [ListPolicies](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html)di *AWS SDK untuk referensi SAP ABAP* API. 

------

## Mencantumkan kebijakan kebijakan yang dilampirkan pada root, OU, atau akun
<a name="list-all-pols-in-entity"></a>

**Izin minimum**  
Untuk daftar kebijakan yang dilampirkan ke akar, unit organisasi (OU), atau akun dalam organisasi Anda, Anda harus memiliki izin berikut:  
`organizations:ListPoliciesForTarget` dengan elemen `Resource` dalam pernyataan kebijakan yang sama yang menyertakan Amazon Resource Name (ARN) dari target yang ditentukan (atau "\$1")

------
#### [ Konsol Manajemen AWS ]

**Untuk daftar semua kebijakan yang dilampirkan secara langsung ke root, OU, atau akun tertentu**

1. Masuk ke [konsol AWS Organizations](https://console.aws.amazon.com/organizations/v2). Anda harus masuk sebagai pengguna IAM, mengambil IAM role, atau masuk sebagai pengguna root ([tidak direkomendasikan](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) di akun pengelolaan organisasi.

1. Pada halaman **[Akun AWS](https://console.aws.amazon.com/organizations/v2/home/accounts)**, pilih nama root, OU, atau akun yang kebijakannya ingin Anda lihat. Anda mungkin harus memperluas OUs (memilih![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/id_id/organizations/latest/userguide/images/console-expand.png)) untuk menemukan OU yang Anda inginkan.

1. Pada halaman Root, OU, atau akun, pilih tab **Kebijakan**.

   Tab **Kebijakan** menampilkan semua kebijakan yang dilampirkan ke root, OU, atau akun, yang dikelompokkan dalam grup berdasarkan jenis kebijakan.

------
#### [ AWS CLI & AWS SDKs ]

**Untuk daftar semua kebijakan yang dilampirkan secara langsung ke root, OU, atau akun tertentu**  
Anda dapat menggunakan salah satu perintah berikut untuk mencantumkan kebijakan yang dilampirkan ke sebuah entitas:
+ AWS CLI: [list-policies-for-target](https://docs.aws.amazon.com/cli/latest/reference/organizations/list-policies-for-target.html)

  Contoh berikut mencantumkan semua kebijakan kontrol layanan yang dilampirkan pada OU tertentu. Anda harus menentukan ID dari root, OU, atau akun, dan jenis kebijakan yang ingin Anda cantumkan.

  ```
  $ aws organizations list-policies-for-target \
      --target-id ou-a1b2-f6g7h222 \
      --filter SERVICE_CONTROL_POLICY
  {
      "Policies": [
          {
              "Id": "p-FullAWSAccess",
              "Arn": "arn:aws:organizations::aws:policy/service_control_policy/p-FullAWSAccess",
              "Name": "FullAWSAccess",
              "Description": "Allows access to every operation",
              "Type": "SERVICE_CONTROL_POLICY",
              "AwsManaged": true
          }
      ]
  }
  ```
+ AWS SDKs: [ListPoliciesForTarget](https://docs.aws.amazon.com/organizations/latest/APIReference/API_ListPoliciesForTarget.html)

------

## Mencantumkan semua akar OUs,, dan akun yang dilampirkan kebijakan
<a name="list-all-entities-attached-to-pol"></a>

**Izin minimum**  
Untuk mencantumkan entitas yang padanya kebijakan terlampir, Anda harus memiliki izin berikut:  
`organizations:ListTargetsForPolicy` dengan elemen `Resource` dalam pernyataan kebijakan yang sama yang mencakup ARN dari kebijakan yang ditentukan (atau "\$1")

------
#### [ Konsol Manajemen AWS ]

**Untuk mencantumkan semua akar, OUs, dan akun yang memiliki kebijakan tertentu yang dilampirkan**

1. Masuk ke [konsol AWS Organizations](https://console.aws.amazon.com/organizations/v2). Anda harus masuk sebagai pengguna IAM, mengambil IAM role, atau masuk sebagai pengguna root ([tidak direkomendasikan](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) di akun pengelolaan organisasi.

1. Pada halaman **[Kebijakan](https://console.aws.amazon.com/organizations/v2/home/policies)**, pilih jenis kebijakan, lalu pilih nama kebijakan yang lampirannya ingin Anda periksa.

1. Pilih tab **Target**, untuk menampilkan tabel dari setiap root, OU, dan akun yang mempunyai kebijakan terlampir yang dipilih.

------
#### [ AWS CLI & AWS SDKs ]

**Untuk mencantumkan semua akar, OUs, dan akun yang memiliki kebijakan tertentu yang dilampirkan**  
Anda dapat menggunakan salah satu perintah berikut untuk mecantumkan entitas yang memiliki sebuah kebijakan:
+ AWS CLI: [list-targets-for-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/list-targets-for-policy.html)

  Contoh berikut menunjukkan semua lampiran ke root, OUs, dan akun untuk kebijakan yang ditentukan.

  ```
  $ aws organizations list-targets-for-policy \
      --policy-id p-FullAWSAccess
  {
      "Targets": [
          {
              "TargetId": "ou-a1b2-f6g7h111",
              "Arn": "arn:aws:organizations::123456789012:ou/o-aa111bb222/ou-a1b2-f6g7h111",
              "Name": "testou2",
              "Type": "ORGANIZATIONAL_UNIT"
          },
          {
              "TargetId": "ou-a1b2-f6g7h222",
              "Arn": "arn:aws:organizations::123456789012:ou/o-aa111bb222/ou-a1b2-f6g7h222",
              "Name": "testou1",
              "Type": "ORGANIZATIONAL_UNIT"
          },
          {
              "TargetId": "123456789012",
              "Arn": "arn:aws:organizations::123456789012:account/o-aa111bb222/123456789012",
              "Name": "My Management Account (bisdavid)",
              "Type": "ACCOUNT"
          },
          {
              "TargetId": "r-a1b2",
              "Arn": "arn:aws:organizations::123456789012:root/o-aa111bb222/r-a1b2",
              "Name": "Root",
              "Type": "ROOT"
          }
      ]
  }
  ```
+ AWS SDKs: [ListTargetsForPolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_ListTargetsForPolicy.html)

------

## Mendapatkan detail tentang sebuah kebijakan
<a name="get-details-about-pol"></a>

**Izin minimum**  
Untuk menampilkan detail kebijakan, Anda harus memiliki izin berikut:  
`organizations:DescribePolicy` dengan elemen `Resource` dalam pernyataan kebijakan yang sama yang mencakup ARN dari kebijakan yang ditentukan (atau "\$1")

### Konsol Manajemen AWS
<a name="get-details-about-pol-console"></a>

**Untuk mendapatkan detail tentang sebuah kebijakan**

1. Masuk ke [konsol AWS Organizations](https://console.aws.amazon.com/organizations/v2). Anda harus masuk sebagai pengguna IAM, mengambil IAM role, atau masuk sebagai pengguna root ([tidak direkomendasikan](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) di akun pengelolaan organisasi.

1. Pada halaman **[Kebijakan](https://console.aws.amazon.com/organizations/v2/home/policies)**, pilih jenis kebijakan yang ingin Anda periksa, dan kemudian pilih nama kebijakan tersebut.

   Halaman kebijakan tersebut akan menampilkan informasi yang tersedia tentang kebijakan, termasuk ARN, deskripsi, dan target terlampir. 
   + Tab **Daftar isi** menunjukkan isi kebijakan saat ini dalam format JSON.
   + Tab **Target** menampilkan daftar akar OUs, dan akun tempat kebijakan dilampirkan.
   + Tab **Tag** menunjukkan tag yang dilampirkan ke kebijakan. Catatan: Tab tag tidak tersedia untuk kebijakan terkelola AWS .

   Untuk mengedit kebijakan, pilih **Edit Kebijakan**. Karena setiap jenis kebijakan memiliki persyaratan pengeditan yang berbeda, lihat petunjuk untuk membuat dan memperbarui kebijakan dari jenis kebijakan yang Anda tentukan.

### AWS CLI & AWS SDKs
<a name="orgs_manage_accounts_create-new-cli-sdk"></a>

Contoh kode berikut menunjukkan cara menggunakan`DescribePolicy`.

------
#### [ CLI ]

**AWS CLI**  
**Untuk mendapatkan informasi tentang kebijakan**  
Contoh berikut menunjukkan cara meminta informasi tentang kebijakan:  

```
aws organizations describe-policy --policy-id p-examplepolicyid111
```
Outputnya mencakup objek kebijakan yang berisi detail tentang kebijakan:  

```
{
        "Policy": {
                "Content": "{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": \"*\",\n      \"Resource\": \"*\"\n    }\n  ]\n}",
                "PolicySummary": {
                        "Arn": "arn:aws:organizations::111111111111:policy/o-exampleorgid/service_control_policy/p-examplepolicyid111",
                        "Type": "SERVICE_CONTROL_POLICY",
                        "Id": "p-examplepolicyid111",
                        "AwsManaged": false,
                        "Name": "AllowAllS3Actions",
                        "Description": "Enables admins to delegate S3 permissions"
                }
        }
}
```
+  Untuk detail API, lihat [DescribePolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/organizations/describe-policy.html)di *Referensi AWS CLI Perintah*. 

------
#### [ Python ]

**SDK untuk Python (Boto3)**  
 Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di [Repositori Contoh Kode AWS](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/organizations#code-examples). 

```
def describe_policy(policy_id, orgs_client):
    """
    Describes a policy.

    :param policy_id: The ID of the policy to describe.
    :param orgs_client: The Boto3 Organizations client.
    :return: The description of the policy.
    """
    try:
        response = orgs_client.describe_policy(PolicyId=policy_id)
        policy = response["Policy"]
        logger.info("Got policy %s.", policy_id)
    except ClientError:
        logger.exception("Couldn't get policy %s.", policy_id)
        raise
    else:
        return policy
```
+  Untuk detail API, lihat [DescribePolicy](https://docs.aws.amazon.com/goto/boto3/organizations-2016-11-28/DescribePolicy)di *AWS SDK for Python (Boto3) Referensi* API. 

------
#### [ SAP ABAP ]

**SDK for SAP ABAP**  
 Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di [Repositori Contoh Kode AWS](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/sap-abap/services/org#code-examples). 

```
    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.
```
+  Untuk detail API, lihat [DescribePolicy](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html)di *AWS SDK untuk referensi SAP ABAP* API. 

------