updateOrganizationalUnit method
Renames the specified organizational unit (OU). The ID and ARN don't change. The child OUs and accounts remain in place, and any attached policies of the OU remain attached.
This operation can be called only from the organization's management account.
May throw AccessDeniedException. May throw AWSOrganizationsNotInUseException. May throw ConcurrentModificationException. May throw DuplicateOrganizationalUnitException. May throw InvalidInputException. May throw OrganizationalUnitNotFoundException. May throw ServiceException. May throw TooManyRequestsException.
Parameter organizationalUnitId
:
The unique identifier (ID) of the OU that you want to rename. You can get
the ID from the ListOrganizationalUnitsForParent operation.
The regex pattern for an organizational unit ID string requires "ou-" followed by from 4 to 32 lowercase letters or digits (the ID of the root that contains the OU). This string is followed by a second "-" dash and from 8 to 32 additional lowercase letters or digits.
Parameter name
:
The new name that you want to assign to the OU.
The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.
Implementation
Future<UpdateOrganizationalUnitResponse> updateOrganizationalUnit({
required String organizationalUnitId,
String? name,
}) async {
ArgumentError.checkNotNull(organizationalUnitId, 'organizationalUnitId');
_s.validateStringLength(
'organizationalUnitId',
organizationalUnitId,
0,
68,
isRequired: true,
);
_s.validateStringLength(
'name',
name,
1,
128,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSOrganizationsV20161128.UpdateOrganizationalUnit'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'OrganizationalUnitId': organizationalUnitId,
if (name != null) 'Name': name,
},
);
return UpdateOrganizationalUnitResponse.fromJson(jsonResponse.body);
}