Há mais exemplos do AWS SDK disponíveis no repositório do GitHub Documento de Exemplos do AWS SDK
Usar DeleteOrganizationalUnit com o AWS SDK ou a CLI
Os exemplos de código a seguir mostram como usar o DeleteOrganizationalUnit.
- .NET
-
- SDK para .NET
-
nota
Há mais no GitHub. Encontre o exemplo completo e veja como configurar e executar no AWS Code Examples Repository
. 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}."); } } }-
Consulte detalhes da API em DeleteOrganizationalUnit na Referência da API AWS SDK para .NET.
-
- CLI
-
- AWS CLI
-
Como excluir uma UO
O exemplo a seguir mostra como excluir uma UO. O exemplo pressupõe que você já removeu todas as contas e outras UOs da UO:
aws organizations delete-organizational-unit --organizational-unit-idou-examplerootid111-exampleouid111-
Consulte detalhes da API em DeleteOrganizationalUnit
na Referência de comandos da AWS CLI.
-
DeleteOrganization
DeletePolicy