id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
6,000
mfitzp/padua
padua/analysis.py
modifiedaminoacids
def modifiedaminoacids(df): """ Calculate the number of modified amino acids in supplied ``DataFrame``. Returns the total of all modifications and the total for each amino acid individually, as an ``int`` and a ``dict`` of ``int``, keyed by amino acid, respectively. :param df: Pandas ``DataFrame``...
python
def modifiedaminoacids(df): """ Calculate the number of modified amino acids in supplied ``DataFrame``. Returns the total of all modifications and the total for each amino acid individually, as an ``int`` and a ``dict`` of ``int``, keyed by amino acid, respectively. :param df: Pandas ``DataFrame``...
[ "def", "modifiedaminoacids", "(", "df", ")", ":", "amino_acids", "=", "list", "(", "df", "[", "'Amino acid'", "]", ".", "values", ")", "aas", "=", "set", "(", "amino_acids", ")", "quants", "=", "{", "}", "for", "aa", "in", "aas", ":", "quants", "[", ...
Calculate the number of modified amino acids in supplied ``DataFrame``. Returns the total of all modifications and the total for each amino acid individually, as an ``int`` and a ``dict`` of ``int``, keyed by amino acid, respectively. :param df: Pandas ``DataFrame`` containing processed data. :return:...
[ "Calculate", "the", "number", "of", "modified", "amino", "acids", "in", "supplied", "DataFrame", "." ]
8b14bf4d2f895da6aea5d7885d409315bd303ec6
https://github.com/mfitzp/padua/blob/8b14bf4d2f895da6aea5d7885d409315bd303ec6/padua/analysis.py#L312-L333
6,001
mfitzp/padua
padua/process.py
build_index_from_design
def build_index_from_design(df, design, remove_prefix=None, types=None, axis=1, auto_convert_numeric=True, unmatched_columns='index'): """ Build a MultiIndex from a design table. Supply with a table with column headings for the new multiindex and a index containing the labels to search for in the data....
python
def build_index_from_design(df, design, remove_prefix=None, types=None, axis=1, auto_convert_numeric=True, unmatched_columns='index'): """ Build a MultiIndex from a design table. Supply with a table with column headings for the new multiindex and a index containing the labels to search for in the data....
[ "def", "build_index_from_design", "(", "df", ",", "design", ",", "remove_prefix", "=", "None", ",", "types", "=", "None", ",", "axis", "=", "1", ",", "auto_convert_numeric", "=", "True", ",", "unmatched_columns", "=", "'index'", ")", ":", "df", "=", "df", ...
Build a MultiIndex from a design table. Supply with a table with column headings for the new multiindex and a index containing the labels to search for in the data. :param df: :param design: :param remove: :param types: :param axis: :param auto_convert_numeric: :return:
[ "Build", "a", "MultiIndex", "from", "a", "design", "table", "." ]
8b14bf4d2f895da6aea5d7885d409315bd303ec6
https://github.com/mfitzp/padua/blob/8b14bf4d2f895da6aea5d7885d409315bd303ec6/padua/process.py#L23-L111
6,002
mfitzp/padua
padua/process.py
build_index_from_labels
def build_index_from_labels(df, indices, remove_prefix=None, types=None, axis=1): """ Build a MultiIndex from a list of labels and matching regex Supply with a dictionary of Hierarchy levels and matching regex to extract this level from the sample label :param df: :param indices: Tuples of ind...
python
def build_index_from_labels(df, indices, remove_prefix=None, types=None, axis=1): """ Build a MultiIndex from a list of labels and matching regex Supply with a dictionary of Hierarchy levels and matching regex to extract this level from the sample label :param df: :param indices: Tuples of ind...
[ "def", "build_index_from_labels", "(", "df", ",", "indices", ",", "remove_prefix", "=", "None", ",", "types", "=", "None", ",", "axis", "=", "1", ")", ":", "df", "=", "df", ".", "copy", "(", ")", "if", "remove_prefix", "is", "None", ":", "remove_prefix...
Build a MultiIndex from a list of labels and matching regex Supply with a dictionary of Hierarchy levels and matching regex to extract this level from the sample label :param df: :param indices: Tuples of indices ('label','regex') matches :param strip: Strip these strings from labels before matchi...
[ "Build", "a", "MultiIndex", "from", "a", "list", "of", "labels", "and", "matching", "regex" ]
8b14bf4d2f895da6aea5d7885d409315bd303ec6
https://github.com/mfitzp/padua/blob/8b14bf4d2f895da6aea5d7885d409315bd303ec6/padua/process.py#L114-L165
6,003
mfitzp/padua
padua/process.py
combine_expression_columns
def combine_expression_columns(df, columns_to_combine, remove_combined=True): """ Combine expression columns, calculating the mean for 2 columns :param df: Pandas dataframe :param columns_to_combine: A list of tuples containing the column names to combine :return: """ df = df.copy() ...
python
def combine_expression_columns(df, columns_to_combine, remove_combined=True): """ Combine expression columns, calculating the mean for 2 columns :param df: Pandas dataframe :param columns_to_combine: A list of tuples containing the column names to combine :return: """ df = df.copy() ...
[ "def", "combine_expression_columns", "(", "df", ",", "columns_to_combine", ",", "remove_combined", "=", "True", ")", ":", "df", "=", "df", ".", "copy", "(", ")", "for", "ca", ",", "cb", "in", "columns_to_combine", ":", "df", "[", "\"%s_(x+y)/2_%s\"", "%", ...
Combine expression columns, calculating the mean for 2 columns :param df: Pandas dataframe :param columns_to_combine: A list of tuples containing the column names to combine :return:
[ "Combine", "expression", "columns", "calculating", "the", "mean", "for", "2", "columns" ]
8b14bf4d2f895da6aea5d7885d409315bd303ec6
https://github.com/mfitzp/padua/blob/8b14bf4d2f895da6aea5d7885d409315bd303ec6/padua/process.py#L198-L218
6,004
mfitzp/padua
padua/process.py
expand_side_table
def expand_side_table(df): """ Perform equivalent of 'expand side table' in Perseus by folding Multiplicity columns down onto duplicate rows The id is remapped to UID___Multiplicity, which is different to Perseus behaviour, but prevents accidental of non-matching rows from occurring later in an...
python
def expand_side_table(df): """ Perform equivalent of 'expand side table' in Perseus by folding Multiplicity columns down onto duplicate rows The id is remapped to UID___Multiplicity, which is different to Perseus behaviour, but prevents accidental of non-matching rows from occurring later in an...
[ "def", "expand_side_table", "(", "df", ")", ":", "df", "=", "df", ".", "copy", "(", ")", "idx", "=", "df", ".", "index", ".", "names", "df", ".", "reset_index", "(", "inplace", "=", "True", ")", "def", "strip_multiplicity", "(", "df", ")", ":", "df...
Perform equivalent of 'expand side table' in Perseus by folding Multiplicity columns down onto duplicate rows The id is remapped to UID___Multiplicity, which is different to Perseus behaviour, but prevents accidental of non-matching rows from occurring later in analysis. :param df: :return:
[ "Perform", "equivalent", "of", "expand", "side", "table", "in", "Perseus", "by", "folding", "Multiplicity", "columns", "down", "onto", "duplicate", "rows" ]
8b14bf4d2f895da6aea5d7885d409315bd303ec6
https://github.com/mfitzp/padua/blob/8b14bf4d2f895da6aea5d7885d409315bd303ec6/padua/process.py#L221-L277
6,005
mfitzp/padua
padua/process.py
apply_experimental_design
def apply_experimental_design(df, f, prefix='Intensity '): """ Load the experimental design template from MaxQuant and use it to apply the label names to the data columns. :param df: :param f: File path for the experimental design template :param prefix: :return: dt """ df = df.copy() ...
python
def apply_experimental_design(df, f, prefix='Intensity '): """ Load the experimental design template from MaxQuant and use it to apply the label names to the data columns. :param df: :param f: File path for the experimental design template :param prefix: :return: dt """ df = df.copy() ...
[ "def", "apply_experimental_design", "(", "df", ",", "f", ",", "prefix", "=", "'Intensity '", ")", ":", "df", "=", "df", ".", "copy", "(", ")", "edt", "=", "pd", ".", "read_csv", "(", "f", ",", "sep", "=", "'\\t'", ",", "header", "=", "0", ")", "e...
Load the experimental design template from MaxQuant and use it to apply the label names to the data columns. :param df: :param f: File path for the experimental design template :param prefix: :return: dt
[ "Load", "the", "experimental", "design", "template", "from", "MaxQuant", "and", "use", "it", "to", "apply", "the", "label", "names", "to", "the", "data", "columns", "." ]
8b14bf4d2f895da6aea5d7885d409315bd303ec6
https://github.com/mfitzp/padua/blob/8b14bf4d2f895da6aea5d7885d409315bd303ec6/padua/process.py#L280-L306
6,006
mfitzp/padua
padua/process.py
transform_expression_columns
def transform_expression_columns(df, fn=np.log2, prefix='Intensity '): """ Apply transformation to expression columns. Default is log2 transform to expression columns beginning with Intensity :param df: :param prefix: The column prefix for expression columns :return: """ df = df.copy(...
python
def transform_expression_columns(df, fn=np.log2, prefix='Intensity '): """ Apply transformation to expression columns. Default is log2 transform to expression columns beginning with Intensity :param df: :param prefix: The column prefix for expression columns :return: """ df = df.copy(...
[ "def", "transform_expression_columns", "(", "df", ",", "fn", "=", "np", ".", "log2", ",", "prefix", "=", "'Intensity '", ")", ":", "df", "=", "df", ".", "copy", "(", ")", "mask", "=", "np", ".", "array", "(", "[", "l", ".", "startswith", "(", "pref...
Apply transformation to expression columns. Default is log2 transform to expression columns beginning with Intensity :param df: :param prefix: The column prefix for expression columns :return:
[ "Apply", "transformation", "to", "expression", "columns", "." ]
8b14bf4d2f895da6aea5d7885d409315bd303ec6
https://github.com/mfitzp/padua/blob/8b14bf4d2f895da6aea5d7885d409315bd303ec6/padua/process.py#L309-L327
6,007
mfitzp/padua
padua/process.py
fold_columns_to_rows
def fold_columns_to_rows(df, levels_from=2): """ Take a levels from the columns and fold down into the row index. This destroys the existing index; existing rows will appear as columns under the new column index :param df: :param levels_from: The level (inclusive) from which column index will b...
python
def fold_columns_to_rows(df, levels_from=2): """ Take a levels from the columns and fold down into the row index. This destroys the existing index; existing rows will appear as columns under the new column index :param df: :param levels_from: The level (inclusive) from which column index will b...
[ "def", "fold_columns_to_rows", "(", "df", ",", "levels_from", "=", "2", ")", ":", "df", "=", "df", ".", "copy", "(", ")", "df", ".", "reset_index", "(", "inplace", "=", "True", ",", "drop", "=", "True", ")", "# Wipe out the current index", "df", "=", "...
Take a levels from the columns and fold down into the row index. This destroys the existing index; existing rows will appear as columns under the new column index :param df: :param levels_from: The level (inclusive) from which column index will be folded :return:
[ "Take", "a", "levels", "from", "the", "columns", "and", "fold", "down", "into", "the", "row", "index", ".", "This", "destroys", "the", "existing", "index", ";", "existing", "rows", "will", "appear", "as", "columns", "under", "the", "new", "column", "index"...
8b14bf4d2f895da6aea5d7885d409315bd303ec6
https://github.com/mfitzp/padua/blob/8b14bf4d2f895da6aea5d7885d409315bd303ec6/padua/process.py#L330-L377
6,008
ECRL/ecabc
ecabc/abc.py
ABC.args
def args(self, args): '''Set additional arguments to be passed to the fitness function Args: args (dict): additional arguments ''' self._args = args self._logger.log('debug', 'Args set to {}'.format(args))
python
def args(self, args): '''Set additional arguments to be passed to the fitness function Args: args (dict): additional arguments ''' self._args = args self._logger.log('debug', 'Args set to {}'.format(args))
[ "def", "args", "(", "self", ",", "args", ")", ":", "self", ".", "_args", "=", "args", "self", ".", "_logger", ".", "log", "(", "'debug'", ",", "'Args set to {}'", ".", "format", "(", "args", ")", ")" ]
Set additional arguments to be passed to the fitness function Args: args (dict): additional arguments
[ "Set", "additional", "arguments", "to", "be", "passed", "to", "the", "fitness", "function" ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/abc.py#L147-L154
6,009
ECRL/ecabc
ecabc/abc.py
ABC.minimize
def minimize(self, minimize): '''Configures the ABC to minimize fitness function return value or derived score Args: minimize (bool): if True, minimizes fitness function return value; if False, minimizes derived score ''' self._minimize = minimize ...
python
def minimize(self, minimize): '''Configures the ABC to minimize fitness function return value or derived score Args: minimize (bool): if True, minimizes fitness function return value; if False, minimizes derived score ''' self._minimize = minimize ...
[ "def", "minimize", "(", "self", ",", "minimize", ")", ":", "self", ".", "_minimize", "=", "minimize", "self", ".", "_logger", ".", "log", "(", "'debug'", ",", "'Minimize set to {}'", ".", "format", "(", "minimize", ")", ")" ]
Configures the ABC to minimize fitness function return value or derived score Args: minimize (bool): if True, minimizes fitness function return value; if False, minimizes derived score
[ "Configures", "the", "ABC", "to", "minimize", "fitness", "function", "return", "value", "or", "derived", "score" ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/abc.py#L165-L175
6,010
ECRL/ecabc
ecabc/abc.py
ABC.num_employers
def num_employers(self, num_employers): '''Sets the number of employer bees; at least two are required Args: num_employers (int): number of employer bees ''' if num_employers < 2: self._logger.log( 'warn', 'Two employers are neede...
python
def num_employers(self, num_employers): '''Sets the number of employer bees; at least two are required Args: num_employers (int): number of employer bees ''' if num_employers < 2: self._logger.log( 'warn', 'Two employers are neede...
[ "def", "num_employers", "(", "self", ",", "num_employers", ")", ":", "if", "num_employers", "<", "2", ":", "self", ".", "_logger", ".", "log", "(", "'warn'", ",", "'Two employers are needed: setting to two'", ")", "num_employers", "=", "2", "self", ".", "_num_...
Sets the number of employer bees; at least two are required Args: num_employers (int): number of employer bees
[ "Sets", "the", "number", "of", "employer", "bees", ";", "at", "least", "two", "are", "required" ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/abc.py#L184-L202
6,011
ECRL/ecabc
ecabc/abc.py
ABC.processes
def processes(self, processes): '''Set the number of concurrent processes the ABC will utilize for fitness function evaluation; if <= 1, single process is used Args: processes (int): number of concurrent processes ''' if self._processes > 1: self._pool.c...
python
def processes(self, processes): '''Set the number of concurrent processes the ABC will utilize for fitness function evaluation; if <= 1, single process is used Args: processes (int): number of concurrent processes ''' if self._processes > 1: self._pool.c...
[ "def", "processes", "(", "self", ",", "processes", ")", ":", "if", "self", ".", "_processes", ">", "1", ":", "self", ".", "_pool", ".", "close", "(", ")", "self", ".", "_pool", ".", "join", "(", ")", "self", ".", "_pool", "=", "multiprocessing", "....
Set the number of concurrent processes the ABC will utilize for fitness function evaluation; if <= 1, single process is used Args: processes (int): number of concurrent processes
[ "Set", "the", "number", "of", "concurrent", "processes", "the", "ABC", "will", "utilize", "for", "fitness", "function", "evaluation", ";", "if", "<", "=", "1", "single", "process", "is", "used" ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/abc.py#L268-L284
6,012
ECRL/ecabc
ecabc/abc.py
ABC.infer_process_count
def infer_process_count(self): '''Infers the number of CPU cores in the current system, sets the number of concurrent processes accordingly ''' try: self.processes = multiprocessing.cpu_count() except NotImplementedError: self._logger.log( ...
python
def infer_process_count(self): '''Infers the number of CPU cores in the current system, sets the number of concurrent processes accordingly ''' try: self.processes = multiprocessing.cpu_count() except NotImplementedError: self._logger.log( ...
[ "def", "infer_process_count", "(", "self", ")", ":", "try", ":", "self", ".", "processes", "=", "multiprocessing", ".", "cpu_count", "(", ")", "except", "NotImplementedError", ":", "self", ".", "_logger", ".", "log", "(", "'error'", ",", "'Could infer CPU coun...
Infers the number of CPU cores in the current system, sets the number of concurrent processes accordingly
[ "Infers", "the", "number", "of", "CPU", "cores", "in", "the", "current", "system", "sets", "the", "number", "of", "concurrent", "processes", "accordingly" ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/abc.py#L286-L298
6,013
ECRL/ecabc
ecabc/abc.py
ABC.create_employers
def create_employers(self): '''Generate employer bees. This should be called directly after the ABC is initialized. ''' self.__verify_ready(True) employers = [] for i in range(self._num_employers): employer = EmployerBee(self.__gen_random_values()) ...
python
def create_employers(self): '''Generate employer bees. This should be called directly after the ABC is initialized. ''' self.__verify_ready(True) employers = [] for i in range(self._num_employers): employer = EmployerBee(self.__gen_random_values()) ...
[ "def", "create_employers", "(", "self", ")", ":", "self", ".", "__verify_ready", "(", "True", ")", "employers", "=", "[", "]", "for", "i", "in", "range", "(", "self", ".", "_num_employers", ")", ":", "employer", "=", "EmployerBee", "(", "self", ".", "_...
Generate employer bees. This should be called directly after the ABC is initialized.
[ "Generate", "employer", "bees", ".", "This", "should", "be", "called", "directly", "after", "the", "ABC", "is", "initialized", "." ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/abc.py#L300-L344
6,014
ECRL/ecabc
ecabc/abc.py
ABC.run_iteration
def run_iteration(self): '''Runs a single iteration of the ABC; employer phase -> probability calculation -> onlooker phase -> check positions ''' self._employer_phase() self._calc_probability() self._onlooker_phase() self._check_positions()
python
def run_iteration(self): '''Runs a single iteration of the ABC; employer phase -> probability calculation -> onlooker phase -> check positions ''' self._employer_phase() self._calc_probability() self._onlooker_phase() self._check_positions()
[ "def", "run_iteration", "(", "self", ")", ":", "self", ".", "_employer_phase", "(", ")", "self", ".", "_calc_probability", "(", ")", "self", ".", "_onlooker_phase", "(", ")", "self", ".", "_check_positions", "(", ")" ]
Runs a single iteration of the ABC; employer phase -> probability calculation -> onlooker phase -> check positions
[ "Runs", "a", "single", "iteration", "of", "the", "ABC", ";", "employer", "phase", "-", ">", "probability", "calculation", "-", ">", "onlooker", "phase", "-", ">", "check", "positions" ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/abc.py#L346-L354
6,015
ECRL/ecabc
ecabc/abc.py
ABC._calc_probability
def _calc_probability(self): '''Determines the probability that each bee will be chosen during the onlooker phase; also determines if a new best-performing bee is found ''' self._logger.log('debug', 'Calculating bee probabilities') self.__verify_ready() self._total_score...
python
def _calc_probability(self): '''Determines the probability that each bee will be chosen during the onlooker phase; also determines if a new best-performing bee is found ''' self._logger.log('debug', 'Calculating bee probabilities') self.__verify_ready() self._total_score...
[ "def", "_calc_probability", "(", "self", ")", ":", "self", ".", "_logger", ".", "log", "(", "'debug'", ",", "'Calculating bee probabilities'", ")", "self", ".", "__verify_ready", "(", ")", "self", ".", "_total_score", "=", "0", "for", "employer", "in", "self...
Determines the probability that each bee will be chosen during the onlooker phase; also determines if a new best-performing bee is found
[ "Determines", "the", "probability", "that", "each", "bee", "will", "be", "chosen", "during", "the", "onlooker", "phase", ";", "also", "determines", "if", "a", "new", "best", "-", "performing", "bee", "is", "found" ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/abc.py#L377-L398
6,016
ECRL/ecabc
ecabc/abc.py
ABC._merge_bee
def _merge_bee(self, bee): '''Shifts a random value for a supplied bee with in accordance with another random bee's value Args: bee (EmployerBee): supplied bee to merge Returns: tuple: (score of new position, values of new position, fitness funct...
python
def _merge_bee(self, bee): '''Shifts a random value for a supplied bee with in accordance with another random bee's value Args: bee (EmployerBee): supplied bee to merge Returns: tuple: (score of new position, values of new position, fitness funct...
[ "def", "_merge_bee", "(", "self", ",", "bee", ")", ":", "random_dimension", "=", "randint", "(", "0", ",", "len", "(", "self", ".", "_value_ranges", ")", "-", "1", ")", "second_bee", "=", "randint", "(", "0", ",", "self", ".", "_num_employers", "-", ...
Shifts a random value for a supplied bee with in accordance with another random bee's value Args: bee (EmployerBee): supplied bee to merge Returns: tuple: (score of new position, values of new position, fitness function return value of new position)
[ "Shifts", "a", "random", "value", "for", "a", "supplied", "bee", "with", "in", "accordance", "with", "another", "random", "bee", "s", "value" ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/abc.py#L452-L478
6,017
ECRL/ecabc
ecabc/abc.py
ABC._move_bee
def _move_bee(self, bee, new_values): '''Moves a bee to a new position if new fitness score is better than the bee's current fitness score Args: bee (EmployerBee): bee to move new_values (tuple): (new score, new values, new fitness function return value) ...
python
def _move_bee(self, bee, new_values): '''Moves a bee to a new position if new fitness score is better than the bee's current fitness score Args: bee (EmployerBee): bee to move new_values (tuple): (new score, new values, new fitness function return value) ...
[ "def", "_move_bee", "(", "self", ",", "bee", ",", "new_values", ")", ":", "score", "=", "np", ".", "nan_to_num", "(", "new_values", "[", "0", "]", ")", "if", "bee", ".", "score", ">", "score", ":", "bee", ".", "failed_trials", "+=", "1", "else", ":...
Moves a bee to a new position if new fitness score is better than the bee's current fitness score Args: bee (EmployerBee): bee to move new_values (tuple): (new score, new values, new fitness function return value)
[ "Moves", "a", "bee", "to", "a", "new", "position", "if", "new", "fitness", "score", "is", "better", "than", "the", "bee", "s", "current", "fitness", "score" ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/abc.py#L480-L498
6,018
ECRL/ecabc
ecabc/abc.py
ABC.__update
def __update(self, score, values, error): '''Update the best score and values if the given score is better than the current best score Args: score (float): new score to evaluate values (list): new value ranges to evaluate error (float): new fitness function r...
python
def __update(self, score, values, error): '''Update the best score and values if the given score is better than the current best score Args: score (float): new score to evaluate values (list): new value ranges to evaluate error (float): new fitness function r...
[ "def", "__update", "(", "self", ",", "score", ",", "values", ",", "error", ")", ":", "if", "self", ".", "_minimize", ":", "if", "self", ".", "_best_score", "is", "None", "or", "score", ">", "self", ".", "_best_score", ":", "self", ".", "_best_score", ...
Update the best score and values if the given score is better than the current best score Args: score (float): new score to evaluate values (list): new value ranges to evaluate error (float): new fitness function return value to evaluate Returns: ...
[ "Update", "the", "best", "score", "and", "values", "if", "the", "given", "score", "is", "better", "than", "the", "current", "best", "score" ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/abc.py#L500-L537
6,019
ECRL/ecabc
ecabc/abc.py
ABC.__gen_random_values
def __gen_random_values(self): '''Generate random values based on supplied value ranges Returns: list: random values, one per tunable variable ''' values = [] if self._value_ranges is None: self._logger.log( 'crit', 'Must ...
python
def __gen_random_values(self): '''Generate random values based on supplied value ranges Returns: list: random values, one per tunable variable ''' values = [] if self._value_ranges is None: self._logger.log( 'crit', 'Must ...
[ "def", "__gen_random_values", "(", "self", ")", ":", "values", "=", "[", "]", "if", "self", ".", "_value_ranges", "is", "None", ":", "self", ".", "_logger", ".", "log", "(", "'crit'", ",", "'Must set the type/range of possible values'", ")", "raise", "RuntimeE...
Generate random values based on supplied value ranges Returns: list: random values, one per tunable variable
[ "Generate", "random", "values", "based", "on", "supplied", "value", "ranges" ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/abc.py#L539-L567
6,020
ECRL/ecabc
ecabc/abc.py
ABC.__verify_ready
def __verify_ready(self, creating=False): '''Some cleanup, ensures that everything is set up properly to avoid random errors during execution Args: creating (bool): True if currently creating employer bees, False for checking all other operations ''' ...
python
def __verify_ready(self, creating=False): '''Some cleanup, ensures that everything is set up properly to avoid random errors during execution Args: creating (bool): True if currently creating employer bees, False for checking all other operations ''' ...
[ "def", "__verify_ready", "(", "self", ",", "creating", "=", "False", ")", ":", "if", "len", "(", "self", ".", "_value_ranges", ")", "==", "0", ":", "self", ".", "_logger", ".", "log", "(", "'crit'", ",", "'Attribute value_ranges must have at least one value'",...
Some cleanup, ensures that everything is set up properly to avoid random errors during execution Args: creating (bool): True if currently creating employer bees, False for checking all other operations
[ "Some", "cleanup", "ensures", "that", "everything", "is", "set", "up", "properly", "to", "avoid", "random", "errors", "during", "execution" ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/abc.py#L569-L588
6,021
ECRL/ecabc
ecabc/abc.py
ABC.import_settings
def import_settings(self, filename): '''Import settings from a JSON file Args: filename (string): name of the file to import from ''' if not os.path.isfile(filename): self._logger.log( 'error', 'File: {} not found, continuing with...
python
def import_settings(self, filename): '''Import settings from a JSON file Args: filename (string): name of the file to import from ''' if not os.path.isfile(filename): self._logger.log( 'error', 'File: {} not found, continuing with...
[ "def", "import_settings", "(", "self", ",", "filename", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "filename", ")", ":", "self", ".", "_logger", ".", "log", "(", "'error'", ",", "'File: {} not found, continuing with default settings'", ".", ...
Import settings from a JSON file Args: filename (string): name of the file to import from
[ "Import", "settings", "from", "a", "JSON", "file" ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/abc.py#L590-L618
6,022
ECRL/ecabc
ecabc/abc.py
ABC.save_settings
def save_settings(self, filename): '''Save settings to a JSON file Arge: filename (string): name of the file to save to ''' data = dict() data['valueRanges'] = self._value_ranges data['best_values'] = [str(value) for value in self._best_values] data[...
python
def save_settings(self, filename): '''Save settings to a JSON file Arge: filename (string): name of the file to save to ''' data = dict() data['valueRanges'] = self._value_ranges data['best_values'] = [str(value) for value in self._best_values] data[...
[ "def", "save_settings", "(", "self", ",", "filename", ")", ":", "data", "=", "dict", "(", ")", "data", "[", "'valueRanges'", "]", "=", "self", ".", "_value_ranges", "data", "[", "'best_values'", "]", "=", "[", "str", "(", "value", ")", "for", "value", ...
Save settings to a JSON file Arge: filename (string): name of the file to save to
[ "Save", "settings", "to", "a", "JSON", "file" ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/abc.py#L620-L636
6,023
ECRL/ecabc
ecabc/bees.py
EmployerBee.get_score
def get_score(self, error=None): '''Calculate bee's fitness score given a value returned by the fitness function Args: error (float): value returned by the fitness function Returns: float: derived fitness score ''' if error is not None: ...
python
def get_score(self, error=None): '''Calculate bee's fitness score given a value returned by the fitness function Args: error (float): value returned by the fitness function Returns: float: derived fitness score ''' if error is not None: ...
[ "def", "get_score", "(", "self", ",", "error", "=", "None", ")", ":", "if", "error", "is", "not", "None", ":", "self", ".", "error", "=", "error", "if", "self", ".", "error", ">=", "0", ":", "return", "1", "/", "(", "self", ".", "error", "+", "...
Calculate bee's fitness score given a value returned by the fitness function Args: error (float): value returned by the fitness function Returns: float: derived fitness score
[ "Calculate", "bee", "s", "fitness", "score", "given", "a", "value", "returned", "by", "the", "fitness", "function" ]
4e73125ff90bfeeae359a5ab1badba8894d70eaa
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/bees.py#L40-L56
6,024
foremast/foremast
src/foremast/dns/create_dns.py
SpinnakerDns.create_elb_dns
def create_elb_dns(self, regionspecific=False): """Create dns entries in route53. Args: regionspecific (bool): The DNS entry should have region on it Returns: str: Auto-generated DNS name for the Elastic Load Balancer. """ if regionspecific: ...
python
def create_elb_dns(self, regionspecific=False): """Create dns entries in route53. Args: regionspecific (bool): The DNS entry should have region on it Returns: str: Auto-generated DNS name for the Elastic Load Balancer. """ if regionspecific: ...
[ "def", "create_elb_dns", "(", "self", ",", "regionspecific", "=", "False", ")", ":", "if", "regionspecific", ":", "dns_elb", "=", "self", ".", "generated", ".", "dns", "(", ")", "[", "'elb_region'", "]", "else", ":", "dns_elb", "=", "self", ".", "generat...
Create dns entries in route53. Args: regionspecific (bool): The DNS entry should have region on it Returns: str: Auto-generated DNS name for the Elastic Load Balancer.
[ "Create", "dns", "entries", "in", "route53", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/dns/create_dns.py#L55-L85
6,025
foremast/foremast
src/foremast/dns/create_dns.py
SpinnakerDns.create_failover_dns
def create_failover_dns(self, primary_region='us-east-1'): """Create dns entries in route53 for multiregion failover setups. Args: primary_region (str): primary AWS region for failover Returns: Auto-generated DNS name. """ dns_record = self.generated.dns(...
python
def create_failover_dns(self, primary_region='us-east-1'): """Create dns entries in route53 for multiregion failover setups. Args: primary_region (str): primary AWS region for failover Returns: Auto-generated DNS name. """ dns_record = self.generated.dns(...
[ "def", "create_failover_dns", "(", "self", ",", "primary_region", "=", "'us-east-1'", ")", ":", "dns_record", "=", "self", ".", "generated", ".", "dns", "(", ")", "[", "'global'", "]", "zone_ids", "=", "get_dns_zone_ids", "(", "env", "=", "self", ".", "env...
Create dns entries in route53 for multiregion failover setups. Args: primary_region (str): primary AWS region for failover Returns: Auto-generated DNS name.
[ "Create", "dns", "entries", "in", "route53", "for", "multiregion", "failover", "setups", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/dns/create_dns.py#L87-L121
6,026
foremast/foremast
src/foremast/elb/format_listeners.py
format_listeners
def format_listeners(elb_settings=None, env='dev', region='us-east-1'): """Format ELB Listeners into standard list. Args: elb_settings (dict): ELB settings including ELB Listeners to add, e.g.:: # old { "certificate": null, ...
python
def format_listeners(elb_settings=None, env='dev', region='us-east-1'): """Format ELB Listeners into standard list. Args: elb_settings (dict): ELB settings including ELB Listeners to add, e.g.:: # old { "certificate": null, ...
[ "def", "format_listeners", "(", "elb_settings", "=", "None", ",", "env", "=", "'dev'", ",", "region", "=", "'us-east-1'", ")", ":", "LOG", ".", "debug", "(", "'ELB settings:\\n%s'", ",", "elb_settings", ")", "credential", "=", "get_env_credential", "(", "env",...
Format ELB Listeners into standard list. Args: elb_settings (dict): ELB settings including ELB Listeners to add, e.g.:: # old { "certificate": null, "i_port": 8080, "lb_port": 80, "s...
[ "Format", "ELB", "Listeners", "into", "standard", "list", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/elb/format_listeners.py#L26-L128
6,027
foremast/foremast
src/foremast/elb/format_listeners.py
format_cert_name
def format_cert_name(env='', account='', region='', certificate=None): """Format the SSL certificate name into ARN for ELB. Args: env (str): Account environment name account (str): Account number for ARN region (str): AWS Region. certificate (str): Name of SSL certificate R...
python
def format_cert_name(env='', account='', region='', certificate=None): """Format the SSL certificate name into ARN for ELB. Args: env (str): Account environment name account (str): Account number for ARN region (str): AWS Region. certificate (str): Name of SSL certificate R...
[ "def", "format_cert_name", "(", "env", "=", "''", ",", "account", "=", "''", ",", "region", "=", "''", ",", "certificate", "=", "None", ")", ":", "cert_name", "=", "None", "if", "certificate", ":", "if", "certificate", ".", "startswith", "(", "'arn'", ...
Format the SSL certificate name into ARN for ELB. Args: env (str): Account environment name account (str): Account number for ARN region (str): AWS Region. certificate (str): Name of SSL certificate Returns: str: Fully qualified ARN for SSL certificate None: Cer...
[ "Format", "the", "SSL", "certificate", "name", "into", "ARN", "for", "ELB", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/elb/format_listeners.py#L131-L161
6,028
foremast/foremast
src/foremast/elb/format_listeners.py
generate_custom_cert_name
def generate_custom_cert_name(env='', region='', account='', certificate=None): """Generate a custom TLS Cert name based on a template. Args: env (str): Account environment name region (str): AWS Region. account (str): Account number for ARN. certificate (str): Name of SSL certi...
python
def generate_custom_cert_name(env='', region='', account='', certificate=None): """Generate a custom TLS Cert name based on a template. Args: env (str): Account environment name region (str): AWS Region. account (str): Account number for ARN. certificate (str): Name of SSL certi...
[ "def", "generate_custom_cert_name", "(", "env", "=", "''", ",", "region", "=", "''", ",", "account", "=", "''", ",", "certificate", "=", "None", ")", ":", "cert_name", "=", "None", "template_kwargs", "=", "{", "'account'", ":", "account", ",", "'name'", ...
Generate a custom TLS Cert name based on a template. Args: env (str): Account environment name region (str): AWS Region. account (str): Account number for ARN. certificate (str): Name of SSL certificate. Returns: str: Fully qualified ARN for SSL certificate. Non...
[ "Generate", "a", "custom", "TLS", "Cert", "name", "based", "on", "a", "template", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/elb/format_listeners.py#L164-L213
6,029
foremast/foremast
src/foremast/slacknotify/__main__.py
main
def main(): """Send Slack notification to a configured channel.""" logging.basicConfig(format=LOGGING_FORMAT) log = logging.getLogger(__name__) parser = argparse.ArgumentParser() add_debug(parser) add_app(parser) add_env(parser) add_properties(parser) args = parser.parse_args() ...
python
def main(): """Send Slack notification to a configured channel.""" logging.basicConfig(format=LOGGING_FORMAT) log = logging.getLogger(__name__) parser = argparse.ArgumentParser() add_debug(parser) add_app(parser) add_env(parser) add_properties(parser) args = parser.parse_args() ...
[ "def", "main", "(", ")", ":", "logging", ".", "basicConfig", "(", "format", "=", "LOGGING_FORMAT", ")", "log", "=", "logging", ".", "getLogger", "(", "__name__", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "add_debug", "(", "parser", ...
Send Slack notification to a configured channel.
[ "Send", "Slack", "notification", "to", "a", "configured", "channel", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/slacknotify/__main__.py#L28-L49
6,030
foremast/foremast
src/foremast/destroyer.py
main
def main(): # noqa """Attempt to fully destroy AWS Resources for a Spinnaker Application.""" logging.basicConfig(format=LOGGING_FORMAT) parser = argparse.ArgumentParser(description=main.__doc__) add_debug(parser) add_app(parser) args = parser.parse_args() if args.debug == logging.DEBUG: ...
python
def main(): # noqa """Attempt to fully destroy AWS Resources for a Spinnaker Application.""" logging.basicConfig(format=LOGGING_FORMAT) parser = argparse.ArgumentParser(description=main.__doc__) add_debug(parser) add_app(parser) args = parser.parse_args() if args.debug == logging.DEBUG: ...
[ "def", "main", "(", ")", ":", "# noqa", "logging", ".", "basicConfig", "(", "format", "=", "LOGGING_FORMAT", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "main", ".", "__doc__", ")", "add_debug", "(", "parser", ")", "add_...
Attempt to fully destroy AWS Resources for a Spinnaker Application.
[ "Attempt", "to", "fully", "destroy", "AWS", "Resources", "for", "a", "Spinnaker", "Application", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/destroyer.py#L34-L79
6,031
foremast/foremast
src/foremast/pipeline/construct_pipeline_block.py
check_provider_healthcheck
def check_provider_healthcheck(settings, default_provider='Discovery'): """Set Provider Health Check when specified. Returns: collections.namedtuple: **ProviderHealthCheck** with attributes: * providers (list): Providers set to use native Health Check. * has_healthcheck (bool):...
python
def check_provider_healthcheck(settings, default_provider='Discovery'): """Set Provider Health Check when specified. Returns: collections.namedtuple: **ProviderHealthCheck** with attributes: * providers (list): Providers set to use native Health Check. * has_healthcheck (bool):...
[ "def", "check_provider_healthcheck", "(", "settings", ",", "default_provider", "=", "'Discovery'", ")", ":", "ProviderHealthCheck", "=", "collections", ".", "namedtuple", "(", "'ProviderHealthCheck'", ",", "[", "'providers'", ",", "'has_healthcheck'", "]", ")", "eurek...
Set Provider Health Check when specified. Returns: collections.namedtuple: **ProviderHealthCheck** with attributes: * providers (list): Providers set to use native Health Check. * has_healthcheck (bool): If any native Health Checks requested.
[ "Set", "Provider", "Health", "Check", "when", "specified", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/pipeline/construct_pipeline_block.py#L29-L70
6,032
foremast/foremast
src/foremast/pipeline/construct_pipeline_block.py
get_template_name
def get_template_name(env, pipeline_type): """Generates the correct template name based on pipeline type Args: env (str): environment to generate templates for pipeline_type (str): Type of pipeline like ec2 or lambda Returns: str: Name of template """ pipeline_base = 'pipel...
python
def get_template_name(env, pipeline_type): """Generates the correct template name based on pipeline type Args: env (str): environment to generate templates for pipeline_type (str): Type of pipeline like ec2 or lambda Returns: str: Name of template """ pipeline_base = 'pipel...
[ "def", "get_template_name", "(", "env", ",", "pipeline_type", ")", ":", "pipeline_base", "=", "'pipeline/pipeline'", "template_name_format", "=", "'{pipeline_base}'", "if", "env", ".", "startswith", "(", "'prod'", ")", ":", "template_name_format", "=", "template_name_...
Generates the correct template name based on pipeline type Args: env (str): environment to generate templates for pipeline_type (str): Type of pipeline like ec2 or lambda Returns: str: Name of template
[ "Generates", "the", "correct", "template", "name", "based", "on", "pipeline", "type" ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/pipeline/construct_pipeline_block.py#L73-L96
6,033
foremast/foremast
src/foremast/pipeline/construct_pipeline_block.py
ec2_pipeline_setup
def ec2_pipeline_setup( generated=None, project='', settings=None, env='', pipeline_type='', region='', region_subnets=None, ): """Handles ec2 pipeline data setup Args: generated (gogoutils.Generator): Generated naming formats. project (st...
python
def ec2_pipeline_setup( generated=None, project='', settings=None, env='', pipeline_type='', region='', region_subnets=None, ): """Handles ec2 pipeline data setup Args: generated (gogoutils.Generator): Generated naming formats. project (st...
[ "def", "ec2_pipeline_setup", "(", "generated", "=", "None", ",", "project", "=", "''", ",", "settings", "=", "None", ",", "env", "=", "''", ",", "pipeline_type", "=", "''", ",", "region", "=", "''", ",", "region_subnets", "=", "None", ",", ")", ":", ...
Handles ec2 pipeline data setup Args: generated (gogoutils.Generator): Generated naming formats. project (str): Group name of application settings (dict): Environment settings from configurations. env (str): Deploy environment name, e.g. dev, stage, prod. pipeline_type (str)...
[ "Handles", "ec2", "pipeline", "data", "setup" ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/pipeline/construct_pipeline_block.py#L169-L275
6,034
foremast/foremast
src/foremast/pipeline/create_pipeline_manual.py
SpinnakerPipelineManual.create_pipeline
def create_pipeline(self): """Use JSON files to create Pipelines.""" pipelines = self.settings['pipeline']['pipeline_files'] self.log.info('Uploading manual Pipelines: %s', pipelines) lookup = FileLookup(git_short=self.generated.gitlab()['main'], runway_dir=self.runway_dir) for...
python
def create_pipeline(self): """Use JSON files to create Pipelines.""" pipelines = self.settings['pipeline']['pipeline_files'] self.log.info('Uploading manual Pipelines: %s', pipelines) lookup = FileLookup(git_short=self.generated.gitlab()['main'], runway_dir=self.runway_dir) for...
[ "def", "create_pipeline", "(", "self", ")", ":", "pipelines", "=", "self", ".", "settings", "[", "'pipeline'", "]", "[", "'pipeline_files'", "]", "self", ".", "log", ".", "info", "(", "'Uploading manual Pipelines: %s'", ",", "pipelines", ")", "lookup", "=", ...
Use JSON files to create Pipelines.
[ "Use", "JSON", "files", "to", "create", "Pipelines", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/pipeline/create_pipeline_manual.py#L25-L42
6,035
foremast/foremast
src/foremast/pipeline/__main__.py
main
def main(): """Creates a pipeline in Spinnaker""" logging.basicConfig(format=LOGGING_FORMAT) log = logging.getLogger(__name__) parser = argparse.ArgumentParser() add_debug(parser) add_app(parser) add_properties(parser) parser.add_argument('-b', '--base', help='Base AMI name to use, e.g....
python
def main(): """Creates a pipeline in Spinnaker""" logging.basicConfig(format=LOGGING_FORMAT) log = logging.getLogger(__name__) parser = argparse.ArgumentParser() add_debug(parser) add_app(parser) add_properties(parser) parser.add_argument('-b', '--base', help='Base AMI name to use, e.g....
[ "def", "main", "(", ")", ":", "logging", ".", "basicConfig", "(", "format", "=", "LOGGING_FORMAT", ")", "log", "=", "logging", ".", "getLogger", "(", "__name__", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "add_debug", "(", "parser", ...
Creates a pipeline in Spinnaker
[ "Creates", "a", "pipeline", "in", "Spinnaker" ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/pipeline/__main__.py#L31-L71
6,036
foremast/foremast
src/foremast/configs/outputs.py
convert_ini
def convert_ini(config_dict): """Convert _config_dict_ into a list of INI formatted strings. Args: config_dict (dict): Configuration dictionary to be flattened. Returns: (list) Lines to be written to a file in the format of KEY1_KEY2=value. """ config_lines = [] for env, confi...
python
def convert_ini(config_dict): """Convert _config_dict_ into a list of INI formatted strings. Args: config_dict (dict): Configuration dictionary to be flattened. Returns: (list) Lines to be written to a file in the format of KEY1_KEY2=value. """ config_lines = [] for env, confi...
[ "def", "convert_ini", "(", "config_dict", ")", ":", "config_lines", "=", "[", "]", "for", "env", ",", "configs", "in", "sorted", "(", "config_dict", ".", "items", "(", ")", ")", ":", "for", "resource", ",", "app_properties", "in", "sorted", "(", "configs...
Convert _config_dict_ into a list of INI formatted strings. Args: config_dict (dict): Configuration dictionary to be flattened. Returns: (list) Lines to be written to a file in the format of KEY1_KEY2=value.
[ "Convert", "_config_dict_", "into", "a", "list", "of", "INI", "formatted", "strings", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/configs/outputs.py#L29-L63
6,037
foremast/foremast
src/foremast/configs/outputs.py
write_variables
def write_variables(app_configs=None, out_file='', git_short=''): """Append _application.json_ configs to _out_file_, .exports, and .json. Variables are written in INI style, e.g. UPPER_CASE=value. The .exports file contains 'export' prepended to each line for easy sourcing. The .json file is a minifie...
python
def write_variables(app_configs=None, out_file='', git_short=''): """Append _application.json_ configs to _out_file_, .exports, and .json. Variables are written in INI style, e.g. UPPER_CASE=value. The .exports file contains 'export' prepended to each line for easy sourcing. The .json file is a minifie...
[ "def", "write_variables", "(", "app_configs", "=", "None", ",", "out_file", "=", "''", ",", "git_short", "=", "''", ")", ":", "generated", "=", "gogoutils", ".", "Generator", "(", "*", "gogoutils", ".", "Parser", "(", "git_short", ")", ".", "parse_url", ...
Append _application.json_ configs to _out_file_, .exports, and .json. Variables are written in INI style, e.g. UPPER_CASE=value. The .exports file contains 'export' prepended to each line for easy sourcing. The .json file is a minified representation of the combined configurations. Args: app_c...
[ "Append", "_application", ".", "json_", "configs", "to", "_out_file_", ".", "exports", "and", ".", "json", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/configs/outputs.py#L66-L122
6,038
foremast/foremast
src/foremast/utils/get_sns_subscriptions.py
get_sns_subscriptions
def get_sns_subscriptions(app_name, env, region): """List SNS lambda subscriptions. Returns: list: List of Lambda subscribed SNS ARNs. """ session = boto3.Session(profile_name=env, region_name=region) sns_client = session.client('sns') lambda_alias_arn = get_lambda_alias_arn(app=app_n...
python
def get_sns_subscriptions(app_name, env, region): """List SNS lambda subscriptions. Returns: list: List of Lambda subscribed SNS ARNs. """ session = boto3.Session(profile_name=env, region_name=region) sns_client = session.client('sns') lambda_alias_arn = get_lambda_alias_arn(app=app_n...
[ "def", "get_sns_subscriptions", "(", "app_name", ",", "env", ",", "region", ")", ":", "session", "=", "boto3", ".", "Session", "(", "profile_name", "=", "env", ",", "region_name", "=", "region", ")", "sns_client", "=", "session", ".", "client", "(", "'sns'...
List SNS lambda subscriptions. Returns: list: List of Lambda subscribed SNS ARNs.
[ "List", "SNS", "lambda", "subscriptions", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/get_sns_subscriptions.py#L11-L33
6,039
foremast/foremast
src/foremast/awslambda/cloudwatch_log_event/destroy_cloudwatch_log_event/destroy_cloudwatch_log_event.py
destroy_cloudwatch_log_event
def destroy_cloudwatch_log_event(app='', env='dev', region=''): """Destroy Cloudwatch log event. Args: app (str): Spinnaker Application name. env (str): Deployment environment. region (str): AWS region. Returns: bool: True upon successful completion. """ session = b...
python
def destroy_cloudwatch_log_event(app='', env='dev', region=''): """Destroy Cloudwatch log event. Args: app (str): Spinnaker Application name. env (str): Deployment environment. region (str): AWS region. Returns: bool: True upon successful completion. """ session = b...
[ "def", "destroy_cloudwatch_log_event", "(", "app", "=", "''", ",", "env", "=", "'dev'", ",", "region", "=", "''", ")", ":", "session", "=", "boto3", ".", "Session", "(", "profile_name", "=", "env", ",", "region_name", "=", "region", ")", "cloudwatch_client...
Destroy Cloudwatch log event. Args: app (str): Spinnaker Application name. env (str): Deployment environment. region (str): AWS region. Returns: bool: True upon successful completion.
[ "Destroy", "Cloudwatch", "log", "event", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/cloudwatch_log_event/destroy_cloudwatch_log_event/destroy_cloudwatch_log_event.py#L24-L42
6,040
foremast/foremast
src/foremast/app/create_app.py
SpinnakerApp.get_accounts
def get_accounts(self, provider='aws'): """Get Accounts added to Spinnaker. Args: provider (str): What provider to find accounts for. Returns: list: list of dicts of Spinnaker credentials matching _provider_. Raises: AssertionError: Failure getting ...
python
def get_accounts(self, provider='aws'): """Get Accounts added to Spinnaker. Args: provider (str): What provider to find accounts for. Returns: list: list of dicts of Spinnaker credentials matching _provider_. Raises: AssertionError: Failure getting ...
[ "def", "get_accounts", "(", "self", ",", "provider", "=", "'aws'", ")", ":", "url", "=", "'{gate}/credentials'", ".", "format", "(", "gate", "=", "API_URL", ")", "response", "=", "requests", ".", "get", "(", "url", ",", "verify", "=", "GATE_CA_BUNDLE", "...
Get Accounts added to Spinnaker. Args: provider (str): What provider to find accounts for. Returns: list: list of dicts of Spinnaker credentials matching _provider_. Raises: AssertionError: Failure getting accounts from Spinnaker.
[ "Get", "Accounts", "added", "to", "Spinnaker", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/app/create_app.py#L55-L82
6,041
foremast/foremast
src/foremast/app/create_app.py
SpinnakerApp.create_app
def create_app(self): """Send a POST to spinnaker to create a new application with class variables. Raises: AssertionError: Application creation failed. """ self.appinfo['accounts'] = self.get_accounts() self.log.debug('Pipeline Config\n%s', pformat(self.pipeline_con...
python
def create_app(self): """Send a POST to spinnaker to create a new application with class variables. Raises: AssertionError: Application creation failed. """ self.appinfo['accounts'] = self.get_accounts() self.log.debug('Pipeline Config\n%s', pformat(self.pipeline_con...
[ "def", "create_app", "(", "self", ")", ":", "self", ".", "appinfo", "[", "'accounts'", "]", "=", "self", ".", "get_accounts", "(", ")", "self", ".", "log", ".", "debug", "(", "'Pipeline Config\\n%s'", ",", "pformat", "(", "self", ".", "pipeline_config", ...
Send a POST to spinnaker to create a new application with class variables. Raises: AssertionError: Application creation failed.
[ "Send", "a", "POST", "to", "spinnaker", "to", "create", "a", "new", "application", "with", "class", "variables", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/app/create_app.py#L84-L97
6,042
foremast/foremast
src/foremast/app/create_app.py
SpinnakerApp.retrieve_template
def retrieve_template(self): """Sets the instance links with pipeline_configs and then renders template files Returns: jsondata: A json objects containing templates """ links = self.retrieve_instance_links() self.log.debug('Links is \n%s', pformat(links)) sel...
python
def retrieve_template(self): """Sets the instance links with pipeline_configs and then renders template files Returns: jsondata: A json objects containing templates """ links = self.retrieve_instance_links() self.log.debug('Links is \n%s', pformat(links)) sel...
[ "def", "retrieve_template", "(", "self", ")", ":", "links", "=", "self", ".", "retrieve_instance_links", "(", ")", "self", ".", "log", ".", "debug", "(", "'Links is \\n%s'", ",", "pformat", "(", "links", ")", ")", "self", ".", "pipeline_config", "[", "'ins...
Sets the instance links with pipeline_configs and then renders template files Returns: jsondata: A json objects containing templates
[ "Sets", "the", "instance", "links", "with", "pipeline_configs", "and", "then", "renders", "template", "files" ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/app/create_app.py#L99-L115
6,043
foremast/foremast
src/foremast/app/create_app.py
SpinnakerApp.retrieve_instance_links
def retrieve_instance_links(self): """Appends on existing instance links Returns: instance_links: A dictionary containing all the instance links in LINKS and not in pipeline_config """ instance_links = {} self.log.debug("LINKS IS %s", LINKS) for key, value in...
python
def retrieve_instance_links(self): """Appends on existing instance links Returns: instance_links: A dictionary containing all the instance links in LINKS and not in pipeline_config """ instance_links = {} self.log.debug("LINKS IS %s", LINKS) for key, value in...
[ "def", "retrieve_instance_links", "(", "self", ")", ":", "instance_links", "=", "{", "}", "self", ".", "log", ".", "debug", "(", "\"LINKS IS %s\"", ",", "LINKS", ")", "for", "key", ",", "value", "in", "LINKS", ".", "items", "(", ")", ":", "if", "value"...
Appends on existing instance links Returns: instance_links: A dictionary containing all the instance links in LINKS and not in pipeline_config
[ "Appends", "on", "existing", "instance", "links" ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/app/create_app.py#L117-L128
6,044
foremast/foremast
src/foremast/utils/get_cloudwatch_event_rule.py
get_cloudwatch_event_rule
def get_cloudwatch_event_rule(app_name, account, region): """Get CloudWatch Event rule names.""" session = boto3.Session(profile_name=account, region_name=region) cloudwatch_client = session.client('events') lambda_alias_arn = get_lambda_alias_arn(app=app_name, account=account, region=region) rule_...
python
def get_cloudwatch_event_rule(app_name, account, region): """Get CloudWatch Event rule names.""" session = boto3.Session(profile_name=account, region_name=region) cloudwatch_client = session.client('events') lambda_alias_arn = get_lambda_alias_arn(app=app_name, account=account, region=region) rule_...
[ "def", "get_cloudwatch_event_rule", "(", "app_name", ",", "account", ",", "region", ")", ":", "session", "=", "boto3", ".", "Session", "(", "profile_name", "=", "account", ",", "region_name", "=", "region", ")", "cloudwatch_client", "=", "session", ".", "clien...
Get CloudWatch Event rule names.
[ "Get", "CloudWatch", "Event", "rule", "names", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/get_cloudwatch_event_rule.py#L11-L24
6,045
foremast/foremast
src/foremast/s3/s3deploy.py
S3Deployment.setup_pathing
def setup_pathing(self): """Format pathing for S3 deployments.""" self.s3_version_uri = self._path_formatter(self.version) self.s3_latest_uri = self._path_formatter("LATEST") self.s3_canary_uri = self._path_formatter("CANARY") self.s3_alpha_uri = self._path_formatter("ALPHA") ...
python
def setup_pathing(self): """Format pathing for S3 deployments.""" self.s3_version_uri = self._path_formatter(self.version) self.s3_latest_uri = self._path_formatter("LATEST") self.s3_canary_uri = self._path_formatter("CANARY") self.s3_alpha_uri = self._path_formatter("ALPHA") ...
[ "def", "setup_pathing", "(", "self", ")", ":", "self", ".", "s3_version_uri", "=", "self", ".", "_path_formatter", "(", "self", ".", "version", ")", "self", ".", "s3_latest_uri", "=", "self", ".", "_path_formatter", "(", "\"LATEST\"", ")", "self", ".", "s3...
Format pathing for S3 deployments.
[ "Format", "pathing", "for", "S3", "deployments", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/s3deploy.py#L69-L75
6,046
foremast/foremast
src/foremast/s3/s3deploy.py
S3Deployment._path_formatter
def _path_formatter(self, suffix): """Format the s3 path properly. Args: suffix (str): suffix to add on to an s3 path Returns: str: formatted path """ if suffix.lower() == "mirror": path_items = [self.bucket, self.s3path] else: ...
python
def _path_formatter(self, suffix): """Format the s3 path properly. Args: suffix (str): suffix to add on to an s3 path Returns: str: formatted path """ if suffix.lower() == "mirror": path_items = [self.bucket, self.s3path] else: ...
[ "def", "_path_formatter", "(", "self", ",", "suffix", ")", ":", "if", "suffix", ".", "lower", "(", ")", "==", "\"mirror\"", ":", "path_items", "=", "[", "self", ".", "bucket", ",", "self", ".", "s3path", "]", "else", ":", "path_items", "=", "[", "sel...
Format the s3 path properly. Args: suffix (str): suffix to add on to an s3 path Returns: str: formatted path
[ "Format", "the", "s3", "path", "properly", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/s3deploy.py#L77-L96
6,047
foremast/foremast
src/foremast/s3/s3deploy.py
S3Deployment.upload_artifacts
def upload_artifacts(self): """Upload artifacts to S3 and copy to correct path depending on strategy.""" deploy_strategy = self.properties["deploy_strategy"] mirror = False if deploy_strategy == "mirror": mirror = True self._upload_artifacts_to_path(mirror=mirror) ...
python
def upload_artifacts(self): """Upload artifacts to S3 and copy to correct path depending on strategy.""" deploy_strategy = self.properties["deploy_strategy"] mirror = False if deploy_strategy == "mirror": mirror = True self._upload_artifacts_to_path(mirror=mirror) ...
[ "def", "upload_artifacts", "(", "self", ")", ":", "deploy_strategy", "=", "self", ".", "properties", "[", "\"deploy_strategy\"", "]", "mirror", "=", "False", "if", "deploy_strategy", "==", "\"mirror\"", ":", "mirror", "=", "True", "self", ".", "_upload_artifacts...
Upload artifacts to S3 and copy to correct path depending on strategy.
[ "Upload", "artifacts", "to", "S3", "and", "copy", "to", "correct", "path", "depending", "on", "strategy", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/s3deploy.py#L98-L116
6,048
foremast/foremast
src/foremast/s3/s3deploy.py
S3Deployment.promote_artifacts
def promote_artifacts(self, promote_stage='latest'): """Promote artifact version to dest. Args: promote_stage (string): Stage that is being promoted """ if promote_stage.lower() == 'alpha': self._sync_to_uri(self.s3_canary_uri) elif promote_stage.lower() ...
python
def promote_artifacts(self, promote_stage='latest'): """Promote artifact version to dest. Args: promote_stage (string): Stage that is being promoted """ if promote_stage.lower() == 'alpha': self._sync_to_uri(self.s3_canary_uri) elif promote_stage.lower() ...
[ "def", "promote_artifacts", "(", "self", ",", "promote_stage", "=", "'latest'", ")", ":", "if", "promote_stage", ".", "lower", "(", ")", "==", "'alpha'", ":", "self", ".", "_sync_to_uri", "(", "self", ".", "s3_canary_uri", ")", "elif", "promote_stage", ".", ...
Promote artifact version to dest. Args: promote_stage (string): Stage that is being promoted
[ "Promote", "artifact", "version", "to", "dest", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/s3deploy.py#L118-L129
6,049
foremast/foremast
src/foremast/s3/s3deploy.py
S3Deployment._get_upload_cmd
def _get_upload_cmd(self, mirror=False): """Generate the S3 CLI upload command Args: mirror (bool): If true, uses a flat directory structure instead of nesting under a version. Returns: str: The full CLI command to run. """ if mirror: dest_ur...
python
def _get_upload_cmd(self, mirror=False): """Generate the S3 CLI upload command Args: mirror (bool): If true, uses a flat directory structure instead of nesting under a version. Returns: str: The full CLI command to run. """ if mirror: dest_ur...
[ "def", "_get_upload_cmd", "(", "self", ",", "mirror", "=", "False", ")", ":", "if", "mirror", ":", "dest_uri", "=", "self", ".", "s3_mirror_uri", "else", ":", "dest_uri", "=", "self", ".", "s3_version_uri", "cmd", "=", "'aws s3 sync {} {} --delete --exact-timest...
Generate the S3 CLI upload command Args: mirror (bool): If true, uses a flat directory structure instead of nesting under a version. Returns: str: The full CLI command to run.
[ "Generate", "the", "S3", "CLI", "upload", "command" ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/s3deploy.py#L131-L147
6,050
foremast/foremast
src/foremast/s3/s3deploy.py
S3Deployment._upload_artifacts_to_path
def _upload_artifacts_to_path(self, mirror=False): """Recursively upload directory contents to S3. Args: mirror (bool): If true, uses a flat directory structure instead of nesting under a version. """ if not os.listdir(self.artifact_path) or not self.artifact_path: ...
python
def _upload_artifacts_to_path(self, mirror=False): """Recursively upload directory contents to S3. Args: mirror (bool): If true, uses a flat directory structure instead of nesting under a version. """ if not os.listdir(self.artifact_path) or not self.artifact_path: ...
[ "def", "_upload_artifacts_to_path", "(", "self", ",", "mirror", "=", "False", ")", ":", "if", "not", "os", ".", "listdir", "(", "self", ".", "artifact_path", ")", "or", "not", "self", ".", "artifact_path", ":", "raise", "S3ArtifactNotFound", "uploaded", "=",...
Recursively upload directory contents to S3. Args: mirror (bool): If true, uses a flat directory structure instead of nesting under a version.
[ "Recursively", "upload", "directory", "contents", "to", "S3", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/s3deploy.py#L149-L168
6,051
foremast/foremast
src/foremast/s3/s3deploy.py
S3Deployment.content_metadata_uploads
def content_metadata_uploads(self, mirror=False): """Finds all specified encoded directories and uploads in multiple parts, setting metadata for objects. Args: mirror (bool): If true, uses a flat directory structure instead of nesting under a version. Returns: b...
python
def content_metadata_uploads(self, mirror=False): """Finds all specified encoded directories and uploads in multiple parts, setting metadata for objects. Args: mirror (bool): If true, uses a flat directory structure instead of nesting under a version. Returns: b...
[ "def", "content_metadata_uploads", "(", "self", ",", "mirror", "=", "False", ")", ":", "excludes_str", "=", "''", "includes_cmds", "=", "[", "]", "cmd_base", "=", "self", ".", "_get_upload_cmd", "(", "mirror", "=", "mirror", ")", "for", "content", "in", "s...
Finds all specified encoded directories and uploads in multiple parts, setting metadata for objects. Args: mirror (bool): If true, uses a flat directory structure instead of nesting under a version. Returns: bool: True if uploaded
[ "Finds", "all", "specified", "encoded", "directories", "and", "uploads", "in", "multiple", "parts", "setting", "metadata", "for", "objects", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/s3deploy.py#L170-L204
6,052
foremast/foremast
src/foremast/s3/s3deploy.py
S3Deployment._sync_to_uri
def _sync_to_uri(self, uri): """Copy and sync versioned directory to uri in S3. Args: uri (str): S3 URI to sync version to. """ cmd_cp = 'aws s3 cp {} {} --recursive --profile {}'.format(self.s3_version_uri, uri, self.env) # AWS CLI sync does not work as expected buc...
python
def _sync_to_uri(self, uri): """Copy and sync versioned directory to uri in S3. Args: uri (str): S3 URI to sync version to. """ cmd_cp = 'aws s3 cp {} {} --recursive --profile {}'.format(self.s3_version_uri, uri, self.env) # AWS CLI sync does not work as expected buc...
[ "def", "_sync_to_uri", "(", "self", ",", "uri", ")", ":", "cmd_cp", "=", "'aws s3 cp {} {} --recursive --profile {}'", ".", "format", "(", "self", ".", "s3_version_uri", ",", "uri", ",", "self", ".", "env", ")", "# AWS CLI sync does not work as expected bucket to buck...
Copy and sync versioned directory to uri in S3. Args: uri (str): S3 URI to sync version to.
[ "Copy", "and", "sync", "versioned", "directory", "to", "uri", "in", "S3", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/s3deploy.py#L206-L223
6,053
foremast/foremast
src/foremast/utils/vpc.py
get_vpc_id
def get_vpc_id(account, region): """Get VPC ID configured for ``account`` in ``region``. Args: account (str): AWS account name. region (str): Region name, e.g. us-east-1. Returns: str: VPC ID for the requested ``account`` in ``region``. Raises: :obj:`foremast.exception...
python
def get_vpc_id(account, region): """Get VPC ID configured for ``account`` in ``region``. Args: account (str): AWS account name. region (str): Region name, e.g. us-east-1. Returns: str: VPC ID for the requested ``account`` in ``region``. Raises: :obj:`foremast.exception...
[ "def", "get_vpc_id", "(", "account", ",", "region", ")", ":", "url", "=", "'{0}/networks/aws'", ".", "format", "(", "API_URL", ")", "response", "=", "requests", ".", "get", "(", "url", ",", "verify", "=", "GATE_CA_BUNDLE", ",", "cert", "=", "GATE_CLIENT_CE...
Get VPC ID configured for ``account`` in ``region``. Args: account (str): AWS account name. region (str): Region name, e.g. us-east-1. Returns: str: VPC ID for the requested ``account`` in ``region``. Raises: :obj:`foremast.exceptions.SpinnakerVPCIDNotFound`: VPC ID not fo...
[ "Get", "VPC", "ID", "configured", "for", "account", "in", "region", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/vpc.py#L27-L62
6,054
foremast/foremast
src/foremast/utils/subnets.py
get_subnets
def get_subnets( target='ec2', purpose='internal', env='', region='', ): """Get all availability zones for a given target. Args: target (str): Type of subnets to look up (ec2 or elb). env (str): Environment to look up. region (str): AWS Region to find Sub...
python
def get_subnets( target='ec2', purpose='internal', env='', region='', ): """Get all availability zones for a given target. Args: target (str): Type of subnets to look up (ec2 or elb). env (str): Environment to look up. region (str): AWS Region to find Sub...
[ "def", "get_subnets", "(", "target", "=", "'ec2'", ",", "purpose", "=", "'internal'", ",", "env", "=", "''", ",", "region", "=", "''", ",", ")", ":", "account_az_dict", "=", "defaultdict", "(", "defaultdict", ")", "subnet_id_dict", "=", "defaultdict", "(",...
Get all availability zones for a given target. Args: target (str): Type of subnets to look up (ec2 or elb). env (str): Environment to look up. region (str): AWS Region to find Subnets for. Returns: az_dict: dictionary of availbility zones, structured like { $region: [ ...
[ "Get", "all", "availability", "zones", "for", "a", "given", "target", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/subnets.py#L32-L93
6,055
foremast/foremast
src/foremast/awslambda/awslambdaevent.py
LambdaEvent.create_lambda_events
def create_lambda_events(self): """Create all defined lambda events for an lambda application.""" # Clean up lambda permissions before creating triggers remove_all_lambda_permissions(app_name=self.app_name, env=self.env, region=self.region) triggers = self.properties['lambda_triggers']...
python
def create_lambda_events(self): """Create all defined lambda events for an lambda application.""" # Clean up lambda permissions before creating triggers remove_all_lambda_permissions(app_name=self.app_name, env=self.env, region=self.region) triggers = self.properties['lambda_triggers']...
[ "def", "create_lambda_events", "(", "self", ")", ":", "# Clean up lambda permissions before creating triggers", "remove_all_lambda_permissions", "(", "app_name", "=", "self", ".", "app_name", ",", "env", "=", "self", ".", "env", ",", "region", "=", "self", ".", "reg...
Create all defined lambda events for an lambda application.
[ "Create", "all", "defined", "lambda", "events", "for", "an", "lambda", "application", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/awslambdaevent.py#L45-L83
6,056
foremast/foremast
src/foremast/utils/pipelines.py
get_all_pipelines
def get_all_pipelines(app=''): """Get a list of all the Pipelines in _app_. Args: app (str): Name of Spinnaker Application. Returns: requests.models.Response: Response from Gate containing Pipelines. """ url = '{host}/applications/{app}/pipelineConfigs'.format(host=API_URL, app=ap...
python
def get_all_pipelines(app=''): """Get a list of all the Pipelines in _app_. Args: app (str): Name of Spinnaker Application. Returns: requests.models.Response: Response from Gate containing Pipelines. """ url = '{host}/applications/{app}/pipelineConfigs'.format(host=API_URL, app=ap...
[ "def", "get_all_pipelines", "(", "app", "=", "''", ")", ":", "url", "=", "'{host}/applications/{app}/pipelineConfigs'", ".", "format", "(", "host", "=", "API_URL", ",", "app", "=", "app", ")", "response", "=", "requests", ".", "get", "(", "url", ",", "veri...
Get a list of all the Pipelines in _app_. Args: app (str): Name of Spinnaker Application. Returns: requests.models.Response: Response from Gate containing Pipelines.
[ "Get", "a", "list", "of", "all", "the", "Pipelines", "in", "_app_", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/pipelines.py#L64-L82
6,057
foremast/foremast
src/foremast/utils/pipelines.py
get_pipeline_id
def get_pipeline_id(app='', name=''): """Get the ID for Pipeline _name_. Args: app (str): Name of Spinnaker Application to search. name (str): Name of Pipeline to get ID for. Returns: str: ID of specified Pipeline. None: Pipeline or Spinnaker Appliation not found. """ ...
python
def get_pipeline_id(app='', name=''): """Get the ID for Pipeline _name_. Args: app (str): Name of Spinnaker Application to search. name (str): Name of Pipeline to get ID for. Returns: str: ID of specified Pipeline. None: Pipeline or Spinnaker Appliation not found. """ ...
[ "def", "get_pipeline_id", "(", "app", "=", "''", ",", "name", "=", "''", ")", ":", "return_id", "=", "None", "pipelines", "=", "get_all_pipelines", "(", "app", "=", "app", ")", "for", "pipeline", "in", "pipelines", ":", "LOG", ".", "debug", "(", "'ID o...
Get the ID for Pipeline _name_. Args: app (str): Name of Spinnaker Application to search. name (str): Name of Pipeline to get ID for. Returns: str: ID of specified Pipeline. None: Pipeline or Spinnaker Appliation not found.
[ "Get", "the", "ID", "for", "Pipeline", "_name_", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/pipelines.py#L85-L109
6,058
foremast/foremast
src/foremast/utils/pipelines.py
normalize_pipeline_name
def normalize_pipeline_name(name=''): """Translate unsafe characters to underscores.""" normalized_name = name for bad in '\\/?%#': normalized_name = normalized_name.replace(bad, '_') return normalized_name
python
def normalize_pipeline_name(name=''): """Translate unsafe characters to underscores.""" normalized_name = name for bad in '\\/?%#': normalized_name = normalized_name.replace(bad, '_') return normalized_name
[ "def", "normalize_pipeline_name", "(", "name", "=", "''", ")", ":", "normalized_name", "=", "name", "for", "bad", "in", "'\\\\/?%#'", ":", "normalized_name", "=", "normalized_name", ".", "replace", "(", "bad", ",", "'_'", ")", "return", "normalized_name" ]
Translate unsafe characters to underscores.
[ "Translate", "unsafe", "characters", "to", "underscores", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/pipelines.py#L112-L117
6,059
foremast/foremast
src/foremast/utils/apps.py
get_all_apps
def get_all_apps(): """Get a list of all applications in Spinnaker. Returns: requests.models.Response: Response from Gate containing list of all apps. """ LOG.info('Retreiving list of all Spinnaker applications') url = '{}/applications'.format(API_URL) response = requests.get(url, veri...
python
def get_all_apps(): """Get a list of all applications in Spinnaker. Returns: requests.models.Response: Response from Gate containing list of all apps. """ LOG.info('Retreiving list of all Spinnaker applications') url = '{}/applications'.format(API_URL) response = requests.get(url, veri...
[ "def", "get_all_apps", "(", ")", ":", "LOG", ".", "info", "(", "'Retreiving list of all Spinnaker applications'", ")", "url", "=", "'{}/applications'", ".", "format", "(", "API_URL", ")", "response", "=", "requests", ".", "get", "(", "url", ",", "verify", "=",...
Get a list of all applications in Spinnaker. Returns: requests.models.Response: Response from Gate containing list of all apps.
[ "Get", "a", "list", "of", "all", "applications", "in", "Spinnaker", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/apps.py#L28-L44
6,060
foremast/foremast
src/foremast/utils/apps.py
get_details
def get_details(app='groupproject', env='dev', region='us-east-1'): """Extract details for Application. Args: app (str): Application Name env (str): Environment/account to get details from Returns: collections.namedtuple with _group_, _policy_, _profile_, _role_, _user_...
python
def get_details(app='groupproject', env='dev', region='us-east-1'): """Extract details for Application. Args: app (str): Application Name env (str): Environment/account to get details from Returns: collections.namedtuple with _group_, _policy_, _profile_, _role_, _user_...
[ "def", "get_details", "(", "app", "=", "'groupproject'", ",", "env", "=", "'dev'", ",", "region", "=", "'us-east-1'", ")", ":", "url", "=", "'{host}/applications/{app}'", ".", "format", "(", "host", "=", "API_URL", ",", "app", "=", "app", ")", "request", ...
Extract details for Application. Args: app (str): Application Name env (str): Environment/account to get details from Returns: collections.namedtuple with _group_, _policy_, _profile_, _role_, _user_.
[ "Extract", "details", "for", "Application", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/apps.py#L47-L74
6,061
foremast/foremast
src/foremast/pipeline/create_pipeline_s3.py
SpinnakerPipelineS3.create_pipeline
def create_pipeline(self): """Main wrapper for pipeline creation. 1. Runs clean_pipelines to clean up existing ones 2. determines which environments the pipeline needs 3. Renders all of the pipeline blocks as defined in configs 4. Runs post_pipeline to create pipeline """...
python
def create_pipeline(self): """Main wrapper for pipeline creation. 1. Runs clean_pipelines to clean up existing ones 2. determines which environments the pipeline needs 3. Renders all of the pipeline blocks as defined in configs 4. Runs post_pipeline to create pipeline """...
[ "def", "create_pipeline", "(", "self", ")", ":", "clean_pipelines", "(", "app", "=", "self", ".", "app_name", ",", "settings", "=", "self", ".", "settings", ")", "pipeline_envs", "=", "self", ".", "environments", "self", ".", "log", ".", "debug", "(", "'...
Main wrapper for pipeline creation. 1. Runs clean_pipelines to clean up existing ones 2. determines which environments the pipeline needs 3. Renders all of the pipeline blocks as defined in configs 4. Runs post_pipeline to create pipeline
[ "Main", "wrapper", "for", "pipeline", "creation", ".", "1", ".", "Runs", "clean_pipelines", "to", "clean", "up", "existing", "ones", "2", ".", "determines", "which", "environments", "the", "pipeline", "needs", "3", ".", "Renders", "all", "of", "the", "pipeli...
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/pipeline/create_pipeline_s3.py#L84-L129
6,062
foremast/foremast
src/foremast/awslambda/awslambda.py
LambdaFunction._check_lambda
def _check_lambda(self): """Check if lambda function exists. Returns: True if function does exist False if function does not exist """ exists = False try: self.lambda_client.get_function(FunctionName=self.app_name) exists = True ...
python
def _check_lambda(self): """Check if lambda function exists. Returns: True if function does exist False if function does not exist """ exists = False try: self.lambda_client.get_function(FunctionName=self.app_name) exists = True ...
[ "def", "_check_lambda", "(", "self", ")", ":", "exists", "=", "False", "try", ":", "self", ".", "lambda_client", ".", "get_function", "(", "FunctionName", "=", "self", ".", "app_name", ")", "exists", "=", "True", "except", "boto3", ".", "exceptions", ".", ...
Check if lambda function exists. Returns: True if function does exist False if function does not exist
[ "Check", "if", "lambda", "function", "exists", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/awslambda.py#L72-L85
6,063
foremast/foremast
src/foremast/awslambda/awslambda.py
LambdaFunction._check_lambda_alias
def _check_lambda_alias(self): """Check if lambda alias exists. Returns: True if alias exists False if alias does not exist """ aliases = self.lambda_client.list_aliases(FunctionName=self.app_name) matched_alias = False for alias in aliases['Alia...
python
def _check_lambda_alias(self): """Check if lambda alias exists. Returns: True if alias exists False if alias does not exist """ aliases = self.lambda_client.list_aliases(FunctionName=self.app_name) matched_alias = False for alias in aliases['Alia...
[ "def", "_check_lambda_alias", "(", "self", ")", ":", "aliases", "=", "self", ".", "lambda_client", ".", "list_aliases", "(", "FunctionName", "=", "self", ".", "app_name", ")", "matched_alias", "=", "False", "for", "alias", "in", "aliases", "[", "'Aliases'", ...
Check if lambda alias exists. Returns: True if alias exists False if alias does not exist
[ "Check", "if", "lambda", "alias", "exists", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/awslambda.py#L87-L104
6,064
foremast/foremast
src/foremast/awslambda/awslambda.py
LambdaFunction._vpc_config
def _vpc_config(self): """Get VPC config.""" if self.vpc_enabled: subnets = get_subnets(env=self.env, region=self.region, purpose='internal')['subnet_ids'][self.region] security_groups = self._get_sg_ids() vpc_config = {'SubnetIds': subnets, 'SecurityGroupIds': secur...
python
def _vpc_config(self): """Get VPC config.""" if self.vpc_enabled: subnets = get_subnets(env=self.env, region=self.region, purpose='internal')['subnet_ids'][self.region] security_groups = self._get_sg_ids() vpc_config = {'SubnetIds': subnets, 'SecurityGroupIds': secur...
[ "def", "_vpc_config", "(", "self", ")", ":", "if", "self", ".", "vpc_enabled", ":", "subnets", "=", "get_subnets", "(", "env", "=", "self", ".", "env", ",", "region", "=", "self", ".", "region", ",", "purpose", "=", "'internal'", ")", "[", "'subnet_ids...
Get VPC config.
[ "Get", "VPC", "config", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/awslambda.py#L106-L116
6,065
foremast/foremast
src/foremast/awslambda/awslambda.py
LambdaFunction._get_sg_ids
def _get_sg_ids(self): """Get IDs for all defined security groups. Returns: list: security group IDs for all lambda_extras """ try: lambda_extras = self.settings['security_groups']['lambda_extras'] except KeyError: lambda_extras = [] ...
python
def _get_sg_ids(self): """Get IDs for all defined security groups. Returns: list: security group IDs for all lambda_extras """ try: lambda_extras = self.settings['security_groups']['lambda_extras'] except KeyError: lambda_extras = [] ...
[ "def", "_get_sg_ids", "(", "self", ")", ":", "try", ":", "lambda_extras", "=", "self", ".", "settings", "[", "'security_groups'", "]", "[", "'lambda_extras'", "]", "except", "KeyError", ":", "lambda_extras", "=", "[", "]", "security_groups", "=", "[", "self"...
Get IDs for all defined security groups. Returns: list: security group IDs for all lambda_extras
[ "Get", "IDs", "for", "all", "defined", "security", "groups", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/awslambda.py#L118-L134
6,066
foremast/foremast
src/foremast/awslambda/awslambda.py
LambdaFunction.update_function_configuration
def update_function_configuration(self, vpc_config): """Update existing Lambda function configuration. Args: vpc_config (dict): Dictionary of SubnetIds and SecurityGroupsIds for using a VPC in lambda """ LOG.info('Updating configuration for lam...
python
def update_function_configuration(self, vpc_config): """Update existing Lambda function configuration. Args: vpc_config (dict): Dictionary of SubnetIds and SecurityGroupsIds for using a VPC in lambda """ LOG.info('Updating configuration for lam...
[ "def", "update_function_configuration", "(", "self", ",", "vpc_config", ")", ":", "LOG", ".", "info", "(", "'Updating configuration for lambda function: %s'", ",", "self", ".", "app_name", ")", "try", ":", "self", ".", "lambda_client", ".", "update_function_configurat...
Update existing Lambda function configuration. Args: vpc_config (dict): Dictionary of SubnetIds and SecurityGroupsIds for using a VPC in lambda
[ "Update", "existing", "Lambda", "function", "configuration", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/awslambda.py#L165-L206
6,067
foremast/foremast
src/foremast/awslambda/awslambda.py
LambdaFunction.create_function
def create_function(self, vpc_config): """Create lambda function, configures lambda parameters. We need to upload non-zero zip when creating function. Uploading hello_world python lambda function since AWS doesn't care which executable is in ZIP. Args: vpc_config (d...
python
def create_function(self, vpc_config): """Create lambda function, configures lambda parameters. We need to upload non-zero zip when creating function. Uploading hello_world python lambda function since AWS doesn't care which executable is in ZIP. Args: vpc_config (d...
[ "def", "create_function", "(", "self", ",", "vpc_config", ")", ":", "zip_file", "=", "'lambda-holder.zip'", "with", "zipfile", ".", "ZipFile", "(", "zip_file", ",", "mode", "=", "'w'", ")", "as", "zipped", ":", "zipped", ".", "writestr", "(", "'index.py'", ...
Create lambda function, configures lambda parameters. We need to upload non-zero zip when creating function. Uploading hello_world python lambda function since AWS doesn't care which executable is in ZIP. Args: vpc_config (dict): Dictionary of SubnetIds and SecurityGroupsId...
[ "Create", "lambda", "function", "configures", "lambda", "parameters", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/awslambda.py#L209-L253
6,068
foremast/foremast
src/foremast/awslambda/awslambda.py
LambdaFunction.create_lambda_function
def create_lambda_function(self): """Create or update Lambda function.""" vpc_config = self._vpc_config() if self._check_lambda(): self.update_function_configuration(vpc_config) else: self.create_function(vpc_config) if self._check_lambda_alias(): ...
python
def create_lambda_function(self): """Create or update Lambda function.""" vpc_config = self._vpc_config() if self._check_lambda(): self.update_function_configuration(vpc_config) else: self.create_function(vpc_config) if self._check_lambda_alias(): ...
[ "def", "create_lambda_function", "(", "self", ")", ":", "vpc_config", "=", "self", ".", "_vpc_config", "(", ")", "if", "self", ".", "_check_lambda", "(", ")", ":", "self", ".", "update_function_configuration", "(", "vpc_config", ")", "else", ":", "self", "."...
Create or update Lambda function.
[ "Create", "or", "update", "Lambda", "function", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/awslambda.py#L255-L267
6,069
foremast/foremast
src/foremast/securitygroup/destroy_sg/destroy_sg.py
destroy_sg
def destroy_sg(app='', env='', region='', **_): """Destroy Security Group. Args: app (str): Spinnaker Application name. env (str): Deployment environment. region (str): Region name, e.g. us-east-1. Returns: True upon successful completion. """ vpc = get_vpc_id(accou...
python
def destroy_sg(app='', env='', region='', **_): """Destroy Security Group. Args: app (str): Spinnaker Application name. env (str): Deployment environment. region (str): Region name, e.g. us-east-1. Returns: True upon successful completion. """ vpc = get_vpc_id(accou...
[ "def", "destroy_sg", "(", "app", "=", "''", ",", "env", "=", "''", ",", "region", "=", "''", ",", "*", "*", "_", ")", ":", "vpc", "=", "get_vpc_id", "(", "account", "=", "env", ",", "region", "=", "region", ")", "url", "=", "'{api}/securityGroups/{...
Destroy Security Group. Args: app (str): Spinnaker Application name. env (str): Deployment environment. region (str): Region name, e.g. us-east-1. Returns: True upon successful completion.
[ "Destroy", "Security", "Group", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/securitygroup/destroy_sg/destroy_sg.py#L27-L52
6,070
foremast/foremast
src/foremast/s3/destroy_s3/destroy_s3.py
destroy_s3
def destroy_s3(app='', env='dev', **_): """Destroy S3 Resources for _app_ in _env_. Args: app (str): Application name env (str): Deployment environment/account name Returns: boolean: True if destroyed sucessfully """ session = boto3.Session(profile_name=env) client = se...
python
def destroy_s3(app='', env='dev', **_): """Destroy S3 Resources for _app_ in _env_. Args: app (str): Application name env (str): Deployment environment/account name Returns: boolean: True if destroyed sucessfully """ session = boto3.Session(profile_name=env) client = se...
[ "def", "destroy_s3", "(", "app", "=", "''", ",", "env", "=", "'dev'", ",", "*", "*", "_", ")", ":", "session", "=", "boto3", ".", "Session", "(", "profile_name", "=", "env", ")", "client", "=", "session", ".", "resource", "(", "'s3'", ")", "generat...
Destroy S3 Resources for _app_ in _env_. Args: app (str): Application name env (str): Deployment environment/account name Returns: boolean: True if destroyed sucessfully
[ "Destroy", "S3", "Resources", "for", "_app_", "in", "_env_", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/destroy_s3/destroy_s3.py#L26-L48
6,071
foremast/foremast
src/foremast/app/__main__.py
main
def main(): """Entry point for creating a Spinnaker application.""" # Setup parser parser = argparse.ArgumentParser() add_debug(parser) add_app(parser) parser.add_argument( '--email', help='Email address to associate with application', default='PS-DevOpsTooling@example.com') parser.a...
python
def main(): """Entry point for creating a Spinnaker application.""" # Setup parser parser = argparse.ArgumentParser() add_debug(parser) add_app(parser) parser.add_argument( '--email', help='Email address to associate with application', default='PS-DevOpsTooling@example.com') parser.a...
[ "def", "main", "(", ")", ":", "# Setup parser", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "add_debug", "(", "parser", ")", "add_app", "(", "parser", ")", "parser", ".", "add_argument", "(", "'--email'", ",", "help", "=", "'Email address to ...
Entry point for creating a Spinnaker application.
[ "Entry", "point", "for", "creating", "a", "Spinnaker", "application", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/app/__main__.py#L30-L56
6,072
foremast/foremast
src/foremast/awslambda/s3_event/destroy_s3_event/destroy_s3_event.py
destroy_s3_event
def destroy_s3_event(app, env, region): """Destroy S3 event. Args: app (str): Spinnaker Application name. env (str): Deployment environment. region (str): AWS region. Returns: bool: True upon successful completion. """ # TODO: how do we know which bucket to process ...
python
def destroy_s3_event(app, env, region): """Destroy S3 event. Args: app (str): Spinnaker Application name. env (str): Deployment environment. region (str): AWS region. Returns: bool: True upon successful completion. """ # TODO: how do we know which bucket to process ...
[ "def", "destroy_s3_event", "(", "app", ",", "env", ",", "region", ")", ":", "# TODO: how do we know which bucket to process if triggers dict is empty?", "# Maybe list buckets and see which has notification to that lambda defined?", "# TODO: buckets should be named the same as apps, what if o...
Destroy S3 event. Args: app (str): Spinnaker Application name. env (str): Deployment environment. region (str): AWS region. Returns: bool: True upon successful completion.
[ "Destroy", "S3", "event", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/s3_event/destroy_s3_event/destroy_s3_event.py#L26-L53
6,073
foremast/foremast
src/foremast/iam/destroy_iam/destroy_iam.py
destroy_iam
def destroy_iam(app='', env='dev', **_): """Destroy IAM Resources. Args: app (str): Spinnaker Application name. env (str): Deployment environment, i.e. dev, stage, prod. Returns: True upon successful completion. """ session = boto3.Session(profile_name=env) client = ses...
python
def destroy_iam(app='', env='dev', **_): """Destroy IAM Resources. Args: app (str): Spinnaker Application name. env (str): Deployment environment, i.e. dev, stage, prod. Returns: True upon successful completion. """ session = boto3.Session(profile_name=env) client = ses...
[ "def", "destroy_iam", "(", "app", "=", "''", ",", "env", "=", "'dev'", ",", "*", "*", "_", ")", ":", "session", "=", "boto3", ".", "Session", "(", "profile_name", "=", "env", ")", "client", "=", "session", ".", "client", "(", "'iam'", ")", "generat...
Destroy IAM Resources. Args: app (str): Spinnaker Application name. env (str): Deployment environment, i.e. dev, stage, prod. Returns: True upon successful completion.
[ "Destroy", "IAM", "Resources", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/iam/destroy_iam/destroy_iam.py#L28-L108
6,074
foremast/foremast
src/foremast/utils/roles.py
get_role_arn
def get_role_arn(role_name, env, region): """Get role ARN given role name. Args: role_name (str): Role name to lookup env (str): Environment in which to lookup region (str): Region Returns: ARN if role found """ session = boto3.Session(profile_name=env, region_name...
python
def get_role_arn(role_name, env, region): """Get role ARN given role name. Args: role_name (str): Role name to lookup env (str): Environment in which to lookup region (str): Region Returns: ARN if role found """ session = boto3.Session(profile_name=env, region_name...
[ "def", "get_role_arn", "(", "role_name", ",", "env", ",", "region", ")", ":", "session", "=", "boto3", ".", "Session", "(", "profile_name", "=", "env", ",", "region_name", "=", "region", ")", "iam_client", "=", "session", ".", "client", "(", "'iam'", ")"...
Get role ARN given role name. Args: role_name (str): Role name to lookup env (str): Environment in which to lookup region (str): Region Returns: ARN if role found
[ "Get", "role", "ARN", "given", "role", "name", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/roles.py#L9-L31
6,075
foremast/foremast
src/foremast/iam/construct_policy.py
render_policy_template
def render_policy_template( # pylint: disable=too-many-arguments account_number='', app='coreforrest', env='dev', group='forrest', items=None, pipeline_settings=None, region='us-east-1', service=''): """Render IAM Policy template. To support mult...
python
def render_policy_template( # pylint: disable=too-many-arguments account_number='', app='coreforrest', env='dev', group='forrest', items=None, pipeline_settings=None, region='us-east-1', service=''): """Render IAM Policy template. To support mult...
[ "def", "render_policy_template", "(", "# pylint: disable=too-many-arguments", "account_number", "=", "''", ",", "app", "=", "'coreforrest'", ",", "env", "=", "'dev'", ",", "group", "=", "'forrest'", ",", "items", "=", "None", ",", "pipeline_settings", "=", "None",...
Render IAM Policy template. To support multiple statement blocks, JSON objects can be separated by a comma. This function attempts to turn any invalid JSON into a valid list based on this comma separated assumption. Args: account_number (str): AWS Account number. app (str): Name of Spi...
[ "Render", "IAM", "Policy", "template", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/iam/construct_policy.py#L57-L108
6,076
foremast/foremast
src/foremast/iam/construct_policy.py
construct_policy
def construct_policy(app='coreforrest', env='dev', group='forrest', region='us-east-1', pipeline_settings=None): """Assemble IAM Policy for _app_. Args: app (str): Name of Spinnaker Application. env (str): Environment/Account in AWS group (str):A Application group/namespace regi...
python
def construct_policy(app='coreforrest', env='dev', group='forrest', region='us-east-1', pipeline_settings=None): """Assemble IAM Policy for _app_. Args: app (str): Name of Spinnaker Application. env (str): Environment/Account in AWS group (str):A Application group/namespace regi...
[ "def", "construct_policy", "(", "app", "=", "'coreforrest'", ",", "env", "=", "'dev'", ",", "group", "=", "'forrest'", ",", "region", "=", "'us-east-1'", ",", "pipeline_settings", "=", "None", ")", ":", "LOG", ".", "info", "(", "'Create custom IAM Policy for %...
Assemble IAM Policy for _app_. Args: app (str): Name of Spinnaker Application. env (str): Environment/Account in AWS group (str):A Application group/namespace region (str): AWS region pipeline_settings (dict): Settings from *pipeline.json*. Returns: json: Custom...
[ "Assemble", "IAM", "Policy", "for", "_app_", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/iam/construct_policy.py#L111-L163
6,077
foremast/foremast
src/foremast/validate.py
validate_gate
def validate_gate(): """Check Gate connection.""" try: credentials = get_env_credential() LOG.debug('Found credentials: %s', credentials) LOG.info('Gate working.') except TypeError: LOG.fatal('Gate connection not valid: API_URL = %s', API_URL)
python
def validate_gate(): """Check Gate connection.""" try: credentials = get_env_credential() LOG.debug('Found credentials: %s', credentials) LOG.info('Gate working.') except TypeError: LOG.fatal('Gate connection not valid: API_URL = %s', API_URL)
[ "def", "validate_gate", "(", ")", ":", "try", ":", "credentials", "=", "get_env_credential", "(", ")", "LOG", ".", "debug", "(", "'Found credentials: %s'", ",", "credentials", ")", "LOG", ".", "info", "(", "'Gate working.'", ")", "except", "TypeError", ":", ...
Check Gate connection.
[ "Check", "Gate", "connection", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/validate.py#L10-L17
6,078
foremast/foremast
src/foremast/awslambda/s3_event/s3_event.py
create_s3_event
def create_s3_event(app_name, env, region, bucket, triggers): """Create S3 lambda events from triggers Args: app_name (str): name of the lambda function env (str): Environment/Account for lambda function region (str): AWS region of the lambda function triggers (list): List of tr...
python
def create_s3_event(app_name, env, region, bucket, triggers): """Create S3 lambda events from triggers Args: app_name (str): name of the lambda function env (str): Environment/Account for lambda function region (str): AWS region of the lambda function triggers (list): List of tr...
[ "def", "create_s3_event", "(", "app_name", ",", "env", ",", "region", ",", "bucket", ",", "triggers", ")", ":", "session", "=", "boto3", ".", "Session", "(", "profile_name", "=", "env", ",", "region_name", "=", "region", ")", "s3_client", "=", "session", ...
Create S3 lambda events from triggers Args: app_name (str): name of the lambda function env (str): Environment/Account for lambda function region (str): AWS region of the lambda function triggers (list): List of triggers from the settings
[ "Create", "S3", "lambda", "events", "from", "triggers" ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/s3_event/s3_event.py#L28-L62
6,079
foremast/foremast
src/foremast/utils/generate_filename.py
generate_packer_filename
def generate_packer_filename(provider, region, builder): """Generate a filename to be used by packer. Args: provider (str): Name of Spinnaker provider. region (str): Name of provider region to use. builder (str): Name of builder process type. Returns: str: Generated filenam...
python
def generate_packer_filename(provider, region, builder): """Generate a filename to be used by packer. Args: provider (str): Name of Spinnaker provider. region (str): Name of provider region to use. builder (str): Name of builder process type. Returns: str: Generated filenam...
[ "def", "generate_packer_filename", "(", "provider", ",", "region", ",", "builder", ")", ":", "filename", "=", "'{0}_{1}_{2}.json'", ".", "format", "(", "provider", ",", "region", ",", "builder", ")", "return", "filename" ]
Generate a filename to be used by packer. Args: provider (str): Name of Spinnaker provider. region (str): Name of provider region to use. builder (str): Name of builder process type. Returns: str: Generated filename based on parameters.
[ "Generate", "a", "filename", "to", "be", "used", "by", "packer", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/generate_filename.py#L19-L32
6,080
foremast/foremast
src/foremast/utils/templates.py
get_template
def get_template(template_file='', **kwargs): """Get the Jinja2 template and renders with dict _kwargs_. Args: template_file (str): name of the template file kwargs: Keywords to use for rendering the Jinja2 template. Returns: String of rendered JSON template. """ template ...
python
def get_template(template_file='', **kwargs): """Get the Jinja2 template and renders with dict _kwargs_. Args: template_file (str): name of the template file kwargs: Keywords to use for rendering the Jinja2 template. Returns: String of rendered JSON template. """ template ...
[ "def", "get_template", "(", "template_file", "=", "''", ",", "*", "*", "kwargs", ")", ":", "template", "=", "get_template_object", "(", "template_file", ")", "LOG", ".", "info", "(", "'Rendering template %s'", ",", "template", ".", "filename", ")", "for", "k...
Get the Jinja2 template and renders with dict _kwargs_. Args: template_file (str): name of the template file kwargs: Keywords to use for rendering the Jinja2 template. Returns: String of rendered JSON template.
[ "Get", "the", "Jinja2", "template", "and", "renders", "with", "dict", "_kwargs_", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/templates.py#L70-L90
6,081
foremast/foremast
src/foremast/pipeline/renumerate_stages.py
renumerate_stages
def renumerate_stages(pipeline): """Renumber Pipeline Stage reference IDs to account for dependencies. stage order is defined in the templates. The ``refId`` field dictates if a stage should be mainline or parallel to other stages. * ``master`` - A mainline required stage. Other stages depend on i...
python
def renumerate_stages(pipeline): """Renumber Pipeline Stage reference IDs to account for dependencies. stage order is defined in the templates. The ``refId`` field dictates if a stage should be mainline or parallel to other stages. * ``master`` - A mainline required stage. Other stages depend on i...
[ "def", "renumerate_stages", "(", "pipeline", ")", ":", "stages", "=", "pipeline", "[", "'stages'", "]", "main_index", "=", "0", "branch_index", "=", "0", "previous_refid", "=", "''", "for", "stage", "in", "stages", ":", "current_refid", "=", "stage", "[", ...
Renumber Pipeline Stage reference IDs to account for dependencies. stage order is defined in the templates. The ``refId`` field dictates if a stage should be mainline or parallel to other stages. * ``master`` - A mainline required stage. Other stages depend on it * ``branch`` - A stage that sh...
[ "Renumber", "Pipeline", "Stage", "reference", "IDs", "to", "account", "for", "dependencies", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/pipeline/renumerate_stages.py#L22-L68
6,082
foremast/foremast
src/foremast/utils/tasks.py
post_task
def post_task(task_data, task_uri='/tasks'): """Create Spinnaker Task. Args: task_data (str): Task JSON definition. Returns: str: Spinnaker Task ID. Raises: AssertionError: Error response from Spinnaker. """ url = '{}/{}'.format(API_URL, task_uri.lstrip('/')) if ...
python
def post_task(task_data, task_uri='/tasks'): """Create Spinnaker Task. Args: task_data (str): Task JSON definition. Returns: str: Spinnaker Task ID. Raises: AssertionError: Error response from Spinnaker. """ url = '{}/{}'.format(API_URL, task_uri.lstrip('/')) if ...
[ "def", "post_task", "(", "task_data", ",", "task_uri", "=", "'/tasks'", ")", ":", "url", "=", "'{}/{}'", ".", "format", "(", "API_URL", ",", "task_uri", ".", "lstrip", "(", "'/'", ")", ")", "if", "isinstance", "(", "task_data", ",", "str", ")", ":", ...
Create Spinnaker Task. Args: task_data (str): Task JSON definition. Returns: str: Spinnaker Task ID. Raises: AssertionError: Error response from Spinnaker.
[ "Create", "Spinnaker", "Task", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/tasks.py#L29-L56
6,083
foremast/foremast
src/foremast/utils/tasks.py
_check_task
def _check_task(taskid): """Check Spinnaker Task status. Args: taskid (str): Existing Spinnaker Task ID. Returns: str: Task status. """ try: taskurl = taskid.get('ref', '0000') except AttributeError: taskurl = taskid taskid = taskurl.split('/tasks/')[-1] ...
python
def _check_task(taskid): """Check Spinnaker Task status. Args: taskid (str): Existing Spinnaker Task ID. Returns: str: Task status. """ try: taskurl = taskid.get('ref', '0000') except AttributeError: taskurl = taskid taskid = taskurl.split('/tasks/')[-1] ...
[ "def", "_check_task", "(", "taskid", ")", ":", "try", ":", "taskurl", "=", "taskid", ".", "get", "(", "'ref'", ",", "'0000'", ")", "except", "AttributeError", ":", "taskurl", "=", "taskid", "taskid", "=", "taskurl", ".", "split", "(", "'/tasks/'", ")", ...
Check Spinnaker Task status. Args: taskid (str): Existing Spinnaker Task ID. Returns: str: Task status.
[ "Check", "Spinnaker", "Task", "status", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/tasks.py#L59-L94
6,084
foremast/foremast
src/foremast/utils/tasks.py
check_task
def check_task(taskid, timeout=DEFAULT_TASK_TIMEOUT, wait=2): """Wrap check_task. Args: taskid (str): Existing Spinnaker Task ID. timeout (int, optional): Consider Task failed after given seconds. wait (int, optional): Seconds to pause between polling attempts. Returns: str...
python
def check_task(taskid, timeout=DEFAULT_TASK_TIMEOUT, wait=2): """Wrap check_task. Args: taskid (str): Existing Spinnaker Task ID. timeout (int, optional): Consider Task failed after given seconds. wait (int, optional): Seconds to pause between polling attempts. Returns: str...
[ "def", "check_task", "(", "taskid", ",", "timeout", "=", "DEFAULT_TASK_TIMEOUT", ",", "wait", "=", "2", ")", ":", "max_attempts", "=", "int", "(", "timeout", "/", "wait", ")", "try", ":", "return", "retry_call", "(", "partial", "(", "_check_task", ",", "...
Wrap check_task. Args: taskid (str): Existing Spinnaker Task ID. timeout (int, optional): Consider Task failed after given seconds. wait (int, optional): Seconds to pause between polling attempts. Returns: str: Task status. Raises: AssertionError: API did not respo...
[ "Wrap", "check_task", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/tasks.py#L97-L122
6,085
foremast/foremast
src/foremast/utils/tasks.py
wait_for_task
def wait_for_task(task_data, task_uri='/tasks'): """Run task and check the result. Args: task_data (str): the task json to execute Returns: str: Task status. """ taskid = post_task(task_data, task_uri) if isinstance(task_data, str): json_data = json.loads(task_data) ...
python
def wait_for_task(task_data, task_uri='/tasks'): """Run task and check the result. Args: task_data (str): the task json to execute Returns: str: Task status. """ taskid = post_task(task_data, task_uri) if isinstance(task_data, str): json_data = json.loads(task_data) ...
[ "def", "wait_for_task", "(", "task_data", ",", "task_uri", "=", "'/tasks'", ")", ":", "taskid", "=", "post_task", "(", "task_data", ",", "task_uri", ")", "if", "isinstance", "(", "task_data", ",", "str", ")", ":", "json_data", "=", "json", ".", "loads", ...
Run task and check the result. Args: task_data (str): the task json to execute Returns: str: Task status.
[ "Run", "task", "and", "check", "the", "result", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/tasks.py#L125-L151
6,086
foremast/foremast
src/foremast/s3/__main__.py
main
def main(): """Create application.properties for a given application.""" logging.basicConfig(format=LOGGING_FORMAT) parser = argparse.ArgumentParser(description=main.__doc__) add_debug(parser) add_app(parser) add_env(parser) add_properties(parser) add_region(parser) add_artifact_pa...
python
def main(): """Create application.properties for a given application.""" logging.basicConfig(format=LOGGING_FORMAT) parser = argparse.ArgumentParser(description=main.__doc__) add_debug(parser) add_app(parser) add_env(parser) add_properties(parser) add_region(parser) add_artifact_pa...
[ "def", "main", "(", ")", ":", "logging", ".", "basicConfig", "(", "format", "=", "LOGGING_FORMAT", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "main", ".", "__doc__", ")", "add_debug", "(", "parser", ")", "add_app", "(",...
Create application.properties for a given application.
[ "Create", "application", ".", "properties", "for", "a", "given", "application", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/__main__.py#L34-L68
6,087
foremast/foremast
src/foremast/s3/create_archaius.py
init_properties
def init_properties(env='dev', app='unnecessary', **_): """Make sure _application.properties_ file exists in S3. For Applications with Archaius support, there needs to be a file where the cloud environment variable points to. Args: env (str): Deployment environment/account, i.e. dev, stage, pr...
python
def init_properties(env='dev', app='unnecessary', **_): """Make sure _application.properties_ file exists in S3. For Applications with Archaius support, there needs to be a file where the cloud environment variable points to. Args: env (str): Deployment environment/account, i.e. dev, stage, pr...
[ "def", "init_properties", "(", "env", "=", "'dev'", ",", "app", "=", "'unnecessary'", ",", "*", "*", "_", ")", ":", "aws_env", "=", "boto3", ".", "session", ".", "Session", "(", "profile_name", "=", "env", ")", "s3client", "=", "aws_env", ".", "resourc...
Make sure _application.properties_ file exists in S3. For Applications with Archaius support, there needs to be a file where the cloud environment variable points to. Args: env (str): Deployment environment/account, i.e. dev, stage, prod. app (str): GitLab Project name. Returns: ...
[ "Make", "sure", "_application", ".", "properties_", "file", "exists", "in", "S3", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/create_archaius.py#L26-L55
6,088
foremast/foremast
src/foremast/awslambda/cloudwatch_event/cloudwatch_event.py
create_cloudwatch_event
def create_cloudwatch_event(app_name, env, region, rules): """Create cloudwatch event for lambda from rules. Args: app_name (str): name of the lambda function env (str): Environment/Account for lambda function region (str): AWS region of the lambda function rules (dict): Trigger...
python
def create_cloudwatch_event(app_name, env, region, rules): """Create cloudwatch event for lambda from rules. Args: app_name (str): name of the lambda function env (str): Environment/Account for lambda function region (str): AWS region of the lambda function rules (dict): Trigger...
[ "def", "create_cloudwatch_event", "(", "app_name", ",", "env", ",", "region", ",", "rules", ")", ":", "session", "=", "boto3", ".", "Session", "(", "profile_name", "=", "env", ",", "region_name", "=", "region", ")", "cloudwatch_client", "=", "session", ".", ...
Create cloudwatch event for lambda from rules. Args: app_name (str): name of the lambda function env (str): Environment/Account for lambda function region (str): AWS region of the lambda function rules (dict): Trigger rules from the settings
[ "Create", "cloudwatch", "event", "for", "lambda", "from", "rules", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/cloudwatch_event/cloudwatch_event.py#L29-L98
6,089
foremast/foremast
src/foremast/awslambda/api_gateway_event/api_gateway_event.py
APIGateway.find_api_id
def find_api_id(self): """Given API name, find API ID.""" allapis = self.client.get_rest_apis() api_name = self.trigger_settings['api_name'] api_id = None for api in allapis['items']: if api['name'] == api_name: api_id = api['id'] self....
python
def find_api_id(self): """Given API name, find API ID.""" allapis = self.client.get_rest_apis() api_name = self.trigger_settings['api_name'] api_id = None for api in allapis['items']: if api['name'] == api_name: api_id = api['id'] self....
[ "def", "find_api_id", "(", "self", ")", ":", "allapis", "=", "self", ".", "client", ".", "get_rest_apis", "(", ")", "api_name", "=", "self", ".", "trigger_settings", "[", "'api_name'", "]", "api_id", "=", "None", "for", "api", "in", "allapis", "[", "'ite...
Given API name, find API ID.
[ "Given", "API", "name", "find", "API", "ID", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/api_gateway_event/api_gateway_event.py#L59-L72
6,090
foremast/foremast
src/foremast/awslambda/api_gateway_event/api_gateway_event.py
APIGateway.find_resource_ids
def find_resource_ids(self): """Given a resource path and API Id, find resource Id.""" all_resources = self.client.get_resources(restApiId=self.api_id) parent_id = None resource_id = None for resource in all_resources['items']: if resource['path'] == "/": ...
python
def find_resource_ids(self): """Given a resource path and API Id, find resource Id.""" all_resources = self.client.get_resources(restApiId=self.api_id) parent_id = None resource_id = None for resource in all_resources['items']: if resource['path'] == "/": ...
[ "def", "find_resource_ids", "(", "self", ")", ":", "all_resources", "=", "self", ".", "client", ".", "get_resources", "(", "restApiId", "=", "self", ".", "api_id", ")", "parent_id", "=", "None", "resource_id", "=", "None", "for", "resource", "in", "all_resou...
Given a resource path and API Id, find resource Id.
[ "Given", "a", "resource", "path", "and", "API", "Id", "find", "resource", "Id", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/api_gateway_event/api_gateway_event.py#L74-L85
6,091
foremast/foremast
src/foremast/awslambda/api_gateway_event/api_gateway_event.py
APIGateway.add_lambda_integration
def add_lambda_integration(self): """Attach lambda found to API.""" lambda_uri = self.generate_uris()['lambda_uri'] self.client.put_integration( restApiId=self.api_id, resourceId=self.resource_id, httpMethod=self.trigger_settings['method'], integra...
python
def add_lambda_integration(self): """Attach lambda found to API.""" lambda_uri = self.generate_uris()['lambda_uri'] self.client.put_integration( restApiId=self.api_id, resourceId=self.resource_id, httpMethod=self.trigger_settings['method'], integra...
[ "def", "add_lambda_integration", "(", "self", ")", ":", "lambda_uri", "=", "self", ".", "generate_uris", "(", ")", "[", "'lambda_uri'", "]", "self", ".", "client", ".", "put_integration", "(", "restApiId", "=", "self", ".", "api_id", ",", "resourceId", "=", ...
Attach lambda found to API.
[ "Attach", "lambda", "found", "to", "API", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/api_gateway_event/api_gateway_event.py#L87-L98
6,092
foremast/foremast
src/foremast/awslambda/api_gateway_event/api_gateway_event.py
APIGateway.add_integration_response
def add_integration_response(self): """Add an intergation response to the API for the lambda integration.""" self.client.put_integration_response( restApiId=self.api_id, resourceId=self.resource_id, httpMethod=self.trigger_settings['method'], statusCode='2...
python
def add_integration_response(self): """Add an intergation response to the API for the lambda integration.""" self.client.put_integration_response( restApiId=self.api_id, resourceId=self.resource_id, httpMethod=self.trigger_settings['method'], statusCode='2...
[ "def", "add_integration_response", "(", "self", ")", ":", "self", ".", "client", ".", "put_integration_response", "(", "restApiId", "=", "self", ".", "api_id", ",", "resourceId", "=", "self", ".", "resource_id", ",", "httpMethod", "=", "self", ".", "trigger_se...
Add an intergation response to the API for the lambda integration.
[ "Add", "an", "intergation", "response", "to", "the", "API", "for", "the", "lambda", "integration", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/api_gateway_event/api_gateway_event.py#L100-L107
6,093
foremast/foremast
src/foremast/awslambda/api_gateway_event/api_gateway_event.py
APIGateway.add_permission
def add_permission(self): """Add permission to Lambda for the API Trigger.""" statement_id = '{}_api_{}'.format(self.app_name, self.trigger_settings['api_name']) principal = 'apigateway.amazonaws.com' lambda_alias_arn = get_lambda_alias_arn(self.app_name, self.env, self.region) l...
python
def add_permission(self): """Add permission to Lambda for the API Trigger.""" statement_id = '{}_api_{}'.format(self.app_name, self.trigger_settings['api_name']) principal = 'apigateway.amazonaws.com' lambda_alias_arn = get_lambda_alias_arn(self.app_name, self.env, self.region) l...
[ "def", "add_permission", "(", "self", ")", ":", "statement_id", "=", "'{}_api_{}'", ".", "format", "(", "self", ".", "app_name", ",", "self", ".", "trigger_settings", "[", "'api_name'", "]", ")", "principal", "=", "'apigateway.amazonaws.com'", "lambda_alias_arn", ...
Add permission to Lambda for the API Trigger.
[ "Add", "permission", "to", "Lambda", "for", "the", "API", "Trigger", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/api_gateway_event/api_gateway_event.py#L109-L152
6,094
foremast/foremast
src/foremast/awslambda/api_gateway_event/api_gateway_event.py
APIGateway.create_api_deployment
def create_api_deployment(self): """Create API deployment of ENV name.""" try: self.client.create_deployment(restApiId=self.api_id, stageName=self.env) self.log.info('Created a deployment resource.') except botocore.exceptions.ClientError as error: error_code ...
python
def create_api_deployment(self): """Create API deployment of ENV name.""" try: self.client.create_deployment(restApiId=self.api_id, stageName=self.env) self.log.info('Created a deployment resource.') except botocore.exceptions.ClientError as error: error_code ...
[ "def", "create_api_deployment", "(", "self", ")", ":", "try", ":", "self", ".", "client", ".", "create_deployment", "(", "restApiId", "=", "self", ".", "api_id", ",", "stageName", "=", "self", ".", "env", ")", "self", ".", "log", ".", "info", "(", "'Cr...
Create API deployment of ENV name.
[ "Create", "API", "deployment", "of", "ENV", "name", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/api_gateway_event/api_gateway_event.py#L155-L165
6,095
foremast/foremast
src/foremast/awslambda/api_gateway_event/api_gateway_event.py
APIGateway.create_api_key
def create_api_key(self): """Create API Key for API access.""" apikeys = self.client.get_api_keys() for key in apikeys['items']: if key['name'] == self.app_name: self.log.info("Key %s already exists", self.app_name) break else: self...
python
def create_api_key(self): """Create API Key for API access.""" apikeys = self.client.get_api_keys() for key in apikeys['items']: if key['name'] == self.app_name: self.log.info("Key %s already exists", self.app_name) break else: self...
[ "def", "create_api_key", "(", "self", ")", ":", "apikeys", "=", "self", ".", "client", ".", "get_api_keys", "(", ")", "for", "key", "in", "apikeys", "[", "'items'", "]", ":", "if", "key", "[", "'name'", "]", "==", "self", ".", "app_name", ":", "self"...
Create API Key for API access.
[ "Create", "API", "Key", "for", "API", "access", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/api_gateway_event/api_gateway_event.py#L167-L180
6,096
foremast/foremast
src/foremast/awslambda/api_gateway_event/api_gateway_event.py
APIGateway._format_base_path
def _format_base_path(self, api_name): """Format the base path name.""" name = self.app_name if self.app_name != api_name: name = '{0}-{1}'.format(self.app_name, api_name) return name
python
def _format_base_path(self, api_name): """Format the base path name.""" name = self.app_name if self.app_name != api_name: name = '{0}-{1}'.format(self.app_name, api_name) return name
[ "def", "_format_base_path", "(", "self", ",", "api_name", ")", ":", "name", "=", "self", ".", "app_name", "if", "self", ".", "app_name", "!=", "api_name", ":", "name", "=", "'{0}-{1}'", ".", "format", "(", "self", ".", "app_name", ",", "api_name", ")", ...
Format the base path name.
[ "Format", "the", "base", "path", "name", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/api_gateway_event/api_gateway_event.py#L182-L187
6,097
foremast/foremast
src/foremast/awslambda/api_gateway_event/api_gateway_event.py
APIGateway.update_api_mappings
def update_api_mappings(self): """Create a cname for the API deployment.""" response_provider = None response_action = None domain = self.generated.apigateway()['domain'] try: response_provider = self.client.create_base_path_mapping( domainName=domain,...
python
def update_api_mappings(self): """Create a cname for the API deployment.""" response_provider = None response_action = None domain = self.generated.apigateway()['domain'] try: response_provider = self.client.create_base_path_mapping( domainName=domain,...
[ "def", "update_api_mappings", "(", "self", ")", ":", "response_provider", "=", "None", "response_action", "=", "None", "domain", "=", "self", ".", "generated", ".", "apigateway", "(", ")", "[", "'domain'", "]", "try", ":", "response_provider", "=", "self", "...
Create a cname for the API deployment.
[ "Create", "a", "cname", "for", "the", "API", "deployment", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/api_gateway_event/api_gateway_event.py#L189-L210
6,098
foremast/foremast
src/foremast/awslambda/api_gateway_event/api_gateway_event.py
APIGateway.generate_uris
def generate_uris(self): """Generate several lambda uris.""" lambda_arn = "arn:aws:execute-api:{0}:{1}:{2}/*/{3}/{4}".format(self.region, self.account_id, self.api_id, self.trigger_settings['method'], ...
python
def generate_uris(self): """Generate several lambda uris.""" lambda_arn = "arn:aws:execute-api:{0}:{1}:{2}/*/{3}/{4}".format(self.region, self.account_id, self.api_id, self.trigger_settings['method'], ...
[ "def", "generate_uris", "(", "self", ")", ":", "lambda_arn", "=", "\"arn:aws:execute-api:{0}:{1}:{2}/*/{3}/{4}\"", ".", "format", "(", "self", ".", "region", ",", "self", ".", "account_id", ",", "self", ".", "api_id", ",", "self", ".", "trigger_settings", "[", ...
Generate several lambda uris.
[ "Generate", "several", "lambda", "uris", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/api_gateway_event/api_gateway_event.py#L212-L225
6,099
foremast/foremast
src/foremast/awslambda/api_gateway_event/api_gateway_event.py
APIGateway.create_api
def create_api(self): """Create the REST API.""" created_api = self.client.create_rest_api(name=self.trigger_settings.get('api_name', self.app_name)) api_id = created_api['id'] self.log.info("Successfully created API") return api_id
python
def create_api(self): """Create the REST API.""" created_api = self.client.create_rest_api(name=self.trigger_settings.get('api_name', self.app_name)) api_id = created_api['id'] self.log.info("Successfully created API") return api_id
[ "def", "create_api", "(", "self", ")", ":", "created_api", "=", "self", ".", "client", ".", "create_rest_api", "(", "name", "=", "self", ".", "trigger_settings", ".", "get", "(", "'api_name'", ",", "self", ".", "app_name", ")", ")", "api_id", "=", "creat...
Create the REST API.
[ "Create", "the", "REST", "API", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/api_gateway_event/api_gateway_event.py#L227-L232