from ssm_document_generator.definition.metadata.common import category, access_level from ssm_document_generator.definition.parameters import common from ssm_document_generator.definition.python_definition import PythonDefinition definition = PythonDefinition( name='getFile', description='Retrieves a specified file content', command_file_name='get_file.py', user='******', metadata=[category('OS'), access_level(2)], parameters=[common.entities_limit(), common.file_path()] )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.parameters.extend([entities_limit(), regex_filter_expression()])
import pytest from ssm_document_generator.definition.parameters.common import entities_limit from ssm_document_generator.definition.parameters.dict_parameters_mixin import DictParametersMixin from test.ssm_document_generator_test.definition.dummy_definition import DummyDefinition class Mixed(DictParametersMixin, DummyDefinition): pass @pytest.mark.parametrize('test_input, expected', [([], ['parameters = {}']), ([entities_limit()], [ "parameters = {\"" + entities_limit().name + "\": \"{{" + entities_limit().name + "}}\"}" ])]) def test_generate_parameters_code(test_input, expected): tobject = Mixed() tobject.parameters = test_input assert tobject.generate_parameters_code() == expected
import pytest from ssm_document_generator.definition.parameters.assign_parameters_mixin import AssignParametersMixin from ssm_document_generator.definition.parameters.common import entities_limit from test.ssm_document_generator_test.definition.dummy_definition import DummyDefinition class Mixed(AssignParametersMixin, DummyDefinition): pass @pytest.mark.parametrize( 'test_input, expected', [([], []), ([entities_limit() ], [entities_limit().name + '={{' + entities_limit().name + '}}'])]) def test_generate_parameters_code(test_input, expected): tobject = Mixed() tobject.parameters = test_input assert tobject.generate_parameters_code() == expected
from ssm_document_generator.definition.bash_formatted_definition import BashFormattedDefinition from ssm_document_generator.definition.metadata.common import access_level, category from ssm_document_generator.definition.parameters import common definition = BashFormattedDefinition( name='pstack', description='Retrieves stack for given processId', user='******', commands=['pstack ${processId}'], metadata=[category('OS'), access_level(2)], parameters=[common.process_id(), common.regex_filter_expression(), common.entities_limit()] )
from ssm_document_generator.definition.bash_definition import BashDefinition from ssm_document_generator.definition.metadata.common import access_level, category from ssm_document_generator.definition.parameters import common definition = BashDefinition( name='dmesg', description='Retrieves filtered dmesg content.', command_file_name='dmesg.sh', metadata=[category('OS'), access_level(1)], parameters=[common.entities_limit()] )