文件範例儲存庫中有更多 AWS SDK可用的範例。 AWS SDK
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
DeleteOrganization
搭配 AWS SDK或 使用 CLI
下列程式碼範例示範如何使用 DeleteOrganization
。
- .NET
-
- AWS SDK for .NET
-
注意
還有更多 。 GitHub尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 using System; using System.Threading.Tasks; using Amazon.Organizations; using Amazon.Organizations.Model; /// <summary> /// Shows how to delete an existing organization using the AWS /// Organizations Service. /// </summary> public class DeleteOrganization { /// <summary> /// Initializes the Organizations client and then calls /// DeleteOrganizationAsync to delete the organization. /// </summary> public static async Task Main() { // Create the client object using the default account. IAmazonOrganizations client = new AmazonOrganizationsClient(); var response = await client.DeleteOrganizationAsync(new DeleteOrganizationRequest()); if (response.HttpStatusCode == System.Net.HttpStatusCode.OK) { Console.WriteLine("Successfully deleted organization."); } else { Console.WriteLine("Could not delete organization."); } } }
-
如需API詳細資訊,請參閱 參考 DeleteOrganization中的 。 AWS SDK for .NET API
-
- CLI
-
- AWS CLI
-
若要刪除組織
下列範例示範如何刪除組織。若要執行此操作,您必須是組織中主要帳戶的管理員。此範例假設您先前已從組織移除了所有成員帳戶OUs、 和 政策:
aws organizations delete-organization
-
如需API詳細資訊,請參閱 命令參考 DeleteOrganization
中的 。 AWS CLI
-
CreatePolicy
DeleteOrganizationalUnit