id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6,100 | 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 |
6,101 | 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 |
6,102 | 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 |
6,103 | 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 |
6,104 | 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 |
6,105 | 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 |
6,106 | 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 |
6,107 | 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 |
6,108 | 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 |
6,109 | 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 |
6,110 | 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",
")",
":",
"# noqa",
"ingress_rules",
"=",
"[",
"]",
"try",
":",
"security_id",
"=",
"get_security_group_id",
"(",
"name",
"=",
"self",
".",
"app_name",
",",
"env",
"=",
"self",
".",
"env",
",",
"region",
"=",
... | 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 |
6,111 | 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",
")",
":",
"# Advanced",
"start_port",
"=",
"rule",
".",
"get",
"(",
"'start_port'",
")",
"end_port",
"=",
"rule",
".",
"get",
"(... | 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 |
6,112 | 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 |
6,113 | 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 |
6,114 | 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 |
6,115 | 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",
")",
"(",
"*",
... | 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 |
6,116 | 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 |
6,117 | 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 |
6,118 | 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 |
6,119 | 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 |
6,120 | 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 |
6,121 | 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 |
6,122 | 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 |
6,123 | 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 |
6,124 | 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 |
6,125 | 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 |
6,126 | 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 |
6,127 | 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 |
6,128 | 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 |
6,129 | 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 |
6,130 | 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 |
6,131 | 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 |
6,132 | 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 |
6,133 | 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 |
6,134 | 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 |
6,135 | 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 |
6,136 | 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 |
6,137 | 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 |
6,138 | 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 |
6,139 | 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 |
6,140 | 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 |
6,141 | 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 |
6,142 | foremast/foremast | src/foremast/elb/destroy_elb/__main__.py | main | def main():
"""Destroy any ELB related Resources."""
logging.basicConfig(format=LOGGING_FORMAT)
parser = argparse.ArgumentParser(description=main.__doc__)
add_debug(parser)
add_app(parser)
add_env(parser)
add_region(parser)
args = parser.parse_args()
logging.getLogger(__package__.s... | python | def main():
"""Destroy any ELB related Resources."""
logging.basicConfig(format=LOGGING_FORMAT)
parser = argparse.ArgumentParser(description=main.__doc__)
add_debug(parser)
add_app(parser)
add_env(parser)
add_region(parser)
args = parser.parse_args()
logging.getLogger(__package__.s... | [
"def",
"main",
"(",
")",
":",
"logging",
".",
"basicConfig",
"(",
"format",
"=",
"LOGGING_FORMAT",
")",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"main",
".",
"__doc__",
")",
"add_debug",
"(",
"parser",
")",
"add_app",
"(",... | Destroy any ELB related Resources. | [
"Destroy",
"any",
"ELB",
"related",
"Resources",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/elb/destroy_elb/__main__.py#L27-L40 |
6,143 | foremast/foremast | src/foremast/utils/security_group.py | get_security_group_id | def get_security_group_id(name='', env='', region=''):
"""Get a security group ID.
Args:
name (str): Security Group name to find.
env (str): Deployment environment to search.
region (str): AWS Region to search.
Returns:
str: ID of Security Group, e.g. sg-xxxx.
Raises:
... | python | def get_security_group_id(name='', env='', region=''):
"""Get a security group ID.
Args:
name (str): Security Group name to find.
env (str): Deployment environment to search.
region (str): AWS Region to search.
Returns:
str: ID of Security Group, e.g. sg-xxxx.
Raises:
... | [
"def",
"get_security_group_id",
"(",
"name",
"=",
"''",
",",
"env",
"=",
"''",
",",
"region",
"=",
"''",
")",
":",
"vpc_id",
"=",
"get_vpc_id",
"(",
"env",
",",
"region",
")",
"LOG",
".",
"info",
"(",
"'Find %s sg in %s [%s] in %s'",
",",
"name",
",",
... | Get a security group ID.
Args:
name (str): Security Group name to find.
env (str): Deployment environment to search.
region (str): AWS Region to search.
Returns:
str: ID of Security Group, e.g. sg-xxxx.
Raises:
AssertionError: Call to Gate API was not successful.
... | [
"Get",
"a",
"security",
"group",
"ID",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/security_group.py#L30-L63 |
6,144 | foremast/foremast | src/foremast/utils/security_group.py | remove_duplicate_sg | def remove_duplicate_sg(security_groups):
"""Removes duplicate Security Groups that share a same name alias
Args:
security_groups (list): A list of security group id to compare against SECURITYGROUP_REPLACEMENTS
Returns:
security_groups (list): A list of security groups with duplicate alia... | python | def remove_duplicate_sg(security_groups):
"""Removes duplicate Security Groups that share a same name alias
Args:
security_groups (list): A list of security group id to compare against SECURITYGROUP_REPLACEMENTS
Returns:
security_groups (list): A list of security groups with duplicate alia... | [
"def",
"remove_duplicate_sg",
"(",
"security_groups",
")",
":",
"for",
"each_sg",
",",
"duplicate_sg_name",
"in",
"SECURITYGROUP_REPLACEMENTS",
".",
"items",
"(",
")",
":",
"if",
"each_sg",
"in",
"security_groups",
"and",
"duplicate_sg_name",
"in",
"security_groups",
... | Removes duplicate Security Groups that share a same name alias
Args:
security_groups (list): A list of security group id to compare against SECURITYGROUP_REPLACEMENTS
Returns:
security_groups (list): A list of security groups with duplicate aliases removed | [
"Removes",
"duplicate",
"Security",
"Groups",
"that",
"share",
"a",
"same",
"name",
"alias"
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/security_group.py#L66-L80 |
6,145 | foremast/foremast | src/foremast/utils/encoding.py | generate_encoded_user_data | def generate_encoded_user_data(
env='dev',
region='us-east-1',
generated=None,
group_name='',
pipeline_type='',
canary=False,
):
r"""Generate base64 encoded User Data.
Args:
env (str): Deployment environment, e.g. dev, stage.
region (str): AWS Reg... | python | def generate_encoded_user_data(
env='dev',
region='us-east-1',
generated=None,
group_name='',
pipeline_type='',
canary=False,
):
r"""Generate base64 encoded User Data.
Args:
env (str): Deployment environment, e.g. dev, stage.
region (str): AWS Reg... | [
"def",
"generate_encoded_user_data",
"(",
"env",
"=",
"'dev'",
",",
"region",
"=",
"'us-east-1'",
",",
"generated",
"=",
"None",
",",
"group_name",
"=",
"''",
",",
"pipeline_type",
"=",
"''",
",",
"canary",
"=",
"False",
",",
")",
":",
"# We need to handle t... | r"""Generate base64 encoded User Data.
Args:
env (str): Deployment environment, e.g. dev, stage.
region (str): AWS Region, e.g. us-east-1.
generated (gogoutils.Generator): Generated naming formats.
group_name (str): Application group nane, e.g. core.
pipeline_type (str): Typ... | [
"r",
"Generate",
"base64",
"encoded",
"User",
"Data",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/encoding.py#L22-L74 |
6,146 | foremast/foremast | src/foremast/runner.py | prepare_infrastructure | def prepare_infrastructure():
"""Entry point for preparing the infrastructure in a specific env."""
runner = ForemastRunner()
runner.write_configs()
runner.create_app()
archaius = runner.configs[runner.env]['app']['archaius_enabled']
eureka = runner.configs[runner.env]['app']['eureka_enabled']... | python | def prepare_infrastructure():
"""Entry point for preparing the infrastructure in a specific env."""
runner = ForemastRunner()
runner.write_configs()
runner.create_app()
archaius = runner.configs[runner.env]['app']['archaius_enabled']
eureka = runner.configs[runner.env]['app']['eureka_enabled']... | [
"def",
"prepare_infrastructure",
"(",
")",
":",
"runner",
"=",
"ForemastRunner",
"(",
")",
"runner",
".",
"write_configs",
"(",
")",
"runner",
".",
"create_app",
"(",
")",
"archaius",
"=",
"runner",
".",
"configs",
"[",
"runner",
".",
"env",
"]",
"[",
"'... | Entry point for preparing the infrastructure in a specific env. | [
"Entry",
"point",
"for",
"preparing",
"the",
"infrastructure",
"in",
"a",
"specific",
"env",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L250-L283 |
6,147 | foremast/foremast | src/foremast/runner.py | prepare_app_pipeline | def prepare_app_pipeline():
"""Entry point for application setup and initial pipeline in Spinnaker."""
runner = ForemastRunner()
runner.write_configs()
runner.create_app()
runner.create_pipeline()
runner.cleanup() | python | def prepare_app_pipeline():
"""Entry point for application setup and initial pipeline in Spinnaker."""
runner = ForemastRunner()
runner.write_configs()
runner.create_app()
runner.create_pipeline()
runner.cleanup() | [
"def",
"prepare_app_pipeline",
"(",
")",
":",
"runner",
"=",
"ForemastRunner",
"(",
")",
"runner",
".",
"write_configs",
"(",
")",
"runner",
".",
"create_app",
"(",
")",
"runner",
".",
"create_pipeline",
"(",
")",
"runner",
".",
"cleanup",
"(",
")"
] | Entry point for application setup and initial pipeline in Spinnaker. | [
"Entry",
"point",
"for",
"application",
"setup",
"and",
"initial",
"pipeline",
"in",
"Spinnaker",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L286-L292 |
6,148 | foremast/foremast | src/foremast/runner.py | prepare_onetime_pipeline | def prepare_onetime_pipeline():
"""Entry point for single use pipeline setup in the defined app."""
runner = ForemastRunner()
runner.write_configs()
runner.create_pipeline(onetime=os.getenv('ENV'))
runner.cleanup() | python | def prepare_onetime_pipeline():
"""Entry point for single use pipeline setup in the defined app."""
runner = ForemastRunner()
runner.write_configs()
runner.create_pipeline(onetime=os.getenv('ENV'))
runner.cleanup() | [
"def",
"prepare_onetime_pipeline",
"(",
")",
":",
"runner",
"=",
"ForemastRunner",
"(",
")",
"runner",
".",
"write_configs",
"(",
")",
"runner",
".",
"create_pipeline",
"(",
"onetime",
"=",
"os",
".",
"getenv",
"(",
"'ENV'",
")",
")",
"runner",
".",
"clean... | Entry point for single use pipeline setup in the defined app. | [
"Entry",
"point",
"for",
"single",
"use",
"pipeline",
"setup",
"in",
"the",
"defined",
"app",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L295-L300 |
6,149 | foremast/foremast | src/foremast/runner.py | ForemastRunner.write_configs | def write_configs(self):
"""Generate the configurations needed for pipes."""
utils.banner("Generating Configs")
if not self.runway_dir:
app_configs = configs.process_git_configs(git_short=self.git_short)
else:
app_configs = configs.process_runway_configs(runway_di... | python | def write_configs(self):
"""Generate the configurations needed for pipes."""
utils.banner("Generating Configs")
if not self.runway_dir:
app_configs = configs.process_git_configs(git_short=self.git_short)
else:
app_configs = configs.process_runway_configs(runway_di... | [
"def",
"write_configs",
"(",
"self",
")",
":",
"utils",
".",
"banner",
"(",
"\"Generating Configs\"",
")",
"if",
"not",
"self",
".",
"runway_dir",
":",
"app_configs",
"=",
"configs",
".",
"process_git_configs",
"(",
"git_short",
"=",
"self",
".",
"git_short",
... | Generate the configurations needed for pipes. | [
"Generate",
"the",
"configurations",
"needed",
"for",
"pipes",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L72-L81 |
6,150 | foremast/foremast | src/foremast/runner.py | ForemastRunner.create_app | def create_app(self):
"""Create the spinnaker application."""
utils.banner("Creating Spinnaker App")
spinnakerapp = app.SpinnakerApp(app=self.app, email=self.email, project=self.group, repo=self.repo,
pipeline_config=self.configs['pipeline'])
spinn... | python | def create_app(self):
"""Create the spinnaker application."""
utils.banner("Creating Spinnaker App")
spinnakerapp = app.SpinnakerApp(app=self.app, email=self.email, project=self.group, repo=self.repo,
pipeline_config=self.configs['pipeline'])
spinn... | [
"def",
"create_app",
"(",
"self",
")",
":",
"utils",
".",
"banner",
"(",
"\"Creating Spinnaker App\"",
")",
"spinnakerapp",
"=",
"app",
".",
"SpinnakerApp",
"(",
"app",
"=",
"self",
".",
"app",
",",
"email",
"=",
"self",
".",
"email",
",",
"project",
"="... | Create the spinnaker application. | [
"Create",
"the",
"spinnaker",
"application",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L83-L88 |
6,151 | foremast/foremast | src/foremast/runner.py | ForemastRunner.create_iam | def create_iam(self):
"""Create IAM resources."""
utils.banner("Creating IAM")
iam.create_iam_resources(env=self.env, app=self.app) | python | def create_iam(self):
"""Create IAM resources."""
utils.banner("Creating IAM")
iam.create_iam_resources(env=self.env, app=self.app) | [
"def",
"create_iam",
"(",
"self",
")",
":",
"utils",
".",
"banner",
"(",
"\"Creating IAM\"",
")",
"iam",
".",
"create_iam_resources",
"(",
"env",
"=",
"self",
".",
"env",
",",
"app",
"=",
"self",
".",
"app",
")"
] | Create IAM resources. | [
"Create",
"IAM",
"resources",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L124-L127 |
6,152 | foremast/foremast | src/foremast/runner.py | ForemastRunner.create_archaius | def create_archaius(self):
"""Create S3 bucket for Archaius."""
utils.banner("Creating S3")
s3.init_properties(env=self.env, app=self.app) | python | def create_archaius(self):
"""Create S3 bucket for Archaius."""
utils.banner("Creating S3")
s3.init_properties(env=self.env, app=self.app) | [
"def",
"create_archaius",
"(",
"self",
")",
":",
"utils",
".",
"banner",
"(",
"\"Creating S3\"",
")",
"s3",
".",
"init_properties",
"(",
"env",
"=",
"self",
".",
"env",
",",
"app",
"=",
"self",
".",
"app",
")"
] | Create S3 bucket for Archaius. | [
"Create",
"S3",
"bucket",
"for",
"Archaius",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L129-L132 |
6,153 | foremast/foremast | src/foremast/runner.py | ForemastRunner.create_s3app | def create_s3app(self):
"""Create S3 infra for s3 applications"""
utils.banner("Creating S3 App Infrastructure")
primary_region = self.configs['pipeline']['primary_region']
s3obj = s3.S3Apps(app=self.app,
env=self.env,
region=self.regio... | python | def create_s3app(self):
"""Create S3 infra for s3 applications"""
utils.banner("Creating S3 App Infrastructure")
primary_region = self.configs['pipeline']['primary_region']
s3obj = s3.S3Apps(app=self.app,
env=self.env,
region=self.regio... | [
"def",
"create_s3app",
"(",
"self",
")",
":",
"utils",
".",
"banner",
"(",
"\"Creating S3 App Infrastructure\"",
")",
"primary_region",
"=",
"self",
".",
"configs",
"[",
"'pipeline'",
"]",
"[",
"'primary_region'",
"]",
"s3obj",
"=",
"s3",
".",
"S3Apps",
"(",
... | Create S3 infra for s3 applications | [
"Create",
"S3",
"infra",
"for",
"s3",
"applications"
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L134-L143 |
6,154 | foremast/foremast | src/foremast/runner.py | ForemastRunner.deploy_s3app | def deploy_s3app(self):
"""Deploys artifacts contents to S3 bucket"""
utils.banner("Deploying S3 App")
primary_region = self.configs['pipeline']['primary_region']
s3obj = s3.S3Deployment(
app=self.app,
env=self.env,
region=self.region,
prop... | python | def deploy_s3app(self):
"""Deploys artifacts contents to S3 bucket"""
utils.banner("Deploying S3 App")
primary_region = self.configs['pipeline']['primary_region']
s3obj = s3.S3Deployment(
app=self.app,
env=self.env,
region=self.region,
prop... | [
"def",
"deploy_s3app",
"(",
"self",
")",
":",
"utils",
".",
"banner",
"(",
"\"Deploying S3 App\"",
")",
"primary_region",
"=",
"self",
".",
"configs",
"[",
"'pipeline'",
"]",
"[",
"'primary_region'",
"]",
"s3obj",
"=",
"s3",
".",
"S3Deployment",
"(",
"app",
... | Deploys artifacts contents to S3 bucket | [
"Deploys",
"artifacts",
"contents",
"to",
"S3",
"bucket"
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L145-L157 |
6,155 | foremast/foremast | src/foremast/runner.py | ForemastRunner.promote_s3app | def promote_s3app(self):
"""promotes S3 deployment to LATEST"""
utils.banner("Promoting S3 App")
primary_region = self.configs['pipeline']['primary_region']
s3obj = s3.S3Deployment(
app=self.app,
env=self.env,
region=self.region,
prop_path=... | python | def promote_s3app(self):
"""promotes S3 deployment to LATEST"""
utils.banner("Promoting S3 App")
primary_region = self.configs['pipeline']['primary_region']
s3obj = s3.S3Deployment(
app=self.app,
env=self.env,
region=self.region,
prop_path=... | [
"def",
"promote_s3app",
"(",
"self",
")",
":",
"utils",
".",
"banner",
"(",
"\"Promoting S3 App\"",
")",
"primary_region",
"=",
"self",
".",
"configs",
"[",
"'pipeline'",
"]",
"[",
"'primary_region'",
"]",
"s3obj",
"=",
"s3",
".",
"S3Deployment",
"(",
"app",... | promotes S3 deployment to LATEST | [
"promotes",
"S3",
"deployment",
"to",
"LATEST"
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L159-L171 |
6,156 | foremast/foremast | src/foremast/runner.py | ForemastRunner.create_elb | def create_elb(self):
"""Create the ELB for the defined environment."""
utils.banner("Creating ELB")
elbobj = elb.SpinnakerELB(app=self.app, env=self.env, region=self.region, prop_path=self.json_path)
elbobj.create_elb() | python | def create_elb(self):
"""Create the ELB for the defined environment."""
utils.banner("Creating ELB")
elbobj = elb.SpinnakerELB(app=self.app, env=self.env, region=self.region, prop_path=self.json_path)
elbobj.create_elb() | [
"def",
"create_elb",
"(",
"self",
")",
":",
"utils",
".",
"banner",
"(",
"\"Creating ELB\"",
")",
"elbobj",
"=",
"elb",
".",
"SpinnakerELB",
"(",
"app",
"=",
"self",
".",
"app",
",",
"env",
"=",
"self",
".",
"env",
",",
"region",
"=",
"self",
".",
... | Create the ELB for the defined environment. | [
"Create",
"the",
"ELB",
"for",
"the",
"defined",
"environment",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L191-L195 |
6,157 | foremast/foremast | src/foremast/runner.py | ForemastRunner.create_dns | def create_dns(self):
"""Create DNS for the defined app and environment."""
utils.banner("Creating DNS")
elb_subnet = self.configs[self.env]['elb']['subnet_purpose']
regions = self.configs[self.env]['regions']
failover = self.configs[self.env]['dns']['failover_dns']
prima... | python | def create_dns(self):
"""Create DNS for the defined app and environment."""
utils.banner("Creating DNS")
elb_subnet = self.configs[self.env]['elb']['subnet_purpose']
regions = self.configs[self.env]['regions']
failover = self.configs[self.env]['dns']['failover_dns']
prima... | [
"def",
"create_dns",
"(",
"self",
")",
":",
"utils",
".",
"banner",
"(",
"\"Creating DNS\"",
")",
"elb_subnet",
"=",
"self",
".",
"configs",
"[",
"self",
".",
"env",
"]",
"[",
"'elb'",
"]",
"[",
"'subnet_purpose'",
"]",
"regions",
"=",
"self",
".",
"co... | Create DNS for the defined app and environment. | [
"Create",
"DNS",
"for",
"the",
"defined",
"app",
"and",
"environment",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L197-L217 |
6,158 | foremast/foremast | src/foremast/runner.py | ForemastRunner.create_autoscaling_policy | def create_autoscaling_policy(self):
"""Create Scaling Policy for app in environment"""
utils.banner("Creating Scaling Policy")
policyobj = autoscaling_policy.AutoScalingPolicy(
app=self.app, env=self.env, region=self.region, prop_path=self.json_path)
policyobj.create_policy(... | python | def create_autoscaling_policy(self):
"""Create Scaling Policy for app in environment"""
utils.banner("Creating Scaling Policy")
policyobj = autoscaling_policy.AutoScalingPolicy(
app=self.app, env=self.env, region=self.region, prop_path=self.json_path)
policyobj.create_policy(... | [
"def",
"create_autoscaling_policy",
"(",
"self",
")",
":",
"utils",
".",
"banner",
"(",
"\"Creating Scaling Policy\"",
")",
"policyobj",
"=",
"autoscaling_policy",
".",
"AutoScalingPolicy",
"(",
"app",
"=",
"self",
".",
"app",
",",
"env",
"=",
"self",
".",
"en... | Create Scaling Policy for app in environment | [
"Create",
"Scaling",
"Policy",
"for",
"app",
"in",
"environment"
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L219-L224 |
6,159 | foremast/foremast | src/foremast/runner.py | ForemastRunner.create_datapipeline | def create_datapipeline(self):
"""Creates data pipeline and adds definition"""
utils.banner("Creating Data Pipeline")
dpobj = datapipeline.AWSDataPipeline(app=self.app, env=self.env, region=self.region, prop_path=self.json_path)
dpobj.create_datapipeline()
dpobj.set_pipeline_defi... | python | def create_datapipeline(self):
"""Creates data pipeline and adds definition"""
utils.banner("Creating Data Pipeline")
dpobj = datapipeline.AWSDataPipeline(app=self.app, env=self.env, region=self.region, prop_path=self.json_path)
dpobj.create_datapipeline()
dpobj.set_pipeline_defi... | [
"def",
"create_datapipeline",
"(",
"self",
")",
":",
"utils",
".",
"banner",
"(",
"\"Creating Data Pipeline\"",
")",
"dpobj",
"=",
"datapipeline",
".",
"AWSDataPipeline",
"(",
"app",
"=",
"self",
".",
"app",
",",
"env",
"=",
"self",
".",
"env",
",",
"regio... | Creates data pipeline and adds definition | [
"Creates",
"data",
"pipeline",
"and",
"adds",
"definition"
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L226-L233 |
6,160 | foremast/foremast | src/foremast/runner.py | ForemastRunner.slack_notify | def slack_notify(self):
"""Send out a slack notification."""
utils.banner("Sending slack notification")
if self.env.startswith("prod"):
notify = slacknotify.SlackNotification(app=self.app, env=self.env, prop_path=self.json_path)
notify.post_message()
else:
... | python | def slack_notify(self):
"""Send out a slack notification."""
utils.banner("Sending slack notification")
if self.env.startswith("prod"):
notify = slacknotify.SlackNotification(app=self.app, env=self.env, prop_path=self.json_path)
notify.post_message()
else:
... | [
"def",
"slack_notify",
"(",
"self",
")",
":",
"utils",
".",
"banner",
"(",
"\"Sending slack notification\"",
")",
"if",
"self",
".",
"env",
".",
"startswith",
"(",
"\"prod\"",
")",
":",
"notify",
"=",
"slacknotify",
".",
"SlackNotification",
"(",
"app",
"=",... | Send out a slack notification. | [
"Send",
"out",
"a",
"slack",
"notification",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L235-L243 |
6,161 | foremast/foremast | src/foremast/args.py | add_debug | def add_debug(parser):
"""Add a `debug` flag to the _parser_."""
parser.add_argument(
'-d', '--debug', action='store_const', const=logging.DEBUG, default=logging.INFO, help='Set DEBUG output') | python | def add_debug(parser):
"""Add a `debug` flag to the _parser_."""
parser.add_argument(
'-d', '--debug', action='store_const', const=logging.DEBUG, default=logging.INFO, help='Set DEBUG output') | [
"def",
"add_debug",
"(",
"parser",
")",
":",
"parser",
".",
"add_argument",
"(",
"'-d'",
",",
"'--debug'",
",",
"action",
"=",
"'store_const'",
",",
"const",
"=",
"logging",
".",
"DEBUG",
",",
"default",
"=",
"logging",
".",
"INFO",
",",
"help",
"=",
"... | Add a `debug` flag to the _parser_. | [
"Add",
"a",
"debug",
"flag",
"to",
"the",
"_parser_",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/args.py#L28-L31 |
6,162 | foremast/foremast | src/foremast/args.py | add_env | def add_env(parser):
"""Add an `env` flag to the _parser_."""
parser.add_argument(
'-e', '--env', choices=ENVS, default=os.getenv('ENV', default='dev'), help='Deploy environment, overrides $ENV') | python | def add_env(parser):
"""Add an `env` flag to the _parser_."""
parser.add_argument(
'-e', '--env', choices=ENVS, default=os.getenv('ENV', default='dev'), help='Deploy environment, overrides $ENV') | [
"def",
"add_env",
"(",
"parser",
")",
":",
"parser",
".",
"add_argument",
"(",
"'-e'",
",",
"'--env'",
",",
"choices",
"=",
"ENVS",
",",
"default",
"=",
"os",
".",
"getenv",
"(",
"'ENV'",
",",
"default",
"=",
"'dev'",
")",
",",
"help",
"=",
"'Deploy ... | Add an `env` flag to the _parser_. | [
"Add",
"an",
"env",
"flag",
"to",
"the",
"_parser_",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/args.py#L34-L37 |
6,163 | foremast/foremast | src/foremast/autoscaling_policy/__main__.py | main | def main():
"""CLI entrypoint for scaling policy creation"""
logging.basicConfig(format=LOGGING_FORMAT)
log = logging.getLogger(__name__)
parser = argparse.ArgumentParser()
add_debug(parser)
add_app(parser)
add_properties(parser)
add_env(parser)
add_region(parser)
args = parser.... | python | def main():
"""CLI entrypoint for scaling policy creation"""
logging.basicConfig(format=LOGGING_FORMAT)
log = logging.getLogger(__name__)
parser = argparse.ArgumentParser()
add_debug(parser)
add_app(parser)
add_properties(parser)
add_env(parser)
add_region(parser)
args = parser.... | [
"def",
"main",
"(",
")",
":",
"logging",
".",
"basicConfig",
"(",
"format",
"=",
"LOGGING_FORMAT",
")",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"add_debug",
"(",
"parser",
... | CLI entrypoint for scaling policy creation | [
"CLI",
"entrypoint",
"for",
"scaling",
"policy",
"creation"
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/autoscaling_policy/__main__.py#L29-L48 |
6,164 | foremast/foremast | src/foremast/awslambda/__main__.py | main | def main():
"""Create Lambda events."""
logging.basicConfig(format=LOGGING_FORMAT)
log = logging.getLogger(__name__)
parser = argparse.ArgumentParser(description=main.__doc__)
add_debug(parser)
add_app(parser)
add_env(parser)
add_properties(parser)
add_region(parser)
args = pars... | python | def main():
"""Create Lambda events."""
logging.basicConfig(format=LOGGING_FORMAT)
log = logging.getLogger(__name__)
parser = argparse.ArgumentParser(description=main.__doc__)
add_debug(parser)
add_app(parser)
add_env(parser)
add_properties(parser)
add_region(parser)
args = pars... | [
"def",
"main",
"(",
")",
":",
"logging",
".",
"basicConfig",
"(",
"format",
"=",
"LOGGING_FORMAT",
")",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"main",
".",
... | Create Lambda events. | [
"Create",
"Lambda",
"events",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/__main__.py#L29-L51 |
6,165 | foremast/foremast | src/foremast/utils/slack.py | post_slack_message | def post_slack_message(message=None, channel=None, username=None, icon_emoji=None):
"""Format the message and post to the appropriate slack channel.
Args:
message (str): Message to post to slack
channel (str): Desired channel. Must start with #
"""
LOG.debug('Slack Channel: %s\nSlack M... | python | def post_slack_message(message=None, channel=None, username=None, icon_emoji=None):
"""Format the message and post to the appropriate slack channel.
Args:
message (str): Message to post to slack
channel (str): Desired channel. Must start with #
"""
LOG.debug('Slack Channel: %s\nSlack M... | [
"def",
"post_slack_message",
"(",
"message",
"=",
"None",
",",
"channel",
"=",
"None",
",",
"username",
"=",
"None",
",",
"icon_emoji",
"=",
"None",
")",
":",
"LOG",
".",
"debug",
"(",
"'Slack Channel: %s\\nSlack Message: %s'",
",",
"channel",
",",
"message",
... | Format the message and post to the appropriate slack channel.
Args:
message (str): Message to post to slack
channel (str): Desired channel. Must start with # | [
"Format",
"the",
"message",
"and",
"post",
"to",
"the",
"appropriate",
"slack",
"channel",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/slack.py#L26-L40 |
6,166 | foremast/foremast | src/foremast/dns/destroy_dns/destroy_dns.py | destroy_dns | def destroy_dns(app='', env='dev', **_):
"""Destroy DNS records.
Args:
app (str): Spinnaker Application name.
env (str): Deployment environment.
regions (str): AWS region.
Returns:
bool: True upon successful completion.
"""
client = boto3.Session(profile_name=env).c... | python | def destroy_dns(app='', env='dev', **_):
"""Destroy DNS records.
Args:
app (str): Spinnaker Application name.
env (str): Deployment environment.
regions (str): AWS region.
Returns:
bool: True upon successful completion.
"""
client = boto3.Session(profile_name=env).c... | [
"def",
"destroy_dns",
"(",
"app",
"=",
"''",
",",
"env",
"=",
"'dev'",
",",
"*",
"*",
"_",
")",
":",
"client",
"=",
"boto3",
".",
"Session",
"(",
"profile_name",
"=",
"env",
")",
".",
"client",
"(",
"'route53'",
")",
"generated",
"=",
"get_details",
... | Destroy DNS records.
Args:
app (str): Spinnaker Application name.
env (str): Deployment environment.
regions (str): AWS region.
Returns:
bool: True upon successful completion. | [
"Destroy",
"DNS",
"records",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/dns/destroy_dns/destroy_dns.py#L27-L52 |
6,167 | foremast/foremast | src/foremast/dns/destroy_dns/destroy_dns.py | destroy_record | def destroy_record(client=None, found_record=None, record='', zone_id=''):
"""Destroy an individual DNS record.
Args:
client (botocore.client.Route53): Route 53 boto3 client.
found_record (dict): Route 53 record set::
{'Name': 'unicorn.forrest.dev.example.com.',
'Resou... | python | def destroy_record(client=None, found_record=None, record='', zone_id=''):
"""Destroy an individual DNS record.
Args:
client (botocore.client.Route53): Route 53 boto3 client.
found_record (dict): Route 53 record set::
{'Name': 'unicorn.forrest.dev.example.com.',
'Resou... | [
"def",
"destroy_record",
"(",
"client",
"=",
"None",
",",
"found_record",
"=",
"None",
",",
"record",
"=",
"''",
",",
"zone_id",
"=",
"''",
")",
":",
"LOG",
".",
"debug",
"(",
"'Found DNS record: %s'",
",",
"found_record",
")",
"if",
"found_record",
"[",
... | Destroy an individual DNS record.
Args:
client (botocore.client.Route53): Route 53 boto3 client.
found_record (dict): Route 53 record set::
{'Name': 'unicorn.forrest.dev.example.com.',
'ResourceRecords':
[{'Value':
'internal-unicornforrest-17774... | [
"Destroy",
"an",
"individual",
"DNS",
"record",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/dns/destroy_dns/destroy_dns.py#L55-L88 |
6,168 | foremast/foremast | src/foremast/awslambda/sns_event/sns_event.py | create_sns_event | def create_sns_event(app_name, env, region, rules):
"""Create SNS lambda event 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 (str): Trigger rules from the set... | python | def create_sns_event(app_name, env, region, rules):
"""Create SNS lambda event 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 (str): Trigger rules from the set... | [
"def",
"create_sns_event",
"(",
"app_name",
",",
"env",
",",
"region",
",",
"rules",
")",
":",
"session",
"=",
"boto3",
".",
"Session",
"(",
"profile_name",
"=",
"env",
",",
"region_name",
"=",
"region",
")",
"sns_client",
"=",
"session",
".",
"client",
... | Create SNS lambda event 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 (str): Trigger rules from the settings | [
"Create",
"SNS",
"lambda",
"event",
"from",
"rules",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/sns_event/sns_event.py#L27-L58 |
6,169 | foremast/foremast | src/foremast/awslambda/sns_event/destroy_sns_event/destroy_sns_event.py | destroy_sns_event | def destroy_sns_event(app_name, env, region):
""" Destroy all Lambda SNS subscriptions.
Args:
app_name (str): name of the lambda function
env (str): Environment/Account for lambda function
region (str): AWS region of the lambda function
Returns:
boolean: True if subscriptio... | python | def destroy_sns_event(app_name, env, region):
""" Destroy all Lambda SNS subscriptions.
Args:
app_name (str): name of the lambda function
env (str): Environment/Account for lambda function
region (str): AWS region of the lambda function
Returns:
boolean: True if subscriptio... | [
"def",
"destroy_sns_event",
"(",
"app_name",
",",
"env",
",",
"region",
")",
":",
"session",
"=",
"boto3",
".",
"Session",
"(",
"profile_name",
"=",
"env",
",",
"region_name",
"=",
"region",
")",
"sns_client",
"=",
"session",
".",
"client",
"(",
"'sns'",
... | Destroy all Lambda SNS subscriptions.
Args:
app_name (str): name of the lambda function
env (str): Environment/Account for lambda function
region (str): AWS region of the lambda function
Returns:
boolean: True if subscription destroyed successfully | [
"Destroy",
"all",
"Lambda",
"SNS",
"subscriptions",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/sns_event/destroy_sns_event/destroy_sns_event.py#L27-L47 |
6,170 | foremast/foremast | src/foremast/elb/destroy_elb/destroy_elb.py | destroy_elb | def destroy_elb(app='', env='dev', region='us-east-1', **_):
"""Destroy ELB Resources.
Args:
app (str): Spinnaker Application name.
env (str): Deployment environment.
region (str): AWS region.
Returns:
True upon successful completion.
"""
task_json = get_template(
... | python | def destroy_elb(app='', env='dev', region='us-east-1', **_):
"""Destroy ELB Resources.
Args:
app (str): Spinnaker Application name.
env (str): Deployment environment.
region (str): AWS region.
Returns:
True upon successful completion.
"""
task_json = get_template(
... | [
"def",
"destroy_elb",
"(",
"app",
"=",
"''",
",",
"env",
"=",
"'dev'",
",",
"region",
"=",
"'us-east-1'",
",",
"*",
"*",
"_",
")",
":",
"task_json",
"=",
"get_template",
"(",
"template_file",
"=",
"'destroy/destroy_elb.json.j2'",
",",
"app",
"=",
"app",
... | Destroy ELB Resources.
Args:
app (str): Spinnaker Application name.
env (str): Deployment environment.
region (str): AWS region.
Returns:
True upon successful completion. | [
"Destroy",
"ELB",
"Resources",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/elb/destroy_elb/destroy_elb.py#L21-L41 |
6,171 | foremast/foremast | src/foremast/pipeline/clean_pipelines.py | delete_pipeline | def delete_pipeline(app='', pipeline_name=''):
"""Delete _pipeline_name_ from _app_."""
safe_pipeline_name = normalize_pipeline_name(name=pipeline_name)
LOG.warning('Deleting Pipeline: %s', safe_pipeline_name)
url = '{host}/pipelines/{app}/{pipeline}'.format(host=API_URL, app=app, pipeline=safe_pipeli... | python | def delete_pipeline(app='', pipeline_name=''):
"""Delete _pipeline_name_ from _app_."""
safe_pipeline_name = normalize_pipeline_name(name=pipeline_name)
LOG.warning('Deleting Pipeline: %s', safe_pipeline_name)
url = '{host}/pipelines/{app}/{pipeline}'.format(host=API_URL, app=app, pipeline=safe_pipeli... | [
"def",
"delete_pipeline",
"(",
"app",
"=",
"''",
",",
"pipeline_name",
"=",
"''",
")",
":",
"safe_pipeline_name",
"=",
"normalize_pipeline_name",
"(",
"name",
"=",
"pipeline_name",
")",
"LOG",
".",
"warning",
"(",
"'Deleting Pipeline: %s'",
",",
"safe_pipeline_nam... | Delete _pipeline_name_ from _app_. | [
"Delete",
"_pipeline_name_",
"from",
"_app_",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/pipeline/clean_pipelines.py#L28-L47 |
6,172 | foremast/foremast | src/foremast/pipeline/clean_pipelines.py | clean_pipelines | def clean_pipelines(app='', settings=None):
"""Delete Pipelines for regions not defined in application.json files.
For Pipelines named **app_name [region]**, _region_ will need to appear
in at least one application.json file. All other names are assumed
unamanaged.
Args:
app (str): Applica... | python | def clean_pipelines(app='', settings=None):
"""Delete Pipelines for regions not defined in application.json files.
For Pipelines named **app_name [region]**, _region_ will need to appear
in at least one application.json file. All other names are assumed
unamanaged.
Args:
app (str): Applica... | [
"def",
"clean_pipelines",
"(",
"app",
"=",
"''",
",",
"settings",
"=",
"None",
")",
":",
"pipelines",
"=",
"get_all_pipelines",
"(",
"app",
"=",
"app",
")",
"envs",
"=",
"settings",
"[",
"'pipeline'",
"]",
"[",
"'env'",
"]",
"LOG",
".",
"debug",
"(",
... | Delete Pipelines for regions not defined in application.json files.
For Pipelines named **app_name [region]**, _region_ will need to appear
in at least one application.json file. All other names are assumed
unamanaged.
Args:
app (str): Application name
settings (dict): imported configu... | [
"Delete",
"Pipelines",
"for",
"regions",
"not",
"defined",
"in",
"application",
".",
"json",
"files",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/pipeline/clean_pipelines.py#L50-L96 |
6,173 | foremast/foremast | src/foremast/consts.py | extract_formats | def extract_formats(config_handle):
"""Get application formats.
See :class:`gogoutils.Formats` for available options.
Args:
config_handle (configparser.ConfigParser): Instance of configurations.
Returns:
dict: Formats in ``{$format_type: $format_pattern}``.
"""
configurations... | python | def extract_formats(config_handle):
"""Get application formats.
See :class:`gogoutils.Formats` for available options.
Args:
config_handle (configparser.ConfigParser): Instance of configurations.
Returns:
dict: Formats in ``{$format_type: $format_pattern}``.
"""
configurations... | [
"def",
"extract_formats",
"(",
"config_handle",
")",
":",
"configurations",
"=",
"dict",
"(",
"config_handle",
")",
"formats",
"=",
"dict",
"(",
"configurations",
".",
"get",
"(",
"'formats'",
",",
"{",
"}",
")",
")",
"return",
"formats"
] | Get application formats.
See :class:`gogoutils.Formats` for available options.
Args:
config_handle (configparser.ConfigParser): Instance of configurations.
Returns:
dict: Formats in ``{$format_type: $format_pattern}``. | [
"Get",
"application",
"formats",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/consts.py#L77-L91 |
6,174 | foremast/foremast | src/foremast/consts.py | load_dynamic_config | def load_dynamic_config(config_file=DEFAULT_DYNAMIC_CONFIG_FILE):
"""Load and parse dynamic config"""
dynamic_configurations = {}
# Insert config path so we can import it
sys.path.insert(0, path.dirname(path.abspath(config_file)))
try:
config_module = __import__('config')
dynamic_c... | python | def load_dynamic_config(config_file=DEFAULT_DYNAMIC_CONFIG_FILE):
"""Load and parse dynamic config"""
dynamic_configurations = {}
# Insert config path so we can import it
sys.path.insert(0, path.dirname(path.abspath(config_file)))
try:
config_module = __import__('config')
dynamic_c... | [
"def",
"load_dynamic_config",
"(",
"config_file",
"=",
"DEFAULT_DYNAMIC_CONFIG_FILE",
")",
":",
"dynamic_configurations",
"=",
"{",
"}",
"# Insert config path so we can import it",
"sys",
".",
"path",
".",
"insert",
"(",
"0",
",",
"path",
".",
"dirname",
"(",
"path"... | Load and parse dynamic config | [
"Load",
"and",
"parse",
"dynamic",
"config"
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/consts.py#L94-L108 |
6,175 | foremast/foremast | src/foremast/consts.py | _remove_empty_entries | def _remove_empty_entries(entries):
"""Remove empty entries in a list"""
valid_entries = []
for entry in set(entries):
if entry:
valid_entries.append(entry)
return sorted(valid_entries) | python | def _remove_empty_entries(entries):
"""Remove empty entries in a list"""
valid_entries = []
for entry in set(entries):
if entry:
valid_entries.append(entry)
return sorted(valid_entries) | [
"def",
"_remove_empty_entries",
"(",
"entries",
")",
":",
"valid_entries",
"=",
"[",
"]",
"for",
"entry",
"in",
"set",
"(",
"entries",
")",
":",
"if",
"entry",
":",
"valid_entries",
".",
"append",
"(",
"entry",
")",
"return",
"sorted",
"(",
"valid_entries"... | Remove empty entries in a list | [
"Remove",
"empty",
"entries",
"in",
"a",
"list"
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/consts.py#L144-L150 |
6,176 | foremast/foremast | src/foremast/consts.py | _convert_string_to_native | def _convert_string_to_native(value):
"""Convert a string to its native python type"""
result = None
try:
result = ast.literal_eval(str(value))
except (SyntaxError, ValueError):
# Likely a string
result = value.split(',')
return result | python | def _convert_string_to_native(value):
"""Convert a string to its native python type"""
result = None
try:
result = ast.literal_eval(str(value))
except (SyntaxError, ValueError):
# Likely a string
result = value.split(',')
return result | [
"def",
"_convert_string_to_native",
"(",
"value",
")",
":",
"result",
"=",
"None",
"try",
":",
"result",
"=",
"ast",
".",
"literal_eval",
"(",
"str",
"(",
"value",
")",
")",
"except",
"(",
"SyntaxError",
",",
"ValueError",
")",
":",
"# Likely a string",
"r... | Convert a string to its native python type | [
"Convert",
"a",
"string",
"to",
"its",
"native",
"python",
"type"
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/consts.py#L153-L162 |
6,177 | foremast/foremast | src/foremast/consts.py | _generate_security_groups | def _generate_security_groups(config_key):
"""Read config file and generate security group dict by environment.
Args:
config_key (str): Configuration file key
Returns:
dict: of environments in {'env1': ['group1', 'group2']} format
"""
raw_default_groups = validate_key_values(CONFIG... | python | def _generate_security_groups(config_key):
"""Read config file and generate security group dict by environment.
Args:
config_key (str): Configuration file key
Returns:
dict: of environments in {'env1': ['group1', 'group2']} format
"""
raw_default_groups = validate_key_values(CONFIG... | [
"def",
"_generate_security_groups",
"(",
"config_key",
")",
":",
"raw_default_groups",
"=",
"validate_key_values",
"(",
"CONFIG",
",",
"'base'",
",",
"config_key",
",",
"default",
"=",
"''",
")",
"default_groups",
"=",
"_convert_string_to_native",
"(",
"raw_default_gr... | Read config file and generate security group dict by environment.
Args:
config_key (str): Configuration file key
Returns:
dict: of environments in {'env1': ['group1', 'group2']} format | [
"Read",
"config",
"file",
"and",
"generate",
"security",
"group",
"dict",
"by",
"environment",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/consts.py#L165-L190 |
6,178 | foremast/foremast | src/foremast/datapipeline/datapipeline.py | AWSDataPipeline.create_datapipeline | def create_datapipeline(self):
"""Creates the data pipeline if it does not already exist
Returns:
dict: the response of the Boto3 command
"""
tags = [{"key": "app_group", "value": self.group}, {"key": "app_name", "value": self.app_name}]
response = self.client.c... | python | def create_datapipeline(self):
"""Creates the data pipeline if it does not already exist
Returns:
dict: the response of the Boto3 command
"""
tags = [{"key": "app_group", "value": self.group}, {"key": "app_name", "value": self.app_name}]
response = self.client.c... | [
"def",
"create_datapipeline",
"(",
"self",
")",
":",
"tags",
"=",
"[",
"{",
"\"key\"",
":",
"\"app_group\"",
",",
"\"value\"",
":",
"self",
".",
"group",
"}",
",",
"{",
"\"key\"",
":",
"\"app_name\"",
",",
"\"value\"",
":",
"self",
".",
"app_name",
"}",
... | Creates the data pipeline if it does not already exist
Returns:
dict: the response of the Boto3 command | [
"Creates",
"the",
"data",
"pipeline",
"if",
"it",
"does",
"not",
"already",
"exist"
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/datapipeline/datapipeline.py#L53-L70 |
6,179 | foremast/foremast | src/foremast/datapipeline/datapipeline.py | AWSDataPipeline.set_pipeline_definition | def set_pipeline_definition(self):
"""Translates the json definition and puts it on created pipeline
Returns:
dict: the response of the Boto3 command
"""
if not self.pipeline_id:
self.get_pipeline_id()
json_def = self.datapipeline_data['json_definit... | python | def set_pipeline_definition(self):
"""Translates the json definition and puts it on created pipeline
Returns:
dict: the response of the Boto3 command
"""
if not self.pipeline_id:
self.get_pipeline_id()
json_def = self.datapipeline_data['json_definit... | [
"def",
"set_pipeline_definition",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"pipeline_id",
":",
"self",
".",
"get_pipeline_id",
"(",
")",
"json_def",
"=",
"self",
".",
"datapipeline_data",
"[",
"'json_definition'",
"]",
"try",
":",
"pipelineobjects",
"=... | Translates the json definition and puts it on created pipeline
Returns:
dict: the response of the Boto3 command | [
"Translates",
"the",
"json",
"definition",
"and",
"puts",
"it",
"on",
"created",
"pipeline"
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/datapipeline/datapipeline.py#L72-L98 |
6,180 | foremast/foremast | src/foremast/datapipeline/datapipeline.py | AWSDataPipeline.get_pipeline_id | def get_pipeline_id(self):
"""Finds the pipeline ID for configured pipeline"""
all_pipelines = []
paginiator = self.client.get_paginator('list_pipelines')
for page in paginiator.paginate():
all_pipelines.extend(page['pipelineIdList'])
for pipeline in all_pipelines:
... | python | def get_pipeline_id(self):
"""Finds the pipeline ID for configured pipeline"""
all_pipelines = []
paginiator = self.client.get_paginator('list_pipelines')
for page in paginiator.paginate():
all_pipelines.extend(page['pipelineIdList'])
for pipeline in all_pipelines:
... | [
"def",
"get_pipeline_id",
"(",
"self",
")",
":",
"all_pipelines",
"=",
"[",
"]",
"paginiator",
"=",
"self",
".",
"client",
".",
"get_paginator",
"(",
"'list_pipelines'",
")",
"for",
"page",
"in",
"paginiator",
".",
"paginate",
"(",
")",
":",
"all_pipelines",... | Finds the pipeline ID for configured pipeline | [
"Finds",
"the",
"pipeline",
"ID",
"for",
"configured",
"pipeline"
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/datapipeline/datapipeline.py#L100-L113 |
6,181 | foremast/foremast | src/foremast/datapipeline/datapipeline.py | AWSDataPipeline.activate_pipeline | def activate_pipeline(self):
"""Activates a deployed pipeline, useful for OnDemand pipelines"""
self.client.activate_pipeline(pipelineId=self.pipeline_id)
LOG.info("Activated Pipeline %s", self.pipeline_id) | python | def activate_pipeline(self):
"""Activates a deployed pipeline, useful for OnDemand pipelines"""
self.client.activate_pipeline(pipelineId=self.pipeline_id)
LOG.info("Activated Pipeline %s", self.pipeline_id) | [
"def",
"activate_pipeline",
"(",
"self",
")",
":",
"self",
".",
"client",
".",
"activate_pipeline",
"(",
"pipelineId",
"=",
"self",
".",
"pipeline_id",
")",
"LOG",
".",
"info",
"(",
"\"Activated Pipeline %s\"",
",",
"self",
".",
"pipeline_id",
")"
] | Activates a deployed pipeline, useful for OnDemand pipelines | [
"Activates",
"a",
"deployed",
"pipeline",
"useful",
"for",
"OnDemand",
"pipelines"
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/datapipeline/datapipeline.py#L115-L118 |
6,182 | foremast/foremast | src/foremast/utils/dns.py | get_dns_zone_ids | def get_dns_zone_ids(env='dev', facing='internal'):
"""Get Route 53 Hosted Zone IDs for _env_.
Args:
env (str): Deployment environment.
facing (str): Type of ELB, external or internal.
Returns:
list: Hosted Zone IDs for _env_. Only *PrivateZone* when _facing_ is
internal.
... | python | def get_dns_zone_ids(env='dev', facing='internal'):
"""Get Route 53 Hosted Zone IDs for _env_.
Args:
env (str): Deployment environment.
facing (str): Type of ELB, external or internal.
Returns:
list: Hosted Zone IDs for _env_. Only *PrivateZone* when _facing_ is
internal.
... | [
"def",
"get_dns_zone_ids",
"(",
"env",
"=",
"'dev'",
",",
"facing",
"=",
"'internal'",
")",
":",
"client",
"=",
"boto3",
".",
"Session",
"(",
"profile_name",
"=",
"env",
")",
".",
"client",
"(",
"'route53'",
")",
"zones",
"=",
"client",
".",
"list_hosted... | Get Route 53 Hosted Zone IDs for _env_.
Args:
env (str): Deployment environment.
facing (str): Type of ELB, external or internal.
Returns:
list: Hosted Zone IDs for _env_. Only *PrivateZone* when _facing_ is
internal. | [
"Get",
"Route",
"53",
"Hosted",
"Zone",
"IDs",
"for",
"_env_",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/dns.py#L31-L56 |
6,183 | foremast/foremast | src/foremast/utils/dns.py | update_dns_zone_record | def update_dns_zone_record(env, zone_id, **kwargs):
"""Create a Route53 CNAME record in _env_ zone.
Args:
env (str): Deployment environment.
zone_id (str): Route53 zone id.
Keyword Args:
dns_name (str): FQDN of application's dns entry to add/update.
dns_name_aws (str): FQDN... | python | def update_dns_zone_record(env, zone_id, **kwargs):
"""Create a Route53 CNAME record in _env_ zone.
Args:
env (str): Deployment environment.
zone_id (str): Route53 zone id.
Keyword Args:
dns_name (str): FQDN of application's dns entry to add/update.
dns_name_aws (str): FQDN... | [
"def",
"update_dns_zone_record",
"(",
"env",
",",
"zone_id",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"boto3",
".",
"Session",
"(",
"profile_name",
"=",
"env",
")",
".",
"client",
"(",
"'route53'",
")",
"response",
"=",
"{",
"}",
"hosted_zone_in... | Create a Route53 CNAME record in _env_ zone.
Args:
env (str): Deployment environment.
zone_id (str): Route53 zone id.
Keyword Args:
dns_name (str): FQDN of application's dns entry to add/update.
dns_name_aws (str): FQDN of AWS resource
dns_ttl (int): DNS time-to-live (t... | [
"Create",
"a",
"Route53",
"CNAME",
"record",
"in",
"_env_",
"zone",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/dns.py#L59-L96 |
6,184 | foremast/foremast | src/foremast/utils/dns.py | find_existing_record | def find_existing_record(env, zone_id, dns_name, check_key=None, check_value=None):
"""Check if a specific DNS record exists.
Args:
env (str): Deployment environment.
zone_id (str): Route53 zone id.
dns_name (str): FQDN of application's dns entry to add/update.
check_key(str): K... | python | def find_existing_record(env, zone_id, dns_name, check_key=None, check_value=None):
"""Check if a specific DNS record exists.
Args:
env (str): Deployment environment.
zone_id (str): Route53 zone id.
dns_name (str): FQDN of application's dns entry to add/update.
check_key(str): K... | [
"def",
"find_existing_record",
"(",
"env",
",",
"zone_id",
",",
"dns_name",
",",
"check_key",
"=",
"None",
",",
"check_value",
"=",
"None",
")",
":",
"client",
"=",
"boto3",
".",
"Session",
"(",
"profile_name",
"=",
"env",
")",
".",
"client",
"(",
"'rout... | Check if a specific DNS record exists.
Args:
env (str): Deployment environment.
zone_id (str): Route53 zone id.
dns_name (str): FQDN of application's dns entry to add/update.
check_key(str): Key to look for in record. Example: "Type"
check_value(str): Value to look for with ... | [
"Check",
"if",
"a",
"specific",
"DNS",
"record",
"exists",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/dns.py#L99-L123 |
6,185 | foremast/foremast | src/foremast/utils/dns.py | delete_existing_cname | def delete_existing_cname(env, zone_id, dns_name):
"""Delete an existing CNAME record.
This is used when updating to multi-region for deleting old records. The
record can not just be upserted since it changes types.
Args:
env (str): Deployment environment.
zone_id (str): Route53 zone i... | python | def delete_existing_cname(env, zone_id, dns_name):
"""Delete an existing CNAME record.
This is used when updating to multi-region for deleting old records. The
record can not just be upserted since it changes types.
Args:
env (str): Deployment environment.
zone_id (str): Route53 zone i... | [
"def",
"delete_existing_cname",
"(",
"env",
",",
"zone_id",
",",
"dns_name",
")",
":",
"client",
"=",
"boto3",
".",
"Session",
"(",
"profile_name",
"=",
"env",
")",
".",
"client",
"(",
"'route53'",
")",
"startrecord",
"=",
"None",
"newrecord_name",
"=",
"d... | Delete an existing CNAME record.
This is used when updating to multi-region for deleting old records. The
record can not just be upserted since it changes types.
Args:
env (str): Deployment environment.
zone_id (str): Route53 zone id.
dns_name (str): FQDN of application's dns entry... | [
"Delete",
"an",
"existing",
"CNAME",
"record",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/dns.py#L126-L148 |
6,186 | foremast/foremast | src/foremast/utils/dns.py | update_failover_dns_record | def update_failover_dns_record(env, zone_id, **kwargs):
"""Create a Failover Route53 alias record in _env_ zone.
Args:
env (str): Deployment environment.
zone_id (str): Route53 zone id.
Keyword Args:
dns_name (str): FQDN of application's dns entry to add/update.
dns_ttl (in... | python | def update_failover_dns_record(env, zone_id, **kwargs):
"""Create a Failover Route53 alias record in _env_ zone.
Args:
env (str): Deployment environment.
zone_id (str): Route53 zone id.
Keyword Args:
dns_name (str): FQDN of application's dns entry to add/update.
dns_ttl (in... | [
"def",
"update_failover_dns_record",
"(",
"env",
",",
"zone_id",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"boto3",
".",
"Session",
"(",
"profile_name",
"=",
"env",
")",
".",
"client",
"(",
"'route53'",
")",
"response",
"=",
"{",
"}",
"hosted_zon... | Create a Failover Route53 alias record in _env_ zone.
Args:
env (str): Deployment environment.
zone_id (str): Route53 zone id.
Keyword Args:
dns_name (str): FQDN of application's dns entry to add/update.
dns_ttl (int): DNS time-to-live (ttl)
elb_aws_dns (str): DNS A Rec... | [
"Create",
"a",
"Failover",
"Route53",
"alias",
"record",
"in",
"_env_",
"zone",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/dns.py#L151-L198 |
6,187 | foremast/foremast | src/foremast/awslambda/cloudwatch_log_event/cloudwatch_log_event.py | create_cloudwatch_log_event | def create_cloudwatch_log_event(app_name, env, region, rules):
"""Create cloudwatch log 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 (str): ... | python | def create_cloudwatch_log_event(app_name, env, region, rules):
"""Create cloudwatch log 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 (str): ... | [
"def",
"create_cloudwatch_log_event",
"(",
"app_name",
",",
"env",
",",
"region",
",",
"rules",
")",
":",
"session",
"=",
"boto3",
".",
"Session",
"(",
"profile_name",
"=",
"env",
",",
"region_name",
"=",
"region",
")",
"cloudwatch_client",
"=",
"session",
"... | Create cloudwatch log 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 (str): Trigger rules from the settings | [
"Create",
"cloudwatch",
"log",
"event",
"for",
"lambda",
"from",
"rules",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/cloudwatch_log_event/cloudwatch_log_event.py#L28-L75 |
6,188 | foremast/foremast | src/foremast/autoscaling_policy/create_policy.py | AutoScalingPolicy.prepare_policy_template | def prepare_policy_template(self, scaling_type, period_sec, server_group):
"""Renders scaling policy templates based on configs and variables.
After rendering, POSTs the json to Spinnaker for creation.
Args:
scaling_type (str): ``scale_up`` or ``scaling_down``. Type of policy
... | python | def prepare_policy_template(self, scaling_type, period_sec, server_group):
"""Renders scaling policy templates based on configs and variables.
After rendering, POSTs the json to Spinnaker for creation.
Args:
scaling_type (str): ``scale_up`` or ``scaling_down``. Type of policy
... | [
"def",
"prepare_policy_template",
"(",
"self",
",",
"scaling_type",
",",
"period_sec",
",",
"server_group",
")",
":",
"template_kwargs",
"=",
"{",
"'app'",
":",
"self",
".",
"app",
",",
"'env'",
":",
"self",
".",
"env",
",",
"'region'",
":",
"self",
".",
... | Renders scaling policy templates based on configs and variables.
After rendering, POSTs the json to Spinnaker for creation.
Args:
scaling_type (str): ``scale_up`` or ``scaling_down``. Type of policy
period_sec (int): Period of time to look at metrics for determining scale
... | [
"Renders",
"scaling",
"policy",
"templates",
"based",
"on",
"configs",
"and",
"variables",
".",
"After",
"rendering",
"POSTs",
"the",
"json",
"to",
"Spinnaker",
"for",
"creation",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/autoscaling_policy/create_policy.py#L56-L88 |
6,189 | foremast/foremast | src/foremast/autoscaling_policy/create_policy.py | AutoScalingPolicy.create_policy | def create_policy(self):
"""Wrapper function. Gets the server group, sets sane defaults,
deletes existing policies, and then runs self.prepare_policy_template
for scaling up and scaling down policies.
This function acts as the main driver for the scaling policy creationprocess
""... | python | def create_policy(self):
"""Wrapper function. Gets the server group, sets sane defaults,
deletes existing policies, and then runs self.prepare_policy_template
for scaling up and scaling down policies.
This function acts as the main driver for the scaling policy creationprocess
""... | [
"def",
"create_policy",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"settings",
"[",
"'asg'",
"]",
"[",
"'scaling_policy'",
"]",
":",
"self",
".",
"log",
".",
"info",
"(",
"\"No scaling policy found, skipping...\"",
")",
"return",
"server_group",
"=",
"... | Wrapper function. Gets the server group, sets sane defaults,
deletes existing policies, and then runs self.prepare_policy_template
for scaling up and scaling down policies.
This function acts as the main driver for the scaling policy creationprocess | [
"Wrapper",
"function",
".",
"Gets",
"the",
"server",
"group",
"sets",
"sane",
"defaults",
"deletes",
"existing",
"policies",
"and",
"then",
"runs",
"self",
".",
"prepare_policy_template",
"for",
"scaling",
"up",
"and",
"scaling",
"down",
"policies",
".",
"This",... | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/autoscaling_policy/create_policy.py#L90-L115 |
6,190 | foremast/foremast | src/foremast/autoscaling_policy/create_policy.py | AutoScalingPolicy.get_server_group | def get_server_group(self):
"""Finds the most recently deployed server group for the application.
This is the server group that the scaling policy will be applied to.
Returns:
server_group (str): Name of the newest server group
"""
api_url = "{0}/applications/{1}".fo... | python | def get_server_group(self):
"""Finds the most recently deployed server group for the application.
This is the server group that the scaling policy will be applied to.
Returns:
server_group (str): Name of the newest server group
"""
api_url = "{0}/applications/{1}".fo... | [
"def",
"get_server_group",
"(",
"self",
")",
":",
"api_url",
"=",
"\"{0}/applications/{1}\"",
".",
"format",
"(",
"API_URL",
",",
"self",
".",
"app",
")",
"response",
"=",
"requests",
".",
"get",
"(",
"api_url",
",",
"verify",
"=",
"GATE_CA_BUNDLE",
",",
"... | Finds the most recently deployed server group for the application.
This is the server group that the scaling policy will be applied to.
Returns:
server_group (str): Name of the newest server group | [
"Finds",
"the",
"most",
"recently",
"deployed",
"server",
"group",
"for",
"the",
"application",
".",
"This",
"is",
"the",
"server",
"group",
"that",
"the",
"scaling",
"policy",
"will",
"be",
"applied",
"to",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/autoscaling_policy/create_policy.py#L117-L127 |
6,191 | foremast/foremast | src/foremast/autoscaling_policy/create_policy.py | AutoScalingPolicy.delete_existing_policy | def delete_existing_policy(self, scaling_policy, server_group):
"""Given a scaling_policy and server_group, deletes the existing scaling_policy.
Scaling policies need to be deleted instead of upserted for consistency.
Args:
scaling_policy (json): the scaling_policy json from Spinnak... | python | def delete_existing_policy(self, scaling_policy, server_group):
"""Given a scaling_policy and server_group, deletes the existing scaling_policy.
Scaling policies need to be deleted instead of upserted for consistency.
Args:
scaling_policy (json): the scaling_policy json from Spinnak... | [
"def",
"delete_existing_policy",
"(",
"self",
",",
"scaling_policy",
",",
"server_group",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"\"Deleting policy %s on %s\"",
",",
"scaling_policy",
"[",
"'policyName'",
"]",
",",
"server_group",
")",
"delete_dict",
"=",... | Given a scaling_policy and server_group, deletes the existing scaling_policy.
Scaling policies need to be deleted instead of upserted for consistency.
Args:
scaling_policy (json): the scaling_policy json from Spinnaker that should be deleted
server_group (str): the affected serv... | [
"Given",
"a",
"scaling_policy",
"and",
"server_group",
"deletes",
"the",
"existing",
"scaling_policy",
".",
"Scaling",
"policies",
"need",
"to",
"be",
"deleted",
"instead",
"of",
"upserted",
"for",
"consistency",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/autoscaling_policy/create_policy.py#L129-L153 |
6,192 | foremast/foremast | src/foremast/autoscaling_policy/create_policy.py | AutoScalingPolicy.get_all_existing | def get_all_existing(self, server_group):
"""Finds all existing scaling policies for an application
Returns:
scalingpolicies (list): List of all existing scaling policies for the application
"""
self.log.info("Checking for existing scaling policy")
url = "{0}/applica... | python | def get_all_existing(self, server_group):
"""Finds all existing scaling policies for an application
Returns:
scalingpolicies (list): List of all existing scaling policies for the application
"""
self.log.info("Checking for existing scaling policy")
url = "{0}/applica... | [
"def",
"get_all_existing",
"(",
"self",
",",
"server_group",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"\"Checking for existing scaling policy\"",
")",
"url",
"=",
"\"{0}/applications/{1}/clusters/{2}/{1}/serverGroups\"",
".",
"format",
"(",
"API_URL",
",",
"sel... | Finds all existing scaling policies for an application
Returns:
scalingpolicies (list): List of all existing scaling policies for the application | [
"Finds",
"all",
"existing",
"scaling",
"policies",
"for",
"an",
"application"
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/autoscaling_policy/create_policy.py#L155-L172 |
6,193 | foremast/foremast | src/foremast/awslambda/cloudwatch_event/destroy_cloudwatch_event/destroy_cloudwatch_event.py | destroy_cloudwatch_event | def destroy_cloudwatch_event(app='', env='dev', region=''):
"""Destroy Cloudwatch event subscription.
Args:
app (str): Spinnaker Application name.
env (str): Deployment environment.
region (str): AWS region.
Returns:
bool: True upon successful completion.
"""
sessio... | python | def destroy_cloudwatch_event(app='', env='dev', region=''):
"""Destroy Cloudwatch event subscription.
Args:
app (str): Spinnaker Application name.
env (str): Deployment environment.
region (str): AWS region.
Returns:
bool: True upon successful completion.
"""
sessio... | [
"def",
"destroy_cloudwatch_event",
"(",
"app",
"=",
"''",
",",
"env",
"=",
"'dev'",
",",
"region",
"=",
"''",
")",
":",
"session",
"=",
"boto3",
".",
"Session",
"(",
"profile_name",
"=",
"env",
",",
"region_name",
"=",
"region",
")",
"cloudwatch_client",
... | Destroy Cloudwatch event subscription.
Args:
app (str): Spinnaker Application name.
env (str): Deployment environment.
region (str): AWS region.
Returns:
bool: True upon successful completion. | [
"Destroy",
"Cloudwatch",
"event",
"subscription",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/cloudwatch_event/destroy_cloudwatch_event/destroy_cloudwatch_event.py#L26-L45 |
6,194 | foremast/foremast | src/foremast/s3/s3apps.py | S3Apps.create_bucket | def create_bucket(self):
"""Create or update bucket based on app name."""
bucket_exists = self._bucket_exists()
if self.s3props.get('shared_bucket_target'):
if bucket_exists:
LOG.info('App uses shared bucket - %s ', self.bucket)
else:
LOG.e... | python | def create_bucket(self):
"""Create or update bucket based on app name."""
bucket_exists = self._bucket_exists()
if self.s3props.get('shared_bucket_target'):
if bucket_exists:
LOG.info('App uses shared bucket - %s ', self.bucket)
else:
LOG.e... | [
"def",
"create_bucket",
"(",
"self",
")",
":",
"bucket_exists",
"=",
"self",
".",
"_bucket_exists",
"(",
")",
"if",
"self",
".",
"s3props",
".",
"get",
"(",
"'shared_bucket_target'",
")",
":",
"if",
"bucket_exists",
":",
"LOG",
".",
"info",
"(",
"'App uses... | Create or update bucket based on app name. | [
"Create",
"or",
"update",
"bucket",
"based",
"on",
"app",
"name",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/s3apps.py#L65-L92 |
6,195 | foremast/foremast | src/foremast/s3/s3apps.py | S3Apps._bucket_exists | def _bucket_exists(self):
"""Check if the bucket exists."""
try:
self.s3client.get_bucket_location(Bucket=self.bucket)
return True
except ClientError as error:
LOG.error(error)
return False | python | def _bucket_exists(self):
"""Check if the bucket exists."""
try:
self.s3client.get_bucket_location(Bucket=self.bucket)
return True
except ClientError as error:
LOG.error(error)
return False | [
"def",
"_bucket_exists",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"s3client",
".",
"get_bucket_location",
"(",
"Bucket",
"=",
"self",
".",
"bucket",
")",
"return",
"True",
"except",
"ClientError",
"as",
"error",
":",
"LOG",
".",
"error",
"(",
"err... | Check if the bucket exists. | [
"Check",
"if",
"the",
"bucket",
"exists",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/s3apps.py#L94-L101 |
6,196 | foremast/foremast | src/foremast/s3/s3apps.py | S3Apps._put_bucket_policy | def _put_bucket_policy(self):
"""Attach a bucket policy to app bucket."""
if self.s3props['bucket_policy']:
policy_str = json.dumps(self.s3props['bucket_policy'])
_response = self.s3client.put_bucket_policy(Bucket=self.bucket, Policy=policy_str)
else:
_respons... | python | def _put_bucket_policy(self):
"""Attach a bucket policy to app bucket."""
if self.s3props['bucket_policy']:
policy_str = json.dumps(self.s3props['bucket_policy'])
_response = self.s3client.put_bucket_policy(Bucket=self.bucket, Policy=policy_str)
else:
_respons... | [
"def",
"_put_bucket_policy",
"(",
"self",
")",
":",
"if",
"self",
".",
"s3props",
"[",
"'bucket_policy'",
"]",
":",
"policy_str",
"=",
"json",
".",
"dumps",
"(",
"self",
".",
"s3props",
"[",
"'bucket_policy'",
"]",
")",
"_response",
"=",
"self",
".",
"s3... | Attach a bucket policy to app bucket. | [
"Attach",
"a",
"bucket",
"policy",
"to",
"app",
"bucket",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/s3apps.py#L103-L111 |
6,197 | foremast/foremast | src/foremast/s3/s3apps.py | S3Apps._put_bucket_website | def _put_bucket_website(self):
"""Configure static website on S3 bucket."""
if self.s3props['website']['enabled']:
website_config = {
'ErrorDocument': {
'Key': self.s3props['website']['error_document']
},
'IndexDocument': {
... | python | def _put_bucket_website(self):
"""Configure static website on S3 bucket."""
if self.s3props['website']['enabled']:
website_config = {
'ErrorDocument': {
'Key': self.s3props['website']['error_document']
},
'IndexDocument': {
... | [
"def",
"_put_bucket_website",
"(",
"self",
")",
":",
"if",
"self",
".",
"s3props",
"[",
"'website'",
"]",
"[",
"'enabled'",
"]",
":",
"website_config",
"=",
"{",
"'ErrorDocument'",
":",
"{",
"'Key'",
":",
"self",
".",
"s3props",
"[",
"'website'",
"]",
"[... | Configure static website on S3 bucket. | [
"Configure",
"static",
"website",
"on",
"S3",
"bucket",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/s3apps.py#L113-L131 |
6,198 | foremast/foremast | src/foremast/s3/s3apps.py | S3Apps._set_bucket_dns | def _set_bucket_dns(self):
"""Create CNAME for S3 endpoint."""
# Different regions have different s3 endpoint formats
dotformat_regions = ["eu-west-2", "eu-central-1", "ap-northeast-2", "ap-south-1", "ca-central-1", "us-east-2"]
if self.region in dotformat_regions:
s3_endpoin... | python | def _set_bucket_dns(self):
"""Create CNAME for S3 endpoint."""
# Different regions have different s3 endpoint formats
dotformat_regions = ["eu-west-2", "eu-central-1", "ap-northeast-2", "ap-south-1", "ca-central-1", "us-east-2"]
if self.region in dotformat_regions:
s3_endpoin... | [
"def",
"_set_bucket_dns",
"(",
"self",
")",
":",
"# Different regions have different s3 endpoint formats",
"dotformat_regions",
"=",
"[",
"\"eu-west-2\"",
",",
"\"eu-central-1\"",
",",
"\"ap-northeast-2\"",
",",
"\"ap-south-1\"",
",",
"\"ca-central-1\"",
",",
"\"us-east-2\"",... | Create CNAME for S3 endpoint. | [
"Create",
"CNAME",
"for",
"S3",
"endpoint",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/s3apps.py#L133-L152 |
6,199 | foremast/foremast | src/foremast/s3/s3apps.py | S3Apps._put_bucket_cors | def _put_bucket_cors(self):
"""Adds bucket cors configuration."""
if self.s3props['cors']['enabled'] and self.s3props['website']['enabled']:
cors_config = {}
cors_rules = []
for each_rule in self.s3props['cors']['cors_rules']:
cors_rules.append({
... | python | def _put_bucket_cors(self):
"""Adds bucket cors configuration."""
if self.s3props['cors']['enabled'] and self.s3props['website']['enabled']:
cors_config = {}
cors_rules = []
for each_rule in self.s3props['cors']['cors_rules']:
cors_rules.append({
... | [
"def",
"_put_bucket_cors",
"(",
"self",
")",
":",
"if",
"self",
".",
"s3props",
"[",
"'cors'",
"]",
"[",
"'enabled'",
"]",
"and",
"self",
".",
"s3props",
"[",
"'website'",
"]",
"[",
"'enabled'",
"]",
":",
"cors_config",
"=",
"{",
"}",
"cors_rules",
"="... | Adds bucket cors configuration. | [
"Adds",
"bucket",
"cors",
"configuration",
"."
] | fb70f29b8ce532f061685a17d120486e47b215ba | https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/s3apps.py#L154-L175 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.