{
  "typeName" : "AWS::EC2::SqlHaStandbyDetectedInstance",
  "description" : "Resource Type definition for AWS::EC2::SqlHaStandbyDetectedInstance",
  "sourceUrl" : "https://docs.aws.amazon.com/sql-server-ec2/latest/userguide/sql-high-availability.html",
  "definitions" : {
    "InstanceId" : {
      "description" : "The ID of the EC2 instance to enable for SQL Server high availability standby detection.",
      "type" : "string",
      "pattern" : "^i-[0-9a-f]{8,17}$"
    },
    "SqlServerCredentials" : {
      "description" : "The ARN of the AWS Secrets Manager secret containing SQL Server access credentials to the EC2 instance. If not specified, AWS Systems Manager agent will use default local user credentials.",
      "type" : "string",
      "pattern" : "^(?=.{20,2048}$)arn:aws[a-z-]*:secretsmanager:[a-z0-9-]+:\\d{12}:secret:[a-zA-Z0-9/_+=.@-]+$"
    },
    "HaStatus" : {
      "description" : "The SQL Server high availability status of the EC2 instance.",
      "type" : "string",
      "enum" : [ "processing", "active", "standby", "invalid" ]
    },
    "SqlServerLicenseUsage" : {
      "description" : "The SQL Server license type of the EC2 instance.",
      "type" : "string",
      "enum" : [ "full", "waived" ]
    },
    "LastUpdatedTime" : {
      "description" : "The timestamp when the EC2 instance's SQL Server high availability status was last updated.",
      "type" : "string"
    }
  },
  "properties" : {
    "InstanceId" : {
      "$ref" : "#/definitions/InstanceId"
    },
    "SqlServerCredentials" : {
      "$ref" : "#/definitions/SqlServerCredentials"
    },
    "HaStatus" : {
      "$ref" : "#/definitions/HaStatus"
    },
    "SqlServerLicenseUsage" : {
      "$ref" : "#/definitions/SqlServerLicenseUsage"
    },
    "LastUpdatedTime" : {
      "$ref" : "#/definitions/LastUpdatedTime"
    }
  },
  "additionalProperties" : false,
  "required" : [ "InstanceId" ],
  "readOnlyProperties" : [ "/properties/HaStatus", "/properties/SqlServerLicenseUsage", "/properties/LastUpdatedTime" ],
  "primaryIdentifier" : [ "/properties/InstanceId" ],
  "createOnlyProperties" : [ "/properties/InstanceId" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "iam:CreateServiceLinkedRole", "ec2:CreateTags", "ec2:DeleteTags", "secretsmanager:DescribeSecret", "secretsmanager:TagResource", "secretsmanager:UntagResource", "ec2:EnableInstanceSqlHaStandbyDetections", "ec2:DescribeInstanceSqlHaStates" ]
    },
    "read" : {
      "permissions" : [ "ec2:DescribeInstanceSqlHaStates" ]
    },
    "update" : {
      "permissions" : [ "iam:CreateServiceLinkedRole", "ec2:CreateTags", "ec2:DeleteTags", "secretsmanager:DescribeSecret", "secretsmanager:TagResource", "secretsmanager:UntagResource", "ec2:EnableInstanceSqlHaStandbyDetections", "ec2:DescribeInstanceSqlHaStates" ]
    },
    "delete" : {
      "permissions" : [ "ec2:CreateTags", "ec2:DeleteTags", "secretsmanager:TagResource", "secretsmanager:UntagResource", "ec2:DisableInstanceSqlHaStandbyDetections", "ec2:DescribeInstanceSqlHaStates" ]
    },
    "list" : {
      "permissions" : [ "ec2:DescribeInstanceSqlHaStates" ]
    }
  },
  "tagging" : {
    "taggable" : false
  }
}