{
  "typeName" : "AWS::DataSync::LocationS3",
  "description" : "Resource schema for AWS::DataSync::LocationS3",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-datasync.git",
  "definitions" : {
    "S3Config" : {
      "additionalProperties" : false,
      "description" : "The Amazon Resource Name (ARN) of the AWS IAM role that is used to access an Amazon S3 bucket.",
      "type" : "object",
      "properties" : {
        "BucketAccessRoleArn" : {
          "description" : "The ARN of the IAM role of the Amazon S3 bucket.",
          "type" : "string",
          "pattern" : "^arn:(aws|aws-cn|aws-us-gov|aws-eusc|aws-iso|aws-iso-b):iam::[0-9]{12}:role/.*$",
          "maxLength" : 2048
        }
      },
      "required" : [ "BucketAccessRoleArn" ]
    },
    "Tag" : {
      "additionalProperties" : false,
      "description" : "A key-value pair to associate with a resource.",
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string",
          "description" : "The key for an AWS resource tag.",
          "pattern" : "^[a-zA-Z0-9\\s+=._:/-]+$",
          "maxLength" : 256,
          "minLength" : 1
        },
        "Value" : {
          "type" : "string",
          "description" : "The value for an AWS resource tag.",
          "pattern" : "^[a-zA-Z0-9\\s+=._:@/-]+$",
          "maxLength" : 256,
          "minLength" : 1
        }
      },
      "required" : [ "Key", "Value" ]
    }
  },
  "properties" : {
    "S3Config" : {
      "$ref" : "#/definitions/S3Config"
    },
    "S3BucketArn" : {
      "description" : "The Amazon Resource Name (ARN) of the Amazon S3 bucket.",
      "type" : "string",
      "maxLength" : 156,
      "pattern" : "^arn:(aws|aws-cn|aws-us-gov|aws-eusc|aws-iso|aws-iso-b):s3:[a-z\\-0-9]*:[0-9]*:.*$"
    },
    "Subdirectory" : {
      "description" : "A subdirectory in the Amazon S3 bucket. This subdirectory in Amazon S3 is used to read data from the S3 source location or write data to the S3 destination.",
      "type" : "string",
      "maxLength" : 1024,
      "pattern" : "^[\\p{L}\\p{M}\\p{Z}\\p{S}\\p{N}\\p{P}\\p{C}]*$"
    },
    "S3StorageClass" : {
      "description" : "The Amazon S3 storage class you want to store your files in when this location is used as a task destination.",
      "type" : "string",
      "enum" : [ "STANDARD", "STANDARD_IA", "ONEZONE_IA", "INTELLIGENT_TIERING", "GLACIER", "GLACIER_INSTANT_RETRIEVAL", "DEEP_ARCHIVE" ],
      "default" : "STANDARD"
    },
    "Tags" : {
      "description" : "An array of key-value pairs to apply to this resource.",
      "type" : "array",
      "maxItems" : 50,
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    },
    "LocationArn" : {
      "description" : "The Amazon Resource Name (ARN) of the Amazon S3 bucket location.",
      "type" : "string",
      "pattern" : "^arn:(aws|aws-cn|aws-us-gov|aws-eusc|aws-iso|aws-iso-b):datasync:[a-z\\-0-9]+:[0-9]{12}:location/loc-[0-9a-z]{17}$",
      "maxLength" : 128
    },
    "LocationUri" : {
      "description" : "The URL of the S3 location that was described.",
      "type" : "string",
      "pattern" : "^(efs|nfs|s3|smb|fsxw)://[a-zA-Z0-9.\\-/]+$",
      "maxLength" : 4356
    }
  },
  "additionalProperties" : false,
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "datasync:TagResource", "datasync:UntagResource", "datasync:ListTagsForResource" ]
  },
  "required" : [ "S3Config" ],
  "readOnlyProperties" : [ "/properties/LocationArn", "/properties/LocationUri" ],
  "primaryIdentifier" : [ "/properties/LocationArn" ],
  "createOnlyProperties" : [ "/properties/S3BucketArn" ],
  "writeOnlyProperties" : [ "/properties/Subdirectory", "/properties/S3BucketArn" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "datasync:CreateLocationS3", "datasync:DescribeLocationS3", "datasync:ListTagsForResource", "datasync:TagResource", "s3:ListAllMyBuckets", "s3:ListBucket", "iam:GetRole", "iam:PassRole" ]
    },
    "read" : {
      "permissions" : [ "datasync:DescribeLocationS3", "datasync:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "datasync:DescribeLocationS3", "datasync:ListTagsForResource", "datasync:TagResource", "datasync:UntagResource", "datasync:UpdateLocationS3", "iam:PassRole" ]
    },
    "delete" : {
      "permissions" : [ "datasync:DeleteLocation" ]
    },
    "list" : {
      "permissions" : [ "datasync:ListLocations" ]
    }
  }
}