{
  "typeName" : "AWS::Lambda::CapacityProvider",
  "description" : "Creates a capacity provider that manages compute resources for Lambda functions",
  "definitions" : {
    "Architecture" : {
      "description" : "Specifications for the types of EC2 instances that the capacity provider can use.",
      "type" : "string",
      "enum" : [ "x86_64", "arm64" ]
    },
    "CapacityProviderPermissionsConfig" : {
      "description" : "Configuration that specifies the permissions required for the capacity provider to manage compute resources.",
      "type" : "object",
      "properties" : {
        "CapacityProviderOperatorRoleArn" : {
          "description" : "The ARN of the IAM role that the capacity provider uses to manage compute instances and other AWS resources.",
          "type" : "string",
          "maxLength" : 10000,
          "minLength" : 0,
          "pattern" : "^arn:(aws[a-zA-Z-]*)?:iam::\\d{12}:role/?[a-zA-Z_0-9+=,.@\\-_/]+$"
        }
      },
      "required" : [ "CapacityProviderOperatorRoleArn" ],
      "additionalProperties" : false
    },
    "CapacityProviderPredefinedMetricType" : {
      "description" : "The predefined metric for target tracking.",
      "type" : "string",
      "enum" : [ "LambdaCapacityProviderAverageCPUUtilization" ]
    },
    "CapacityProviderScalingConfig" : {
      "description" : "Configuration that defines how the capacity provider scales compute instances based on demand and policies.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "MaxVCpuCount" : {
          "description" : "The maximum number of vCPUs that the capacity provider can provision across all compute instances.",
          "type" : "integer",
          "minimum" : 2,
          "maximum" : 15000
        },
        "ScalingMode" : {
          "$ref" : "#/definitions/CapacityProviderScalingMode",
          "description" : "The scaling mode that determines how the capacity provider responds to changes in demand."
        },
        "ScalingPolicies" : {
          "description" : "A list of target tracking scaling policies for the capacity provider.",
          "type" : "array",
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/TargetTrackingScalingPolicy"
          },
          "maxItems" : 10,
          "minItems" : 1
        }
      }
    },
    "CapacityProviderScalingMode" : {
      "description" : "The scaling mode for the capacity provider.",
      "type" : "string",
      "enum" : [ "Auto", "Manual" ]
    },
    "CapacityProviderState" : {
      "description" : "The current state of the capacity provider. Indicates whether the provider is being created, is active and ready for use, has failed, or is being deleted.",
      "type" : "string",
      "enum" : [ "Pending", "Active", "Failed", "Deleting" ]
    },
    "CapacityProviderVpcConfig" : {
      "description" : "VPC configuration that specifies the network settings for compute instances managed by the capacity provider.",
      "type" : "object",
      "properties" : {
        "SubnetIds" : {
          "description" : "A list of subnet IDs where the capacity provider launches compute instances.",
          "type" : "array",
          "insertionOrder" : false,
          "items" : {
            "type" : "string",
            "maxLength" : 1024,
            "minLength" : 0,
            "pattern" : "^subnet-[0-9a-z]*$"
          },
          "maxItems" : 16,
          "minItems" : 1
        },
        "SecurityGroupIds" : {
          "description" : "A list of security group IDs that control network access for compute instances managed by the capacity provider.",
          "type" : "array",
          "insertionOrder" : false,
          "items" : {
            "type" : "string",
            "maxLength" : 1024,
            "minLength" : 0,
            "pattern" : "^sg-[0-9a-zA-Z]*$"
          },
          "maxItems" : 5,
          "minItems" : 0
        }
      },
      "required" : [ "SubnetIds", "SecurityGroupIds" ],
      "additionalProperties" : false
    },
    "InstanceRequirements" : {
      "description" : "Specifications that define the characteristics and constraints for compute instances used by the capacity provider.",
      "type" : "object",
      "properties" : {
        "Architectures" : {
          "description" : "A list of supported CPU architectures for compute instances. Valid values include ``x86_64`` and ``arm64``.",
          "type" : "array",
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/Architecture"
          },
          "maxItems" : 1,
          "minItems" : 1
        },
        "AllowedInstanceTypes" : {
          "description" : "A list of EC2 instance types that the capacity provider is allowed to use. If not specified, all compatible instance types are allowed.",
          "type" : "array",
          "insertionOrder" : false,
          "items" : {
            "type" : "string",
            "maxLength" : 30,
            "minLength" : 1,
            "pattern" : "^[a-zA-Z0-9\\.\\-]+$"
          },
          "maxItems" : 400,
          "minItems" : 0
        },
        "ExcludedInstanceTypes" : {
          "description" : "A list of EC2 instance types that the capacity provider should not use, even if they meet other requirements.",
          "type" : "array",
          "insertionOrder" : false,
          "items" : {
            "type" : "string",
            "maxLength" : 30,
            "minLength" : 1,
            "pattern" : "^[a-zA-Z0-9\\.\\-]+$"
          },
          "maxItems" : 400,
          "minItems" : 0
        }
      },
      "additionalProperties" : false
    },
    "PropagateTagsConfig" : {
      "description" : "Configuration that defines how tags are propagated to managed resources.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Mode" : {
          "$ref" : "#/definitions/PropagateTagsMode",
          "description" : "The mode for tag propagation. Use ``Explicit`` to propagate specific tags, or ``None`` to disable propagation."
        },
        "ExplicitTags" : {
          "description" : "A list of tags to explicitly propagate to managed resources. Maximum of 40 tags.",
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "maxItems" : 40,
          "minItems" : 0,
          "items" : {
            "$ref" : "#/definitions/Tag"
          }
        }
      }
    },
    "PropagateTagsMode" : {
      "description" : "The mode for tag propagation.",
      "type" : "string",
      "enum" : [ "None", "Explicit" ]
    },
    "CapacityProviderTelemetryConfig" : {
      "description" : "",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "LoggingConfig" : {
          "description" : "",
          "$ref" : "#/definitions/CapacityProviderLoggingConfig"
        }
      }
    },
    "CapacityProviderLoggingConfig" : {
      "description" : "",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "LogGroup" : {
          "type" : "string",
          "description" : "",
          "pattern" : "[\\.\\-_/#A-Za-z0-9]+",
          "minLength" : 1,
          "maxLength" : 512
        },
        "SystemLogLevel" : {
          "type" : "string",
          "description" : "",
          "enum" : [ "DEBUG", "INFO", "WARN" ]
        }
      }
    },
    "Tag" : {
      "description" : "A key-value pair that provides metadata for the capacity provider.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Key" : {
          "type" : "string",
          "description" : "The key name of the tag.",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "type" : "string",
          "description" : "The value for the tag.",
          "minLength" : 0,
          "maxLength" : 256
        }
      },
      "required" : [ "Key" ]
    },
    "TargetTrackingScalingPolicy" : {
      "description" : "A scaling policy for the capacity provider that automatically adjusts capacity to maintain a target value for a specific metric.",
      "type" : "object",
      "properties" : {
        "PredefinedMetricType" : {
          "$ref" : "#/definitions/CapacityProviderPredefinedMetricType",
          "description" : "The predefined metric type to track for scaling decisions."
        },
        "TargetValue" : {
          "description" : "The target value for the metric that the scaling policy attempts to maintain through scaling actions.",
          "type" : "number",
          "minimum" : 0
        }
      },
      "required" : [ "PredefinedMetricType", "TargetValue" ],
      "additionalProperties" : false
    }
  },
  "properties" : {
    "Arn" : {
      "description" : "",
      "type" : "string",
      "maxLength" : 140,
      "minLength" : 1,
      "pattern" : "^arn:aws[a-zA-Z-]*:lambda:(eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\\d{1}:\\d{12}:capacity-provider:[a-zA-Z0-9-_]+$"
    },
    "CapacityProviderName" : {
      "description" : "",
      "type" : "string",
      "maxLength" : 140,
      "minLength" : 1,
      "pattern" : "^(arn:aws[a-zA-Z-]*:lambda:(eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\\d{1}:\\d{12}:capacity-provider:[a-zA-Z0-9-_]+)|[a-zA-Z0-9-_]+$"
    },
    "CapacityProviderScalingConfig" : {
      "description" : "The scaling configuration for the capacity provider.",
      "$ref" : "#/definitions/CapacityProviderScalingConfig"
    },
    "InstanceRequirements" : {
      "description" : "The instance requirements for compute resources managed by the capacity provider.",
      "$ref" : "#/definitions/InstanceRequirements"
    },
    "KmsKeyArn" : {
      "description" : "The ARN of the KMS key used to encrypt the capacity provider's resources.",
      "type" : "string",
      "maxLength" : 10000,
      "minLength" : 0,
      "pattern" : "^(arn:(aws[a-zA-Z-]*)?:[a-z0-9-.]+:.*)|()$"
    },
    "PermissionsConfig" : {
      "description" : "The permissions configuration for the capacity provider.",
      "$ref" : "#/definitions/CapacityProviderPermissionsConfig"
    },
    "State" : {
      "description" : "",
      "$ref" : "#/definitions/CapacityProviderState"
    },
    "Tags" : {
      "description" : "A key-value pair that provides metadata for the capacity provider.",
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    },
    "VpcConfig" : {
      "description" : "The VPC configuration for the capacity provider.",
      "$ref" : "#/definitions/CapacityProviderVpcConfig"
    },
    "PropagateTags" : {
      "description" : "Configuration for tag propagation to managed resources launched by the capacity provider.",
      "$ref" : "#/definitions/PropagateTagsConfig"
    },
    "TelemetryConfig" : {
      "description" : "",
      "$ref" : "#/definitions/CapacityProviderTelemetryConfig"
    }
  },
  "required" : [ "PermissionsConfig", "VpcConfig" ],
  "readOnlyProperties" : [ "/properties/State", "/properties/Arn" ],
  "createOnlyProperties" : [ "/properties/CapacityProviderName", "/properties/VpcConfig", "/properties/InstanceRequirements", "/properties/PermissionsConfig", "/properties/KmsKeyArn" ],
  "primaryIdentifier" : [ "/properties/CapacityProviderName" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "lambda:TagResource", "lambda:UntagResource" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "lambda:CreateCapacityProvider", "lambda:GetCapacityProvider", "lambda:TagResource", "iam:PassRole", "iam:CreateServiceLinkedRole", "kms:DescribeKey" ]
    },
    "read" : {
      "permissions" : [ "lambda:GetCapacityProvider", "lambda:ListTags" ]
    },
    "update" : {
      "permissions" : [ "lambda:UpdateCapacityProvider", "lambda:TagResource", "lambda:UntagResource" ]
    },
    "delete" : {
      "permissions" : [ "lambda:DeleteCapacityProvider", "lambda:GetCapacityProvider" ]
    },
    "list" : {
      "handlerSchema" : {
        "properties" : {
          "State" : {
            "description" : "The current state of the capacity provider. Indicates whether the provider is being created, is active and ready for use, has failed, or is being deleted.",
            "type" : "string",
            "enum" : [ "Pending", "Active", "Failed", "Deleting" ]
          }
        }
      },
      "permissions" : [ "lambda:ListCapacityProviders" ]
    }
  },
  "additionalProperties" : false
}