0

我正在尝试使用默认提供的组织架构在 AWS CloudDirectory 中输入一个新对象。

import boto3
#
client = boto3.client('clouddirectory')
#
AWS_CLOUD_DIR_ARN = 'arn:aws:clouddirectory:us-east-1:000000000000:directory/AUaGFp4A7Ea_lY5QwPxSQTw'
AWS_CLOUD_DIR_SCHEMA_ARN = 'arn:aws:clouddirectory:us-east-1:000000000000:schema/published/customer-org.json/v0.0'
#
schemaFacets = [
    {
        "SchemaArn" : AWS_CLOUD_DIR_SCHEMA_ARN,
        "FacetName" : "Organization"
    },
    {
        "SchemaArn" : AWS_CLOUD_DIR_SCHEMA_ARN,
        "FacetName" : "Legal_Entity"
    }    
]
objectAttributeList = [
    {
      "Key" : {
        "SchemaArn" : AWS_CLOUD_DIR_SCHEMA_ARN,
        "FacetName" : "Organization",
        "Name" : "account_id"
      },
      "Value" : {
        "StringValue" : "W000"
      }
    },

schemaFacets列表具有构成架构的许多其他字段。最后,

response = client.create_object(
    DirectoryArn = AWS_CLOUD_DIR_ARN,
    SchemaFacets = schemaFacets,
    ObjectAttributeList = objectAttributeList
)
print response 

我得到的回应是:

botocore.errorfactory.InvalidArnException: An error occurred (InvalidArnException) when calling the CreateObject operation: Provided ARN is invalid arn:aws:clouddirectory:us-east-1:000000000000:schema/published/customer-org.json/v0.0

然而,目录和架构 ARN 实际上都存在。我错过了什么?

4

1 回答 1

0

您是否applied已将架构发布到目录?我相信您需要先执行此操作,然后才能在目录中创建对象。假设您应用的架构 ARN 是,'arn:aws:clouddirectory:us-east-1:000000000000:schema/customer-org.json/v0.0'那么如果您更改,您的代码应该可以工作

AWS_CLOUD_DIR_SCHEMA_ARN = 'arn:aws:clouddirectory:us-east-1:000000000000:schema/customer-org.json/v0.0'

于 2018-07-11T13:36:40.337 回答