Verwenden Sie es CreateOrganizationalUnit mit einem AWS SDK oder CLI - AWS Organizations

Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.

Verwenden Sie es CreateOrganizationalUnit mit einem AWS SDK oder CLI

Die folgenden Codebeispiele zeigen, wie man es benutztCreateOrganizationalUnit.

.NET
AWS SDK for .NET
Anmerkung

Es gibt noch mehr dazu GitHub. Sie sehen das vollständige Beispiel und erfahren, wie Sie das AWS -Code-Beispiel-Repository einrichten und ausführen.

using System; using System.Threading.Tasks; using Amazon.Organizations; using Amazon.Organizations.Model; /// <summary> /// Creates a new organizational unit in AWS Organizations. /// </summary> public class CreateOrganizationalUnit { /// <summary> /// Initializes an Organizations client object and then uses it to call /// the CreateOrganizationalUnit method. If the call succeeds, it /// displays information about the new organizational unit. /// </summary> public static async Task Main() { // Create the client object using the default account. IAmazonOrganizations client = new AmazonOrganizationsClient(); var orgUnitName = "ProductDevelopmentUnit"; var request = new CreateOrganizationalUnitRequest { Name = orgUnitName, ParentId = "r-0000", }; var response = await client.CreateOrganizationalUnitAsync(request); if (response.HttpStatusCode == System.Net.HttpStatusCode.OK) { Console.WriteLine($"Successfully created organizational unit: {orgUnitName}."); Console.WriteLine($"Organizational unit {orgUnitName} Details"); Console.WriteLine($"ARN: {response.OrganizationalUnit.Arn} Id: {response.OrganizationalUnit.Id}"); } else { Console.WriteLine("Could not create new organizational unit."); } } }
CLI
AWS CLI

So erstellen Sie eine Organisationseinheit in einer Stamm- oder übergeordneten Organisationseinheit

Das folgende Beispiel zeigt, wie eine Organisationseinheit mit dem Namen AccountingOU erstellt wird:

aws organizations create-organizational-unit --parent-id r-examplerootid111 --name AccountingOU

Die Ausgabe enthält ein organizationalUnit Objekt mit Details zur neuen Organisationseinheit:

{ "OrganizationalUnit": { "Id": "ou-examplerootid111-exampleouid111", "Arn": "arn:aws:organizations::111111111111:ou/o-exampleorgid/ou-examplerootid111-exampleouid111", "Name": "AccountingOU" } }

Eine vollständige Liste der AWS SDK Entwicklerhandbücher und Codebeispiele finden Sie unterVerwendung AWS Organizations mit einem SDK AWS. Dieses Thema enthält auch Informationen zu den ersten Schritten und Details zu früheren SDK Versionen.