{
  "typeName" : "AWS::DataSync::LocationFSxONTAP",
  "description" : "Resource Type definition for AWS::DataSync::LocationFSxONTAP.",
  "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" ]
    },
    "Protocol" : {
      "additionalProperties" : false,
      "description" : "Configuration settings for NFS or SMB protocol.",
      "type" : "object",
      "properties" : {
        "NFS" : {
          "$ref" : "#/definitions/NFS"
        },
        "SMB" : {
          "$ref" : "#/definitions/SMB"
        }
      }
    },
    "NFS" : {
      "additionalProperties" : false,
      "description" : "NFS protocol configuration for FSx ONTAP file system.",
      "type" : "object",
      "properties" : {
        "MountOptions" : {
          "$ref" : "#/definitions/NfsMountOptions"
        }
      },
      "required" : [ "MountOptions" ]
    },
    "SMB" : {
      "additionalProperties" : false,
      "description" : "SMB protocol configuration for FSx ONTAP file system.",
      "type" : "object",
      "properties" : {
        "MountOptions" : {
          "$ref" : "#/definitions/SmbMountOptions"
        },
        "Domain" : {
          "description" : "The name of the Windows domain that the SMB server belongs to.",
          "type" : "string",
          "maxLength" : 253,
          "pattern" : "^([A-Za-z0-9]+[A-Za-z0-9-.]*)*[A-Za-z0-9-]*[A-Za-z0-9]$"
        },
        "Password" : {
          "description" : "The password of the user who can mount the share and has the permissions to access files and folders in the SMB share.",
          "type" : "string",
          "maxLength" : 104,
          "pattern" : "^.{0,104}$"
        },
        "User" : {
          "description" : "The user who can mount the share, has the permissions to access files and folders in the SMB share.",
          "type" : "string",
          "maxLength" : 104,
          "pattern" : "^[^\\x5B\\x5D\\\\/:;|=,+*?]{1,104}$"
        },
        "CmkSecretConfig" : {
          "$ref" : "#/definitions/CmkSecretConfig"
        },
        "CustomSecretConfig" : {
          "$ref" : "#/definitions/CustomSecretConfig"
        },
        "ManagedSecretConfig" : {
          "$ref" : "#/definitions/ManagedSecretConfig"
        }
      },
      "required" : [ "User", "MountOptions" ]
    },
    "NfsMountOptions" : {
      "additionalProperties" : false,
      "description" : "The NFS mount options that DataSync can use to mount your NFS share.",
      "type" : "object",
      "properties" : {
        "Version" : {
          "description" : "The specific NFS version that you want DataSync to use to mount your NFS share.",
          "type" : "string",
          "enum" : [ "AUTOMATIC", "NFS3", "NFS4_0", "NFS4_1" ]
        }
      }
    },
    "SmbMountOptions" : {
      "additionalProperties" : false,
      "description" : "The mount options used by DataSync to access the SMB server.",
      "type" : "object",
      "properties" : {
        "Version" : {
          "description" : "The specific SMB version that you want DataSync to use to mount your SMB share.",
          "type" : "string",
          "enum" : [ "AUTOMATIC", "SMB2", "SMB3" ]
        }
      }
    },
    "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" : {
    "StorageVirtualMachineArn" : {
      "description" : "The Amazon Resource Name (ARN) for the FSx ONTAP SVM.",
      "type" : "string",
      "maxLength" : 162,
      "pattern" : "^arn:(aws|aws-cn|aws-us-gov|aws-eusc|aws-iso|aws-iso-b):fsx:[a-z\\-0-9]+:[0-9]{12}:storage-virtual-machine/fs-[0-9a-f]+/svm-[0-9a-f]{17,}$"
    },
    "FsxFilesystemArn" : {
      "description" : "The Amazon Resource Name (ARN) for the FSx ONAP file system.",
      "type" : "string",
      "maxLength" : 128,
      "pattern" : "^arn:(aws|aws-cn|aws-us-gov|aws-eusc|aws-iso|aws-iso-b):fsx:[a-z\\-0-9]+:[0-9]{12}:file-system/fs-[0-9a-f]+$"
    },
    "SecurityGroupArns" : {
      "description" : "The ARNs of the security groups that are to use to configure the FSx ONTAP file system.",
      "type" : "array",
      "items" : {
        "type" : "string",
        "maxLength" : 128,
        "pattern" : "^arn:(aws|aws-cn|aws-us-gov|aws-eusc|aws-iso|aws-iso-b):ec2:[a-z\\-0-9]*:[0-9]{12}:security-group/sg-[a-f0-9]+$"
      },
      "maxItems" : 5,
      "minItems" : 1,
      "insertionOrder" : false
    },
    "Protocol" : {
      "$ref" : "#/definitions/Protocol"
    },
    "Subdirectory" : {
      "description" : "A subdirectory in the location's path.",
      "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,
      "minItems" : 0,
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    },
    "LocationArn" : {
      "description" : "The Amazon Resource Name (ARN) of the Amazon FSx ONTAP file system 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 FSx ONTAP file system that was described.",
      "type" : "string",
      "pattern" : "^(efs|nfs|s3|smb|hdfs|fsx[a-z0-9-]+)://[a-zA-Z0-9.:/\\-]+$",
      "maxLength" : 4360
    }
  },
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "datasync:TagResource", "datasync:UntagResource", "datasync:ListTagsForResource" ]
  },
  "additionalProperties" : false,
  "required" : [ "SecurityGroupArns", "StorageVirtualMachineArn" ],
  "readOnlyProperties" : [ "/properties/LocationArn", "/properties/LocationUri", "/properties/FsxFilesystemArn", "/properties/Protocol/SMB/ManagedSecretConfig", "/properties/Protocol/SMB/CmkSecretConfig/SecretArn" ],
  "writeOnlyProperties" : [ "/properties/Protocol/SMB/Password", "/properties/Subdirectory" ],
  "primaryIdentifier" : [ "/properties/LocationArn" ],
  "createOnlyProperties" : [ "/properties/StorageVirtualMachineArn", "/properties/SecurityGroupArns" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "datasync:CreateLocationFsxOntap", "datasync:DescribeLocationFsxOntap", "datasync:ListTagsForResource", "datasync:TagResource", "fsx:DescribeStorageVirtualMachines", "fsx:DescribeFileSystems", "ec2:DescribeNetworkInterfaces", "ec2:DescribeSubnets", "ec2:DescribeSecurityGroups", "secretsmanager:CreateSecret", "secretsmanager:PutSecretValue", "secretsmanager:DeleteSecret", "iam:CreateServiceLinkedRole", "iam:PassRole", "kms:Encrypt", "kms:Decrypt", "kms:GenerateDataKey" ]
    },
    "read" : {
      "permissions" : [ "datasync:DescribeLocationFsxOntap", "datasync:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "datasync:UpdateLocationFsxOntap", "datasync:DescribeLocationFsxOntap", "datasync:ListTagsForResource", "datasync:TagResource", "datasync:UntagResource", "fsx:DescribeFileSystems", "fsx:DescribeStorageVirtualMachines", "ec2:DescribeNetworkInterfaces", "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" ]
    }
  }
}