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
partition
stringclasses
1 value
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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", ")", "cmd_sync", "=", "'aws s3 sync {} {} --delete --exac...
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
train
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
train
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
train
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", ")", ":", "remove_all_lambda_permissions", "(", "app_name", "=", "self", ".", "app_name", ",", "env", "=", "self", ".", "env", ",", "region", "=", "self", ".", "region", ")", "triggers", "=", "self", ".", "proper...
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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/{env}/{...
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
train
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'", ")", "generated", ...
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
train
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", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "add_debug", "(", "parser", ")", "add_app", "(", "parser", ")", "parser", ".", "add_argument", "(", "'--email'", ",", "help", "=", "'Email address to associate with appli...
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
train
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", ")", ":", "generated", "=", "get_details", "(", "app", "=", "app", ",", "env", "=", "env", ")", "bucket", "=", "generated", ".", "s3_app_bucket", "(", ")", "session", "=", "boto3", ".", ...
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
train
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'", ")", "generated", ...
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
train
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
train
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", "(", "account_number", "=", "''", ",", "app", "=", "'coreforrest'", ",", "env", "=", "'dev'", ",", "group", "=", "'forrest'", ",", "items", "=", "None", ",", "pipeline_settings", "=", "None", ",", "region", "=", "'us-east-1'"...
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
train
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
train
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
train
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
train
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
train
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", "key", ...
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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", ".", "resource", ...
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
foremast/foremast
src/foremast/awslambda/api_gateway_event/api_gateway_event.py
APIGateway.create_resource
def create_resource(self, parent_id=""): """Create the specified resource. Args: parent_id (str): The resource ID of the parent resource in API Gateway """ resource_name = self.trigger_settings.get('resource', '') resource_name = resource_name.replace('/', '') ...
python
def create_resource(self, parent_id=""): """Create the specified resource. Args: parent_id (str): The resource ID of the parent resource in API Gateway """ resource_name = self.trigger_settings.get('resource', '') resource_name = resource_name.replace('/', '') ...
[ "def", "create_resource", "(", "self", ",", "parent_id", "=", "\"\"", ")", ":", "resource_name", "=", "self", ".", "trigger_settings", ".", "get", "(", "'resource'", ",", "''", ")", "resource_name", "=", "resource_name", ".", "replace", "(", "'/'", ",", "'...
Create the specified resource. Args: parent_id (str): The resource ID of the parent resource in API Gateway
[ "Create", "the", "specified", "resource", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/api_gateway_event/api_gateway_event.py#L234-L249
train
foremast/foremast
src/foremast/awslambda/api_gateway_event/api_gateway_event.py
APIGateway.attach_method
def attach_method(self, resource_id): """Attach the defined method.""" try: _response = self.client.put_method( restApiId=self.api_id, resourceId=resource_id, httpMethod=self.trigger_settings['method'], authorizationType="NONE",...
python
def attach_method(self, resource_id): """Attach the defined method.""" try: _response = self.client.put_method( restApiId=self.api_id, resourceId=resource_id, httpMethod=self.trigger_settings['method'], authorizationType="NONE",...
[ "def", "attach_method", "(", "self", ",", "resource_id", ")", ":", "try", ":", "_response", "=", "self", ".", "client", ".", "put_method", "(", "restApiId", "=", "self", ".", "api_id", ",", "resourceId", "=", "resource_id", ",", "httpMethod", "=", "self", ...
Attach the defined method.
[ "Attach", "the", "defined", "method", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/api_gateway_event/api_gateway_event.py#L251-L270
train
foremast/foremast
src/foremast/awslambda/api_gateway_event/api_gateway_event.py
APIGateway.setup_lambda_api
def setup_lambda_api(self): """A wrapper for all the steps needed to setup the integration.""" self.create_resource(self.parent_id) self.attach_method(self.resource_id) self.add_lambda_integration() self.add_permission() self.create_api_deployment() self.create_ap...
python
def setup_lambda_api(self): """A wrapper for all the steps needed to setup the integration.""" self.create_resource(self.parent_id) self.attach_method(self.resource_id) self.add_lambda_integration() self.add_permission() self.create_api_deployment() self.create_ap...
[ "def", "setup_lambda_api", "(", "self", ")", ":", "self", ".", "create_resource", "(", "self", ".", "parent_id", ")", "self", ".", "attach_method", "(", "self", ".", "resource_id", ")", "self", ".", "add_lambda_integration", "(", ")", "self", ".", "add_permi...
A wrapper for all the steps needed to setup the integration.
[ "A", "wrapper", "for", "all", "the", "steps", "needed", "to", "setup", "the", "integration", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/api_gateway_event/api_gateway_event.py#L272-L280
train
foremast/foremast
src/foremast/dns/__main__.py
main
def main(): """Run newer stuffs.""" logging.basicConfig(format=LOGGING_FORMAT) log = logging.getLogger(__name__) parser = argparse.ArgumentParser() add_debug(parser) add_app(parser) add_env(parser) add_region(parser) add_properties(parser) parser.add_argument("--elb-subnet", hel...
python
def main(): """Run newer stuffs.""" logging.basicConfig(format=LOGGING_FORMAT) log = logging.getLogger(__name__) parser = argparse.ArgumentParser() add_debug(parser) add_app(parser) add_env(parser) add_region(parser) add_properties(parser) parser.add_argument("--elb-subnet", hel...
[ "def", "main", "(", ")", ":", "logging", ".", "basicConfig", "(", "format", "=", "LOGGING_FORMAT", ")", "log", "=", "logging", ".", "getLogger", "(", "__name__", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "add_debug", "(", "parser", ...
Run newer stuffs.
[ "Run", "newer", "stuffs", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/dns/__main__.py#L28-L48
train
foremast/foremast
src/foremast/securitygroup/create_securitygroup.py
SpinnakerSecurityGroup._validate_cidr
def _validate_cidr(self, rule): """Validate the cidr block in a rule. Returns: True: Upon successful completion. Raises: SpinnakerSecurityGroupCreationFailed: CIDR definition is invalid or the network range is too wide. """ try: ...
python
def _validate_cidr(self, rule): """Validate the cidr block in a rule. Returns: True: Upon successful completion. Raises: SpinnakerSecurityGroupCreationFailed: CIDR definition is invalid or the network range is too wide. """ try: ...
[ "def", "_validate_cidr", "(", "self", ",", "rule", ")", ":", "try", ":", "network", "=", "ipaddress", ".", "IPv4Network", "(", "rule", "[", "'app'", "]", ")", "except", "(", "ipaddress", ".", "NetmaskValueError", ",", "ValueError", ")", "as", "error", ":...
Validate the cidr block in a rule. Returns: True: Upon successful completion. Raises: SpinnakerSecurityGroupCreationFailed: CIDR definition is invalid or the network range is too wide.
[ "Validate", "the", "cidr", "block", "in", "a", "rule", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/securitygroup/create_securitygroup.py#L77-L94
train
foremast/foremast
src/foremast/securitygroup/create_securitygroup.py
SpinnakerSecurityGroup._process_rules
def _process_rules(self, rules): """Process rules into cidr and non-cidr lists. Args: rules (list): Allowed Security Group ports and protocols. Returns: (list, list): Security Group reference rules and custom CIDR rules. """ cidr = [] non_cidr = ...
python
def _process_rules(self, rules): """Process rules into cidr and non-cidr lists. Args: rules (list): Allowed Security Group ports and protocols. Returns: (list, list): Security Group reference rules and custom CIDR rules. """ cidr = [] non_cidr = ...
[ "def", "_process_rules", "(", "self", ",", "rules", ")", ":", "cidr", "=", "[", "]", "non_cidr", "=", "[", "]", "for", "rule", "in", "rules", ":", "if", "'.'", "in", "rule", "[", "'app'", "]", ":", "self", ".", "log", ".", "debug", "(", "'Custom ...
Process rules into cidr and non-cidr lists. Args: rules (list): Allowed Security Group ports and protocols. Returns: (list, list): Security Group reference rules and custom CIDR rules.
[ "Process", "rules", "into", "cidr", "and", "non", "-", "cidr", "lists", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/securitygroup/create_securitygroup.py#L96-L119
train
foremast/foremast
src/foremast/securitygroup/create_securitygroup.py
SpinnakerSecurityGroup.add_tags
def add_tags(self): """Add tags to security group. Returns: True: Upon successful completion. """ session = boto3.session.Session(profile_name=self.env, region_name=self.region) resource = session.resource('ec2') group_id = get_security_group_id(self.app_name...
python
def add_tags(self): """Add tags to security group. Returns: True: Upon successful completion. """ session = boto3.session.Session(profile_name=self.env, region_name=self.region) resource = session.resource('ec2') group_id = get_security_group_id(self.app_name...
[ "def", "add_tags", "(", "self", ")", ":", "session", "=", "boto3", ".", "session", ".", "Session", "(", "profile_name", "=", "self", ".", "env", ",", "region_name", "=", "self", ".", "region", ")", "resource", "=", "session", ".", "resource", "(", "'ec...
Add tags to security group. Returns: True: Upon successful completion.
[ "Add", "tags", "to", "security", "group", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/securitygroup/create_securitygroup.py#L121-L146
train
foremast/foremast
src/foremast/securitygroup/create_securitygroup.py
SpinnakerSecurityGroup.add_cidr_rules
def add_cidr_rules(self, rules): """Add cidr rules to security group via boto. Args: rules (list): Allowed Security Group ports and protocols. Returns: True: Upon successful completion. Raises: SpinnakerSecurityGroupError: boto3 call failed to add C...
python
def add_cidr_rules(self, rules): """Add cidr rules to security group via boto. Args: rules (list): Allowed Security Group ports and protocols. Returns: True: Upon successful completion. Raises: SpinnakerSecurityGroupError: boto3 call failed to add C...
[ "def", "add_cidr_rules", "(", "self", ",", "rules", ")", ":", "session", "=", "boto3", ".", "session", ".", "Session", "(", "profile_name", "=", "self", ".", "env", ",", "region_name", "=", "self", ".", "region", ")", "client", "=", "session", ".", "cl...
Add cidr rules to security group via boto. Args: rules (list): Allowed Security Group ports and protocols. Returns: True: Upon successful completion. Raises: SpinnakerSecurityGroupError: boto3 call failed to add CIDR block to Security Group.
[ "Add", "cidr", "rules", "to", "security", "group", "via", "boto", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/securitygroup/create_securitygroup.py#L148-L193
train
foremast/foremast
src/foremast/securitygroup/create_securitygroup.py
SpinnakerSecurityGroup.update_default_rules
def update_default_rules(self): """Concatinate application and global security group rules.""" app_ingress = self.properties['security_group']['ingress'] ingress = conservative_merger.merge(DEFAULT_SECURITYGROUP_RULES, app_ingress) resolved_ingress = self.resolve_self_references(ingress)...
python
def update_default_rules(self): """Concatinate application and global security group rules.""" app_ingress = self.properties['security_group']['ingress'] ingress = conservative_merger.merge(DEFAULT_SECURITYGROUP_RULES, app_ingress) resolved_ingress = self.resolve_self_references(ingress)...
[ "def", "update_default_rules", "(", "self", ")", ":", "app_ingress", "=", "self", ".", "properties", "[", "'security_group'", "]", "[", "'ingress'", "]", "ingress", "=", "conservative_merger", ".", "merge", "(", "DEFAULT_SECURITYGROUP_RULES", ",", "app_ingress", "...
Concatinate application and global security group rules.
[ "Concatinate", "application", "and", "global", "security", "group", "rules", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/securitygroup/create_securitygroup.py#L202-L208
train
foremast/foremast
src/foremast/securitygroup/create_securitygroup.py
SpinnakerSecurityGroup._create_security_group
def _create_security_group(self, ingress): """Send a POST to spinnaker to create a new security group. Returns: boolean: True if created successfully """ template_kwargs = { 'app': self.app_name, 'env': self.env, 'region': self.region, ...
python
def _create_security_group(self, ingress): """Send a POST to spinnaker to create a new security group. Returns: boolean: True if created successfully """ template_kwargs = { 'app': self.app_name, 'env': self.env, 'region': self.region, ...
[ "def", "_create_security_group", "(", "self", ",", "ingress", ")", ":", "template_kwargs", "=", "{", "'app'", ":", "self", ".", "app_name", ",", "'env'", ":", "self", ".", "env", ",", "'region'", ":", "self", ".", "region", ",", "'vpc'", ":", "get_vpc_id...
Send a POST to spinnaker to create a new security group. Returns: boolean: True if created successfully
[ "Send", "a", "POST", "to", "spinnaker", "to", "create", "a", "new", "security", "group", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/securitygroup/create_securitygroup.py#L210-L230
train
foremast/foremast
src/foremast/securitygroup/create_securitygroup.py
SpinnakerSecurityGroup.create_security_group
def create_security_group(self): # noqa """Send a POST to spinnaker to create or update a security group. Returns: boolean: True if created successfully Raises: ForemastConfigurationFileError: Missing environment configuration or misconfigured Security ...
python
def create_security_group(self): # noqa """Send a POST to spinnaker to create or update a security group. Returns: boolean: True if created successfully Raises: ForemastConfigurationFileError: Missing environment configuration or misconfigured Security ...
[ "def", "create_security_group", "(", "self", ")", ":", "ingress_rules", "=", "[", "]", "try", ":", "security_id", "=", "get_security_group_id", "(", "name", "=", "self", ".", "app_name", ",", "env", "=", "self", ".", "env", ",", "region", "=", "self", "....
Send a POST to spinnaker to create or update a security group. Returns: boolean: True if created successfully Raises: ForemastConfigurationFileError: Missing environment configuration or misconfigured Security Group definition.
[ "Send", "a", "POST", "to", "spinnaker", "to", "create", "or", "update", "a", "security", "group", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/securitygroup/create_securitygroup.py#L232-L279
train
foremast/foremast
src/foremast/securitygroup/create_securitygroup.py
SpinnakerSecurityGroup.create_ingress_rule
def create_ingress_rule(self, app, rule): """Create a normalized ingress rule. Args: app (str): Application name rule (dict or int): Allowed Security Group ports and protocols. Returns: dict: Contains app, start_port, end_port, protocol, cross_account_env an...
python
def create_ingress_rule(self, app, rule): """Create a normalized ingress rule. Args: app (str): Application name rule (dict or int): Allowed Security Group ports and protocols. Returns: dict: Contains app, start_port, end_port, protocol, cross_account_env an...
[ "def", "create_ingress_rule", "(", "self", ",", "app", ",", "rule", ")", ":", "if", "isinstance", "(", "rule", ",", "dict", ")", ":", "start_port", "=", "rule", ".", "get", "(", "'start_port'", ")", "end_port", "=", "rule", ".", "get", "(", "'end_port'...
Create a normalized ingress rule. Args: app (str): Application name rule (dict or int): Allowed Security Group ports and protocols. Returns: dict: Contains app, start_port, end_port, protocol, cross_account_env and cross_account_vpc_id
[ "Create", "a", "normalized", "ingress", "rule", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/securitygroup/create_securitygroup.py#L281-L324
train
foremast/foremast
src/foremast/utils/awslambda.py
get_lambda_arn
def get_lambda_arn(app, account, region): """Get lambda ARN. Args: account (str): AWS account name. region (str): Region name, e.g. us-east-1 app (str): Lambda function name Returns: str: ARN for requested lambda function """ session = boto3.Session(profile_name=ac...
python
def get_lambda_arn(app, account, region): """Get lambda ARN. Args: account (str): AWS account name. region (str): Region name, e.g. us-east-1 app (str): Lambda function name Returns: str: ARN for requested lambda function """ session = boto3.Session(profile_name=ac...
[ "def", "get_lambda_arn", "(", "app", ",", "account", ",", "region", ")", ":", "session", "=", "boto3", ".", "Session", "(", "profile_name", "=", "account", ",", "region_name", "=", "region", ")", "lambda_client", "=", "session", ".", "client", "(", "'lambd...
Get lambda ARN. Args: account (str): AWS account name. region (str): Region name, e.g. us-east-1 app (str): Lambda function name Returns: str: ARN for requested lambda function
[ "Get", "lambda", "ARN", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/awslambda.py#L28-L60
train
foremast/foremast
src/foremast/utils/awslambda.py
get_lambda_alias_arn
def get_lambda_alias_arn(app, account, region): """Get lambda alias ARN. Assumes that account name is equal to alias name. Args: account (str): AWS account name. region (str): Region name, e.g. us-east-1 app (str): Lambda function name Returns: str: ARN for requested lambda...
python
def get_lambda_alias_arn(app, account, region): """Get lambda alias ARN. Assumes that account name is equal to alias name. Args: account (str): AWS account name. region (str): Region name, e.g. us-east-1 app (str): Lambda function name Returns: str: ARN for requested lambda...
[ "def", "get_lambda_alias_arn", "(", "app", ",", "account", ",", "region", ")", ":", "session", "=", "boto3", ".", "Session", "(", "profile_name", "=", "account", ",", "region_name", "=", "region", ")", "lambda_client", "=", "session", ".", "client", "(", "...
Get lambda alias ARN. Assumes that account name is equal to alias name. Args: account (str): AWS account name. region (str): Region name, e.g. us-east-1 app (str): Lambda function name Returns: str: ARN for requested lambda alias
[ "Get", "lambda", "alias", "ARN", ".", "Assumes", "that", "account", "name", "is", "equal", "to", "alias", "name", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/awslambda.py#L63-L91
train
foremast/foremast
src/foremast/utils/awslambda.py
add_lambda_permissions
def add_lambda_permissions(function='', statement_id='', action='lambda:InvokeFunction', principal='', source_arn='', env='', region='us-east-1'): """Add ...
python
def add_lambda_permissions(function='', statement_id='', action='lambda:InvokeFunction', principal='', source_arn='', env='', region='us-east-1'): """Add ...
[ "def", "add_lambda_permissions", "(", "function", "=", "''", ",", "statement_id", "=", "''", ",", "action", "=", "'lambda:InvokeFunction'", ",", "principal", "=", "''", ",", "source_arn", "=", "''", ",", "env", "=", "''", ",", "region", "=", "'us-east-1'", ...
Add permission to Lambda for the event trigger. Args: function (str): Lambda function name statement_id (str): IAM policy statement (principal) id action (str): Lambda action to allow principal (str): AWS principal to add permissions source_arn (str): ARN of the source of th...
[ "Add", "permission", "to", "Lambda", "for", "the", "event", "trigger", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/awslambda.py#L94-L135
train
foremast/foremast
src/foremast/iam/resource_action.py
resource_action
def resource_action(client, action='', log_format='item: %(key)s', **kwargs): """Call _action_ using boto3 _client_ with _kwargs_. This is meant for _action_ methods that will create or implicitely prove a given Resource exists. The _log_failure_ flag is available for methods that should always succeed...
python
def resource_action(client, action='', log_format='item: %(key)s', **kwargs): """Call _action_ using boto3 _client_ with _kwargs_. This is meant for _action_ methods that will create or implicitely prove a given Resource exists. The _log_failure_ flag is available for methods that should always succeed...
[ "def", "resource_action", "(", "client", ",", "action", "=", "''", ",", "log_format", "=", "'item: %(key)s'", ",", "**", "kwargs", ")", ":", "result", "=", "None", "try", ":", "result", "=", "getattr", "(", "client", ",", "action", ")", "(", "**", "kwa...
Call _action_ using boto3 _client_ with _kwargs_. This is meant for _action_ methods that will create or implicitely prove a given Resource exists. The _log_failure_ flag is available for methods that should always succeed, but will occasionally fail due to unknown AWS issues. Args: client...
[ "Call", "_action_", "using", "boto3", "_client_", "with", "_kwargs_", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/iam/resource_action.py#L24-L59
train
foremast/foremast
src/foremast/elb/__main__.py
main
def main(): """Entry point for ELB creation""" logging.basicConfig(format=LOGGING_FORMAT) parser = argparse.ArgumentParser(description='Example with non-optional arguments') add_debug(parser) add_app(parser) add_env(parser) add_region(parser) add_properties(parser) args = parser.p...
python
def main(): """Entry point for ELB creation""" logging.basicConfig(format=LOGGING_FORMAT) parser = argparse.ArgumentParser(description='Example with non-optional arguments') add_debug(parser) add_app(parser) add_env(parser) add_region(parser) add_properties(parser) args = parser.p...
[ "def", "main", "(", ")", ":", "logging", ".", "basicConfig", "(", "format", "=", "LOGGING_FORMAT", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Example with non-optional arguments'", ")", "add_debug", "(", "parser", ")", "add...
Entry point for ELB creation
[ "Entry", "point", "for", "ELB", "creation" ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/elb/__main__.py#L30-L47
train
foremast/foremast
src/foremast/elb/create_elb.py
SpinnakerELB.make_elb_json
def make_elb_json(self): """Render the JSON template with arguments. Returns: str: Rendered ELB template. """ env = self.env region = self.region elb_settings = self.properties['elb'] LOG.debug('Block ELB Settings:\n%s', pformat(elb_settings)) ...
python
def make_elb_json(self): """Render the JSON template with arguments. Returns: str: Rendered ELB template. """ env = self.env region = self.region elb_settings = self.properties['elb'] LOG.debug('Block ELB Settings:\n%s', pformat(elb_settings)) ...
[ "def", "make_elb_json", "(", "self", ")", ":", "env", "=", "self", ".", "env", "region", "=", "self", ".", "region", "elb_settings", "=", "self", ".", "properties", "[", "'elb'", "]", "LOG", ".", "debug", "(", "'Block ELB Settings:\\n%s'", ",", "pformat", ...
Render the JSON template with arguments. Returns: str: Rendered ELB template.
[ "Render", "the", "JSON", "template", "with", "arguments", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/elb/create_elb.py#L47-L112
train
foremast/foremast
src/foremast/elb/create_elb.py
SpinnakerELB.create_elb
def create_elb(self): """Create or Update the ELB after rendering JSON data from configs. Asserts that the ELB task was successful. """ json_data = self.make_elb_json() LOG.debug('Block ELB JSON Data:\n%s', pformat(json_data)) wait_for_task(json_data) self.add_...
python
def create_elb(self): """Create or Update the ELB after rendering JSON data from configs. Asserts that the ELB task was successful. """ json_data = self.make_elb_json() LOG.debug('Block ELB JSON Data:\n%s', pformat(json_data)) wait_for_task(json_data) self.add_...
[ "def", "create_elb", "(", "self", ")", ":", "json_data", "=", "self", ".", "make_elb_json", "(", ")", "LOG", ".", "debug", "(", "'Block ELB JSON Data:\\n%s'", ",", "pformat", "(", "json_data", ")", ")", "wait_for_task", "(", "json_data", ")", "self", ".", ...
Create or Update the ELB after rendering JSON data from configs. Asserts that the ELB task was successful.
[ "Create", "or", "Update", "the", "ELB", "after", "rendering", "JSON", "data", "from", "configs", ".", "Asserts", "that", "the", "ELB", "task", "was", "successful", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/elb/create_elb.py#L114-L127
train
foremast/foremast
src/foremast/elb/create_elb.py
SpinnakerELB.add_listener_policy
def add_listener_policy(self, json_data): """Attaches listerner policies to an ELB Args: json_data (json): return data from ELB upsert """ env = boto3.session.Session(profile_name=self.env, region_name=self.region) elbclient = env.client('elb') # create stic...
python
def add_listener_policy(self, json_data): """Attaches listerner policies to an ELB Args: json_data (json): return data from ELB upsert """ env = boto3.session.Session(profile_name=self.env, region_name=self.region) elbclient = env.client('elb') # create stic...
[ "def", "add_listener_policy", "(", "self", ",", "json_data", ")", ":", "env", "=", "boto3", ".", "session", ".", "Session", "(", "profile_name", "=", "self", ".", "env", ",", "region_name", "=", "self", ".", "region", ")", "elbclient", "=", "env", ".", ...
Attaches listerner policies to an ELB Args: json_data (json): return data from ELB upsert
[ "Attaches", "listerner", "policies", "to", "an", "ELB" ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/elb/create_elb.py#L129-L161
train
foremast/foremast
src/foremast/elb/create_elb.py
SpinnakerELB.add_backend_policy
def add_backend_policy(self, json_data): """Attaches backend server policies to an ELB Args: json_data (json): return data from ELB upsert """ env = boto3.session.Session(profile_name=self.env, region_name=self.region) elbclient = env.client('elb') # Attach ...
python
def add_backend_policy(self, json_data): """Attaches backend server policies to an ELB Args: json_data (json): return data from ELB upsert """ env = boto3.session.Session(profile_name=self.env, region_name=self.region) elbclient = env.client('elb') # Attach ...
[ "def", "add_backend_policy", "(", "self", ",", "json_data", ")", ":", "env", "=", "boto3", ".", "session", ".", "Session", "(", "profile_name", "=", "self", ".", "env", ",", "region_name", "=", "self", ".", "region", ")", "elbclient", "=", "env", ".", ...
Attaches backend server policies to an ELB Args: json_data (json): return data from ELB upsert
[ "Attaches", "backend", "server", "policies", "to", "an", "ELB" ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/elb/create_elb.py#L163-L180
train
foremast/foremast
src/foremast/elb/create_elb.py
SpinnakerELB.add_stickiness
def add_stickiness(self): """ Adds stickiness policy to created ELB Returns: dict: A dict of stickiness policies and ports:: example: { 80: "$policy_name" } """ stickiness_dict = {} env = boto3.sess...
python
def add_stickiness(self): """ Adds stickiness policy to created ELB Returns: dict: A dict of stickiness policies and ports:: example: { 80: "$policy_name" } """ stickiness_dict = {} env = boto3.sess...
[ "def", "add_stickiness", "(", "self", ")", ":", "stickiness_dict", "=", "{", "}", "env", "=", "boto3", ".", "session", ".", "Session", "(", "profile_name", "=", "self", ".", "env", ",", "region_name", "=", "self", ".", "region", ")", "elbclient", "=", ...
Adds stickiness policy to created ELB Returns: dict: A dict of stickiness policies and ports:: example: { 80: "$policy_name" }
[ "Adds", "stickiness", "policy", "to", "created", "ELB" ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/elb/create_elb.py#L182-L218
train
foremast/foremast
src/foremast/elb/create_elb.py
SpinnakerELB.configure_attributes
def configure_attributes(self, json_data): """Configure load balancer attributes such as idle timeout, connection draining, etc Args: json_data (json): return data from ELB upsert """ env = boto3.session.Session(profile_name=self.env, region_name=self.region) elbclie...
python
def configure_attributes(self, json_data): """Configure load balancer attributes such as idle timeout, connection draining, etc Args: json_data (json): return data from ELB upsert """ env = boto3.session.Session(profile_name=self.env, region_name=self.region) elbclie...
[ "def", "configure_attributes", "(", "self", ",", "json_data", ")", ":", "env", "=", "boto3", ".", "session", ".", "Session", "(", "profile_name", "=", "self", ".", "env", ",", "region_name", "=", "self", ".", "region", ")", "elbclient", "=", "env", ".", ...
Configure load balancer attributes such as idle timeout, connection draining, etc Args: json_data (json): return data from ELB upsert
[ "Configure", "load", "balancer", "attributes", "such", "as", "idle", "timeout", "connection", "draining", "etc" ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/elb/create_elb.py#L220-L276
train
foremast/foremast
src/foremast/configs/__main__.py
main
def main(): """Append Application Configurations to a given file in multiple formats.""" logging.basicConfig(format=LOGGING_FORMAT) parser = argparse.ArgumentParser(description=main.__doc__) add_debug(parser) parser.add_argument('-o', '--output', required=True, help='Name of environment file to app...
python
def main(): """Append Application Configurations to a given file in multiple formats.""" logging.basicConfig(format=LOGGING_FORMAT) parser = argparse.ArgumentParser(description=main.__doc__) add_debug(parser) parser.add_argument('-o', '--output', required=True, help='Name of environment file to app...
[ "def", "main", "(", ")", ":", "logging", ".", "basicConfig", "(", "format", "=", "LOGGING_FORMAT", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "main", ".", "__doc__", ")", "add_debug", "(", "parser", ")", "parser", ".", ...
Append Application Configurations to a given file in multiple formats.
[ "Append", "Application", "Configurations", "to", "a", "given", "file", "in", "multiple", "formats", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/configs/__main__.py#L33-L56
train
foremast/foremast
src/foremast/__main__.py
add_infra
def add_infra(subparsers): """Infrastructure subcommands.""" infra_parser = subparsers.add_parser('infra', help=runner.prepare_infrastructure.__doc__) infra_parser.set_defaults(func=runner.prepare_infrastructure)
python
def add_infra(subparsers): """Infrastructure subcommands.""" infra_parser = subparsers.add_parser('infra', help=runner.prepare_infrastructure.__doc__) infra_parser.set_defaults(func=runner.prepare_infrastructure)
[ "def", "add_infra", "(", "subparsers", ")", ":", "infra_parser", "=", "subparsers", ".", "add_parser", "(", "'infra'", ",", "help", "=", "runner", ".", "prepare_infrastructure", ".", "__doc__", ")", "infra_parser", ".", "set_defaults", "(", "func", "=", "runne...
Infrastructure subcommands.
[ "Infrastructure", "subcommands", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/__main__.py#L15-L18
train
foremast/foremast
src/foremast/__main__.py
add_pipeline
def add_pipeline(subparsers): """Pipeline subcommands.""" pipeline_parser = subparsers.add_parser( 'pipeline', help=add_pipeline.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) pipeline_parser.set_defaults(func=pipeline_parser.print_help) pipeline_subparsers = pipeline_parser.a...
python
def add_pipeline(subparsers): """Pipeline subcommands.""" pipeline_parser = subparsers.add_parser( 'pipeline', help=add_pipeline.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) pipeline_parser.set_defaults(func=pipeline_parser.print_help) pipeline_subparsers = pipeline_parser.a...
[ "def", "add_pipeline", "(", "subparsers", ")", ":", "pipeline_parser", "=", "subparsers", ".", "add_parser", "(", "'pipeline'", ",", "help", "=", "add_pipeline", ".", "__doc__", ",", "formatter_class", "=", "argparse", ".", "ArgumentDefaultsHelpFormatter", ")", "p...
Pipeline subcommands.
[ "Pipeline", "subcommands", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/__main__.py#L21-L36
train
foremast/foremast
src/foremast/__main__.py
add_rebuild
def add_rebuild(subparsers): """Rebuild Pipeline subcommands.""" rebuild_parser = subparsers.add_parser( 'rebuild', help=runner.rebuild_pipelines.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) rebuild_parser.set_defaults(func=runner.rebuild_pipelines) rebuild_parser.add_argumen...
python
def add_rebuild(subparsers): """Rebuild Pipeline subcommands.""" rebuild_parser = subparsers.add_parser( 'rebuild', help=runner.rebuild_pipelines.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) rebuild_parser.set_defaults(func=runner.rebuild_pipelines) rebuild_parser.add_argumen...
[ "def", "add_rebuild", "(", "subparsers", ")", ":", "rebuild_parser", "=", "subparsers", ".", "add_parser", "(", "'rebuild'", ",", "help", "=", "runner", ".", "rebuild_pipelines", ".", "__doc__", ",", "formatter_class", "=", "argparse", ".", "ArgumentDefaultsHelpFo...
Rebuild Pipeline subcommands.
[ "Rebuild", "Pipeline", "subcommands", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/__main__.py#L39-L49
train
foremast/foremast
src/foremast/__main__.py
add_autoscaling
def add_autoscaling(subparsers): """Auto Scaling Group Policy subcommands.""" autoscaling_parser = subparsers.add_parser( 'autoscaling', help=runner.create_scaling_policy.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) autoscaling_parser.set_defaults(func=runner.crea...
python
def add_autoscaling(subparsers): """Auto Scaling Group Policy subcommands.""" autoscaling_parser = subparsers.add_parser( 'autoscaling', help=runner.create_scaling_policy.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) autoscaling_parser.set_defaults(func=runner.crea...
[ "def", "add_autoscaling", "(", "subparsers", ")", ":", "autoscaling_parser", "=", "subparsers", ".", "add_parser", "(", "'autoscaling'", ",", "help", "=", "runner", ".", "create_scaling_policy", ".", "__doc__", ",", "formatter_class", "=", "argparse", ".", "Argume...
Auto Scaling Group Policy subcommands.
[ "Auto", "Scaling", "Group", "Policy", "subcommands", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/__main__.py#L52-L58
train
foremast/foremast
src/foremast/__main__.py
add_validate
def add_validate(subparsers): """Validate Spinnaker setup.""" validate_parser = subparsers.add_parser( 'validate', help=add_validate.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) validate_parser.set_defaults(func=validate_parser.print_help) validate_subparsers = validate_pars...
python
def add_validate(subparsers): """Validate Spinnaker setup.""" validate_parser = subparsers.add_parser( 'validate', help=add_validate.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) validate_parser.set_defaults(func=validate_parser.print_help) validate_subparsers = validate_pars...
[ "def", "add_validate", "(", "subparsers", ")", ":", "validate_parser", "=", "subparsers", ".", "add_parser", "(", "'validate'", ",", "help", "=", "add_validate", ".", "__doc__", ",", "formatter_class", "=", "argparse", ".", "ArgumentDefaultsHelpFormatter", ")", "v...
Validate Spinnaker setup.
[ "Validate", "Spinnaker", "setup", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/__main__.py#L61-L75
train
foremast/foremast
src/foremast/pipeline/create_pipeline.py
SpinnakerPipeline.get_existing_pipelines
def get_existing_pipelines(self): """Get existing pipeline configs for specific application. Returns: str: Pipeline config json """ url = "{0}/applications/{1}/pipelineConfigs".format(API_URL, self.app_name) resp = requests.get(url, verify=GATE_CA_BUNDLE, cert=GATE_...
python
def get_existing_pipelines(self): """Get existing pipeline configs for specific application. Returns: str: Pipeline config json """ url = "{0}/applications/{1}/pipelineConfigs".format(API_URL, self.app_name) resp = requests.get(url, verify=GATE_CA_BUNDLE, cert=GATE_...
[ "def", "get_existing_pipelines", "(", "self", ")", ":", "url", "=", "\"{0}/applications/{1}/pipelineConfigs\"", ".", "format", "(", "API_URL", ",", "self", ".", "app_name", ")", "resp", "=", "requests", ".", "get", "(", "url", ",", "verify", "=", "GATE_CA_BUND...
Get existing pipeline configs for specific application. Returns: str: Pipeline config json
[ "Get", "existing", "pipeline", "configs", "for", "specific", "application", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/pipeline/create_pipeline.py#L148-L159
train
foremast/foremast
src/foremast/pipeline/create_pipeline.py
SpinnakerPipeline.compare_with_existing
def compare_with_existing(self, region='us-east-1', onetime=False): """Compare desired pipeline with existing pipelines. Args: region (str): Region of desired pipeline. onetime (bool): Looks for different pipeline if Onetime Returns: str: pipeline_id if exis...
python
def compare_with_existing(self, region='us-east-1', onetime=False): """Compare desired pipeline with existing pipelines. Args: region (str): Region of desired pipeline. onetime (bool): Looks for different pipeline if Onetime Returns: str: pipeline_id if exis...
[ "def", "compare_with_existing", "(", "self", ",", "region", "=", "'us-east-1'", ",", "onetime", "=", "False", ")", ":", "pipelines", "=", "self", ".", "get_existing_pipelines", "(", ")", "pipeline_id", "=", "None", "found", "=", "False", "for", "pipeline", "...
Compare desired pipeline with existing pipelines. Args: region (str): Region of desired pipeline. onetime (bool): Looks for different pipeline if Onetime Returns: str: pipeline_id if existing, empty string of not.
[ "Compare", "desired", "pipeline", "with", "existing", "pipelines", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/pipeline/create_pipeline.py#L161-L191
train
foremast/foremast
src/foremast/pipeline/create_pipeline.py
SpinnakerPipeline.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. gets all subnets for template rendering 4. Renders all of the pipeline blocks as defined in configs 5...
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. gets all subnets for template rendering 4. Renders all of the pipeline blocks as defined in configs 5...
[ "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. gets all subnets for template rendering 4. Renders all of the pipeline blocks as defined in configs 5. Runs post_pipeline to create pipelin...
[ "Main", "wrapper", "for", "pipeline", "creation", ".", "1", ".", "Runs", "clean_pipelines", "to", "clean", "up", "existing", "ones", "2", ".", "determines", "which", "environments", "the", "pipeline", "needs", "3", ".", "gets", "all", "subnets", "for", "temp...
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/pipeline/create_pipeline.py#L193-L259
train
foremast/foremast
src/foremast/utils/lookups.py
ami_lookup
def ami_lookup(region='us-east-1', name='tomcat8'): """Look up AMI ID. Use _name_ to find AMI ID. If no ami_base_url or gitlab_token is provided, _name_ is returned as the ami id. Args: region (str): AWS Region to find AMI ID. name (str): Simple AMI base name to lookup. Returns: ...
python
def ami_lookup(region='us-east-1', name='tomcat8'): """Look up AMI ID. Use _name_ to find AMI ID. If no ami_base_url or gitlab_token is provided, _name_ is returned as the ami id. Args: region (str): AWS Region to find AMI ID. name (str): Simple AMI base name to lookup. Returns: ...
[ "def", "ami_lookup", "(", "region", "=", "'us-east-1'", ",", "name", "=", "'tomcat8'", ")", ":", "if", "AMI_JSON_URL", ":", "ami_dict", "=", "_get_ami_dict", "(", "AMI_JSON_URL", ")", "ami_id", "=", "ami_dict", "[", "region", "]", "[", "name", "]", "elif",...
Look up AMI ID. Use _name_ to find AMI ID. If no ami_base_url or gitlab_token is provided, _name_ is returned as the ami id. Args: region (str): AWS Region to find AMI ID. name (str): Simple AMI base name to lookup. Returns: str: AMI ID for _name_ in _region_.
[ "Look", "up", "AMI", "ID", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/lookups.py#L32-L59
train
foremast/foremast
src/foremast/utils/lookups.py
_get_ami_file
def _get_ami_file(region='us-east-1'): """Get file from Gitlab. Args: region (str): AWS Region to find AMI ID. Returns: str: Contents in json format. """ LOG.info("Getting AMI from Gitlab") lookup = FileLookup(git_short='devops/ansible') filename = 'scripts/{0}.json'.forma...
python
def _get_ami_file(region='us-east-1'): """Get file from Gitlab. Args: region (str): AWS Region to find AMI ID. Returns: str: Contents in json format. """ LOG.info("Getting AMI from Gitlab") lookup = FileLookup(git_short='devops/ansible') filename = 'scripts/{0}.json'.forma...
[ "def", "_get_ami_file", "(", "region", "=", "'us-east-1'", ")", ":", "LOG", ".", "info", "(", "\"Getting AMI from Gitlab\"", ")", "lookup", "=", "FileLookup", "(", "git_short", "=", "'devops/ansible'", ")", "filename", "=", "'scripts/{0}.json'", ".", "format", "...
Get file from Gitlab. Args: region (str): AWS Region to find AMI ID. Returns: str: Contents in json format.
[ "Get", "file", "from", "Gitlab", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/lookups.py#L62-L77
train
foremast/foremast
src/foremast/utils/lookups.py
_get_ami_dict
def _get_ami_dict(json_url): """Get ami from a web url. Args: region (str): AWS Region to find AMI ID. Returns: dict: Contents in dictionary format. """ LOG.info("Getting AMI from %s", json_url) response = requests.get(json_url) assert response.ok, "Error getting ami info ...
python
def _get_ami_dict(json_url): """Get ami from a web url. Args: region (str): AWS Region to find AMI ID. Returns: dict: Contents in dictionary format. """ LOG.info("Getting AMI from %s", json_url) response = requests.get(json_url) assert response.ok, "Error getting ami info ...
[ "def", "_get_ami_dict", "(", "json_url", ")", ":", "LOG", ".", "info", "(", "\"Getting AMI from %s\"", ",", "json_url", ")", "response", "=", "requests", ".", "get", "(", "json_url", ")", "assert", "response", ".", "ok", ",", "\"Error getting ami info from {}\""...
Get ami from a web url. Args: region (str): AWS Region to find AMI ID. Returns: dict: Contents in dictionary format.
[ "Get", "ami", "from", "a", "web", "url", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/lookups.py#L80-L95
train
foremast/foremast
src/foremast/utils/lookups.py
FileLookup.get_gitlab_project
def get_gitlab_project(self): """Get numerical GitLab Project ID. Returns: int: Project ID number. Raises: foremast.exceptions.GitLabApiError: GitLab responded with bad status code. """ self.server = gitlab.Gitlab(GIT_URL, private_token=...
python
def get_gitlab_project(self): """Get numerical GitLab Project ID. Returns: int: Project ID number. Raises: foremast.exceptions.GitLabApiError: GitLab responded with bad status code. """ self.server = gitlab.Gitlab(GIT_URL, private_token=...
[ "def", "get_gitlab_project", "(", "self", ")", ":", "self", ".", "server", "=", "gitlab", ".", "Gitlab", "(", "GIT_URL", ",", "private_token", "=", "GITLAB_TOKEN", ",", "api_version", "=", "4", ")", "project", "=", "self", ".", "server", ".", "projects", ...
Get numerical GitLab Project ID. Returns: int: Project ID number. Raises: foremast.exceptions.GitLabApiError: GitLab responded with bad status code.
[ "Get", "numerical", "GitLab", "Project", "ID", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/lookups.py#L121-L139
train
foremast/foremast
src/foremast/utils/lookups.py
FileLookup.local_file
def local_file(self, filename): """Read the local file in _self.runway_dir_. Args: filename (str): Name of file to retrieve relative to root of _runway_dir_. Returns: str: Contents of local file. Raises: FileNotFoundError: Requested ...
python
def local_file(self, filename): """Read the local file in _self.runway_dir_. Args: filename (str): Name of file to retrieve relative to root of _runway_dir_. Returns: str: Contents of local file. Raises: FileNotFoundError: Requested ...
[ "def", "local_file", "(", "self", ",", "filename", ")", ":", "LOG", ".", "info", "(", "'Retrieving \"%s\" from \"%s\".'", ",", "filename", ",", "self", ".", "runway_dir", ")", "file_contents", "=", "''", "file_path", "=", "os", ".", "path", ".", "join", "(...
Read the local file in _self.runway_dir_. Args: filename (str): Name of file to retrieve relative to root of _runway_dir_. Returns: str: Contents of local file. Raises: FileNotFoundError: Requested file missing.
[ "Read", "the", "local", "file", "in", "_self", ".", "runway_dir_", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/lookups.py#L141-L169
train
foremast/foremast
src/foremast/utils/lookups.py
FileLookup.remote_file
def remote_file(self, branch='master', filename=''): """Read the remote file on Git Server. Args: branch (str): Git Branch to find file. filename (str): Name of file to retrieve relative to root of repository. Returns: str: Contents of remote...
python
def remote_file(self, branch='master', filename=''): """Read the remote file on Git Server. Args: branch (str): Git Branch to find file. filename (str): Name of file to retrieve relative to root of repository. Returns: str: Contents of remote...
[ "def", "remote_file", "(", "self", ",", "branch", "=", "'master'", ",", "filename", "=", "''", ")", ":", "LOG", ".", "info", "(", "'Retrieving \"%s\" from \"%s\".'", ",", "filename", ",", "self", ".", "git_short", ")", "file_contents", "=", "''", "try", ":...
Read the remote file on Git Server. Args: branch (str): Git Branch to find file. filename (str): Name of file to retrieve relative to root of repository. Returns: str: Contents of remote file. Raises: FileNotFoundError: Requested...
[ "Read", "the", "remote", "file", "on", "Git", "Server", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/lookups.py#L171-L205
train
foremast/foremast
src/foremast/utils/banners.py
banner
def banner(text, border='=', width=80): """Center _text_ in a banner _width_ wide with _border_ characters. Args: text (str): What to write in the banner border (str): Border character width (int): How long the border should be """ text_padding = '{0:^%d}' % (width) LOG.info...
python
def banner(text, border='=', width=80): """Center _text_ in a banner _width_ wide with _border_ characters. Args: text (str): What to write in the banner border (str): Border character width (int): How long the border should be """ text_padding = '{0:^%d}' % (width) LOG.info...
[ "def", "banner", "(", "text", ",", "border", "=", "'='", ",", "width", "=", "80", ")", ":", "text_padding", "=", "'{0:^%d}'", "%", "(", "width", ")", "LOG", ".", "info", "(", "border", "*", "width", ")", "LOG", ".", "info", "(", "text_padding", "."...
Center _text_ in a banner _width_ wide with _border_ characters. Args: text (str): What to write in the banner border (str): Border character width (int): How long the border should be
[ "Center", "_text_", "in", "a", "banner", "_width_", "wide", "with", "_border_", "characters", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/banners.py#L30-L41
train
foremast/foremast
src/foremast/utils/get_sns_topic_arn.py
get_sns_topic_arn
def get_sns_topic_arn(topic_name, account, region): """Get SNS topic ARN. Args: topic_name (str): Name of the topic to lookup. account (str): Environment, e.g. dev region (str): Region name, e.g. us-east-1 Returns: str: ARN for requested topic name """ if topic_nam...
python
def get_sns_topic_arn(topic_name, account, region): """Get SNS topic ARN. Args: topic_name (str): Name of the topic to lookup. account (str): Environment, e.g. dev region (str): Region name, e.g. us-east-1 Returns: str: ARN for requested topic name """ if topic_nam...
[ "def", "get_sns_topic_arn", "(", "topic_name", ",", "account", ",", "region", ")", ":", "if", "topic_name", ".", "count", "(", "':'", ")", "==", "5", "and", "topic_name", ".", "startswith", "(", "'arn:aws:sns:'", ")", ":", "return", "topic_name", "session", ...
Get SNS topic ARN. Args: topic_name (str): Name of the topic to lookup. account (str): Environment, e.g. dev region (str): Region name, e.g. us-east-1 Returns: str: ARN for requested topic name
[ "Get", "SNS", "topic", "ARN", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/get_sns_topic_arn.py#L11-L39
train
foremast/foremast
src/foremast/slacknotify/slack_notification.py
SlackNotification.notify_slack_channel
def notify_slack_channel(self): """Post message to a defined Slack channel.""" message = get_template(template_file='slack/pipeline-prepare-ran.j2', info=self.info) if self.settings['pipeline']['notifications']['slack']: post_slack_message( message=message, ...
python
def notify_slack_channel(self): """Post message to a defined Slack channel.""" message = get_template(template_file='slack/pipeline-prepare-ran.j2', info=self.info) if self.settings['pipeline']['notifications']['slack']: post_slack_message( message=message, ...
[ "def", "notify_slack_channel", "(", "self", ")", ":", "message", "=", "get_template", "(", "template_file", "=", "'slack/pipeline-prepare-ran.j2'", ",", "info", "=", "self", ".", "info", ")", "if", "self", ".", "settings", "[", "'pipeline'", "]", "[", "'notifi...
Post message to a defined Slack channel.
[ "Post", "message", "to", "a", "defined", "Slack", "channel", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/slacknotify/slack_notification.py#L54-L63
train
foremast/foremast
src/foremast/utils/properties.py
get_properties
def get_properties(properties_file='raw.properties.json', env=None, region=None): """Get contents of _properties_file_ for the _env_. Args: properties_file (str): File name of `create-configs` JSON output. env (str): Environment to read optionally. region (str): Region to get specific c...
python
def get_properties(properties_file='raw.properties.json', env=None, region=None): """Get contents of _properties_file_ for the _env_. Args: properties_file (str): File name of `create-configs` JSON output. env (str): Environment to read optionally. region (str): Region to get specific c...
[ "def", "get_properties", "(", "properties_file", "=", "'raw.properties.json'", ",", "env", "=", "None", ",", "region", "=", "None", ")", ":", "with", "open", "(", "properties_file", ",", "'rt'", ")", "as", "file_handle", ":", "properties", "=", "json", ".", ...
Get contents of _properties_file_ for the _env_. Args: properties_file (str): File name of `create-configs` JSON output. env (str): Environment to read optionally. region (str): Region to get specific configs for. Returns: dict: JSON loaded Application properties for _env_. ...
[ "Get", "contents", "of", "_properties_file_", "for", "the", "_env_", "." ]
fb70f29b8ce532f061685a17d120486e47b215ba
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/properties.py#L23-L42
train