{
  "typeName" : "AWS::Transfer::Agreement",
  "description" : "Resource Type definition for AWS::Transfer::Agreement",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-transfer",
  "definitions" : {
    "Tag" : {
      "description" : "Creates a key-value pair for a specific resource.",
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string",
          "description" : "The name assigned to the tag that you create.",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "type" : "string",
          "description" : "Contains one or more values that you assigned to the key name you create.",
          "minLength" : 0,
          "maxLength" : 256
        }
      },
      "required" : [ "Key", "Value" ],
      "additionalProperties" : false
    }
  },
  "properties" : {
    "Description" : {
      "description" : "A textual description for the agreement.",
      "type" : "string",
      "pattern" : "^[\\u0021-\\u007E]+$",
      "minLength" : 1,
      "maxLength" : 200
    },
    "ServerId" : {
      "description" : "A unique identifier for the server.",
      "type" : "string",
      "pattern" : "^s-([0-9a-f]{17})$",
      "minLength" : 19,
      "maxLength" : 19
    },
    "LocalProfileId" : {
      "description" : "A unique identifier for the local profile.",
      "type" : "string",
      "pattern" : "^p-([0-9a-f]{17})$",
      "minLength" : 19,
      "maxLength" : 19
    },
    "PartnerProfileId" : {
      "description" : "A unique identifier for the partner profile.",
      "type" : "string",
      "pattern" : "^p-([0-9a-f]{17})$",
      "minLength" : 19,
      "maxLength" : 19
    },
    "BaseDirectory" : {
      "description" : "Specifies the base directory for the agreement.",
      "type" : "string",
      "pattern" : "^(|/.*)$",
      "maxLength" : 1024
    },
    "AccessRole" : {
      "description" : "Specifies the access role for the agreement.",
      "type" : "string",
      "pattern" : "arn:.*role/.*",
      "minLength" : 20,
      "maxLength" : 2048
    },
    "Status" : {
      "description" : "Specifies the status of the agreement.",
      "type" : "string",
      "enum" : [ "ACTIVE", "INACTIVE" ]
    },
    "Tags" : {
      "description" : "Key-value pairs that can be used to group and search for agreements. Tags are metadata attached to agreements for any purpose.",
      "type" : "array",
      "maxItems" : 50,
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    },
    "AgreementId" : {
      "description" : "A unique identifier for the agreement.",
      "type" : "string",
      "pattern" : "^a-([0-9a-f]{17})$",
      "minLength" : 19,
      "maxLength" : 19
    },
    "Arn" : {
      "description" : "Specifies the unique Amazon Resource Name (ARN) for the agreement.",
      "type" : "string",
      "pattern" : "arn:.*",
      "minLength" : 20,
      "maxLength" : 1600
    },
    "PreserveFilename" : {
      "description" : "Specifies whether to preserve the filename received for this agreement.",
      "type" : "string",
      "enum" : [ "ENABLED", "DISABLED" ]
    },
    "EnforceMessageSigning" : {
      "description" : "Specifies whether to enforce an AS2 message is signed for this agreement.",
      "type" : "string",
      "enum" : [ "ENABLED", "DISABLED" ]
    },
    "CustomDirectories" : {
      "description" : "Specifies a separate directory for each type of file to store for an AS2 message.",
      "type" : "object",
      "properties" : {
        "FailedFilesDirectory" : {
          "type" : "string",
          "description" : "Specifies a location to store the failed files for an AS2 message.",
          "pattern" : "(|/.*)"
        },
        "MdnFilesDirectory" : {
          "type" : "string",
          "description" : "Specifies a location to store the MDN file for an AS2 message.",
          "pattern" : "(|/.*)"
        },
        "PayloadFilesDirectory" : {
          "type" : "string",
          "description" : "Specifies a location to store the payload file for an AS2 message.",
          "pattern" : "(|/.*)"
        },
        "StatusFilesDirectory" : {
          "type" : "string",
          "description" : "Specifies a location to store the status file for an AS2 message.",
          "pattern" : "(|/.*)"
        },
        "TemporaryFilesDirectory" : {
          "type" : "string",
          "description" : "Specifies a location to store the temporary processing file for an AS2 message.",
          "pattern" : "(|/.*)"
        }
      },
      "required" : [ "FailedFilesDirectory", "MdnFilesDirectory", "PayloadFilesDirectory", "StatusFilesDirectory", "TemporaryFilesDirectory" ],
      "additionalProperties" : false
    }
  },
  "additionalProperties" : false,
  "required" : [ "ServerId", "LocalProfileId", "PartnerProfileId", "AccessRole" ],
  "readOnlyProperties" : [ "/properties/AgreementId", "/properties/Arn" ],
  "createOnlyProperties" : [ "/properties/ServerId" ],
  "primaryIdentifier" : [ "/properties/AgreementId", "/properties/ServerId" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "transfer:ListTagsForResource", "transfer:UnTagResource", "transfer:TagResource" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "transfer:CreateAgreement", "transfer:TagResource", "iam:PassRole" ]
    },
    "read" : {
      "permissions" : [ "transfer:DescribeAgreement" ]
    },
    "update" : {
      "permissions" : [ "transfer:UpdateAgreement", "transfer:UnTagResource", "transfer:TagResource", "iam:PassRole" ]
    },
    "delete" : {
      "permissions" : [ "transfer:DeleteAgreement" ]
    },
    "list" : {
      "handlerSchema" : {
        "properties" : {
          "ServerId" : {
            "$ref" : "resource-schema.json#/properties/ServerId"
          }
        },
        "required" : [ "ServerId" ]
      },
      "permissions" : [ "transfer:ListAgreements" ]
    }
  }
}