# Path: stacker_blueprints/empire/base.py
# class EmpireBase(Blueprint):
#     def create_conditions(self):
#         logger.debug("No conditions to setup for %s", self.name)
# 
#     def create_security_groups(self):
#         logger.debug("No security_groups to setup for %s", self.name)
# 
#     def create_ecs_cluster(self):
#         logger.debug("No ecs cluster to setup for %s", self.name)
# 
#     def create_load_balancer(self):
#         logger.debug("No load_balancer to setup for %s", self.name)
# 
#     def create_iam_profile(self):
#         logger.debug("No iam_profile to setup for %s", self.name)
# 
#     def create_autoscaling_group(self):
#         logger.debug("No autoscaling_group to setup for %s", self.name)
# 
#     def generate_seed_contents(self):
#         raise Exception('Empire subclass must define seed contents')
# 
#     def generate_user_data(self):
#         contents = Join("", self.generate_seed_contents())
#         stanza = Base64(Join(
#             "",
#             [
#                 "#cloud-config\n",
#                 "write_files:\n",
#                 "  - encoding: b64\n",
#                 "    content: ", Base64(contents), "\n",
#                 "    owner: root:root\n",
#                 "    path: /etc/empire/seed\n",
#                 "    permissions: 0640\n"
#             ]
#         ))
#         return stanza
# 
#     def create_template(self):
#         self.create_conditions()
#         self.create_security_groups()
#         self.create_ecs_cluster()
#         self.create_load_balancer()
#         self.create_iam_profile()
#         self.create_autoscaling_group()
# 
# Path: stacker_blueprints/empire/policies.py
# def ecs_agent_policy():
#     p = Policy(
#         Statement=[
#             Statement(
#                 Effect=Allow,
#                 Resource=["*"],
#                 Action=[
#                     ecs.CreateCluster,
#                     ecs.RegisterContainerInstance,
#                     ecs.DeregisterContainerInstance,
#                     ecs.DiscoverPollEndpoint,
#                     ecs.Action("Submit*"),
#                     ecs.Poll,
#                     ecs.Action("StartTelemetrySession")]),
#             Statement(
#                 Effect=Allow,
#                 Action=[
#                     ecr.GetAuthorizationToken,
#                     ecr.BatchCheckLayerAvailability,
#                     ecr.GetDownloadUrlForLayer,
#                     ecr.BatchGetImage,
#                 ],
#                 Resource=["*"],
#             ),
#         ]
#     )
# 
#     return p
# 
# def logstream_policy():
#     """Policy needed for logspout -> kinesis log streaming."""
#     p = Policy(
#         Statement=[
#             Statement(
#                 Effect=Allow,
#                 Resource=["*"],
#                 Action=[
#                     kinesis.CreateStream, kinesis.DescribeStream,
#                     Action(kinesis.prefix, "AddTagsToStream"),
#                     Action(kinesis.prefix, "PutRecords")
#                 ])])
#     return p


import logging
import copy
from troposphere import Ref, Output, GetAtt, Tags, FindInMap, If, Equals
from troposphere import ec2, autoscaling, ecs
from troposphere.autoscaling import Tag as ASTag
from troposphere.iam import Role, InstanceProfile, Policy
from awacs.helpers.trust import get_default_assumerole_policy
from stacker.blueprints.variables.types import (
    CFNCommaDelimitedList,
    CFNNumber,
    CFNString,
    EC2KeyPairKeyName,
    EC2SecurityGroupId,
    EC2SubnetIdList,
    EC2VPCId,
)
from .base import EmpireBase
from .policies import ecs_agent_policy, logstream_policy
            "description": (
                "Size, in GB, of the EBS volume where docker will store its "
                "images and containers."
            ),
            "default": "50"},
        "SwapVolumeSize": {
            "type": CFNNumber,
            "description": (
                "Size, in GB, of the EBS volume that will be turned into a "
                "swap volume."
            ),
            "default": "16"},
        "DockerRegistry": {
            "type": CFNString,
            "description": (
                "Optional docker registry where private images are located."
            ),
            "default": "https://index.docker.io/v1/"},
        "DockerRegistryUser": {
            "type": CFNString,
            "description": "User for authentication with docker registry."},
        "DockerRegistryPassword": {
            "type": CFNString,
            "no_echo": True,
            "description": (
                "Password for authentication with docker registry."
            )},
        "DockerRegistryEmail": {
            "type": CFNString,
            "description": "Email for authentication with docker registry."},

