{
  "typeName" : "AWS::FSx::S3AccessPointAttachment",
  "description" : "Resource type definition for AWS::FSx::S3AccessPointAttachment",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git",
  "properties" : {
    "Name" : {
      "description" : "The name of the S3 access point attachment; also used for the name of the S3 access point.",
      "type" : "string",
      "minLength" : 3,
      "maxLength" : 50,
      "pattern" : "^(?=[a-z0-9])[a-z0-9-]{1,48}[a-z0-9]$"
    },
    "Type" : {
      "description" : "The type of Amazon FSx volume that the S3 access point is attached to.",
      "type" : "string",
      "enum" : [ "OPENZFS", "ONTAP" ]
    },
    "OntapConfiguration" : {
      "description" : "The OntapConfiguration of the S3 access point attachment.",
      "$ref" : "#/definitions/S3AccessPointOntapConfiguration"
    },
    "OpenZFSConfiguration" : {
      "description" : "The OpenZFSConfiguration of the S3 access point attachment.",
      "$ref" : "#/definitions/S3AccessPointOpenZFSConfiguration"
    },
    "S3AccessPoint" : {
      "description" : "The S3 access point configuration of the S3 access point attachment.",
      "$ref" : "#/definitions/S3AccessPoint"
    },
    "Lifecycle" : {
      "description" : "The lifecycle status of the S3 access point attachment.",
      "type" : "string",
      "enum" : [ "AVAILABLE", "CREATING", "DELETING", "FAILED", "MISCONFIGURED", "UPDATING" ]
    }
  },
  "definitions" : {
    "S3AccessPointVpcConfiguration" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "VpcId" : {
          "description" : "Specifies the virtual private cloud (VPC) for the S3 access point VPC configuration, if one exists.",
          "type" : "string",
          "minLength" : 12,
          "maxLength" : 21,
          "pattern" : "^(vpc-[0-9a-f]{8,})$"
        }
      },
      "required" : [ "VpcId" ]
    },
    "S3AccessPoint" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "ResourceARN" : {
          "description" : "The S3 access point's ARN.",
          "type" : "string",
          "minLength" : 8,
          "maxLength" : 1024,
          "pattern" : "^arn:[^:]{1,63}:[^:]{0,63}:[^:]{0,63}:(?:|\\d{12}):[^/].{0,1023}$"
        },
        "Alias" : {
          "description" : "The S3 access point's alias.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 63,
          "pattern" : "^[0-9a-z\\\\-]{1,63}"
        },
        "VpcConfiguration" : {
          "description" : "The S3 access point's virtual private cloud (VPC) configuration.",
          "$ref" : "#/definitions/S3AccessPointVpcConfiguration"
        },
        "Policy" : {
          "description" : "The S3 access point's policy.",
          "type" : [ "object", "string" ],
          "minLength" : 1,
          "maxLength" : 200000
        }
      }
    },
    "OntapUnixFileSystemUser" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Name" : {
          "description" : "The name of the UNIX user.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 256,
          "pattern" : "^[^\\u0000\\u0085\\u2028\\u2029\\r\\n]{1,256}$"
        }
      },
      "required" : [ "Name" ]
    },
    "OntapWindowsFileSystemUser" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Name" : {
          "description" : "The name of the Windows user.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 256,
          "pattern" : "^[^\\u0000\\u0085\\u2028\\u2029\\r\\n]{1,256}$"
        }
      },
      "required" : [ "Name" ]
    },
    "OntapFileSystemIdentity" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Type" : {
          "description" : "Specifies the FSx for ONTAP user identity type, accepts either UNIX or WINDOWS.",
          "type" : "string",
          "enum" : [ "UNIX", "WINDOWS" ]
        },
        "UnixUser" : {
          "description" : "Specifies the properties of the file system UNIX user.",
          "$ref" : "#/definitions/OntapUnixFileSystemUser"
        },
        "WindowsUser" : {
          "description" : "Specifies the properties of the file system Windows user.",
          "$ref" : "#/definitions/OntapWindowsFileSystemUser"
        }
      },
      "required" : [ "Type" ],
      "oneOf" : [ {
        "required" : [ "UnixUser" ]
      }, {
        "required" : [ "WindowsUser" ]
      } ]
    },
    "S3AccessPointOntapConfiguration" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "VolumeId" : {
          "description" : "The ID of the FSx for ONTAP volume that the S3 access point is attached to.",
          "type" : "string",
          "minLength" : 23,
          "maxLength" : 23,
          "pattern" : "^(fsvol-[0-9a-f]{17,})$"
        },
        "FileSystemIdentity" : {
          "description" : "The file system identity used to authorize file access requests made using the S3 access point.",
          "$ref" : "#/definitions/OntapFileSystemIdentity"
        }
      },
      "required" : [ "VolumeId", "FileSystemIdentity" ]
    },
    "OpenZFSPosixFileSystemUser" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Uid" : {
          "description" : "The UID of the file system user.",
          "type" : "number",
          "minimum" : 0,
          "maximum" : 4294967295
        },
        "Gid" : {
          "description" : "The GID of the file system user.",
          "type" : "number",
          "minimum" : 0,
          "maximum" : 4294967295
        },
        "SecondaryGids" : {
          "description" : "The list of secondary GIDs for the file system user.",
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/FileSystemGID"
          }
        }
      },
      "required" : [ "Uid", "Gid" ]
    },
    "OpenZFSFileSystemIdentity" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Type" : {
          "description" : "Specifies the FSx for OpenZFS user identity type, accepts only POSIX.",
          "type" : "string",
          "enum" : [ "POSIX" ]
        },
        "PosixUser" : {
          "description" : "Specifies the UID and GIDs of the file system POSIX user.",
          "$ref" : "#/definitions/OpenZFSPosixFileSystemUser"
        }
      },
      "required" : [ "Type", "PosixUser" ]
    },
    "S3AccessPointOpenZFSConfiguration" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "VolumeId" : {
          "description" : "The ID of the FSx for OpenZFS volume that the S3 access point is attached to.",
          "type" : "string",
          "minLength" : 23,
          "maxLength" : 23,
          "pattern" : "^(fsvol-[0-9a-f]{17,})$"
        },
        "FileSystemIdentity" : {
          "description" : "The file system identity used to authorize file access requests made using the S3 access point.",
          "$ref" : "#/definitions/OpenZFSFileSystemIdentity"
        }
      },
      "required" : [ "VolumeId", "FileSystemIdentity" ]
    },
    "FileSystemGID" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Gid" : {
          "description" : "The GID of the file system user.",
          "type" : "number",
          "minimum" : 0,
          "maximum" : 4294967295
        }
      },
      "required" : [ "Gid" ]
    }
  },
  "additionalProperties" : false,
  "replacementStrategy" : "delete_then_create",
  "required" : [ "Name", "Type" ],
  "oneOf" : [ {
    "required" : [ "OntapConfiguration" ]
  }, {
    "required" : [ "OpenZFSConfiguration" ]
  } ],
  "createOnlyProperties" : [ "/properties/Name", "/properties/Type", "/properties/OntapConfiguration", "/properties/OpenZFSConfiguration", "/properties/S3AccessPoint" ],
  "readOnlyProperties" : [ "/properties/S3AccessPoint/ResourceARN", "/properties/S3AccessPoint/Alias", "/properties/Lifecycle" ],
  "writeOnlyProperties" : [ "/properties/S3AccessPoint/Policy" ],
  "primaryIdentifier" : [ "/properties/Name" ],
  "tagging" : {
    "taggable" : false
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "fsx:CreateAndAttachS3AccessPoint", "fsx:DescribeS3AccessPointAttachments", "s3:CreateAccessPoint", "s3:GetAccessPoint", "s3:PutAccessPointPolicy" ]
    },
    "read" : {
      "permissions" : [ "fsx:DescribeS3AccessPointAttachments", "s3:GetAccessPoint" ]
    },
    "delete" : {
      "permissions" : [ "fsx:DescribeS3AccessPointAttachments", "fsx:DetachAndDeleteS3AccessPoint", "s3:DeleteAccessPoint", "s3:GetAccessPoint" ]
    },
    "list" : {
      "permissions" : [ "fsx:DescribeS3AccessPointAttachments", "s3:GetAccessPoint" ]
    }
  }
}