{
  "typeName" : "AWS::Connect::Instance",
  "description" : "Resource Type definition for AWS::Connect::Instance",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-connect",
  "definitions" : {
    "InboundCalls" : {
      "description" : "Mandatory element which enables inbound calls on new instance.",
      "type" : "boolean"
    },
    "OutboundCalls" : {
      "description" : "Mandatory element which enables outbound calls on new instance.",
      "type" : "boolean"
    },
    "ContactflowLogs" : {
      "description" : "Boolean flag which enables CONTACTFLOW_LOGS on an instance.",
      "type" : "boolean"
    },
    "ContactLens" : {
      "description" : "Boolean flag which enables CONTACT_LENS on an instance.",
      "type" : "boolean"
    },
    "AutoResolveBestVoices" : {
      "description" : "Boolean flag which enables AUTO_RESOLVE_BEST_VOICES on an instance.",
      "type" : "boolean"
    },
    "UseCustomTTSVoices" : {
      "description" : "Boolean flag which enables USE_CUSTOM_TTS_VOICES on an instance.",
      "type" : "boolean"
    },
    "EarlyMedia" : {
      "description" : "Boolean flag which enables EARLY_MEDIA on an instance.",
      "type" : "boolean"
    },
    "MultiPartyConference" : {
      "description" : "Boolean flag which enables MULTI_PARTY_CONFERENCE on an instance.",
      "type" : "boolean"
    },
    "HighVolumeOutBound" : {
      "description" : "Boolean flag which enables HIGH_VOLUME_OUTBOUND on an instance.",
      "type" : "boolean"
    },
    "EnhancedContactMonitoring" : {
      "description" : "Boolean flag which enables ENHANCED_CONTACT_MONITORING on an instance.",
      "type" : "boolean"
    },
    "EnhancedChatMonitoring" : {
      "description" : "Boolean flag which enables ENHANCED_CHAT_MONITORING on an instance.",
      "type" : "boolean"
    },
    "MultiPartyChatConference" : {
      "description" : "Boolean flag which enables MULTI_PARTY_CHAT_CONFERENCE on an instance.",
      "type" : "boolean"
    },
    "MessageStreaming" : {
      "description" : "Boolean flag which enables MESSAGE_STREAMING on an instance.",
      "type" : "boolean"
    },
    "Attributes" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "InboundCalls" : {
          "$ref" : "#/definitions/InboundCalls"
        },
        "OutboundCalls" : {
          "$ref" : "#/definitions/OutboundCalls"
        },
        "ContactflowLogs" : {
          "$ref" : "#/definitions/ContactflowLogs"
        },
        "ContactLens" : {
          "$ref" : "#/definitions/ContactLens"
        },
        "AutoResolveBestVoices" : {
          "$ref" : "#/definitions/AutoResolveBestVoices"
        },
        "UseCustomTTSVoices" : {
          "$ref" : "#/definitions/UseCustomTTSVoices"
        },
        "EarlyMedia" : {
          "$ref" : "#/definitions/EarlyMedia"
        },
        "MultiPartyConference" : {
          "$ref" : "#/definitions/MultiPartyConference"
        },
        "HighVolumeOutBound" : {
          "$ref" : "#/definitions/HighVolumeOutBound"
        },
        "EnhancedContactMonitoring" : {
          "$ref" : "#/definitions/EnhancedContactMonitoring"
        },
        "EnhancedChatMonitoring" : {
          "$ref" : "#/definitions/EnhancedChatMonitoring"
        },
        "MultiPartyChatConference" : {
          "$ref" : "#/definitions/MultiPartyChatConference"
        },
        "MessageStreaming" : {
          "$ref" : "#/definitions/MessageStreaming"
        }
      },
      "required" : [ "InboundCalls", "OutboundCalls" ]
    },
    "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" : {
    "Id" : {
      "description" : "An instanceId is automatically generated on creation and assigned as the unique identifier.",
      "type" : "string"
    },
    "Arn" : {
      "description" : "An instanceArn is automatically generated on creation based on instanceId.",
      "type" : "string",
      "pattern" : "^arn:aws[-a-z0-9]*:connect:[-a-z0-9]*:[0-9]{12}:instance/[-a-zA-Z0-9]*$"
    },
    "IdentityManagementType" : {
      "description" : "Specifies the type of directory integration for new instance.",
      "type" : "string",
      "enum" : [ "SAML", "CONNECT_MANAGED", "EXISTING_DIRECTORY" ]
    },
    "InstanceAlias" : {
      "description" : "Alias of the new directory created as part of new instance creation.",
      "type" : "string",
      "pattern" : "^(?!d-)([\\da-zA-Z]+)([-]*[\\da-zA-Z])*$",
      "minLength" : 1,
      "maxLength" : 45
    },
    "CreatedTime" : {
      "description" : "Timestamp of instance creation logged as part of instance creation.",
      "type" : "string",
      "format" : "date-time"
    },
    "ServiceRole" : {
      "description" : "Service linked role created as part of instance creation.",
      "type" : "string"
    },
    "InstanceStatus" : {
      "description" : "Specifies the creation status of new instance.",
      "type" : "string",
      "enum" : [ "CREATION_IN_PROGRESS", "CREATION_FAILED", "ACTIVE" ]
    },
    "DirectoryId" : {
      "description" : "Existing directoryId user wants to map to the new Connect instance.",
      "type" : "string",
      "pattern" : "^d-[0-9a-f]{10}$",
      "minLength" : 12,
      "maxLength" : 12
    },
    "Attributes" : {
      "description" : "The attributes for the instance.",
      "$ref" : "#/definitions/Attributes"
    },
    "Tags" : {
      "description" : "An array of key-value pairs to apply to this resource.",
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    }
  },
  "additionalProperties" : false,
  "required" : [ "IdentityManagementType", "Attributes" ],
  "readOnlyProperties" : [ "/properties/Id", "/properties/Arn", "/properties/ServiceRole", "/properties/CreatedTime", "/properties/InstanceStatus" ],
  "createOnlyProperties" : [ "/properties/DirectoryId", "/properties/InstanceAlias", "/properties/IdentityManagementType" ],
  "writeOnlyProperties" : [ "/properties/DirectoryId" ],
  "primaryIdentifier" : [ "/properties/Arn" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "connect:ListTagsForResource", "connect:UntagResource", "connect:TagResource" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "connect:CreateInstance", "connect:DescribeInstance", "connect:UpdateInstanceAttribute", "connect:TagResource", "ds:CheckAlias", "ds:CreateAlias", "ds:AuthorizeApplication", "ds:UnauthorizeApplication", "ds:CreateIdentityPoolDirectory", "ds:CreateDirectory", "ds:DescribeDirectories", "iam:CreateServiceLinkedRole", "iam:PutRolePolicy", "logs:CreateLogGroup" ]
    },
    "read" : {
      "permissions" : [ "connect:DescribeInstance", "connect:ListInstanceAttributes", "ds:DescribeDirectories" ]
    },
    "update" : {
      "permissions" : [ "connect:ListInstanceAttributes", "connect:UpdateInstanceAttribute", "ds:DescribeDirectories", "iam:CreateServiceLinkedRole", "iam:DeleteRolePolicy", "logs:CreateLogGroup", "iam:PutRolePolicy", "connect:TagResource", "connect:UntagResource" ]
    },
    "delete" : {
      "permissions" : [ "connect:DeleteInstance", "connect:DescribeInstance", "connect:UntagResource", "ds:DeleteDirectory", "ds:UnauthorizeApplication", "ds:DescribeDirectories" ]
    },
    "list" : {
      "permissions" : [ "connect:ListInstances", "connect:ListInstanceAttributes", "ds:DescribeDirectories" ]
    }
  }
}