Example #1
0
import importlib
import os
import pathlib
import stat
import sys
import time
from paco.core.exception import StackException
from paco.core.exception import PacoErrorCode
from paco.controllers.controllers import Controller
from paco.models import loader, vocabulary
from paco.core.yaml import YAML
from paco.utils import enhanced_input
from cookiecutter.main import cookiecutter
from jinja2.ext import Extension

yaml = YAML()
yaml.default_flow_sytle = False

prompt_help_mapping = {
    'project_title': "Project title - Describe this Paco project",
    'budget': "Budget - Lower cost but less robust set-up?",
    'network_environment_name':
    "NetworkEnvironment name - Short alphanumeric string to identify a network environment",
    'network_environment_title':
    "NetworkEnvironment title - Long description for a network environment",
    'application_name':
    "Application name - Short alphanumeric string to identify this application",
    'application_title':
    "Application title - Long description for this application",
    'aws_default_region':
    "AWS Region name - e.g. us-west-2, us-east-1 or ca-central-1",
Example #2
0
..%%%%.....%%....%%%%%%..%%%%%%...%%%%..
........................................

"""

import hashlib
import pathlib
from paco.core.exception import StackException, PacoErrorCode
from paco.core.yaml import YAML
from paco.models import schemas
from paco.models.locations import get_parent_by_interface
from copy import deepcopy
from functools import partial
from hashlib import blake2b

yaml = YAML(typ="safe", pure=True)
yaml.default_flow_sytle = False


def get_support_resource_ref_ext(resource, support_resource):
    """The reference extension of a supporting resource.
    For example an instance IAM Role to suport an ASG:
    netenv.mynet.dev.us-west-2.applications.app.groups.bastion.resources.asg.instance_iam_role
    The .asg is the ASG resource and the .instance_iam_role is the supporting Role resource.
    The return value would be "instance_iam_role".
    """
    return support_resource.paco_ref_parts[len(resource.paco_ref_parts) + 1:]


def enhanced_input(prompt,
                   default=None,
Example #3
0
from paco.cftemplates import IAMRoles, IAMManagedPolicies,IAMUsers, IAMUserAccountDelegates, IAMSLRoles
from paco.controllers.controllers import Controller
from paco.core.exception import StackException, InvalidAccountPermission, PacoErrorCode
from paco.core.yaml import YAML
from paco.models.references import Reference
from paco.models.locations import get_parent_by_interface
from paco.models import schemas
from paco.models.base import Named
from paco.stack import StackOrder, StackGroup, StackTags, StackHooks
from paco.utils import md5sum, get_support_resource_ref_ext
from parliament import analyze_policy_string
import paco

yaml=YAML(typ='safe')


class IAMUserStackGroup(StackGroup):
    def __init__(self, paco_ctx, account_ctx, group_name, controller):
        super().__init__(
            paco_ctx,
            account_ctx,
            group_name,
            'User',
            controller
        )

class SLRoleContext():
    def __init__(
        self,
        paco_ctx,
        account_ctx,