def __init__(self, command: CliCommand, context: HelpContext, figgy_context: FiggyContext): self._command = command self._context = context self._figgy_context = figgy_context self._options = context.options self._utils = Utils(False) self._setup: FiggySetup = FiggySetup(self._figgy_context)
def __init__(self, command: CliCommand, context: MaintenanceContext, figgy_context: FiggyContext, config: Optional[ConfigService]): self._command = command self._context = context self._figgy_context = figgy_context self._options = context.options self._utils = Utils(False) self._setup: FiggySetup = FiggySetup(self._figgy_context) self._config: Optional[ConfigService] = config
def __init__(self, ssm_init: SsmDao, colors_enabled: bool, config_context: ConfigContext, config_view: RBACLimitedConfigView, config_completer: WordCompleter): super().__init__(edit, colors_enabled, config_context) self._ssm = ssm_init self._config_view = config_view self._utils = Utils(colors_enabled) self._config_completer = config_completer
def __init__(self, source_ssm: SsmDao, config_completer_init: WordCompleter, colors_enabled: bool, config_context: ConfigContext, session_mgr: SessionManager): super().__init__(promote, colors_enabled, config_context) self.config_context = config_context self._source_ssm = source_ssm self._session_mgr = session_mgr self._config_completer = config_completer_init self._utils = Utils(colors_enabled) self._out = Output(colors_enabled)
def __init__(self, ssm_init: SsmDao, audit_init: AuditDao, config_completer_init: WordCompleter, colors_enabled: bool, config_context: ConfigContext): super().__init__(audit, colors_enabled, config_context) self._ssm = ssm_init self._audit_dao = audit_init self._config_completer = config_completer_init self._utils = Utils(colors_enabled) self._out = Output(colors_enabled)
def __init__(self, command: CliCommand, context: CommandContext, session_manager: SessionManager, figgy_context: FiggyContext): self._command = command self._context = context self._utils = Utils(False) self._setup: FiggySetup = FiggySetup(figgy_context) self._session_manager = session_manager
def __init__(self, ssm_init, repl_init: ReplicationDao, config_completer_init, colors_enabled: bool, config_context: ConfigContext): super().__init__(share, colors_enabled, config_context) self._ssm = ssm_init self._repl = repl_init self._config_completer = config_completer_init self._utils = Utils(colors_enabled) self._out = Output(colors_enabled)
def __init__(self, maintenance_context: MaintenanceContext, config_service: Optional[ConfigService]): super().__init__(version, maintenance_context.defaults.colors_enabled, maintenance_context) self.tracker = VersionTracker(self.context.defaults, config_service) self.upgrade_mgr = UpgradeManager( maintenance_context.defaults.colors_enabled) self._utils = Utils( colors_enabled=maintenance_context.defaults.colors_enabled) self._out = Output( colors_enabled=maintenance_context.defaults.colors_enabled)
def __init__(self, ssm_init: SsmDao, cfg_view: RBACLimitedConfigView, config_init: ConfigDao, repl_init: ReplicationDao, context: ConfigContext, colors_enabled: bool, config_completer: WordCompleter): super().__init__(delete, colors_enabled, context) self._ssm = ssm_init self._config = config_init self._repl = repl_init self._utils = Utils(colors_enabled) self._config_completer = config_completer self._out = Output(colors_enabled) self._cfg_view = cfg_view
def __init__(self, defaults: CLIDefaults, context: FiggyContext): super().__init__(defaults, context) self._utils = Utils(defaults.colors_enabled) self._sts = boto3.client('sts') self._context = context keychain_enabled = defaults.extras.get(DISABLE_KEYRING) is not True vault = FiggyVault(keychain_enabled=keychain_enabled, secrets_mgr=self._secrets_mgr) self._sts_cache: CacheManager = CacheManager( file_override=STS_SESSION_CACHE_PATH, vault=vault) self._saml_cache: CacheManager = CacheManager( file_override=SAML_SESSION_CACHE_PATH, vault=vault)
def __init__(self, help_context: HelpContext, figgy_setup: FiggySetup, figgy_context: FiggyContext): super().__init__(login, Utils.not_windows(), help_context) self._setup = figgy_setup self._defaults: CLIDefaults = figgy_setup.get_defaults() self._figgy_context = figgy_context self._utils = Utils(self._defaults.colors_enabled) self._aws_cfg = AWSConfig(color=self.c) self._out = Output(self._defaults.colors_enabled) self.example = f"\n\n{self.c.fg_bl}{CLI_NAME} {login.name} \n" \ f"{self.c.rs}{self.c.fg_yl} --or--{self.c.rs}\n" \ f"{self.c.fg_bl}{CLI_NAME} {login.name} {sandbox.name}{self.c.rs}"
def __init__(self, ssm_init: SsmDao, colors_enabled: bool, context: ConfigContext): super().__init__(validate, colors_enabled, context) self._ssm = ssm_init self._config_path = context.ci_config_path if context.ci_config_path else Utils.find_figgy_json( ) self._utils = Utils(colors_enabled) self._replication_only = context.replication_only self._errors_detected = False self.example = f"{self.c.fg_bl}{CLI_NAME} config {self.command_printable} " \ f"--env dev --config /path/to/config{self.c.rs}" self._FILE_PREFIX = "file://" self._out = Output(colors_enabled)
def __init__(self, ssm: SsmDao, ddb: ConfigDao, repl_dao: ReplicationDao, context: ConfigContext, config_completer_init: WordCompleter, colors_enabled: bool, delete: Delete, args=None): super().__init__(prune, colors_enabled, context) self._ssm = ssm # type: SsmDao self._config_dao = ddb # type: ConfigDao self._repl = repl_dao self._config_completer = config_completer_init # type: WordCompleter self._utils = Utils(colors_enabled) self.example = f"{self.c.fg_bl}{CLI_NAME} config {self.command_printable} --env dev " \ f"--config /path/to/figgy.json{self.c.rs}" self._config_path = context.ci_config_path if context.ci_config_path else Utils.find_figgy_json( ) self._out = Output(colors_enabled) # If user passes in --info flag, we don't need all of this to be initialized. if not hasattr(args, info.name) or args.info is False: # Validate & parse figgy.json self._config = self._utils.get_ci_config( self._config_path) # type: Dict self._shared_names = set( self._utils.get_config_key_safe(SHARED_KEY, self._config, default=[])) # type: Set self._repl_conf = self._utils.get_config_key_safe( REPLICATION_KEY, self._config, default={}) # type: Dict self._merge_conf = self._utils.get_config_key_safe( MERGE_KEY, self._config, default={}) # type: Dict self._config_keys = set( self._utils.get_config_key_safe(CONFIG_KEY, self._config, default=[])) # type: Set self._merge_keys = set(self._merge_conf.keys()) # type: Set self._namespace = self._utils.get_namespace( self._config) # type: str self._delete_command = delete self._repl_from_conf = self._utils.get_config_key_safe( REPL_FROM_KEY, self._config, default={}) self._repl_conf = KeyUtils.merge_repl_and_repl_from_blocks( self._repl_conf, self._repl_from_conf, self._namespace) # Build list of all keys found across all config types self._all_keys = KeyUtils().find_all_expected_names( self._config_keys, self._shared_names, self._merge_conf, self._repl_conf, self._repl_from_conf, self._namespace)
def __init__(self, ssm_init: SsmDao, colors_enabled: bool, config_context: ConfigContext, config_view: RBACLimitedConfigView, get: Get): super().__init__(put, colors_enabled, config_context) self._ssm = ssm_init self._utils = Utils(colors_enabled) self._config_view = config_view self._get = get self._source_key = Utils.attr_if_exists(copy_from, config_context.args) self._out = Output(colors_enabled) self._select_name = [('class:', 'Please input a PS Name: ')] self._FILE_PREFIX = "file://"
def __init__(self, ssm_init: SsmDao, cfg_svc: ConfigService, colors_enabled: bool, context: ConfigContext, get_command: Get, delete_command: Delete, config_view: RBACLimitedConfigView): super().__init__(browse, colors_enabled, context) self._ssm = ssm_init self._get = get_command self._cfg_svc = cfg_svc self._config_view = config_view self.selected_ps_paths = [] self.deleted_ps_paths = [] self.dirs = set() self._utils = Utils(colors_enabled) self._delete = delete_command self.prefix = context.prefix
def __init__(self, defaults: CLIDefaults, context: FiggyContext): super().__init__(defaults, context) self.__id = uuid.uuid4() self._utils = Utils(defaults.colors_enabled) self.__bastion_session = boto3.session.Session( profile_name=self._defaults.provider_config.profile_name) self._ssm = None self._sts = None self._iam_client = None self._iam = None keychain_enabled = defaults.extras.get(DISABLE_KEYRING) is not True vault = FiggyVault(keychain_enabled=keychain_enabled, secrets_mgr=self._secrets_mgr) self._sts_cache: CacheManager = CacheManager( file_override=STS_SESSION_CACHE_PATH, vault=vault) self._role_name_prefix = os.getenv(FIGGY_ROLE_PREFIX_OVERRIDE_ENV, FIGGY_ROLE_NAME_PREFIX)
def __init__(self, ssm_init: SsmDao, kms_init: KmsService, config_init: ConfigDao, repl_dao: ReplicationDao, audit_dao: AuditDao, cfg_view: RBACLimitedConfigView, colors_enabled: bool, context: ConfigContext, config_completer: WordCompleter, delete: Delete): super().__init__(restore, colors_enabled, context) self._config_context = context self._ssm = ssm_init self._kms = kms_init self._config = config_init self._repl = repl_dao self._audit = audit_dao self._cfg_view = cfg_view self._utils = Utils(colors_enabled) self._point_in_time = context.point_in_time self._config_completer = config_completer self._delete = delete self._out = Output(colors_enabled=colors_enabled)
def __init__(self, args): """ Initializes global shared properties :param args: Arguments passed in from user, collected from ArgParse """ self._profile = None self._command_factory = None self._setup = None self._is_setup_command: bool = FiggyCLI.is_setup_command(args) self._utils = Utils(self.get_colors_enabled()) self._profile = Utils.attr_if_exists(profile, args) self._defaults: CLIDefaults = FiggySetup.stc_get_defaults(skip=self._is_setup_command, profile=self._profile) self._run_env = self._defaults.run_env role_override = Utils.attr_if_exists(role, args) self._role: Role = self.get_role(args.prompt, role_override=role_override, is_setup=self._is_setup_command) FiggyCLI.validate_environment(self._defaults) if not self._is_setup_command: if not hasattr(args, 'env') or args.env is None: print(f"{EMPTY_ENV_HELP_TEXT}{self._run_env.env}\n") else: Utils.stc_validate(args.env in self._defaults.valid_envs, f'{ENV_HELP_TEXT} {self._defaults.valid_envs}. Provided: {args.env}') self._run_env = RunEnv(env=args.env) self._utils.validate(Utils.attr_exists(configure, args) or Utils.attr_exists(command, args), f"No command found. Proper format is `{CLI_NAME} <resource> <command> --option(s)`") self._assumable_role = self.find_assumable_role(self._run_env, self._role, skip=self._is_setup_command, profile=self._profile) command_name = Utils.attr_if_exists(command, args) resource_name = Utils.attr_if_exists(resource, args) found_command: CliCommand = Utils.find_command(str(command_name)) found_resource: CliCommand = Utils.find_resource(str(resource_name)) self._context: FiggyContext = FiggyContext(self.get_colors_enabled(), found_resource, found_command, self._run_env, self._assumable_role, args)
def __init__(self, context: FiggyContext, cli_defaults: CLIDefaults): self._id = uuid.uuid4() self._context = context self._utils = Utils(context.colors_enabled) self._cli_defaults = cli_defaults self._session_mgr = None self._session_provider = None self._env_session = None self._ssm = None self._config = None self._kms = None self._s3_rsc = None self._service_registry = None self._all_sessions = None self._config_svc = None self._cache_mgr = None self._rbac_config_view = None self._audit = None self._repl = None self._ots_svc = None self._kms_dao: Optional[KmsDao] = None self.__env_lock = Lock() self.__mgr_lock = Lock()
def __init__(self, defaults: CLIDefaults): self._defaults = defaults self._out = Output(self._defaults.colors_enabled) self._utils = Utils(self._defaults.colors_enabled)
def __init__(self, defaults: CLIDefaults, session_provider: SessionProvider): self._sts = boto3.client('sts') self._utils = Utils(defaults.colors_enabled) self._defaults = defaults self.session_provider: SessionProvider = session_provider
def __init__(self, colors_enabled: bool): self._utils = Utils(colors_enabled=colors_enabled) self.c = Utils.default_colors(enabled=colors_enabled) self.current_version: FiggyVersionDetails = VersionTracker.get_version()
def __init__(self): aws_session = botocore.session.get_session() boto_client = aws_session.create_client("ssm", "us-east-1") self._ssm: SsmDao = SsmDao(boto_client) self._utils = Utils(True)
def __init__(self, ots_svc: OTSService, ots_context: OTSContext, colors_enabled: bool): super().__init__(ots_put, colors_enabled, ots_context) self._ots = ots_svc self._utils = Utils(colors_enabled) self._out = Output(colors_enabled)