{
  "typeName" : "AWS::EntityResolution::IdNamespace",
  "description" : "IdNamespace defined in AWS Entity Resolution service",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-entity-resolution.git",
  "definitions" : {
    "EntityName" : {
      "type" : "string",
      "pattern" : "^[a-zA-Z_0-9-]*$",
      "minLength" : 1,
      "maxLength" : 255
    },
    "AttributeName" : {
      "type" : "string",
      "pattern" : "^[a-zA-Z_0-9- \\t]*$",
      "minLength" : 0,
      "maxLength" : 255
    },
    "IdNamespaceInputSource" : {
      "type" : "object",
      "properties" : {
        "InputSourceARN" : {
          "type" : "string",
          "pattern" : "^arn:(aws|aws-us-gov|aws-cn):entityresolution:[a-z]{2}-[a-z]{1,10}-[0-9]:[0-9]{12}:(matchingworkflow/[a-zA-Z_0-9-]{1,255})$|^arn:(aws|aws-us-gov|aws-cn):glue:[a-z]{2}-[a-z]{1,10}-[0-9]:[0-9]{12}:(table/[a-zA-Z_0-9-]{1,255}/[a-zA-Z_0-9-]{1,255})$"
        },
        "SchemaName" : {
          "$ref" : "#/definitions/EntityName"
        }
      },
      "required" : [ "InputSourceARN" ],
      "additionalProperties" : false
    },
    "IdNamespaceIdMappingWorkflowProperties" : {
      "type" : "object",
      "properties" : {
        "IdMappingType" : {
          "type" : "string",
          "enum" : [ "PROVIDER", "RULE_BASED" ]
        },
        "RuleBasedProperties" : {
          "$ref" : "#/definitions/NamespaceRuleBasedProperties"
        },
        "ProviderProperties" : {
          "$ref" : "#/definitions/NamespaceProviderProperties"
        }
      },
      "required" : [ "IdMappingType" ],
      "additionalProperties" : false
    },
    "NamespaceRuleBasedProperties" : {
      "type" : "object",
      "properties" : {
        "Rules" : {
          "type" : "array",
          "insertionOrder" : false,
          "minItems" : 1,
          "maxItems" : 25,
          "items" : {
            "$ref" : "#/definitions/Rule"
          }
        },
        "RuleDefinitionTypes" : {
          "type" : "array",
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/RuleDefinitionType"
          }
        },
        "AttributeMatchingModel" : {
          "type" : "string",
          "enum" : [ "ONE_TO_ONE", "MANY_TO_MANY" ]
        },
        "RecordMatchingModels" : {
          "type" : "array",
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/RecordMatchingModel"
          }
        }
      },
      "additionalProperties" : false
    },
    "RecordMatchingModel" : {
      "type" : "string",
      "enum" : [ "ONE_SOURCE_TO_ONE_TARGET", "MANY_SOURCE_TO_ONE_TARGET" ]
    },
    "RuleDefinitionType" : {
      "type" : "string",
      "enum" : [ "SOURCE", "TARGET" ]
    },
    "Rule" : {
      "type" : "object",
      "properties" : {
        "RuleName" : {
          "type" : "string",
          "pattern" : "^[a-zA-Z_0-9- \\t]*$",
          "minLength" : 0,
          "maxLength" : 255
        },
        "MatchingKeys" : {
          "type" : "array",
          "insertionOrder" : false,
          "minItems" : 1,
          "maxItems" : 25,
          "items" : {
            "$ref" : "#/definitions/AttributeName"
          }
        }
      },
      "required" : [ "RuleName", "MatchingKeys" ],
      "additionalProperties" : false
    },
    "NamespaceProviderProperties" : {
      "type" : "object",
      "properties" : {
        "ProviderServiceArn" : {
          "$ref" : "#/definitions/ProviderServiceArn"
        },
        "ProviderConfiguration" : {
          "type" : "object",
          "description" : "Additional Provider configuration that would be required for the provider service. The Configuration must be in JSON string format.",
          "patternProperties" : {
            "^.+$" : {
              "type" : "string"
            }
          },
          "additionalProperties" : false
        }
      },
      "required" : [ "ProviderServiceArn" ],
      "additionalProperties" : false
    },
    "ProviderServiceArn" : {
      "type" : "string",
      "pattern" : "^arn:(aws|aws-us-gov|aws-cn):(entityresolution):([a-z]{2}-[a-z]{1,10}-[0-9])::providerservice/([a-zA-Z0-9_-]{1,255})/([a-zA-Z0-9_-]{1,255})$",
      "minLength" : 20,
      "maxLength" : 255
    },
    "Tag" : {
      "description" : "A key-value pair to associate with a resource.",
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string",
          "description" : "The key name of the tag. You can specify a value that is 1 to 128 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "type" : "string",
          "description" : "The value for the tag. You can specify a value that is 0 to 256 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.",
          "minLength" : 0,
          "maxLength" : 256
        }
      },
      "required" : [ "Key", "Value" ],
      "additionalProperties" : false
    }
  },
  "properties" : {
    "IdNamespaceName" : {
      "$ref" : "#/definitions/EntityName"
    },
    "Description" : {
      "type" : "string",
      "minLength" : 0,
      "maxLength" : 255
    },
    "InputSourceConfig" : {
      "type" : "array",
      "insertionOrder" : false,
      "minItems" : 0,
      "maxItems" : 20,
      "items" : {
        "$ref" : "#/definitions/IdNamespaceInputSource"
      }
    },
    "IdMappingWorkflowProperties" : {
      "type" : "array",
      "insertionOrder" : false,
      "minItems" : 1,
      "maxItems" : 1,
      "items" : {
        "$ref" : "#/definitions/IdNamespaceIdMappingWorkflowProperties"
      }
    },
    "Type" : {
      "type" : "string",
      "enum" : [ "SOURCE", "TARGET" ]
    },
    "RoleArn" : {
      "type" : "string",
      "pattern" : "^arn:(aws|aws-us-gov|aws-cn):iam::\\d{12}:role/?[a-zA-Z_0-9+=,.@\\-_/]+$",
      "minLength" : 32,
      "maxLength" : 512
    },
    "IdNamespaceArn" : {
      "description" : "The arn associated with the IdNamespace",
      "type" : "string",
      "pattern" : "^arn:(aws|aws-us-gov|aws-cn):entityresolution:[a-z]{2}-[a-z]{1,10}-[0-9]:[0-9]{12}:(idnamespace/[a-zA-Z_0-9-]{1,255})$"
    },
    "CreatedAt" : {
      "description" : "The date and time when the IdNamespace was created",
      "type" : "string"
    },
    "UpdatedAt" : {
      "description" : "The date and time when the IdNamespace was updated",
      "type" : "string"
    },
    "Tags" : {
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "minItems" : 0,
      "maxItems" : 200,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    }
  },
  "createOnlyProperties" : [ "/properties/IdNamespaceName" ],
  "readOnlyProperties" : [ "/properties/IdNamespaceArn", "/properties/CreatedAt", "/properties/UpdatedAt" ],
  "primaryIdentifier" : [ "/properties/IdNamespaceName" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "entityresolution:TagResource", "entityresolution:UntagResource", "entityresolution:ListTagsForResource" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "entityresolution:CreateIdNamespace", "entityresolution:TagResource", "iam:PassRole" ]
    },
    "read" : {
      "permissions" : [ "entityresolution:GetIdNamespace", "entityresolution:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "entityresolution:UpdateIdNamespace", "entityresolution:ListTagsForResource", "entityresolution:TagResource", "entityresolution:UntagResource", "iam:PassRole" ]
    },
    "delete" : {
      "permissions" : [ "entityresolution:DeleteIdNamespace", "entityresolution:GetIdNamespace", "entityresolution:UntagResource" ]
    },
    "list" : {
      "permissions" : [ "entityresolution:ListIdNamespaces" ]
    }
  },
  "required" : [ "IdNamespaceName", "Type" ],
  "additionalProperties" : false
}