{
  "typeName" : "AWS::DataSync::LocationObjectStorage",
  "description" : "Resource Type definition for AWS::DataSync::LocationObjectStorage.",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-datasync.git",
  "definitions" : {
    "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" ]
    },
    "CmkSecretConfig" : {
      "additionalProperties" : false,
      "description" : "Specifies configuration information for a DataSync-managed secret, such as an authentication token or set of credentials that DataSync uses to access a specific transfer location, and a customer-managed AWS KMS key.",
      "type" : "object",
      "properties" : {
        "SecretArn" : {
          "description" : "Specifies the ARN for an AWS Secrets Manager secret, managed by DataSync.",
          "type" : "string",
          "pattern" : "^(arn:(aws|aws-cn|aws-us-gov|aws-eusc|aws-iso|aws-iso-b):secretsmanager:[a-z-0-9]+:[0-9]{12}:secret:.*|)$",
          "maxLength" : 2048
        },
        "KmsKeyArn" : {
          "description" : "Specifies the ARN for the customer-managed AWS KMS key used to encrypt the secret specified for SecretArn. DataSync provides this key to AWS Secrets Manager.",
          "type" : "string",
          "pattern" : "^(arn:(aws|aws-cn|aws-us-gov|aws-eusc|aws-iso|aws-iso-b):kms:[a-z-0-9]+:[0-9]{12}:key/.*|)$",
          "maxLength" : 2048
        }
      }
    },
    "CustomSecretConfig" : {
      "additionalProperties" : false,
      "description" : "Specifies configuration information for a customer-managed secret, such as an authentication token or set of credentials that DataSync uses to access a specific transfer location, and an IAM role that DataSync can assume and access the customer-managed secret.",
      "type" : "object",
      "properties" : {
        "SecretArn" : {
          "description" : "Specifies the ARN for a customer created AWS Secrets Manager secret.",
          "type" : "string",
          "pattern" : "^(arn:(aws|aws-cn|aws-us-gov|aws-eusc|aws-iso|aws-iso-b):secretsmanager:[a-z-0-9]+:[0-9]{12}:secret:.*|)$",
          "maxLength" : 2048
        },
        "SecretAccessRoleArn" : {
          "description" : "Specifies the ARN for the AWS Identity and Access Management role that DataSync uses to access the secret specified for SecretArn.",
          "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" : [ "SecretArn", "SecretAccessRoleArn" ]
    },
    "ManagedSecretConfig" : {
      "additionalProperties" : false,
      "description" : "Specifies configuration information for a DataSync-managed secret, such as an authentication token or set of credentials that DataSync uses to access a specific transfer location. DataSync uses the default AWS-managed KMS key to encrypt this secret in AWS Secrets Manager.",
      "type" : "object",
      "properties" : {
        "SecretArn" : {
          "description" : "Specifies the ARN for an AWS Secrets Manager secret.",
          "type" : "string",
          "pattern" : "^(arn:(aws|aws-cn|aws-us-gov|aws-eusc|aws-iso|aws-iso-b):secretsmanager:[a-z-0-9]+:[0-9]{12}:secret:.*|)$",
          "maxLength" : 2048
        }
      },
      "required" : [ "SecretArn" ]
    }
  },
  "properties" : {
    "AccessKey" : {
      "description" : "Optional. The access key is used if credentials are required to access the self-managed object storage server.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 200,
      "pattern" : "^.+$"
    },
    "AgentArns" : {
      "description" : "Specifies the Amazon Resource Names (ARNs) of the DataSync agents that can connect with your object storage system. If you are setting up an agentless cross-cloud transfer, you do not need to specify a value for this parameter.",
      "type" : "array",
      "items" : {
        "type" : "string",
        "maxLength" : 128,
        "pattern" : "^arn:(aws|aws-cn|aws-us-gov|aws-eusc|aws-iso|aws-iso-b):datasync:[a-z\\-0-9]+:[0-9]{12}:agent/agent-[0-9a-z]{17}$"
      },
      "minItems" : 1,
      "maxItems" : 4,
      "insertionOrder" : false
    },
    "BucketName" : {
      "description" : "The name of the bucket on the self-managed object storage server.",
      "type" : "string",
      "maxLength" : 63,
      "minLength" : 3,
      "pattern" : "^[a-zA-Z0-9_\\-\\+\\./\\(\\)\\$\\p{Zs}]+$"
    },
    "SecretKey" : {
      "description" : "Optional. The secret key is used if credentials are required to access the self-managed object storage server.",
      "type" : "string",
      "minLength" : 8,
      "maxLength" : 200,
      "pattern" : "^.+$"
    },
    "ServerCertificate" : {
      "description" : "X.509 PEM content containing a certificate authority or chain to trust.",
      "type" : "string",
      "maxLength" : 32768
    },
    "ServerHostname" : {
      "description" : "The name of the self-managed object storage server. This value is the IP address or Domain Name Service (DNS) name of the object storage server.",
      "type" : "string",
      "maxLength" : 255,
      "pattern" : "^(([a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9\\-]*[A-Za-z0-9])$"
    },
    "ServerPort" : {
      "description" : "The port that your self-managed server accepts inbound network traffic on.",
      "type" : "integer",
      "minimum" : 1,
      "maximum" : 65536
    },
    "ServerProtocol" : {
      "description" : "The protocol that the object storage server uses to communicate.",
      "type" : "string",
      "enum" : [ "HTTPS", "HTTP" ]
    },
    "Subdirectory" : {
      "description" : "The subdirectory in the self-managed object storage server that is used to read data from.",
      "type" : "string",
      "maxLength" : 4096,
      "pattern" : "^[a-zA-Z0-9_\\-\\+\\./\\(\\)\\p{Zs}]*$"
    },
    "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 location that is created.",
      "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 object storage location that was described.",
      "type" : "string",
      "pattern" : "^(efs|nfs|s3|smb|fsxw|object-storage)://[a-zA-Z0-9./\\-]+$",
      "maxLength" : 4356
    },
    "CmkSecretConfig" : {
      "$ref" : "#/definitions/CmkSecretConfig"
    },
    "CustomSecretConfig" : {
      "$ref" : "#/definitions/CustomSecretConfig"
    },
    "ManagedSecretConfig" : {
      "$ref" : "#/definitions/ManagedSecretConfig"
    }
  },
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : false,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "datasync:TagResource", "datasync:UntagResource", "datasync:ListTagsForResource" ]
  },
  "additionalProperties" : false,
  "readOnlyProperties" : [ "/properties/LocationArn", "/properties/LocationUri", "/properties/ManagedSecretConfig", "/properties/CmkSecretConfig/SecretArn" ],
  "writeOnlyProperties" : [ "/properties/SecretKey", "/properties/BucketName", "/properties/ServerHostname", "/properties/Subdirectory" ],
  "primaryIdentifier" : [ "/properties/LocationArn" ],
  "createOnlyProperties" : [ "/properties/BucketName" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "datasync:CreateLocationObjectStorage", "datasync:DescribeLocationObjectStorage", "datasync:ListTagsForResource", "datasync:TagResource", "secretsmanager:CreateSecret", "secretsmanager:PutSecretValue", "secretsmanager:DeleteSecret", "iam:CreateServiceLinkedRole", "iam:PassRole", "kms:Encrypt", "kms:Decrypt", "kms:GenerateDataKey" ]
    },
    "read" : {
      "permissions" : [ "datasync:DescribeLocationObjectStorage", "datasync:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "datasync:DescribeLocationObjectStorage", "datasync:ListTagsForResource", "datasync:TagResource", "datasync:UntagResource", "datasync:UpdateLocationObjectStorage", "secretsmanager:UpdateSecret", "secretsmanager:DeleteSecret", "secretsmanager:PutSecretValue", "secretsmanager:CreateSecret", "iam:CreateServiceLinkedRole", "iam:PassRole", "kms:Encrypt", "kms:Decrypt", "kms:GenerateDataKey" ]
    },
    "delete" : {
      "permissions" : [ "datasync:DeleteLocation", "secretsmanager:DeleteSecret" ]
    },
    "list" : {
      "permissions" : [ "datasync:ListLocations" ]
    }
  }
}