boto3
boto3 copied to clipboard
botocore.client.Organizations.list_children does not return OUs
Describe the bug
botocore.client.Organizations.list_children
is inconsistent with aws cli.
import boto3
session = boto3.Session(profile_name='master-account-read-role')
organizations = session.client('organizations')
root_id = organizations.list_roots()["Roots"][0]["Id"]
ous = organizations.list_children(ParentId=root_id, ChildType="ORGANIZATIONAL_UNIT")["Children"]
print(len(ous))
0
root_id=$(aws --profile master-account-read-role organizations list-roots --query 'Roots[0].Id' --output text)
aws --profile master-account-read-role organizations list-children --parent-id $root_id --child-type ORGANIZATIONAL_UNIT --query 'Children[*].Id' --output text | wc -w
16
Expected Behavior
I expect boto3 to return all Organizational Units nested under a root account or Organizational Unit when using botocore.client.Organizations.list_children
.
Current Behavior
boto3 does not return any Children OUs
Reproduction Steps
See the bug description for code.
aws --version
aws-cli/2.14.5 Python/3.11.6 Linux/5.15.133.1-microsoft-standard-WSL2 source/x86_64.ubuntu.22 prompt/off
python --version
Python 3.12.0
Possible Solution
No response
Additional Information/Context
No response
SDK version used
1.34.34
Environment details (OS name and version, etc.)
Windows 11 10.0.19045 Build 19045, WSLv2 Ubuntu 22.04.3 LTS