{
  "typeName" : "AWS::FinSpace::Environment",
  "description" : "An example resource schema demonstrating some basic constructs and validation rules.",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git",
  "definitions" : {
    "FederationParameters" : {
      "description" : "Additional parameters to identify Federation mode",
      "type" : "object",
      "properties" : {
        "SamlMetadataURL" : {
          "description" : "SAML metadata URL to link with the Environment",
          "type" : "string",
          "pattern" : "^https?://[-a-zA-Z0-9+&amp;@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&amp;@#/%=~_|]{1,1000}"
        },
        "FederationProviderName" : {
          "description" : "Federation provider name to link with the Environment",
          "type" : "string",
          "pattern" : "[^_\\p{Z}][\\p{L}\\p{M}\\p{S}\\p{N}\\p{P}][^_\\p{Z}]+",
          "minLength" : 1,
          "maxLength" : 32
        },
        "SamlMetadataDocument" : {
          "description" : "SAML metadata document to link the federation provider to the Environment",
          "type" : "string",
          "pattern" : ".*",
          "minLength" : 1000,
          "maxLength" : 10000000
        },
        "ApplicationCallBackURL" : {
          "description" : "SAML metadata URL to link with the Environment",
          "type" : "string",
          "pattern" : "^https?://[-a-zA-Z0-9+&amp;@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&amp;@#/%=~_|]{1,1000}"
        },
        "FederationURN" : {
          "description" : "SAML metadata URL to link with the Environment",
          "type" : "string",
          "pattern" : "^[A-Za-z0-9._\\-:\\/#\\+]+{1,255}$"
        },
        "AttributeMap" : {
          "description" : "Attribute map for SAML configuration",
          "type" : "object"
        }
      }
    },
    "SuperuserParameters" : {
      "description" : "Parameters of the first Superuser for the FinSpace Environment",
      "type" : "object",
      "properties" : {
        "FirstName" : {
          "description" : "First name",
          "type" : "string",
          "pattern" : "^[a-zA-Z0-9]{1,50}$",
          "minLength" : 1,
          "maxLength" : 50
        },
        "LastName" : {
          "description" : "Last name",
          "type" : "string",
          "pattern" : "^[a-zA-Z0-9]{1,50}$",
          "minLength" : 1,
          "maxLength" : 50
        },
        "EmailAddress" : {
          "description" : "Email address",
          "type" : "string",
          "pattern" : "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+[.]+[A-Za-z]+",
          "minLength" : 1,
          "maxLength" : 128
        }
      }
    },
    "DataBundleArn" : {
      "type" : "string",
      "pattern" : "^arn:aws:finspace:[A-Za-z0-9_/.-]{0,63}:\\d*:data-bundle/[0-9A-Za-z_-]{1,128}$"
    }
  },
  "properties" : {
    "EnvironmentId" : {
      "description" : "Unique identifier for representing FinSpace Environment",
      "type" : "string",
      "pattern" : "^[a-zA-Z0-9]{1,26}$"
    },
    "Name" : {
      "description" : "Name of the Environment",
      "type" : "string",
      "pattern" : "^[a-zA-Z0-9]+[a-zA-Z0-9-]*[a-zA-Z0-9]{1,255}$"
    },
    "AwsAccountId" : {
      "description" : "AWS account ID associated with the Environment",
      "type" : "string",
      "pattern" : "^[a-zA-Z0-9]{1,26}$"
    },
    "Description" : {
      "description" : "Description of the Environment",
      "type" : "string",
      "pattern" : "^[a-zA-Z0-9. ]{1,1000}$"
    },
    "Status" : {
      "description" : "State of the Environment",
      "type" : "string",
      "enum" : [ "CREATE_REQUESTED", "CREATING", "CREATED", "DELETE_REQUESTED", "DELETING", "DELETED", "FAILED_CREATION", "FAILED_DELETION", "RETRY_DELETION", "SUSPENDED" ]
    },
    "EnvironmentUrl" : {
      "description" : "URL used to login to the Environment",
      "type" : "string",
      "pattern" : "^[-a-zA-Z0-9+&amp;@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&amp;@#/%=~_|]{1,1000}"
    },
    "EnvironmentArn" : {
      "description" : "ARN of the Environment",
      "type" : "string",
      "pattern" : "^arn:aws:finspace:[A-Za-z0-9_/.-]{0,63}:\\d+:environment/[0-9A-Za-z_-]{1,128}$"
    },
    "SageMakerStudioDomainUrl" : {
      "description" : "SageMaker Studio Domain URL associated with the Environment",
      "type" : "string",
      "pattern" : "^[a-zA-Z-0-9-:\\/.]*{1,1000}$"
    },
    "KmsKeyId" : {
      "description" : "KMS key used to encrypt customer data within FinSpace Environment infrastructure",
      "type" : "string",
      "pattern" : "^[a-zA-Z-0-9-:\\/]*{1,1000}$"
    },
    "DedicatedServiceAccountId" : {
      "description" : "ID for FinSpace created account used to store Environment artifacts",
      "type" : "string",
      "pattern" : "^[a-zA-Z0-9]{1,26}$"
    },
    "FederationMode" : {
      "description" : "Federation mode used with the Environment",
      "type" : "string",
      "enum" : [ "LOCAL", "FEDERATED" ]
    },
    "FederationParameters" : {
      "$ref" : "#/definitions/FederationParameters"
    },
    "SuperuserParameters" : {
      "$ref" : "#/definitions/SuperuserParameters"
    },
    "DataBundles" : {
      "description" : "ARNs of FinSpace Data Bundles to install",
      "type" : "array",
      "uniqueItems" : false,
      "items" : {
        "$ref" : "#/definitions/DataBundleArn"
      }
    }
  },
  "additionalProperties" : false,
  "required" : [ "Name" ],
  "readOnlyProperties" : [ "/properties/EnvironmentId", "/properties/Status", "/properties/SageMakerStudioDomainUrl", "/properties/EnvironmentArn", "/properties/EnvironmentUrl", "/properties/AwsAccountId", "/properties/DedicatedServiceAccountId" ],
  "createOnlyProperties" : [ "/properties/KmsKeyId", "/properties/SuperuserParameters", "/properties/DataBundles" ],
  "primaryIdentifier" : [ "/properties/EnvironmentId" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "finspace:CreateEnvironment", "finspace:GetEnvironment", "finspace:ListEnvironments", "sts:AssumeRole" ]
    },
    "read" : {
      "permissions" : [ "finspace:GetEnvironment" ]
    },
    "update" : {
      "permissions" : [ "finspace:UpdateEnvironment" ]
    },
    "delete" : {
      "permissions" : [ "finspace:DeleteEnvironment", "finspace:GetEnvironment" ]
    },
    "list" : {
      "permissions" : [ "finspace:ListEnvironments" ]
    }
  },
  "propertyTransform" : {
    "/properties/SuperuserParameters" : null,
    "/properties/DataBundles" : null
  }
}