# Path: stacker_blueprints/empire/base.py
# class EmpireBase(Blueprint):
#     def create_conditions(self):
#         logger.debug("No conditions to setup for %s", self.name)
# 
#     def create_security_groups(self):
#         logger.debug("No security_groups to setup for %s", self.name)
# 
#     def create_ecs_cluster(self):
#         logger.debug("No ecs cluster to setup for %s", self.name)
# 
#     def create_load_balancer(self):
#         logger.debug("No load_balancer to setup for %s", self.name)
# 
#     def create_iam_profile(self):
#         logger.debug("No iam_profile to setup for %s", self.name)
# 
#     def create_autoscaling_group(self):
#         logger.debug("No autoscaling_group to setup for %s", self.name)
# 
#     def generate_seed_contents(self):
#         raise Exception('Empire subclass must define seed contents')
# 
#     def generate_user_data(self):
#         contents = Join("", self.generate_seed_contents())
#         stanza = Base64(Join(
#             "",
#             [
#                 "#cloud-config\n",
#                 "write_files:\n",
#                 "  - encoding: b64\n",
#                 "    content: ", Base64(contents), "\n",
#                 "    owner: root:root\n",
#                 "    path: /etc/empire/seed\n",
#                 "    permissions: 0640\n"
#             ]
#         ))
#         return stanza
# 
#     def create_template(self):
#         self.create_conditions()
#         self.create_security_groups()
#         self.create_ecs_cluster()
#         self.create_load_balancer()
#         self.create_iam_profile()
#         self.create_autoscaling_group()
# 
# Path: stacker_blueprints/empire/policies.py
# def ecs_agent_policy():
#     p = Policy(
#         Statement=[
#             Statement(
#                 Effect=Allow,
#                 Resource=["*"],
#                 Action=[
#                     ecs.CreateCluster,
#                     ecs.RegisterContainerInstance,
#                     ecs.DeregisterContainerInstance,
#                     ecs.DiscoverPollEndpoint,
#                     ecs.Action("Submit*"),
#                     ecs.Poll,
#                     ecs.Action("StartTelemetrySession")]),
#             Statement(
#                 Effect=Allow,
#                 Action=[
#                     ecr.GetAuthorizationToken,
#                     ecr.BatchCheckLayerAvailability,
#                     ecr.GetDownloadUrlForLayer,
#                     ecr.BatchGetImage,
#                 ],
#                 Resource=["*"],
#             ),
#         ]
#     )
# 
#     return p
# 
# def logstream_policy():
#     """Policy needed for logspout -> kinesis log streaming."""
#     p = Policy(
#         Statement=[
#             Statement(
#                 Effect=Allow,
#                 Resource=["*"],
#                 Action=[
#                     kinesis.CreateStream, kinesis.DescribeStream,
#                     Action(kinesis.prefix, "AddTagsToStream"),
#                     Action(kinesis.prefix, "PutRecords")
#                 ])])
#     return p


# Path: stacker_blueprints/empire/minion.py
import logging
import copy
from troposphere import Ref, Output, GetAtt, Tags, FindInMap, If, Equals
from troposphere import ec2, autoscaling, ecs
from troposphere.autoscaling import Tag as ASTag
from troposphere.iam import Role, InstanceProfile, Policy
from awacs.helpers.trust import get_default_assumerole_policy
from stacker.blueprints.variables.types import (
    CFNCommaDelimitedList,
    CFNNumber,
    CFNString,
    EC2KeyPairKeyName,
    EC2SecurityGroupId,
    EC2SubnetIdList,
    EC2VPCId,
)
from .base import EmpireBase
from .policies import ecs_agent_policy, logstream_policy

            "description": (
                "Size, in GB, of the EBS volume where docker will store its "
                "images and containers."
            ),
            "default": "50"},
        "SwapVolumeSize": {
            "type": CFNNumber,
            "description": (
                "Size, in GB, of the EBS volume that will be turned into a "
                "swap volume."
            ),
            "default": "16"},
        "DockerRegistry": {
            "type": CFNString,
            "description": (
                "Optional docker registry where private images are located."
            ),
            "default": "https://index.docker.io/v1/"},
        "DockerRegistryUser": {
            "type": CFNString,
            "description": "User for authentication with docker registry."},
        "DockerRegistryPassword": {
            "type": CFNString,
            "no_echo": True,
            "description": (
                "Password for authentication with docker registry."
            )},
        "DockerRegistryEmail": {
            "type": CFNString,
            "description": "Email for authentication with docker registry."},

        "DisableStreamingLogs": {