{
  "typeName" : "AWS::Wisdom::AssistantAssociation",
  "description" : "Definition of AWS::Wisdom::AssistantAssociation Resource Type",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-rpdk",
  "definitions" : {
    "AssociationData" : {
      "oneOf" : [ {
        "type" : "object",
        "properties" : {
          "KnowledgeBaseId" : {
            "type" : "string",
            "pattern" : "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
          }
        },
        "required" : [ "KnowledgeBaseId" ],
        "additionalProperties" : false
      }, {
        "type" : "object",
        "properties" : {
          "ExternalBedrockKnowledgeBaseConfig" : {
            "$ref" : "#/definitions/ExternalBedrockKnowledgeBaseConfig"
          }
        },
        "required" : [ "ExternalBedrockKnowledgeBaseConfig" ],
        "additionalProperties" : false
      } ]
    },
    "ExternalBedrockKnowledgeBaseConfig" : {
      "type" : "object",
      "properties" : {
        "BedrockKnowledgeBaseArn" : {
          "type" : "string",
          "pattern" : "^arn:aws(|-cn|-us-gov):bedrock:[a-zA-Z0-9-]*:[0-9]{12}:knowledge-base/[0-9a-zA-Z]+$"
        },
        "AccessRoleArn" : {
          "type" : "string",
          "pattern" : "^arn:aws:iam::[0-9]{12}:role/(?:service-role/)?[a-zA-Z0-9_+=,.@-]{1,64}$"
        }
      },
      "required" : [ "BedrockKnowledgeBaseArn", "AccessRoleArn" ],
      "additionalProperties" : false
    },
    "AssociationType" : {
      "type" : "string",
      "enum" : [ "KNOWLEDGE_BASE", "EXTERNAL_BEDROCK_KNOWLEDGE_BASE" ]
    },
    "Tag" : {
      "additionalProperties" : false,
      "properties" : {
        "Key" : {
          "maxLength" : 128,
          "minLength" : 1,
          "pattern" : "^(?!aws:)[a-zA-Z+-=._:/]+$",
          "type" : "string"
        },
        "Value" : {
          "maxLength" : 256,
          "minLength" : 1,
          "type" : "string"
        }
      },
      "required" : [ "Key", "Value" ],
      "type" : "object"
    }
  },
  "properties" : {
    "AssistantAssociationArn" : {
      "type" : "string",
      "pattern" : "^arn:[a-z-]*?:wisdom:[a-z0-9-]*?:[0-9]{12}:[a-z-]*?/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}(?:/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})?$"
    },
    "AssistantArn" : {
      "type" : "string",
      "pattern" : "^arn:[a-z-]*?:wisdom:[a-z0-9-]*?:[0-9]{12}:[a-z-]*?/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}(?:/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})?$"
    },
    "AssistantAssociationId" : {
      "type" : "string",
      "pattern" : "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
    },
    "AssistantId" : {
      "type" : "string",
      "pattern" : "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
    },
    "Association" : {
      "$ref" : "#/definitions/AssociationData"
    },
    "AssociationType" : {
      "$ref" : "#/definitions/AssociationType"
    },
    "Tags" : {
      "insertionOrder" : false,
      "uniqueItems" : true,
      "items" : {
        "$ref" : "#/definitions/Tag"
      },
      "type" : "array"
    }
  },
  "required" : [ "Association", "AssociationType", "AssistantId" ],
  "readOnlyProperties" : [ "/properties/AssistantAssociationId", "/properties/AssistantAssociationArn", "/properties/AssistantArn" ],
  "createOnlyProperties" : [ "/properties/Association", "/properties/AssociationType", "/properties/AssistantId", "/properties/Tags" ],
  "primaryIdentifier" : [ "/properties/AssistantAssociationId", "/properties/AssistantId" ],
  "additionalIdentifiers" : [ [ "/properties/AssistantAssociationArn", "/properties/AssistantArn" ] ],
  "additionalProperties" : false,
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : false,
    "cloudFormationSystemTags" : false,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "wisdom:TagResource" ]
  },
  "replacementStrategy" : "delete_then_create",
  "handlers" : {
    "create" : {
      "permissions" : [ "wisdom:CreateAssistantAssociation", "wisdom:TagResource", "iam:PassRole" ]
    },
    "update" : {
      "permissions" : [ "wisdom:GetAssistantAssociation" ]
    },
    "read" : {
      "permissions" : [ "wisdom:GetAssistantAssociation" ]
    },
    "list" : {
      "permissions" : [ "wisdom:ListAssistantAssociations" ],
      "handlerSchema" : {
        "properties" : {
          "AssistantId" : {
            "$ref" : "resource-schema.json#/properties/AssistantId"
          }
        },
        "required" : [ "AssistantId" ]
      }
    },
    "delete" : {
      "permissions" : [ "wisdom:DeleteAssistantAssociation" ]
    }
  }
}