{
  "typeName" : "AWS::CustomerProfiles::Integration",
  "description" : "The resource schema for creating an Amazon Connect Customer Profiles Integration.",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-customer-profiles.git",
  "definitions" : {
    "Tag" : {
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string",
          "pattern" : "^(?!aws:)[a-zA-Z+-=._:/]+$",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "type" : "string",
          "minLength" : 0,
          "maxLength" : 256
        }
      },
      "additionalProperties" : false,
      "required" : [ "Key", "Value" ]
    },
    "Object" : {
      "type" : "string",
      "maxLength" : 512,
      "pattern" : "\\S+",
      "additionalProperties" : false
    },
    "MarketoSourceProperties" : {
      "type" : "object",
      "properties" : {
        "Object" : {
          "$ref" : "#/definitions/Object"
        }
      },
      "required" : [ "Object" ],
      "additionalProperties" : false
    },
    "S3SourceProperties" : {
      "type" : "object",
      "properties" : {
        "BucketName" : {
          "type" : "string",
          "minLength" : 3,
          "maxLength" : 63,
          "pattern" : "\\S+"
        },
        "BucketPrefix" : {
          "type" : "string",
          "maxLength" : 512,
          "pattern" : ".*"
        }
      },
      "required" : [ "BucketName" ],
      "additionalProperties" : false
    },
    "SalesforceSourceProperties" : {
      "type" : "object",
      "properties" : {
        "Object" : {
          "$ref" : "#/definitions/Object"
        },
        "EnableDynamicFieldUpdate" : {
          "type" : "boolean"
        },
        "IncludeDeletedRecords" : {
          "type" : "boolean"
        }
      },
      "required" : [ "Object" ],
      "additionalProperties" : false
    },
    "ServiceNowSourceProperties" : {
      "type" : "object",
      "properties" : {
        "Object" : {
          "$ref" : "#/definitions/Object"
        }
      },
      "required" : [ "Object" ],
      "additionalProperties" : false
    },
    "ZendeskSourceProperties" : {
      "type" : "object",
      "properties" : {
        "Object" : {
          "$ref" : "#/definitions/Object"
        }
      },
      "required" : [ "Object" ],
      "additionalProperties" : false
    },
    "SourceConnectorProperties" : {
      "type" : "object",
      "properties" : {
        "Marketo" : {
          "$ref" : "#/definitions/MarketoSourceProperties"
        },
        "S3" : {
          "$ref" : "#/definitions/S3SourceProperties"
        },
        "Salesforce" : {
          "$ref" : "#/definitions/SalesforceSourceProperties"
        },
        "ServiceNow" : {
          "$ref" : "#/definitions/ServiceNowSourceProperties"
        },
        "Zendesk" : {
          "$ref" : "#/definitions/ZendeskSourceProperties"
        }
      },
      "additionalProperties" : false
    },
    "ConnectorType" : {
      "type" : "string",
      "enum" : [ "Salesforce", "Marketo", "ServiceNow", "Zendesk", "S3" ]
    },
    "IncrementalPullConfig" : {
      "type" : "object",
      "properties" : {
        "DatetimeTypeFieldName" : {
          "type" : "string",
          "maxLength" : 256
        }
      },
      "additionalProperties" : false
    },
    "SourceFlowConfig" : {
      "type" : "object",
      "properties" : {
        "ConnectorType" : {
          "$ref" : "#/definitions/ConnectorType"
        },
        "ConnectorProfileName" : {
          "type" : "string",
          "maxLength" : 256,
          "pattern" : "[\\w/!@#+=.-]+"
        },
        "IncrementalPullConfig" : {
          "$ref" : "#/definitions/IncrementalPullConfig"
        },
        "SourceConnectorProperties" : {
          "$ref" : "#/definitions/SourceConnectorProperties"
        }
      },
      "required" : [ "ConnectorType", "SourceConnectorProperties" ],
      "additionalProperties" : false
    },
    "ConnectorOperator" : {
      "type" : "object",
      "properties" : {
        "Marketo" : {
          "$ref" : "#/definitions/MarketoConnectorOperator"
        },
        "S3" : {
          "$ref" : "#/definitions/S3ConnectorOperator"
        },
        "Salesforce" : {
          "$ref" : "#/definitions/SalesforceConnectorOperator"
        },
        "ServiceNow" : {
          "$ref" : "#/definitions/ServiceNowConnectorOperator"
        },
        "Zendesk" : {
          "$ref" : "#/definitions/ZendeskConnectorOperator"
        }
      },
      "additionalProperties" : false
    },
    "Operator" : {
      "type" : "string",
      "enum" : [ "PROJECTION", "LESS_THAN", "GREATER_THAN", "CONTAINS", "BETWEEN", "LESS_THAN_OR_EQUAL_TO", "GREATER_THAN_OR_EQUAL_TO", "EQUAL_TO", "NOT_EQUAL_TO", "ADDITION", "MULTIPLICATION", "DIVISION", "SUBTRACTION", "MASK_ALL", "MASK_FIRST_N", "MASK_LAST_N", "VALIDATE_NON_NULL", "VALIDATE_NON_ZERO", "VALIDATE_NON_NEGATIVE", "VALIDATE_NUMERIC", "NO_OP" ]
    },
    "MarketoConnectorOperator" : {
      "type" : "string",
      "enum" : [ "PROJECTION", "LESS_THAN", "GREATER_THAN", "BETWEEN", "ADDITION", "MULTIPLICATION", "DIVISION", "SUBTRACTION", "MASK_ALL", "MASK_FIRST_N", "MASK_LAST_N", "VALIDATE_NON_NULL", "VALIDATE_NON_ZERO", "VALIDATE_NON_NEGATIVE", "VALIDATE_NUMERIC", "NO_OP" ]
    },
    "S3ConnectorOperator" : {
      "type" : "string",
      "enum" : [ "PROJECTION", "LESS_THAN", "GREATER_THAN", "BETWEEN", "LESS_THAN_OR_EQUAL_TO", "GREATER_THAN_OR_EQUAL_TO", "EQUAL_TO", "NOT_EQUAL_TO", "ADDITION", "MULTIPLICATION", "DIVISION", "SUBTRACTION", "MASK_ALL", "MASK_FIRST_N", "MASK_LAST_N", "VALIDATE_NON_NULL", "VALIDATE_NON_ZERO", "VALIDATE_NON_NEGATIVE", "VALIDATE_NUMERIC", "NO_OP" ]
    },
    "SalesforceConnectorOperator" : {
      "type" : "string",
      "enum" : [ "PROJECTION", "LESS_THAN", "GREATER_THAN", "CONTAINS", "BETWEEN", "LESS_THAN_OR_EQUAL_TO", "GREATER_THAN_OR_EQUAL_TO", "EQUAL_TO", "NOT_EQUAL_TO", "ADDITION", "MULTIPLICATION", "DIVISION", "SUBTRACTION", "MASK_ALL", "MASK_FIRST_N", "MASK_LAST_N", "VALIDATE_NON_NULL", "VALIDATE_NON_ZERO", "VALIDATE_NON_NEGATIVE", "VALIDATE_NUMERIC", "NO_OP" ]
    },
    "ServiceNowConnectorOperator" : {
      "type" : "string",
      "enum" : [ "PROJECTION", "LESS_THAN", "GREATER_THAN", "CONTAINS", "BETWEEN", "LESS_THAN_OR_EQUAL_TO", "GREATER_THAN_OR_EQUAL_TO", "EQUAL_TO", "NOT_EQUAL_TO", "ADDITION", "MULTIPLICATION", "DIVISION", "SUBTRACTION", "MASK_ALL", "MASK_FIRST_N", "MASK_LAST_N", "VALIDATE_NON_NULL", "VALIDATE_NON_ZERO", "VALIDATE_NON_NEGATIVE", "VALIDATE_NUMERIC", "NO_OP" ]
    },
    "ZendeskConnectorOperator" : {
      "type" : "string",
      "enum" : [ "PROJECTION", "GREATER_THAN", "ADDITION", "MULTIPLICATION", "DIVISION", "SUBTRACTION", "MASK_ALL", "MASK_FIRST_N", "MASK_LAST_N", "VALIDATE_NON_NULL", "VALIDATE_NON_ZERO", "VALIDATE_NON_NEGATIVE", "VALIDATE_NUMERIC", "NO_OP" ]
    },
    "OperatorPropertiesKeys" : {
      "type" : "string",
      "enum" : [ "VALUE", "VALUES", "DATA_TYPE", "UPPER_BOUND", "LOWER_BOUND", "SOURCE_DATA_TYPE", "DESTINATION_DATA_TYPE", "VALIDATION_ACTION", "MASK_VALUE", "MASK_LENGTH", "TRUNCATE_LENGTH", "MATH_OPERATION_FIELDS_ORDER", "CONCAT_FORMAT", "SUBFIELD_CATEGORY_MAP" ]
    },
    "DestinationField" : {
      "type" : "string",
      "maxLength" : 256,
      "pattern" : ".*"
    },
    "TaskType" : {
      "type" : "string",
      "enum" : [ "Arithmetic", "Filter", "Map", "Mask", "Merge", "Truncate", "Validate" ]
    },
    "TaskPropertiesMap" : {
      "type" : "object",
      "properties" : {
        "OperatorPropertyKey" : {
          "$ref" : "#/definitions/OperatorPropertiesKeys"
        },
        "Property" : {
          "type" : "string",
          "maxLength" : 2048,
          "pattern" : ".+"
        }
      },
      "required" : [ "OperatorPropertyKey", "Property" ],
      "additionalProperties" : false
    },
    "Task" : {
      "type" : "object",
      "properties" : {
        "ConnectorOperator" : {
          "$ref" : "#/definitions/ConnectorOperator"
        },
        "SourceFields" : {
          "type" : "array",
          "items" : {
            "type" : "string",
            "maxLength" : 2048,
            "pattern" : ".*"
          }
        },
        "DestinationField" : {
          "$ref" : "#/definitions/DestinationField"
        },
        "TaskType" : {
          "$ref" : "#/definitions/TaskType"
        },
        "TaskProperties" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/TaskPropertiesMap"
          }
        }
      },
      "required" : [ "SourceFields", "TaskType" ],
      "additionalProperties" : false
    },
    "TriggerType" : {
      "type" : "string",
      "enum" : [ "Scheduled", "Event", "OnDemand" ]
    },
    "Date" : {
      "type" : "number"
    },
    "ScheduledTriggerProperties" : {
      "type" : "object",
      "properties" : {
        "ScheduleExpression" : {
          "type" : "string",
          "maxLength" : 256,
          "pattern" : ".*"
        },
        "DataPullMode" : {
          "type" : "string",
          "enum" : [ "Incremental", "Complete" ]
        },
        "ScheduleStartTime" : {
          "$ref" : "#/definitions/Date"
        },
        "ScheduleEndTime" : {
          "$ref" : "#/definitions/Date"
        },
        "Timezone" : {
          "type" : "string",
          "maxLength" : 256,
          "pattern" : ".*"
        },
        "ScheduleOffset" : {
          "type" : "integer",
          "minimum" : 0,
          "maximum" : 36000
        },
        "FirstExecutionFrom" : {
          "$ref" : "#/definitions/Date"
        }
      },
      "required" : [ "ScheduleExpression" ],
      "additionalProperties" : false
    },
    "TriggerProperties" : {
      "type" : "object",
      "properties" : {
        "Scheduled" : {
          "$ref" : "#/definitions/ScheduledTriggerProperties"
        }
      },
      "additionalProperties" : false
    },
    "TriggerConfig" : {
      "type" : "object",
      "properties" : {
        "TriggerType" : {
          "$ref" : "#/definitions/TriggerType"
        },
        "TriggerProperties" : {
          "$ref" : "#/definitions/TriggerProperties"
        }
      },
      "required" : [ "TriggerType" ],
      "additionalProperties" : false
    },
    "FlowDefinition" : {
      "type" : "object",
      "properties" : {
        "FlowName" : {
          "type" : "string",
          "pattern" : "[a-zA-Z0-9][\\w!@#.-]+",
          "maxLength" : 256
        },
        "Description" : {
          "type" : "string",
          "pattern" : "[\\w!@#\\-.?,\\s]*",
          "maxLength" : 2048
        },
        "KmsArn" : {
          "type" : "string",
          "pattern" : "arn:aws:kms:.*:[0-9]+:.*",
          "minLength" : 20,
          "maxLength" : 2048
        },
        "Tasks" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/Task"
          }
        },
        "TriggerConfig" : {
          "$ref" : "#/definitions/TriggerConfig"
        },
        "SourceFlowConfig" : {
          "$ref" : "#/definitions/SourceFlowConfig"
        }
      },
      "required" : [ "FlowName", "KmsArn", "Tasks", "TriggerConfig", "SourceFlowConfig" ],
      "additionalProperties" : false
    },
    "ObjectTypeMapping" : {
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 255
        },
        "Value" : {
          "type" : "string",
          "pattern" : "^[a-zA-Z_][a-zA-Z_0-9-]*$",
          "minLength" : 1,
          "maxLength" : 255
        }
      },
      "additionalProperties" : false,
      "required" : [ "Key", "Value" ]
    }
  },
  "properties" : {
    "DomainName" : {
      "description" : "The unique name of the domain.",
      "type" : "string",
      "pattern" : "^[a-zA-Z0-9_-]+$",
      "minLength" : 1,
      "maxLength" : 64
    },
    "Uri" : {
      "description" : "The URI of the S3 bucket or any other type of data source.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 255
    },
    "FlowDefinition" : {
      "$ref" : "#/definitions/FlowDefinition"
    },
    "ObjectTypeName" : {
      "description" : "The name of the ObjectType defined for the 3rd party data in Profile Service",
      "type" : "string",
      "pattern" : "^[a-zA-Z_][a-zA-Z_0-9-]*$",
      "minLength" : 1,
      "maxLength" : 255
    },
    "CreatedAt" : {
      "description" : "The time of this integration got created",
      "type" : "string"
    },
    "LastUpdatedAt" : {
      "description" : "The time of this integration got last updated at",
      "type" : "string"
    },
    "Tags" : {
      "description" : "The tags (keys and values) associated with the integration",
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Tag"
      },
      "minItems" : 0,
      "maxItems" : 50
    },
    "ObjectTypeNames" : {
      "description" : "The mapping between 3rd party event types and ObjectType names",
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/ObjectTypeMapping"
      }
    }
  },
  "required" : [ "DomainName" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "profile:GetIntegration", "profile:PutIntegration", "appflow:CreateFlow" ]
    },
    "read" : {
      "permissions" : [ "profile:GetIntegration" ]
    },
    "delete" : {
      "permissions" : [ "profile:DeleteIntegration", "appflow:DeleteFlow" ]
    },
    "update" : {
      "permissions" : [ "profile:PutIntegration", "profile:GetIntegration", "profile:UntagResource", "profile:TagResource" ]
    },
    "list" : {
      "permissions" : [ "profile:ListIntegrations" ]
    }
  },
  "additionalProperties" : false,
  "primaryIdentifier" : [ "/properties/DomainName", "/properties/Uri" ],
  "createOnlyProperties" : [ "/properties/DomainName", "/properties/Uri" ],
  "readOnlyProperties" : [ "/properties/LastUpdatedAt", "/properties/CreatedAt" ],
  "writeOnlyProperties" : [ "/properties/FlowDefinition" ]
}