{
  "typeName" : "AWS::AppRunner::Service",
  "description" : "The AWS::AppRunner::Service resource specifies an AppRunner Service.",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-apprunner.git",
  "definitions" : {
    "SourceConfiguration" : {
      "description" : "Source Code configuration",
      "type" : "object",
      "properties" : {
        "CodeRepository" : {
          "$ref" : "#/definitions/CodeRepository"
        },
        "ImageRepository" : {
          "$ref" : "#/definitions/ImageRepository"
        },
        "AutoDeploymentsEnabled" : {
          "description" : "Auto Deployment enabled",
          "type" : "boolean"
        },
        "AuthenticationConfiguration" : {
          "$ref" : "#/definitions/AuthenticationConfiguration"
        }
      },
      "additionalProperties" : false
    },
    "CodeRepository" : {
      "description" : "Source Code Repository",
      "type" : "object",
      "properties" : {
        "RepositoryUrl" : {
          "type" : "string",
          "description" : "Repository Url"
        },
        "SourceCodeVersion" : {
          "$ref" : "#/definitions/SourceCodeVersion"
        },
        "CodeConfiguration" : {
          "$ref" : "#/definitions/CodeConfiguration"
        },
        "SourceDirectory" : {
          "type" : "string",
          "description" : "Source Directory",
          "minLength" : 1,
          "maxLength" : 4096,
          "pattern" : "[^\\x00]+"
        }
      },
      "required" : [ "RepositoryUrl", "SourceCodeVersion" ],
      "additionalProperties" : false
    },
    "SourceCodeVersion" : {
      "description" : "Source Code Version",
      "type" : "object",
      "properties" : {
        "Type" : {
          "type" : "string",
          "description" : "Source Code Version Type",
          "enum" : [ "BRANCH" ]
        },
        "Value" : {
          "type" : "string",
          "description" : "Source Code Version Value"
        }
      },
      "required" : [ "Type", "Value" ],
      "additionalProperties" : false
    },
    "CodeConfiguration" : {
      "description" : "Code Configuration",
      "type" : "object",
      "properties" : {
        "ConfigurationSource" : {
          "type" : "string",
          "description" : "Configuration Source",
          "enum" : [ "REPOSITORY", "API" ]
        },
        "CodeConfigurationValues" : {
          "$ref" : "#/definitions/CodeConfigurationValues"
        }
      },
      "required" : [ "ConfigurationSource" ],
      "additionalProperties" : false
    },
    "CodeConfigurationValues" : {
      "description" : "Code Configuration Values",
      "type" : "object",
      "properties" : {
        "Runtime" : {
          "type" : "string",
          "description" : "Runtime",
          "enum" : [ "PYTHON_3", "NODEJS_12", "NODEJS_14", "CORRETTO_8", "CORRETTO_11", "NODEJS_16", "GO_1", "DOTNET_6", "PHP_81", "RUBY_31", "PYTHON_311", "NODEJS_18", "NODEJS_22" ]
        },
        "BuildCommand" : {
          "type" : "string",
          "description" : "Build Command"
        },
        "StartCommand" : {
          "type" : "string",
          "description" : "Start Command"
        },
        "Port" : {
          "type" : "string",
          "description" : "Port"
        },
        "RuntimeEnvironmentVariables" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/KeyValuePair"
          }
        },
        "RuntimeEnvironmentSecrets" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/KeyValuePair"
          },
          "description" : "The secrets and parameters that get referenced by your service as environment variables"
        }
      },
      "required" : [ "Runtime" ],
      "additionalProperties" : false
    },
    "ImageRepository" : {
      "description" : "Image Repository",
      "type" : "object",
      "properties" : {
        "ImageIdentifier" : {
          "type" : "string",
          "description" : "Image Identifier",
          "minLength" : 1,
          "maxLength" : 1024,
          "pattern" : "([0-9]{12}.dkr.ecr.[a-z\\-]+-[0-9]{1}.amazonaws.com\\/.*)|(^public\\.ecr\\.aws\\/.+\\/.+)"
        },
        "ImageConfiguration" : {
          "$ref" : "#/definitions/ImageConfiguration"
        },
        "ImageRepositoryType" : {
          "type" : "string",
          "description" : "Image Repository Type",
          "enum" : [ "ECR", "ECR_PUBLIC" ]
        }
      },
      "required" : [ "ImageIdentifier", "ImageRepositoryType" ],
      "additionalProperties" : false
    },
    "ImageConfiguration" : {
      "description" : "Image Configuration",
      "type" : "object",
      "properties" : {
        "StartCommand" : {
          "type" : "string",
          "description" : "Start Command"
        },
        "Port" : {
          "type" : "string",
          "description" : "Port"
        },
        "RuntimeEnvironmentVariables" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/KeyValuePair"
          }
        },
        "RuntimeEnvironmentSecrets" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/KeyValuePair"
          },
          "description" : "The secrets and parameters that get referenced by your service as environment variables"
        }
      },
      "additionalProperties" : false
    },
    "AuthenticationConfiguration" : {
      "description" : "Authentication Configuration",
      "type" : "object",
      "properties" : {
        "ConnectionArn" : {
          "type" : "string",
          "description" : "Connection Arn",
          "minLength" : 1,
          "maxLength" : 1011,
          "pattern" : "arn:aws(-[\\w]+)*:[a-z0-9-\\\\.]{0,63}:[a-z0-9-\\\\.]{0,63}:[0-9]{12}:(\\w|\\/|-){1,1011}"
        },
        "AccessRoleArn" : {
          "description" : "Access Role Arn",
          "$ref" : "#/definitions/RoleArn"
        }
      },
      "additionalProperties" : false
    },
    "InstanceConfiguration" : {
      "description" : "Instance Configuration",
      "type" : "object",
      "properties" : {
        "Cpu" : {
          "type" : "string",
          "description" : "CPU",
          "minLength" : 3,
          "maxLength" : 9,
          "pattern" : "256|512|1024|2048|4096|(0.25|0.5|1|2|4) vCPU"
        },
        "Memory" : {
          "type" : "string",
          "description" : "Memory",
          "minLength" : 3,
          "maxLength" : 6,
          "pattern" : "512|1024|2048|3072|4096|6144|8192|10240|12288|(0.5|1|2|3|4|6|8|10|12) GB"
        },
        "InstanceRoleArn" : {
          "description" : "Instance Role Arn",
          "$ref" : "#/definitions/RoleArn"
        }
      },
      "additionalProperties" : false
    },
    "RoleArn" : {
      "type" : "string",
      "minLength" : 29,
      "maxLength" : 1024,
      "pattern" : "arn:(aws|aws-us-gov|aws-cn|aws-iso|aws-iso-b):iam::[0-9]{12}:role/[\\w+=,.@-]{1,64}"
    },
    "EncryptionConfiguration" : {
      "description" : "Encryption configuration (KMS key)",
      "type" : "object",
      "properties" : {
        "KmsKey" : {
          "type" : "string",
          "description" : "The KMS Key",
          "minLength" : 0,
          "maxLength" : 256,
          "pattern" : "arn:aws(-[\\w]+)*:kms:[a-z\\-]+-[0-9]{1}:[0-9]{12}:key\\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
        }
      },
      "required" : [ "KmsKey" ],
      "additionalProperties" : false
    },
    "HealthCheckConfiguration" : {
      "description" : "Health check configuration",
      "type" : "object",
      "properties" : {
        "Protocol" : {
          "type" : "string",
          "description" : "Health Check Protocol",
          "enum" : [ "TCP", "HTTP" ]
        },
        "Path" : {
          "type" : "string",
          "description" : "Health check Path"
        },
        "Interval" : {
          "type" : "integer",
          "description" : "Health check Interval"
        },
        "Timeout" : {
          "type" : "integer",
          "description" : "Health check Timeout",
          "minimum" : 1,
          "maximum" : 20
        },
        "HealthyThreshold" : {
          "type" : "integer",
          "description" : "Health check Healthy Threshold",
          "minimum" : 1,
          "maximum" : 20
        },
        "UnhealthyThreshold" : {
          "type" : "integer",
          "description" : "Health check Unhealthy Threshold",
          "minimum" : 1,
          "maximum" : 20
        }
      },
      "additionalProperties" : false
    },
    "EgressConfiguration" : {
      "description" : "Network egress configuration",
      "type" : "object",
      "properties" : {
        "EgressType" : {
          "description" : "Network egress type.",
          "type" : "string",
          "enum" : [ "DEFAULT", "VPC" ]
        },
        "VpcConnectorArn" : {
          "description" : "The Amazon Resource Name (ARN) of the App Runner VpcConnector.",
          "type" : "string",
          "minLength" : 44,
          "maxLength" : 1011,
          "pattern" : "arn:aws(-[\\w]+)*:[a-z0-9-\\\\.]{0,63}:[a-z0-9-\\\\.]{0,63}:[0-9]{12}:(\\w|\\/|-){1,1011}"
        }
      },
      "required" : [ "EgressType" ],
      "additionalProperties" : false
    },
    "IngressConfiguration" : {
      "description" : "Network ingress configuration",
      "type" : "object",
      "properties" : {
        "IsPubliclyAccessible" : {
          "description" : "It's set to true if the Apprunner service is publicly accessible. It's set to false otherwise.",
          "type" : "boolean"
        }
      },
      "required" : [ "IsPubliclyAccessible" ],
      "additionalProperties" : false
    },
    "NetworkConfiguration" : {
      "description" : "Network configuration",
      "type" : "object",
      "properties" : {
        "EgressConfiguration" : {
          "$ref" : "#/definitions/EgressConfiguration"
        },
        "IngressConfiguration" : {
          "$ref" : "#/definitions/IngressConfiguration"
        },
        "IpAddressType" : {
          "description" : "App Runner service endpoint IP address type",
          "type" : "string",
          "enum" : [ "IPV4", "DUAL_STACK" ]
        }
      },
      "additionalProperties" : false
    },
    "ServiceObservabilityConfiguration" : {
      "description" : "Service observability configuration",
      "type" : "object",
      "properties" : {
        "ObservabilityEnabled" : {
          "description" : "Observability enabled",
          "type" : "boolean"
        },
        "ObservabilityConfigurationArn" : {
          "description" : "The Amazon Resource Name (ARN) of the App Runner ObservabilityConfiguration.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 1011,
          "pattern" : "arn:aws(-[\\w]+)*:[a-z0-9-\\.]{0,63}:[a-z0-9-\\.]{0,63}:[0-9]{12}:(\\w|/|-){1,1011}"
        }
      },
      "required" : [ "ObservabilityEnabled" ],
      "additionalProperties" : false
    },
    "Tag" : {
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string"
        },
        "Value" : {
          "type" : "string"
        }
      },
      "additionalProperties" : false
    },
    "KeyValuePair" : {
      "type" : "object",
      "properties" : {
        "Name" : {
          "type" : "string"
        },
        "Value" : {
          "type" : "string"
        }
      },
      "additionalProperties" : false
    }
  },
  "properties" : {
    "ServiceName" : {
      "description" : "The AppRunner Service Name.",
      "type" : "string",
      "minLength" : 4,
      "maxLength" : 40,
      "pattern" : "[A-Za-z0-9][A-Za-z0-9-_]{3,39}"
    },
    "ServiceId" : {
      "description" : "The AppRunner Service Id",
      "type" : "string",
      "minLength" : 32,
      "maxLength" : 32
    },
    "ServiceArn" : {
      "description" : "The Amazon Resource Name (ARN) of the AppRunner Service.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 1011,
      "pattern" : "arn:aws(-[\\w]+)*:[a-z0-9-\\\\.]{0,63}:[a-z0-9-\\\\.]{0,63}:[0-9]{12}:(\\w|\\/|-){1,1011}"
    },
    "ServiceUrl" : {
      "description" : "The Service Url of the AppRunner Service.",
      "type" : "string"
    },
    "Status" : {
      "description" : "AppRunner Service status.",
      "type" : "string"
    },
    "SourceConfiguration" : {
      "$ref" : "#/definitions/SourceConfiguration"
    },
    "InstanceConfiguration" : {
      "$ref" : "#/definitions/InstanceConfiguration"
    },
    "Tags" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    },
    "EncryptionConfiguration" : {
      "$ref" : "#/definitions/EncryptionConfiguration"
    },
    "HealthCheckConfiguration" : {
      "$ref" : "#/definitions/HealthCheckConfiguration"
    },
    "ObservabilityConfiguration" : {
      "$ref" : "#/definitions/ServiceObservabilityConfiguration"
    },
    "AutoScalingConfigurationArn" : {
      "description" : "Autoscaling configuration ARN",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 1011,
      "pattern" : "arn:aws(-[\\w]+)*:[a-z0-9-\\\\.]{0,63}:[a-z0-9-\\\\.]{0,63}:[0-9]{12}:(\\w|\\/|-){1,1011}"
    },
    "NetworkConfiguration" : {
      "$ref" : "#/definitions/NetworkConfiguration"
    }
  },
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : false,
    "cloudFormationSystemTags" : false,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "apprunner:TagResource", "apprunner:UntagResource", "apprunner:ListTagsForResource" ]
  },
  "required" : [ "SourceConfiguration" ],
  "createOnlyProperties" : [ "/properties/ServiceName", "/properties/EncryptionConfiguration", "/properties/Tags" ],
  "readOnlyProperties" : [ "/properties/ServiceArn", "/properties/ServiceId", "/properties/ServiceUrl", "/properties/Status" ],
  "writeOnlyProperties" : [ "/properties/AutoScalingConfigurationArn", "/properties/Tags" ],
  "primaryIdentifier" : [ "/properties/ServiceArn" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "apprunner:CreateService", "apprunner:TagResource", "iam:PassRole", "iam:CreateServiceLinkedRole", "logs:CreateLogGroup", "logs:PutRetentionPolicy", "logs:CreateLogStream", "logs:PutLogEvents", "logs:DescribeLogStreams", "events:PutRule", "events:PutTargets" ]
    },
    "read" : {
      "permissions" : [ "apprunner:DescribeService" ]
    },
    "update" : {
      "permissions" : [ "apprunner:UpdateService", "iam:PassRole" ]
    },
    "delete" : {
      "permissions" : [ "apprunner:DeleteService" ]
    },
    "list" : {
      "permissions" : [ "apprunner:ListServices", "iam:PassRole" ]
    }
  },
  "additionalProperties" : false
}