Há mais AWS SDK exemplos disponíveis no GitHub repositório AWS Doc SDK Examples
As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.
Use DeleteOrganizationalUnit
com um AWS SDK ou CLI
Os exemplos de código a seguir mostram como usar o DeleteOrganizationalUnit
.
- .NET
-
- AWS SDK for .NET
-
nota
Tem mais sobre GitHub. Encontre o exemplo completo e saiba como configurar e executar no Repositório de exemplos de código da AWS
. using System; using System.Threading.Tasks; using Amazon.Organizations; using Amazon.Organizations.Model; /// <summary> /// Shows how to delete an existing AWS Organizations organizational unit. /// </summary> public class DeleteOrganizationalUnit { /// <summary> /// Initializes the Organizations client object and calls /// DeleteOrganizationalUnitAsync to delete the organizational unit /// with the selected ID. /// </summary> public static async Task Main() { // Create the client object using the default account. IAmazonOrganizations client = new AmazonOrganizationsClient(); var orgUnitId = "ou-0000-00000000"; var request = new DeleteOrganizationalUnitRequest { OrganizationalUnitId = orgUnitId, }; var response = await client.DeleteOrganizationalUnitAsync(request); if (response.HttpStatusCode == System.Net.HttpStatusCode.OK) { Console.WriteLine($"Successfully deleted the organizational unit with ID: {orgUnitId}."); } else { Console.WriteLine($"Could not delete the organizational unit with ID: {orgUnitId}."); } } }
-
Para API obter detalhes, consulte DeleteOrganizationalUnitem AWS SDK for .NET APIReferência.
-
- CLI
-
- AWS CLI
-
Como excluir uma UO
O exemplo a seguir mostra como excluir uma UO. O exemplo pressupõe que você removeu anteriormente todas as contas e outras OUs da OU:
aws organizations delete-organizational-unit --organizational-unit-id
ou-examplerootid111-exampleouid111
-
Para API obter detalhes, consulte DeleteOrganizationalUnit
na Referência de AWS CLI Comandos.
-