{
  "typeName" : "AWS::Batch::ComputeEnvironment",
  "description" : "Resource Type definition for AWS::Batch::ComputeEnvironment",
  "additionalProperties" : false,
  "properties" : {
    "ComputeEnvironmentArn" : {
      "type" : "string"
    },
    "ComputeEnvironmentName" : {
      "type" : "string"
    },
    "ComputeResources" : {
      "$ref" : "#/definitions/ComputeResources"
    },
    "ReplaceComputeEnvironment" : {
      "type" : "boolean",
      "default" : true
    },
    "ServiceRole" : {
      "type" : "string"
    },
    "State" : {
      "type" : "string"
    },
    "Tags" : {
      "type" : "object",
      "description" : "A key-value pair to associate with a resource.",
      "patternProperties" : {
        ".*" : {
          "type" : "string"
        }
      },
      "additionalProperties" : false
    },
    "Type" : {
      "type" : "string"
    },
    "UpdatePolicy" : {
      "$ref" : "#/definitions/UpdatePolicy"
    },
    "UnmanagedvCpus" : {
      "type" : "integer"
    },
    "EksConfiguration" : {
      "$ref" : "#/definitions/EksConfiguration"
    },
    "Context" : {
      "type" : "string"
    }
  },
  "definitions" : {
    "ComputeResources" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "AllocationStrategy" : {
          "type" : "string"
        },
        "BidPercentage" : {
          "type" : "integer"
        },
        "DesiredvCpus" : {
          "type" : "integer"
        },
        "Ec2Configuration" : {
          "type" : "array",
          "uniqueItems" : false,
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/Ec2ConfigurationObject"
          }
        },
        "Ec2KeyPair" : {
          "type" : "string"
        },
        "ImageId" : {
          "type" : "string"
        },
        "InstanceRole" : {
          "type" : "string"
        },
        "InstanceTypes" : {
          "type" : "array",
          "uniqueItems" : false,
          "insertionOrder" : false,
          "items" : {
            "type" : "string"
          }
        },
        "LaunchTemplate" : {
          "$ref" : "#/definitions/LaunchTemplateSpecification"
        },
        "MaxvCpus" : {
          "type" : "integer"
        },
        "MinvCpus" : {
          "type" : "integer"
        },
        "PlacementGroup" : {
          "type" : "string"
        },
        "ScalingPolicy" : {
          "$ref" : "#/definitions/ComputeScalingPolicy"
        },
        "SecurityGroupIds" : {
          "type" : "array",
          "uniqueItems" : false,
          "insertionOrder" : false,
          "items" : {
            "type" : "string"
          }
        },
        "SpotIamFleetRole" : {
          "type" : "string"
        },
        "Subnets" : {
          "type" : "array",
          "uniqueItems" : false,
          "insertionOrder" : false,
          "items" : {
            "type" : "string"
          }
        },
        "Tags" : {
          "type" : "object",
          "description" : "A key-value pair to associate with a resource.",
          "patternProperties" : {
            ".*" : {
              "type" : "string"
            }
          },
          "additionalProperties" : false
        },
        "Type" : {
          "type" : "string"
        },
        "UpdateToLatestImageVersion" : {
          "type" : "boolean",
          "default" : false
        }
      },
      "required" : [ "Subnets", "Type", "MaxvCpus" ]
    },
    "ComputeScalingPolicy" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "MinScaleDownDelayMinutes" : {
          "type" : "integer"
        }
      }
    },
    "Ec2ConfigurationObject" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "ImageIdOverride" : {
          "type" : "string"
        },
        "ImageType" : {
          "type" : "string"
        },
        "ImageKubernetesVersion" : {
          "type" : "string"
        },
        "BatchImageStatus" : {
          "type" : "string"
        }
      },
      "required" : [ "ImageType" ]
    },
    "LaunchTemplateSpecification" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "LaunchTemplateId" : {
          "type" : "string"
        },
        "LaunchTemplateName" : {
          "type" : "string"
        },
        "Version" : {
          "type" : "string"
        },
        "UserdataType" : {
          "type" : "string",
          "enum" : [ "EKS_BOOTSTRAP_SH", "EKS_NODEADM" ]
        },
        "Overrides" : {
          "type" : "array",
          "uniqueItems" : false,
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/LaunchTemplateSpecificationOverride"
          }
        }
      }
    },
    "LaunchTemplateSpecificationOverride" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "LaunchTemplateId" : {
          "type" : "string"
        },
        "LaunchTemplateName" : {
          "type" : "string"
        },
        "Version" : {
          "type" : "string"
        },
        "UserdataType" : {
          "type" : "string",
          "enum" : [ "EKS_BOOTSTRAP_SH", "EKS_NODEADM" ]
        },
        "TargetInstanceTypes" : {
          "type" : "array",
          "uniqueItems" : false,
          "insertionOrder" : false,
          "items" : {
            "type" : "string"
          }
        }
      }
    },
    "UpdatePolicy" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "TerminateJobsOnUpdate" : {
          "type" : "boolean",
          "default" : false
        },
        "JobExecutionTimeoutMinutes" : {
          "type" : "integer",
          "default" : 30
        }
      }
    },
    "EksConfiguration" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "EksClusterArn" : {
          "type" : "string",
          "default" : false
        },
        "KubernetesNamespace" : {
          "type" : "string",
          "default" : false
        }
      },
      "required" : [ "EksClusterArn", "KubernetesNamespace" ]
    }
  },
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : false,
    "cloudFormationSystemTags" : false,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "Batch:TagResource", "Batch:UnTagResource" ]
  },
  "required" : [ "Type" ],
  "createOnlyProperties" : [ "/properties/ComputeResources/SpotIamFleetRole", "/properties/ComputeEnvironmentName", "/properties/Tags", "/properties/Type", "/properties/EksConfiguration" ],
  "conditionalCreateOnlyProperties" : [ "/properties/ComputeResources/AllocationStrategy", "/properties/ComputeResources/BidPercentage", "/properties/ComputeResources/Ec2Configuration", "/properties/ComputeResources/Ec2KeyPair", "/properties/ComputeResources/ImageId", "/properties/ComputeResources/InstanceRole", "/properties/ComputeResources/InstanceTypes", "/properties/ComputeResources/LaunchTemplate", "/properties/ComputeResources/PlacementGroup", "/properties/ComputeResources/ScalingPolicy", "/properties/ComputeResources/SecurityGroupIds", "/properties/ComputeResources/Subnets", "/properties/ComputeResources/Tags", "/properties/ComputeResources/Type" ],
  "writeOnlyProperties" : [ "/properties/ComputeResources/UpdateToLatestImageVersion", "/properties/ReplaceComputeEnvironment", "/properties/UpdatePolicy" ],
  "primaryIdentifier" : [ "/properties/ComputeEnvironmentArn" ],
  "readOnlyProperties" : [ "/properties/ComputeEnvironmentArn", "/properties/ComputeResources/Ec2Configuration/*/BatchImageStatus" ],
  "additionalIdentifiers" : [ [ "/properties/ComputeEnvironmentName" ] ],
  "handlers" : {
    "create" : {
      "permissions" : [ "Batch:CreateComputeEnvironment", "Batch:TagResource", "Batch:DescribeComputeEnvironments", "iam:CreateServiceLinkedRole", "Iam:PassRole", "Eks:DescribeCluster", "ec2:DescribeLaunchTemplateVersions" ]
    },
    "read" : {
      "permissions" : [ "Batch:DescribeComputeEnvironments" ]
    },
    "update" : {
      "permissions" : [ "Batch:UpdateComputeEnvironment", "Batch:DescribeComputeEnvironments", "Batch:TagResource", "Batch:UnTagResource", "Iam:PassRole", "Eks:DescribeCluster", "ec2:DescribeLaunchTemplateVersions" ]
    },
    "delete" : {
      "permissions" : [ "Batch:DeleteComputeEnvironment", "Batch:DescribeComputeEnvironments", "Batch:UpdateComputeEnvironment", "Iam:PassRole", "Eks:DescribeCluster", "ec2:DescribeLaunchTemplateVersions" ]
    },
    "list" : {
      "permissions" : [ "Batch:DescribeComputeEnvironments" ]
    }
  }
}