Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh SDK AWS Doc
Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Gunakan DeletePolicy
dengan AWS SDK atau CLI
Contoh kode berikut menunjukkan cara menggunakanDeletePolicy
.
- .NET
-
- AWS SDK for .NET
-
catatan
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di AWS Repositori Contoh Kode
. using System; using System.Threading.Tasks; using Amazon.Organizations; using Amazon.Organizations.Model; /// <summary> /// Deletes an existing AWS Organizations policy. /// </summary> public class DeletePolicy { /// <summary> /// Initializes the Organizations client object and then uses it to /// delete the policy with the specified policyId. /// </summary> public static async Task Main() { // Create the client object using the default account. IAmazonOrganizations client = new AmazonOrganizationsClient(); var policyId = "p-00000000"; var request = new DeletePolicyRequest { PolicyId = policyId, }; var response = await client.DeletePolicyAsync(request); if (response.HttpStatusCode == System.Net.HttpStatusCode.OK) { Console.WriteLine($"Successfully deleted Policy: {policyId}."); } else { Console.WriteLine($"Could not delete Policy: {policyId}."); } } }
-
Untuk detail API, lihat DeletePolicydi Referensi AWS SDK for .NET API.
-
- CLI
-
- AWS CLI
-
Untuk menghapus kebijakan
Contoh berikut menunjukkan cara menghapus kebijakan dari organisasi. Contoh ini mengasumsikan bahwa Anda sebelumnya melepaskan kebijakan dari semua entitas:
aws organizations delete-policy --policy-id p-examplepolicyid111
-
Untuk detail API, lihat DeletePolicy
di Referensi AWS CLI Perintah.
-
- Python
-
- SDK untuk Python (Boto3)
-
catatan
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di AWS Repositori Contoh Kode
. def delete_policy(policy_id, orgs_client): """ Deletes a policy. :param policy_id: The ID of the policy to delete. :param orgs_client: The Boto3 Organizations client. """ try: orgs_client.delete_policy(PolicyId=policy_id) logger.info("Deleted policy %s.", policy_id) except ClientError: logger.exception("Couldn't delete policy %s.", policy_id) raise
-
Untuk detail API, lihat DeletePolicydi AWS SDK for Python (Boto3) Referensi API.
-