repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
Miserlou/Zappa
zappa/utilities.py
contains_python_files_or_subdirs
def contains_python_files_or_subdirs(folder): """ Checks (recursively) if the directory contains .py or .pyc files """ for root, dirs, files in os.walk(folder): if [filename for filename in files if filename.endswith('.py') or filename.endswith('.pyc')]: return True for d in...
python
def contains_python_files_or_subdirs(folder): """ Checks (recursively) if the directory contains .py or .pyc files """ for root, dirs, files in os.walk(folder): if [filename for filename in files if filename.endswith('.py') or filename.endswith('.pyc')]: return True for d in...
[ "def", "contains_python_files_or_subdirs", "(", "folder", ")", ":", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "folder", ")", ":", "if", "[", "filename", "for", "filename", "in", "files", "if", "filename", ".", "endswith", "(...
Checks (recursively) if the directory contains .py or .pyc files
[ "Checks", "(", "recursively", ")", "if", "the", "directory", "contains", ".", "py", "or", ".", "pyc", "files" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/utilities.py#L493-L506
train
Miserlou/Zappa
zappa/utilities.py
conflicts_with_a_neighbouring_module
def conflicts_with_a_neighbouring_module(directory_path): """ Checks if a directory lies in the same directory as a .py file with the same name. """ parent_dir_path, current_dir_name = os.path.split(os.path.normpath(directory_path)) neighbours = os.listdir(parent_dir_path) conflicting_neighbour_...
python
def conflicts_with_a_neighbouring_module(directory_path): """ Checks if a directory lies in the same directory as a .py file with the same name. """ parent_dir_path, current_dir_name = os.path.split(os.path.normpath(directory_path)) neighbours = os.listdir(parent_dir_path) conflicting_neighbour_...
[ "def", "conflicts_with_a_neighbouring_module", "(", "directory_path", ")", ":", "parent_dir_path", ",", "current_dir_name", "=", "os", ".", "path", ".", "split", "(", "os", ".", "path", ".", "normpath", "(", "directory_path", ")", ")", "neighbours", "=", "os", ...
Checks if a directory lies in the same directory as a .py file with the same name.
[ "Checks", "if", "a", "directory", "lies", "in", "the", "same", "directory", "as", "a", ".", "py", "file", "with", "the", "same", "name", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/utilities.py#L509-L516
train
Miserlou/Zappa
zappa/utilities.py
is_valid_bucket_name
def is_valid_bucket_name(name): """ Checks if an S3 bucket name is valid according to https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html#bucketnamingrules """ # Bucket names must be at least 3 and no more than 63 characters long. if (len(name) < 3 or len(name) > 63): ret...
python
def is_valid_bucket_name(name): """ Checks if an S3 bucket name is valid according to https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html#bucketnamingrules """ # Bucket names must be at least 3 and no more than 63 characters long. if (len(name) < 3 or len(name) > 63): ret...
[ "def", "is_valid_bucket_name", "(", "name", ")", ":", "# Bucket names must be at least 3 and no more than 63 characters long.", "if", "(", "len", "(", "name", ")", "<", "3", "or", "len", "(", "name", ")", ">", "63", ")", ":", "return", "False", "# Bucket names mus...
Checks if an S3 bucket name is valid according to https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html#bucketnamingrules
[ "Checks", "if", "an", "S3", "bucket", "name", "is", "valid", "according", "to", "https", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "AmazonS3", "/", "latest", "/", "dev", "/", "BucketRestrictions", ".", "html#bucketnamingrules" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/utilities.py#L528-L561
train
Miserlou/Zappa
zappa/utilities.py
merge_headers
def merge_headers(event): """ Merge the values of headers and multiValueHeaders into a single dict. Opens up support for multivalue headers via API Gateway and ALB. See: https://github.com/Miserlou/Zappa/pull/1756 """ headers = event.get('headers') or {} multi_headers = (event.get('multiValu...
python
def merge_headers(event): """ Merge the values of headers and multiValueHeaders into a single dict. Opens up support for multivalue headers via API Gateway and ALB. See: https://github.com/Miserlou/Zappa/pull/1756 """ headers = event.get('headers') or {} multi_headers = (event.get('multiValu...
[ "def", "merge_headers", "(", "event", ")", ":", "headers", "=", "event", ".", "get", "(", "'headers'", ")", "or", "{", "}", "multi_headers", "=", "(", "event", ".", "get", "(", "'multiValueHeaders'", ")", "or", "{", "}", ")", ".", "copy", "(", ")", ...
Merge the values of headers and multiValueHeaders into a single dict. Opens up support for multivalue headers via API Gateway and ALB. See: https://github.com/Miserlou/Zappa/pull/1756
[ "Merge", "the", "values", "of", "headers", "and", "multiValueHeaders", "into", "a", "single", "dict", ".", "Opens", "up", "support", "for", "multivalue", "headers", "via", "API", "Gateway", "and", "ALB", ".", "See", ":", "https", ":", "//", "github", ".", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/utilities.py#L564-L577
train
Miserlou/Zappa
zappa/wsgi.py
create_wsgi_request
def create_wsgi_request(event_info, server_name='zappa', script_name=None, trailing_slash=True, binary_support=False, base_path=None, context_header_mappings={}, ...
python
def create_wsgi_request(event_info, server_name='zappa', script_name=None, trailing_slash=True, binary_support=False, base_path=None, context_header_mappings={}, ...
[ "def", "create_wsgi_request", "(", "event_info", ",", "server_name", "=", "'zappa'", ",", "script_name", "=", "None", ",", "trailing_slash", "=", "True", ",", "binary_support", "=", "False", ",", "base_path", "=", "None", ",", "context_header_mappings", "=", "{"...
Given some event_info via API Gateway, create and return a valid WSGI request environ.
[ "Given", "some", "event_info", "via", "API", "Gateway", "create", "and", "return", "a", "valid", "WSGI", "request", "environ", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/wsgi.py#L30-L168
train
Miserlou/Zappa
zappa/wsgi.py
common_log
def common_log(environ, response, response_time=None): """ Given the WSGI environ and the response, log this event in Common Log Format. """ logger = logging.getLogger() if response_time: formatter = ApacheFormatter(with_response_time=True) try: log_entry = formatt...
python
def common_log(environ, response, response_time=None): """ Given the WSGI environ and the response, log this event in Common Log Format. """ logger = logging.getLogger() if response_time: formatter = ApacheFormatter(with_response_time=True) try: log_entry = formatt...
[ "def", "common_log", "(", "environ", ",", "response", ",", "response_time", "=", "None", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", ")", "if", "response_time", ":", "formatter", "=", "ApacheFormatter", "(", "with_response_time", "=", "True", ...
Given the WSGI environ and the response, log this event in Common Log Format.
[ "Given", "the", "WSGI", "environ", "and", "the", "response", "log", "this", "event", "in", "Common", "Log", "Format", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/wsgi.py#L171-L196
train
Miserlou/Zappa
zappa/handler.py
LambdaHandler.load_remote_project_archive
def load_remote_project_archive(self, project_zip_path): """ Puts the project files from S3 in /tmp and adds to path """ project_folder = '/tmp/{0!s}'.format(self.settings.PROJECT_NAME) if not os.path.isdir(project_folder): # The project folder doesn't exist in this c...
python
def load_remote_project_archive(self, project_zip_path): """ Puts the project files from S3 in /tmp and adds to path """ project_folder = '/tmp/{0!s}'.format(self.settings.PROJECT_NAME) if not os.path.isdir(project_folder): # The project folder doesn't exist in this c...
[ "def", "load_remote_project_archive", "(", "self", ",", "project_zip_path", ")", ":", "project_folder", "=", "'/tmp/{0!s}'", ".", "format", "(", "self", ".", "settings", ".", "PROJECT_NAME", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "project_fold...
Puts the project files from S3 in /tmp and adds to path
[ "Puts", "the", "project", "files", "from", "S3", "in", "/", "tmp", "and", "adds", "to", "path" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/handler.py#L156-L182
train
Miserlou/Zappa
zappa/handler.py
LambdaHandler.load_remote_settings
def load_remote_settings(self, remote_bucket, remote_file): """ Attempt to read a file from s3 containing a flat json object. Adds each key->value pair as environment variables. Helpful for keeping sensitiZve or stage-specific configuration variables in s3 instead of version cont...
python
def load_remote_settings(self, remote_bucket, remote_file): """ Attempt to read a file from s3 containing a flat json object. Adds each key->value pair as environment variables. Helpful for keeping sensitiZve or stage-specific configuration variables in s3 instead of version cont...
[ "def", "load_remote_settings", "(", "self", ",", "remote_bucket", ",", "remote_file", ")", ":", "if", "not", "self", ".", "session", ":", "boto_session", "=", "boto3", ".", "Session", "(", ")", "else", ":", "boto_session", "=", "self", ".", "session", "s3"...
Attempt to read a file from s3 containing a flat json object. Adds each key->value pair as environment variables. Helpful for keeping sensitiZve or stage-specific configuration variables in s3 instead of version control.
[ "Attempt", "to", "read", "a", "file", "from", "s3", "containing", "a", "flat", "json", "object", ".", "Adds", "each", "key", "-", ">", "value", "pair", "as", "environment", "variables", ".", "Helpful", "for", "keeping", "sensitiZve", "or", "stage", "-", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/handler.py#L184-L230
train
Miserlou/Zappa
zappa/handler.py
LambdaHandler.import_module_and_get_function
def import_module_and_get_function(whole_function): """ Given a modular path to a function, import that module and return the function. """ module, function = whole_function.rsplit('.', 1) app_module = importlib.import_module(module) app_function = getattr(app_mod...
python
def import_module_and_get_function(whole_function): """ Given a modular path to a function, import that module and return the function. """ module, function = whole_function.rsplit('.', 1) app_module = importlib.import_module(module) app_function = getattr(app_mod...
[ "def", "import_module_and_get_function", "(", "whole_function", ")", ":", "module", ",", "function", "=", "whole_function", ".", "rsplit", "(", "'.'", ",", "1", ")", "app_module", "=", "importlib", ".", "import_module", "(", "module", ")", "app_function", "=", ...
Given a modular path to a function, import that module and return the function.
[ "Given", "a", "modular", "path", "to", "a", "function", "import", "that", "module", "and", "return", "the", "function", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/handler.py#L233-L241
train
Miserlou/Zappa
zappa/handler.py
LambdaHandler.run_function
def run_function(app_function, event, context): """ Given a function and event context, detect signature and execute, returning any result. """ # getargspec does not support python 3 method with type hints # Related issue: https://github.com/Miserlou/Zappa/issues/1452 ...
python
def run_function(app_function, event, context): """ Given a function and event context, detect signature and execute, returning any result. """ # getargspec does not support python 3 method with type hints # Related issue: https://github.com/Miserlou/Zappa/issues/1452 ...
[ "def", "run_function", "(", "app_function", ",", "event", ",", "context", ")", ":", "# getargspec does not support python 3 method with type hints", "# Related issue: https://github.com/Miserlou/Zappa/issues/1452", "if", "hasattr", "(", "inspect", ",", "\"getfullargspec\"", ")", ...
Given a function and event context, detect signature and execute, returning any result.
[ "Given", "a", "function", "and", "event", "context", "detect", "signature", "and", "execute", "returning", "any", "result", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/handler.py#L270-L291
train
Miserlou/Zappa
zappa/handler.py
LambdaHandler.get_function_for_aws_event
def get_function_for_aws_event(self, record): """ Get the associated function to execute for a triggered AWS event Support S3, SNS, DynamoDB, kinesis and SQS events """ if 's3' in record: if ':' in record['s3']['configurationId']: return record['s3'][...
python
def get_function_for_aws_event(self, record): """ Get the associated function to execute for a triggered AWS event Support S3, SNS, DynamoDB, kinesis and SQS events """ if 's3' in record: if ':' in record['s3']['configurationId']: return record['s3'][...
[ "def", "get_function_for_aws_event", "(", "self", ",", "record", ")", ":", "if", "'s3'", "in", "record", ":", "if", "':'", "in", "record", "[", "'s3'", "]", "[", "'configurationId'", "]", ":", "return", "record", "[", "'s3'", "]", "[", "'configurationId'",...
Get the associated function to execute for a triggered AWS event Support S3, SNS, DynamoDB, kinesis and SQS events
[ "Get", "the", "associated", "function", "to", "execute", "for", "a", "triggered", "AWS", "event" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/handler.py#L293-L322
train
Miserlou/Zappa
zappa/handler.py
LambdaHandler.get_function_from_bot_intent_trigger
def get_function_from_bot_intent_trigger(self, event): """ For the given event build ARN and return the configured function """ intent = event.get('currentIntent') if intent: intent = intent.get('name') if intent: return self.settings.AWS_B...
python
def get_function_from_bot_intent_trigger(self, event): """ For the given event build ARN and return the configured function """ intent = event.get('currentIntent') if intent: intent = intent.get('name') if intent: return self.settings.AWS_B...
[ "def", "get_function_from_bot_intent_trigger", "(", "self", ",", "event", ")", ":", "intent", "=", "event", ".", "get", "(", "'currentIntent'", ")", "if", "intent", ":", "intent", "=", "intent", ".", "get", "(", "'name'", ")", "if", "intent", ":", "return"...
For the given event build ARN and return the configured function
[ "For", "the", "given", "event", "build", "ARN", "and", "return", "the", "configured", "function" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/handler.py#L324-L334
train
Miserlou/Zappa
zappa/handler.py
LambdaHandler.get_function_for_cognito_trigger
def get_function_for_cognito_trigger(self, trigger): """ Get the associated function to execute for a cognito trigger """ print("get_function_for_cognito_trigger", self.settings.COGNITO_TRIGGER_MAPPING, trigger, self.settings.COGNITO_TRIGGER_MAPPING.get(trigger)) return self.sett...
python
def get_function_for_cognito_trigger(self, trigger): """ Get the associated function to execute for a cognito trigger """ print("get_function_for_cognito_trigger", self.settings.COGNITO_TRIGGER_MAPPING, trigger, self.settings.COGNITO_TRIGGER_MAPPING.get(trigger)) return self.sett...
[ "def", "get_function_for_cognito_trigger", "(", "self", ",", "trigger", ")", ":", "print", "(", "\"get_function_for_cognito_trigger\"", ",", "self", ".", "settings", ".", "COGNITO_TRIGGER_MAPPING", ",", "trigger", ",", "self", ".", "settings", ".", "COGNITO_TRIGGER_MA...
Get the associated function to execute for a cognito trigger
[ "Get", "the", "associated", "function", "to", "execute", "for", "a", "cognito", "trigger" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/handler.py#L336-L341
train
Miserlou/Zappa
zappa/handler.py
LambdaHandler.handler
def handler(self, event, context): """ An AWS Lambda function which parses specific API Gateway input into a WSGI request, feeds it to our WSGI app, procceses the response, and returns that back to the API Gateway. """ settings = self.settings # If in DEBUG mode...
python
def handler(self, event, context): """ An AWS Lambda function which parses specific API Gateway input into a WSGI request, feeds it to our WSGI app, procceses the response, and returns that back to the API Gateway. """ settings = self.settings # If in DEBUG mode...
[ "def", "handler", "(", "self", ",", "event", ",", "context", ")", ":", "settings", "=", "self", ".", "settings", "# If in DEBUG mode, log all raw incoming events.", "if", "settings", ".", "DEBUG", ":", "logger", ".", "debug", "(", "'Zappa Event: {}'", ".", "form...
An AWS Lambda function which parses specific API Gateway input into a WSGI request, feeds it to our WSGI app, procceses the response, and returns that back to the API Gateway.
[ "An", "AWS", "Lambda", "function", "which", "parses", "specific", "API", "Gateway", "input", "into", "a", "WSGI", "request", "feeds", "it", "to", "our", "WSGI", "app", "procceses", "the", "response", "and", "returns", "that", "back", "to", "the", "API", "G...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/handler.py#L343-L598
train
Miserlou/Zappa
example/authmodule.py
lambda_handler
def lambda_handler(event, context): print("Client token: " + event['authorizationToken']) print("Method ARN: " + event['methodArn']) """validate the incoming token""" """and produce the principal user identifier associated with the token""" """this could be accomplished in a number of ways:""" ...
python
def lambda_handler(event, context): print("Client token: " + event['authorizationToken']) print("Method ARN: " + event['methodArn']) """validate the incoming token""" """and produce the principal user identifier associated with the token""" """this could be accomplished in a number of ways:""" ...
[ "def", "lambda_handler", "(", "event", ",", "context", ")", ":", "print", "(", "\"Client token: \"", "+", "event", "[", "'authorizationToken'", "]", ")", "print", "(", "\"Method ARN: \"", "+", "event", "[", "'methodArn'", "]", ")", "\"\"\"and produce the principal...
validate the incoming token
[ "validate", "the", "incoming", "token" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/example/authmodule.py#L15-L61
train
Miserlou/Zappa
example/authmodule.py
AuthPolicy._addMethod
def _addMethod(self, effect, verb, resource, conditions): """Adds a method to the internal lists of allowed or denied methods. Each object in the internal list contains a resource ARN and a condition statement. The condition statement can be null.""" if verb != "*" and not hasattr(HttpVe...
python
def _addMethod(self, effect, verb, resource, conditions): """Adds a method to the internal lists of allowed or denied methods. Each object in the internal list contains a resource ARN and a condition statement. The condition statement can be null.""" if verb != "*" and not hasattr(HttpVe...
[ "def", "_addMethod", "(", "self", ",", "effect", ",", "verb", ",", "resource", ",", "conditions", ")", ":", "if", "verb", "!=", "\"*\"", "and", "not", "hasattr", "(", "HttpVerb", ",", "verb", ")", ":", "raise", "NameError", "(", "\"Invalid HTTP verb \"", ...
Adds a method to the internal lists of allowed or denied methods. Each object in the internal list contains a resource ARN and a condition statement. The condition statement can be null.
[ "Adds", "a", "method", "to", "the", "internal", "lists", "of", "allowed", "or", "denied", "methods", ".", "Each", "object", "in", "the", "internal", "list", "contains", "a", "resource", "ARN", "and", "a", "condition", "statement", ".", "The", "condition", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/example/authmodule.py#L104-L134
train
Miserlou/Zappa
example/authmodule.py
AuthPolicy.allowMethodWithConditions
def allowMethodWithConditions(self, verb, resource, conditions): """Adds an API Gateway method (Http verb + Resource path) to the list of allowed methods and includes a condition for the policy statement. More on AWS policy conditions here: http://docs.aws.amazon.com/IAM/latest/UserGuide/referen...
python
def allowMethodWithConditions(self, verb, resource, conditions): """Adds an API Gateway method (Http verb + Resource path) to the list of allowed methods and includes a condition for the policy statement. More on AWS policy conditions here: http://docs.aws.amazon.com/IAM/latest/UserGuide/referen...
[ "def", "allowMethodWithConditions", "(", "self", ",", "verb", ",", "resource", ",", "conditions", ")", ":", "self", ".", "_addMethod", "(", "\"Allow\"", ",", "verb", ",", "resource", ",", "conditions", ")" ]
Adds an API Gateway method (Http verb + Resource path) to the list of allowed methods and includes a condition for the policy statement. More on AWS policy conditions here: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html#Condition
[ "Adds", "an", "API", "Gateway", "method", "(", "Http", "verb", "+", "Resource", "path", ")", "to", "the", "list", "of", "allowed", "methods", "and", "includes", "a", "condition", "for", "the", "policy", "statement", ".", "More", "on", "AWS", "policy", "c...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/example/authmodule.py#L186-L190
train
Miserlou/Zappa
example/authmodule.py
AuthPolicy.denyMethodWithConditions
def denyMethodWithConditions(self, verb, resource, conditions): """Adds an API Gateway method (Http verb + Resource path) to the list of denied methods and includes a condition for the policy statement. More on AWS policy conditions here: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference...
python
def denyMethodWithConditions(self, verb, resource, conditions): """Adds an API Gateway method (Http verb + Resource path) to the list of denied methods and includes a condition for the policy statement. More on AWS policy conditions here: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference...
[ "def", "denyMethodWithConditions", "(", "self", ",", "verb", ",", "resource", ",", "conditions", ")", ":", "self", ".", "_addMethod", "(", "\"Deny\"", ",", "verb", ",", "resource", ",", "conditions", ")" ]
Adds an API Gateway method (Http verb + Resource path) to the list of denied methods and includes a condition for the policy statement. More on AWS policy conditions here: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html#Condition
[ "Adds", "an", "API", "Gateway", "method", "(", "Http", "verb", "+", "Resource", "path", ")", "to", "the", "list", "of", "denied", "methods", "and", "includes", "a", "condition", "for", "the", "policy", "statement", ".", "More", "on", "AWS", "policy", "co...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/example/authmodule.py#L192-L196
train
Miserlou/Zappa
example/authmodule.py
AuthPolicy.build
def build(self): """Generates the policy document based on the internal lists of allowed and denied conditions. This will generate a policy with two main statements for the effect: one statement for Allow and one statement for Deny. Methods that includes conditions will have their own st...
python
def build(self): """Generates the policy document based on the internal lists of allowed and denied conditions. This will generate a policy with two main statements for the effect: one statement for Allow and one statement for Deny. Methods that includes conditions will have their own st...
[ "def", "build", "(", "self", ")", ":", "if", "(", "(", "self", ".", "allowMethods", "is", "None", "or", "len", "(", "self", ".", "allowMethods", ")", "==", "0", ")", "and", "(", "self", ".", "denyMethods", "is", "None", "or", "len", "(", "self", ...
Generates the policy document based on the internal lists of allowed and denied conditions. This will generate a policy with two main statements for the effect: one statement for Allow and one statement for Deny. Methods that includes conditions will have their own statement in the policy.
[ "Generates", "the", "policy", "document", "based", "on", "the", "internal", "lists", "of", "allowed", "and", "denied", "conditions", ".", "This", "will", "generate", "a", "policy", "with", "two", "main", "statements", "for", "the", "effect", ":", "one", "sta...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/example/authmodule.py#L198-L218
train
Miserlou/Zappa
zappa/core.py
Zappa.configure_boto_session_method_kwargs
def configure_boto_session_method_kwargs(self, service, kw): """Allow for custom endpoint urls for non-AWS (testing and bootleg cloud) deployments""" if service in self.endpoint_urls and not 'endpoint_url' in kw: kw['endpoint_url'] = self.endpoint_urls[service] return kw
python
def configure_boto_session_method_kwargs(self, service, kw): """Allow for custom endpoint urls for non-AWS (testing and bootleg cloud) deployments""" if service in self.endpoint_urls and not 'endpoint_url' in kw: kw['endpoint_url'] = self.endpoint_urls[service] return kw
[ "def", "configure_boto_session_method_kwargs", "(", "self", ",", "service", ",", "kw", ")", ":", "if", "service", "in", "self", ".", "endpoint_urls", "and", "not", "'endpoint_url'", "in", "kw", ":", "kw", "[", "'endpoint_url'", "]", "=", "self", ".", "endpoi...
Allow for custom endpoint urls for non-AWS (testing and bootleg cloud) deployments
[ "Allow", "for", "custom", "endpoint", "urls", "for", "non", "-", "AWS", "(", "testing", "and", "bootleg", "cloud", ")", "deployments" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L328-L332
train
Miserlou/Zappa
zappa/core.py
Zappa.boto_client
def boto_client(self, service, *args, **kwargs): """A wrapper to apply configuration options to boto clients""" return self.boto_session.client(service, *args, **self.configure_boto_session_method_kwargs(service, kwargs))
python
def boto_client(self, service, *args, **kwargs): """A wrapper to apply configuration options to boto clients""" return self.boto_session.client(service, *args, **self.configure_boto_session_method_kwargs(service, kwargs))
[ "def", "boto_client", "(", "self", ",", "service", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "boto_session", ".", "client", "(", "service", ",", "*", "args", ",", "*", "*", "self", ".", "configure_boto_session_method_kwa...
A wrapper to apply configuration options to boto clients
[ "A", "wrapper", "to", "apply", "configuration", "options", "to", "boto", "clients" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L334-L336
train
Miserlou/Zappa
zappa/core.py
Zappa.boto_resource
def boto_resource(self, service, *args, **kwargs): """A wrapper to apply configuration options to boto resources""" return self.boto_session.resource(service, *args, **self.configure_boto_session_method_kwargs(service, kwargs))
python
def boto_resource(self, service, *args, **kwargs): """A wrapper to apply configuration options to boto resources""" return self.boto_session.resource(service, *args, **self.configure_boto_session_method_kwargs(service, kwargs))
[ "def", "boto_resource", "(", "self", ",", "service", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "boto_session", ".", "resource", "(", "service", ",", "*", "args", ",", "*", "*", "self", ".", "configure_boto_session_method...
A wrapper to apply configuration options to boto resources
[ "A", "wrapper", "to", "apply", "configuration", "options", "to", "boto", "resources" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L338-L340
train
Miserlou/Zappa
zappa/core.py
Zappa.cache_param
def cache_param(self, value): '''Returns a troposphere Ref to a value cached as a parameter.''' if value not in self.cf_parameters: keyname = chr(ord('A') + len(self.cf_parameters)) param = self.cf_template.add_parameter(troposphere.Parameter( keyname, Type="Stri...
python
def cache_param(self, value): '''Returns a troposphere Ref to a value cached as a parameter.''' if value not in self.cf_parameters: keyname = chr(ord('A') + len(self.cf_parameters)) param = self.cf_template.add_parameter(troposphere.Parameter( keyname, Type="Stri...
[ "def", "cache_param", "(", "self", ",", "value", ")", ":", "if", "value", "not", "in", "self", ".", "cf_parameters", ":", "keyname", "=", "chr", "(", "ord", "(", "'A'", ")", "+", "len", "(", "self", ".", "cf_parameters", ")", ")", "param", "=", "se...
Returns a troposphere Ref to a value cached as a parameter.
[ "Returns", "a", "troposphere", "Ref", "to", "a", "value", "cached", "as", "a", "parameter", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L342-L353
train
Miserlou/Zappa
zappa/core.py
Zappa.get_deps_list
def get_deps_list(self, pkg_name, installed_distros=None): """ For a given package, returns a list of required packages. Recursive. """ # https://github.com/Miserlou/Zappa/issues/1478. Using `pkg_resources` # instead of `pip` is the recommended approach. The usage is nearly ...
python
def get_deps_list(self, pkg_name, installed_distros=None): """ For a given package, returns a list of required packages. Recursive. """ # https://github.com/Miserlou/Zappa/issues/1478. Using `pkg_resources` # instead of `pip` is the recommended approach. The usage is nearly ...
[ "def", "get_deps_list", "(", "self", ",", "pkg_name", ",", "installed_distros", "=", "None", ")", ":", "# https://github.com/Miserlou/Zappa/issues/1478. Using `pkg_resources`", "# instead of `pip` is the recommended approach. The usage is nearly", "# identical.", "import", "pkg_res...
For a given package, returns a list of required packages. Recursive.
[ "For", "a", "given", "package", "returns", "a", "list", "of", "required", "packages", ".", "Recursive", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L373-L389
train
Miserlou/Zappa
zappa/core.py
Zappa.create_handler_venv
def create_handler_venv(self): """ Takes the installed zappa and brings it into a fresh virtualenv-like folder. All dependencies are then downloaded. """ import subprocess # We will need the currenv venv to pull Zappa from current_venv = self.get_current_venv() ...
python
def create_handler_venv(self): """ Takes the installed zappa and brings it into a fresh virtualenv-like folder. All dependencies are then downloaded. """ import subprocess # We will need the currenv venv to pull Zappa from current_venv = self.get_current_venv() ...
[ "def", "create_handler_venv", "(", "self", ")", ":", "import", "subprocess", "# We will need the currenv venv to pull Zappa from", "current_venv", "=", "self", ".", "get_current_venv", "(", ")", "# Make a new folder for the handler packages", "ve_path", "=", "os", ".", "pat...
Takes the installed zappa and brings it into a fresh virtualenv-like folder. All dependencies are then downloaded.
[ "Takes", "the", "installed", "zappa", "and", "brings", "it", "into", "a", "fresh", "virtualenv", "-", "like", "folder", ".", "All", "dependencies", "are", "then", "downloaded", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L391-L437
train
Miserlou/Zappa
zappa/core.py
Zappa.get_current_venv
def get_current_venv(): """ Returns the path to the current virtualenv """ if 'VIRTUAL_ENV' in os.environ: venv = os.environ['VIRTUAL_ENV'] elif os.path.exists('.python-version'): # pragma: no cover try: subprocess.check_output(['pyenv', '...
python
def get_current_venv(): """ Returns the path to the current virtualenv """ if 'VIRTUAL_ENV' in os.environ: venv = os.environ['VIRTUAL_ENV'] elif os.path.exists('.python-version'): # pragma: no cover try: subprocess.check_output(['pyenv', '...
[ "def", "get_current_venv", "(", ")", ":", "if", "'VIRTUAL_ENV'", "in", "os", ".", "environ", ":", "venv", "=", "os", ".", "environ", "[", "'VIRTUAL_ENV'", "]", "elif", "os", ".", "path", ".", "exists", "(", "'.python-version'", ")", ":", "# pragma: no cove...
Returns the path to the current virtualenv
[ "Returns", "the", "path", "to", "the", "current", "virtualenv" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L441-L461
train
Miserlou/Zappa
zappa/core.py
Zappa.create_lambda_zip
def create_lambda_zip( self, prefix='lambda_package', handler_file=None, slim_handler=False, minify=True, exclude=None, use_precompiled_packages=True, ...
python
def create_lambda_zip( self, prefix='lambda_package', handler_file=None, slim_handler=False, minify=True, exclude=None, use_precompiled_packages=True, ...
[ "def", "create_lambda_zip", "(", "self", ",", "prefix", "=", "'lambda_package'", ",", "handler_file", "=", "None", ",", "slim_handler", "=", "False", ",", "minify", "=", "True", ",", "exclude", "=", "None", ",", "use_precompiled_packages", "=", "True", ",", ...
Create a Lambda-ready zip file of the current virtualenvironment and working directory. Returns path to that file.
[ "Create", "a", "Lambda", "-", "ready", "zip", "file", "of", "the", "current", "virtualenvironment", "and", "working", "directory", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L463-L760
train
Miserlou/Zappa
zappa/core.py
Zappa.extract_lambda_package
def extract_lambda_package(self, package_name, path): """ Extracts the lambda package into a given path. Assumes the package exists in lambda packages. """ lambda_package = lambda_packages[package_name][self.runtime] # Trash the local version to help with package space saving ...
python
def extract_lambda_package(self, package_name, path): """ Extracts the lambda package into a given path. Assumes the package exists in lambda packages. """ lambda_package = lambda_packages[package_name][self.runtime] # Trash the local version to help with package space saving ...
[ "def", "extract_lambda_package", "(", "self", ",", "package_name", ",", "path", ")", ":", "lambda_package", "=", "lambda_packages", "[", "package_name", "]", "[", "self", ".", "runtime", "]", "# Trash the local version to help with package space saving", "shutil", ".", ...
Extracts the lambda package into a given path. Assumes the package exists in lambda packages.
[ "Extracts", "the", "lambda", "package", "into", "a", "given", "path", ".", "Assumes", "the", "package", "exists", "in", "lambda", "packages", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L762-L773
train
Miserlou/Zappa
zappa/core.py
Zappa.get_installed_packages
def get_installed_packages(site_packages, site_packages_64): """ Returns a dict of installed packages that Zappa cares about. """ import pkg_resources package_to_keep = [] if os.path.isdir(site_packages): package_to_keep += os.listdir(site_packages) i...
python
def get_installed_packages(site_packages, site_packages_64): """ Returns a dict of installed packages that Zappa cares about. """ import pkg_resources package_to_keep = [] if os.path.isdir(site_packages): package_to_keep += os.listdir(site_packages) i...
[ "def", "get_installed_packages", "(", "site_packages", ",", "site_packages_64", ")", ":", "import", "pkg_resources", "package_to_keep", "=", "[", "]", "if", "os", ".", "path", ".", "isdir", "(", "site_packages", ")", ":", "package_to_keep", "+=", "os", ".", "l...
Returns a dict of installed packages that Zappa cares about.
[ "Returns", "a", "dict", "of", "installed", "packages", "that", "Zappa", "cares", "about", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L776-L795
train
Miserlou/Zappa
zappa/core.py
Zappa.have_correct_lambda_package_version
def have_correct_lambda_package_version(self, package_name, package_version): """ Checks if a given package version binary should be copied over from lambda packages. package_name should be lower-cased version of package name. """ lambda_package_details = lambda_packages.get(pack...
python
def have_correct_lambda_package_version(self, package_name, package_version): """ Checks if a given package version binary should be copied over from lambda packages. package_name should be lower-cased version of package name. """ lambda_package_details = lambda_packages.get(pack...
[ "def", "have_correct_lambda_package_version", "(", "self", ",", "package_name", ",", "package_version", ")", ":", "lambda_package_details", "=", "lambda_packages", ".", "get", "(", "package_name", ",", "{", "}", ")", ".", "get", "(", "self", ".", "runtime", ")",...
Checks if a given package version binary should be copied over from lambda packages. package_name should be lower-cased version of package name.
[ "Checks", "if", "a", "given", "package", "version", "binary", "should", "be", "copied", "over", "from", "lambda", "packages", ".", "package_name", "should", "be", "lower", "-", "cased", "version", "of", "package", "name", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L797-L812
train
Miserlou/Zappa
zappa/core.py
Zappa.download_url_with_progress
def download_url_with_progress(url, stream, disable_progress): """ Downloads a given url in chunks and writes to the provided stream (can be any io stream). Displays the progress bar for the download. """ resp = requests.get(url, timeout=float(os.environ.get('PIP_TIMEOUT', 2)), s...
python
def download_url_with_progress(url, stream, disable_progress): """ Downloads a given url in chunks and writes to the provided stream (can be any io stream). Displays the progress bar for the download. """ resp = requests.get(url, timeout=float(os.environ.get('PIP_TIMEOUT', 2)), s...
[ "def", "download_url_with_progress", "(", "url", ",", "stream", ",", "disable_progress", ")", ":", "resp", "=", "requests", ".", "get", "(", "url", ",", "timeout", "=", "float", "(", "os", ".", "environ", ".", "get", "(", "'PIP_TIMEOUT'", ",", "2", ")", ...
Downloads a given url in chunks and writes to the provided stream (can be any io stream). Displays the progress bar for the download.
[ "Downloads", "a", "given", "url", "in", "chunks", "and", "writes", "to", "the", "provided", "stream", "(", "can", "be", "any", "io", "stream", ")", ".", "Displays", "the", "progress", "bar", "for", "the", "download", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L822-L836
train
Miserlou/Zappa
zappa/core.py
Zappa.get_cached_manylinux_wheel
def get_cached_manylinux_wheel(self, package_name, package_version, disable_progress=False): """ Gets the locally stored version of a manylinux wheel. If one does not exist, the function downloads it. """ cached_wheels_dir = os.path.join(tempfile.gettempdir(), 'cached_wheels') if...
python
def get_cached_manylinux_wheel(self, package_name, package_version, disable_progress=False): """ Gets the locally stored version of a manylinux wheel. If one does not exist, the function downloads it. """ cached_wheels_dir = os.path.join(tempfile.gettempdir(), 'cached_wheels') if...
[ "def", "get_cached_manylinux_wheel", "(", "self", ",", "package_name", ",", "package_version", ",", "disable_progress", "=", "False", ")", ":", "cached_wheels_dir", "=", "os", ".", "path", ".", "join", "(", "tempfile", ".", "gettempdir", "(", ")", ",", "'cache...
Gets the locally stored version of a manylinux wheel. If one does not exist, the function downloads it.
[ "Gets", "the", "locally", "stored", "version", "of", "a", "manylinux", "wheel", ".", "If", "one", "does", "not", "exist", "the", "function", "downloads", "it", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L838-L864
train
Miserlou/Zappa
zappa/core.py
Zappa.get_manylinux_wheel_url
def get_manylinux_wheel_url(self, package_name, package_version): """ For a given package name, returns a link to the download URL, else returns None. Related: https://github.com/Miserlou/Zappa/issues/398 Examples here: https://gist.github.com/perrygeo/9545f94eaddec18a65fd7b5688...
python
def get_manylinux_wheel_url(self, package_name, package_version): """ For a given package name, returns a link to the download URL, else returns None. Related: https://github.com/Miserlou/Zappa/issues/398 Examples here: https://gist.github.com/perrygeo/9545f94eaddec18a65fd7b5688...
[ "def", "get_manylinux_wheel_url", "(", "self", ",", "package_name", ",", "package_version", ")", ":", "cached_pypi_info_dir", "=", "os", ".", "path", ".", "join", "(", "tempfile", ".", "gettempdir", "(", ")", ",", "'cached_pypi_info'", ")", "if", "not", "os", ...
For a given package name, returns a link to the download URL, else returns None. Related: https://github.com/Miserlou/Zappa/issues/398 Examples here: https://gist.github.com/perrygeo/9545f94eaddec18a65fd7b56880adbae This function downloads metadata JSON of `package_name` from Pypi ...
[ "For", "a", "given", "package", "name", "returns", "a", "link", "to", "the", "download", "URL", "else", "returns", "None", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L866-L909
train
Miserlou/Zappa
zappa/core.py
Zappa.upload_to_s3
def upload_to_s3(self, source_path, bucket_name, disable_progress=False): r""" Given a file, upload it to S3. Credentials should be stored in environment variables or ~/.aws/credentials (%USERPROFILE%\.aws\credentials on Windows). Returns True on success, false on failure. """ ...
python
def upload_to_s3(self, source_path, bucket_name, disable_progress=False): r""" Given a file, upload it to S3. Credentials should be stored in environment variables or ~/.aws/credentials (%USERPROFILE%\.aws\credentials on Windows). Returns True on success, false on failure. """ ...
[ "def", "upload_to_s3", "(", "self", ",", "source_path", ",", "bucket_name", ",", "disable_progress", "=", "False", ")", ":", "try", ":", "self", ".", "s3_client", ".", "head_bucket", "(", "Bucket", "=", "bucket_name", ")", "except", "botocore", ".", "excepti...
r""" Given a file, upload it to S3. Credentials should be stored in environment variables or ~/.aws/credentials (%USERPROFILE%\.aws\credentials on Windows). Returns True on success, false on failure.
[ "r", "Given", "a", "file", "upload", "it", "to", "S3", ".", "Credentials", "should", "be", "stored", "in", "environment", "variables", "or", "~", "/", ".", "aws", "/", "credentials", "(", "%USERPROFILE%", "\\", ".", "aws", "\\", "credentials", "on", "Win...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L915-L973
train
Miserlou/Zappa
zappa/core.py
Zappa.copy_on_s3
def copy_on_s3(self, src_file_name, dst_file_name, bucket_name): """ Copies src file to destination within a bucket. """ try: self.s3_client.head_bucket(Bucket=bucket_name) except botocore.exceptions.ClientError as e: # pragma: no cover # If a client erro...
python
def copy_on_s3(self, src_file_name, dst_file_name, bucket_name): """ Copies src file to destination within a bucket. """ try: self.s3_client.head_bucket(Bucket=bucket_name) except botocore.exceptions.ClientError as e: # pragma: no cover # If a client erro...
[ "def", "copy_on_s3", "(", "self", ",", "src_file_name", ",", "dst_file_name", ",", "bucket_name", ")", ":", "try", ":", "self", ".", "s3_client", ".", "head_bucket", "(", "Bucket", "=", "bucket_name", ")", "except", "botocore", ".", "exceptions", ".", "Clien...
Copies src file to destination within a bucket.
[ "Copies", "src", "file", "to", "destination", "within", "a", "bucket", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L975-L1000
train
Miserlou/Zappa
zappa/core.py
Zappa.remove_from_s3
def remove_from_s3(self, file_name, bucket_name): """ Given a file name and a bucket, remove it from S3. There's no reason to keep the file hosted on S3 once its been made into a Lambda function, so we can delete it from S3. Returns True on success, False on failure. """ ...
python
def remove_from_s3(self, file_name, bucket_name): """ Given a file name and a bucket, remove it from S3. There's no reason to keep the file hosted on S3 once its been made into a Lambda function, so we can delete it from S3. Returns True on success, False on failure. """ ...
[ "def", "remove_from_s3", "(", "self", ",", "file_name", ",", "bucket_name", ")", ":", "try", ":", "self", ".", "s3_client", ".", "head_bucket", "(", "Bucket", "=", "bucket_name", ")", "except", "botocore", ".", "exceptions", ".", "ClientError", "as", "e", ...
Given a file name and a bucket, remove it from S3. There's no reason to keep the file hosted on S3 once its been made into a Lambda function, so we can delete it from S3. Returns True on success, False on failure.
[ "Given", "a", "file", "name", "and", "a", "bucket", "remove", "it", "from", "S3", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1002-L1024
train
Miserlou/Zappa
zappa/core.py
Zappa.create_lambda_function
def create_lambda_function( self, bucket=None, function_name=None, handler=None, s3_key=None, description='Zappa Deployment', ti...
python
def create_lambda_function( self, bucket=None, function_name=None, handler=None, s3_key=None, description='Zappa Deployment', ti...
[ "def", "create_lambda_function", "(", "self", ",", "bucket", "=", "None", ",", "function_name", "=", "None", ",", "handler", "=", "None", ",", "s3_key", "=", "None", ",", "description", "=", "'Zappa Deployment'", ",", "timeout", "=", "30", ",", "memory_size"...
Given a bucket and key (or a local path) of a valid Lambda-zip, a function name and a handler, register that Lambda function.
[ "Given", "a", "bucket", "and", "key", "(", "or", "a", "local", "path", ")", "of", "a", "valid", "Lambda", "-", "zip", "a", "function", "name", "and", "a", "handler", "register", "that", "Lambda", "function", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1030-L1109
train
Miserlou/Zappa
zappa/core.py
Zappa.update_lambda_function
def update_lambda_function(self, bucket, function_name, s3_key=None, publish=True, local_zip=None, num_revisions=None): """ Given a bucket and key (or a local path) of a valid Lambda-zip, a function name and a handler, update that Lambda function's code. Optionally, delete previous versions if t...
python
def update_lambda_function(self, bucket, function_name, s3_key=None, publish=True, local_zip=None, num_revisions=None): """ Given a bucket and key (or a local path) of a valid Lambda-zip, a function name and a handler, update that Lambda function's code. Optionally, delete previous versions if t...
[ "def", "update_lambda_function", "(", "self", ",", "bucket", ",", "function_name", ",", "s3_key", "=", "None", ",", "publish", "=", "True", ",", "local_zip", "=", "None", ",", "num_revisions", "=", "None", ")", ":", "print", "(", "\"Updating Lambda function co...
Given a bucket and key (or a local path) of a valid Lambda-zip, a function name and a handler, update that Lambda function's code. Optionally, delete previous versions if they exceed the optional limit.
[ "Given", "a", "bucket", "and", "key", "(", "or", "a", "local", "path", ")", "of", "a", "valid", "Lambda", "-", "zip", "a", "function", "name", "and", "a", "handler", "update", "that", "Lambda", "function", "s", "code", ".", "Optionally", "delete", "pre...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1111-L1172
train
Miserlou/Zappa
zappa/core.py
Zappa.update_lambda_configuration
def update_lambda_configuration( self, lambda_arn, function_name, handler, description='Zappa Deployment', timeout=30...
python
def update_lambda_configuration( self, lambda_arn, function_name, handler, description='Zappa Deployment', timeout=30...
[ "def", "update_lambda_configuration", "(", "self", ",", "lambda_arn", ",", "function_name", ",", "handler", ",", "description", "=", "'Zappa Deployment'", ",", "timeout", "=", "30", ",", "memory_size", "=", "512", ",", "publish", "=", "True", ",", "vpc_config", ...
Given an existing function ARN, update the configuration variables.
[ "Given", "an", "existing", "function", "ARN", "update", "the", "configuration", "variables", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1174-L1232
train
Miserlou/Zappa
zappa/core.py
Zappa.invoke_lambda_function
def invoke_lambda_function( self, function_name, payload, invocation_type='Event', log_type='Tail', client_context=None, qualifi...
python
def invoke_lambda_function( self, function_name, payload, invocation_type='Event', log_type='Tail', client_context=None, qualifi...
[ "def", "invoke_lambda_function", "(", "self", ",", "function_name", ",", "payload", ",", "invocation_type", "=", "'Event'", ",", "log_type", "=", "'Tail'", ",", "client_context", "=", "None", ",", "qualifier", "=", "None", ")", ":", "return", "self", ".", "l...
Directly invoke a named Lambda function with a payload. Returns the response.
[ "Directly", "invoke", "a", "named", "Lambda", "function", "with", "a", "payload", ".", "Returns", "the", "response", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1234-L1251
train
Miserlou/Zappa
zappa/core.py
Zappa.rollback_lambda_function_version
def rollback_lambda_function_version(self, function_name, versions_back=1, publish=True): """ Rollback the lambda function code 'versions_back' number of revisions. Returns the Function ARN. """ response = self.lambda_client.list_versions_by_function(FunctionName=function_name) ...
python
def rollback_lambda_function_version(self, function_name, versions_back=1, publish=True): """ Rollback the lambda function code 'versions_back' number of revisions. Returns the Function ARN. """ response = self.lambda_client.list_versions_by_function(FunctionName=function_name) ...
[ "def", "rollback_lambda_function_version", "(", "self", ",", "function_name", ",", "versions_back", "=", "1", ",", "publish", "=", "True", ")", ":", "response", "=", "self", ".", "lambda_client", ".", "list_versions_by_function", "(", "FunctionName", "=", "functio...
Rollback the lambda function code 'versions_back' number of revisions. Returns the Function ARN.
[ "Rollback", "the", "lambda", "function", "code", "versions_back", "number", "of", "revisions", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1253-L1278
train
Miserlou/Zappa
zappa/core.py
Zappa.get_lambda_function
def get_lambda_function(self, function_name): """ Returns the lambda function ARN, given a name This requires the "lambda:GetFunction" role. """ response = self.lambda_client.get_function( FunctionName=function_name) return response['Configuration']['Func...
python
def get_lambda_function(self, function_name): """ Returns the lambda function ARN, given a name This requires the "lambda:GetFunction" role. """ response = self.lambda_client.get_function( FunctionName=function_name) return response['Configuration']['Func...
[ "def", "get_lambda_function", "(", "self", ",", "function_name", ")", ":", "response", "=", "self", ".", "lambda_client", ".", "get_function", "(", "FunctionName", "=", "function_name", ")", "return", "response", "[", "'Configuration'", "]", "[", "'FunctionArn'", ...
Returns the lambda function ARN, given a name This requires the "lambda:GetFunction" role.
[ "Returns", "the", "lambda", "function", "ARN", "given", "a", "name" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1280-L1288
train
Miserlou/Zappa
zappa/core.py
Zappa.get_lambda_function_versions
def get_lambda_function_versions(self, function_name): """ Simply returns the versions available for a Lambda function, given a function name. """ try: response = self.lambda_client.list_versions_by_function( FunctionName=function_name ) ...
python
def get_lambda_function_versions(self, function_name): """ Simply returns the versions available for a Lambda function, given a function name. """ try: response = self.lambda_client.list_versions_by_function( FunctionName=function_name ) ...
[ "def", "get_lambda_function_versions", "(", "self", ",", "function_name", ")", ":", "try", ":", "response", "=", "self", ".", "lambda_client", ".", "list_versions_by_function", "(", "FunctionName", "=", "function_name", ")", "return", "response", ".", "get", "(", ...
Simply returns the versions available for a Lambda function, given a function name.
[ "Simply", "returns", "the", "versions", "available", "for", "a", "Lambda", "function", "given", "a", "function", "name", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1290-L1301
train
Miserlou/Zappa
zappa/core.py
Zappa.deploy_lambda_alb
def deploy_lambda_alb( self, lambda_arn, lambda_name, alb_vpc_config, timeout ): """ The `zappa deploy` functionality for ALB infrastructure. """ if n...
python
def deploy_lambda_alb( self, lambda_arn, lambda_name, alb_vpc_config, timeout ): """ The `zappa deploy` functionality for ALB infrastructure. """ if n...
[ "def", "deploy_lambda_alb", "(", "self", ",", "lambda_arn", ",", "lambda_name", ",", "alb_vpc_config", ",", "timeout", ")", ":", "if", "not", "alb_vpc_config", ":", "raise", "EnvironmentError", "(", "'When creating an ALB, alb_vpc_config must be filled out in zappa_settings...
The `zappa deploy` functionality for ALB infrastructure.
[ "The", "zappa", "deploy", "functionality", "for", "ALB", "infrastructure", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1320-L1432
train
Miserlou/Zappa
zappa/core.py
Zappa.undeploy_lambda_alb
def undeploy_lambda_alb(self, lambda_name): """ The `zappa undeploy` functionality for ALB infrastructure. """ print("Undeploying ALB infrastructure...") # Locate and delete alb/lambda permissions try: # https://boto3.amazonaws.com/v1/documentation/api/latest...
python
def undeploy_lambda_alb(self, lambda_name): """ The `zappa undeploy` functionality for ALB infrastructure. """ print("Undeploying ALB infrastructure...") # Locate and delete alb/lambda permissions try: # https://boto3.amazonaws.com/v1/documentation/api/latest...
[ "def", "undeploy_lambda_alb", "(", "self", ",", "lambda_name", ")", ":", "print", "(", "\"Undeploying ALB infrastructure...\"", ")", "# Locate and delete alb/lambda permissions", "try", ":", "# https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#Lambd...
The `zappa undeploy` functionality for ALB infrastructure.
[ "The", "zappa", "undeploy", "functionality", "for", "ALB", "infrastructure", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1434-L1518
train
Miserlou/Zappa
zappa/core.py
Zappa.create_api_gateway_routes
def create_api_gateway_routes( self, lambda_arn, api_name=None, api_key_required=False, authorization_type='NONE', authorizer=None, ...
python
def create_api_gateway_routes( self, lambda_arn, api_name=None, api_key_required=False, authorization_type='NONE', authorizer=None, ...
[ "def", "create_api_gateway_routes", "(", "self", ",", "lambda_arn", ",", "api_name", "=", "None", ",", "api_key_required", "=", "False", ",", "authorization_type", "=", "'NONE'", ",", "authorizer", "=", "None", ",", "cors_options", "=", "None", ",", "description...
Create the API Gateway for this Zappa deployment. Returns the new RestAPI CF resource.
[ "Create", "the", "API", "Gateway", "for", "this", "Zappa", "deployment", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1525-L1616
train
Miserlou/Zappa
zappa/core.py
Zappa.create_authorizer
def create_authorizer(self, restapi, uri, authorizer): """ Create Authorizer for API gateway """ authorizer_type = authorizer.get("type", "TOKEN").upper() identity_validation_expression = authorizer.get('validation_expression', None) authorizer_resource = troposphere.api...
python
def create_authorizer(self, restapi, uri, authorizer): """ Create Authorizer for API gateway """ authorizer_type = authorizer.get("type", "TOKEN").upper() identity_validation_expression = authorizer.get('validation_expression', None) authorizer_resource = troposphere.api...
[ "def", "create_authorizer", "(", "self", ",", "restapi", ",", "uri", ",", "authorizer", ")", ":", "authorizer_type", "=", "authorizer", ".", "get", "(", "\"type\"", ",", "\"TOKEN\"", ")", ".", "upper", "(", ")", "identity_validation_expression", "=", "authoriz...
Create Authorizer for API gateway
[ "Create", "Authorizer", "for", "API", "gateway" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1618-L1645
train
Miserlou/Zappa
zappa/core.py
Zappa.create_and_setup_methods
def create_and_setup_methods( self, restapi, resource, api_key_required, uri, authorization_type, ...
python
def create_and_setup_methods( self, restapi, resource, api_key_required, uri, authorization_type, ...
[ "def", "create_and_setup_methods", "(", "self", ",", "restapi", ",", "resource", ",", "api_key_required", ",", "uri", ",", "authorization_type", ",", "authorizer_resource", ",", "depth", ")", ":", "for", "method_name", "in", "self", ".", "http_methods", ":", "me...
Set up the methods, integration responses and method responses for a given API Gateway resource.
[ "Set", "up", "the", "methods", "integration", "responses", "and", "method", "responses", "for", "a", "given", "API", "Gateway", "resource", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1647-L1689
train
Miserlou/Zappa
zappa/core.py
Zappa.create_and_setup_cors
def create_and_setup_cors(self, restapi, resource, uri, depth, config): """ Set up the methods, integration responses and method responses for a given API Gateway resource. """ if config is True: config = {} method_name = "OPTIONS" method = troposphere.apigate...
python
def create_and_setup_cors(self, restapi, resource, uri, depth, config): """ Set up the methods, integration responses and method responses for a given API Gateway resource. """ if config is True: config = {} method_name = "OPTIONS" method = troposphere.apigate...
[ "def", "create_and_setup_cors", "(", "self", ",", "restapi", ",", "resource", ",", "uri", ",", "depth", ",", "config", ")", ":", "if", "config", "is", "True", ":", "config", "=", "{", "}", "method_name", "=", "\"OPTIONS\"", "method", "=", "troposphere", ...
Set up the methods, integration responses and method responses for a given API Gateway resource.
[ "Set", "up", "the", "methods", "integration", "responses", "and", "method", "responses", "for", "a", "given", "API", "Gateway", "resource", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1691-L1749
train
Miserlou/Zappa
zappa/core.py
Zappa.deploy_api_gateway
def deploy_api_gateway( self, api_id, stage_name, stage_description="", description="", cache_cluster_enabled=False, cache_cluster_size='0.5', ...
python
def deploy_api_gateway( self, api_id, stage_name, stage_description="", description="", cache_cluster_enabled=False, cache_cluster_size='0.5', ...
[ "def", "deploy_api_gateway", "(", "self", ",", "api_id", ",", "stage_name", ",", "stage_description", "=", "\"\"", ",", "description", "=", "\"\"", ",", "cache_cluster_enabled", "=", "False", ",", "cache_cluster_size", "=", "'0.5'", ",", "variables", "=", "None"...
Deploy the API Gateway! Return the deployed API URL.
[ "Deploy", "the", "API", "Gateway!" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1751-L1797
train
Miserlou/Zappa
zappa/core.py
Zappa.remove_binary_support
def remove_binary_support(self, api_id, cors=False): """ Remove binary support """ response = self.apigateway_client.get_rest_api( restApiId=api_id ) if "binaryMediaTypes" in response and "*/*" in response["binaryMediaTypes"]: self.apigateway_clien...
python
def remove_binary_support(self, api_id, cors=False): """ Remove binary support """ response = self.apigateway_client.get_rest_api( restApiId=api_id ) if "binaryMediaTypes" in response and "*/*" in response["binaryMediaTypes"]: self.apigateway_clien...
[ "def", "remove_binary_support", "(", "self", ",", "api_id", ",", "cors", "=", "False", ")", ":", "response", "=", "self", ".", "apigateway_client", ".", "get_rest_api", "(", "restApiId", "=", "api_id", ")", "if", "\"binaryMediaTypes\"", "in", "response", "and"...
Remove binary support
[ "Remove", "binary", "support" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1840-L1877
train
Miserlou/Zappa
zappa/core.py
Zappa.add_api_compression
def add_api_compression(self, api_id, min_compression_size): """ Add Rest API compression """ self.apigateway_client.update_rest_api( restApiId=api_id, patchOperations=[ { 'op': 'replace', 'path': '/minimumCo...
python
def add_api_compression(self, api_id, min_compression_size): """ Add Rest API compression """ self.apigateway_client.update_rest_api( restApiId=api_id, patchOperations=[ { 'op': 'replace', 'path': '/minimumCo...
[ "def", "add_api_compression", "(", "self", ",", "api_id", ",", "min_compression_size", ")", ":", "self", ".", "apigateway_client", ".", "update_rest_api", "(", "restApiId", "=", "api_id", ",", "patchOperations", "=", "[", "{", "'op'", ":", "'replace'", ",", "'...
Add Rest API compression
[ "Add", "Rest", "API", "compression" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1879-L1892
train
Miserlou/Zappa
zappa/core.py
Zappa.get_api_keys
def get_api_keys(self, api_id, stage_name): """ Generator that allows to iterate per API keys associated to an api_id and a stage_name. """ response = self.apigateway_client.get_api_keys(limit=500) stage_key = '{}/{}'.format(api_id, stage_name) for api_key in response.get...
python
def get_api_keys(self, api_id, stage_name): """ Generator that allows to iterate per API keys associated to an api_id and a stage_name. """ response = self.apigateway_client.get_api_keys(limit=500) stage_key = '{}/{}'.format(api_id, stage_name) for api_key in response.get...
[ "def", "get_api_keys", "(", "self", ",", "api_id", ",", "stage_name", ")", ":", "response", "=", "self", ".", "apigateway_client", ".", "get_api_keys", "(", "limit", "=", "500", ")", "stage_key", "=", "'{}/{}'", ".", "format", "(", "api_id", ",", "stage_na...
Generator that allows to iterate per API keys associated to an api_id and a stage_name.
[ "Generator", "that", "allows", "to", "iterate", "per", "API", "keys", "associated", "to", "an", "api_id", "and", "a", "stage_name", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1908-L1916
train
Miserlou/Zappa
zappa/core.py
Zappa.create_api_key
def create_api_key(self, api_id, stage_name): """ Create new API key and link it with an api_id and a stage_name """ response = self.apigateway_client.create_api_key( name='{}_{}'.format(stage_name, api_id), description='Api Key for {}'.format(api_id), ...
python
def create_api_key(self, api_id, stage_name): """ Create new API key and link it with an api_id and a stage_name """ response = self.apigateway_client.create_api_key( name='{}_{}'.format(stage_name, api_id), description='Api Key for {}'.format(api_id), ...
[ "def", "create_api_key", "(", "self", ",", "api_id", ",", "stage_name", ")", ":", "response", "=", "self", ".", "apigateway_client", ".", "create_api_key", "(", "name", "=", "'{}_{}'", ".", "format", "(", "stage_name", ",", "api_id", ")", ",", "description",...
Create new API key and link it with an api_id and a stage_name
[ "Create", "new", "API", "key", "and", "link", "it", "with", "an", "api_id", "and", "a", "stage_name" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1918-L1933
train
Miserlou/Zappa
zappa/core.py
Zappa.remove_api_key
def remove_api_key(self, api_id, stage_name): """ Remove a generated API key for api_id and stage_name """ response = self.apigateway_client.get_api_keys( limit=1, nameQuery='{}_{}'.format(stage_name, api_id) ) for api_key in response.get('items'):...
python
def remove_api_key(self, api_id, stage_name): """ Remove a generated API key for api_id and stage_name """ response = self.apigateway_client.get_api_keys( limit=1, nameQuery='{}_{}'.format(stage_name, api_id) ) for api_key in response.get('items'):...
[ "def", "remove_api_key", "(", "self", ",", "api_id", ",", "stage_name", ")", ":", "response", "=", "self", ".", "apigateway_client", ".", "get_api_keys", "(", "limit", "=", "1", ",", "nameQuery", "=", "'{}_{}'", ".", "format", "(", "stage_name", ",", "api_...
Remove a generated API key for api_id and stage_name
[ "Remove", "a", "generated", "API", "key", "for", "api_id", "and", "stage_name" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1935-L1946
train
Miserlou/Zappa
zappa/core.py
Zappa.add_api_stage_to_api_key
def add_api_stage_to_api_key(self, api_key, api_id, stage_name): """ Add api stage to Api key """ self.apigateway_client.update_api_key( apiKey=api_key, patchOperations=[ { 'op': 'add', 'path': '/stages', ...
python
def add_api_stage_to_api_key(self, api_key, api_id, stage_name): """ Add api stage to Api key """ self.apigateway_client.update_api_key( apiKey=api_key, patchOperations=[ { 'op': 'add', 'path': '/stages', ...
[ "def", "add_api_stage_to_api_key", "(", "self", ",", "api_key", ",", "api_id", ",", "stage_name", ")", ":", "self", ".", "apigateway_client", ".", "update_api_key", "(", "apiKey", "=", "api_key", ",", "patchOperations", "=", "[", "{", "'op'", ":", "'add'", "...
Add api stage to Api key
[ "Add", "api", "stage", "to", "Api", "key" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1948-L1961
train
Miserlou/Zappa
zappa/core.py
Zappa.get_patch_op
def get_patch_op(self, keypath, value, op='replace'): """ Return an object that describes a change of configuration on the given staging. Setting will be applied on all available HTTP methods. """ if isinstance(value, bool): value = str(value).lower() return {...
python
def get_patch_op(self, keypath, value, op='replace'): """ Return an object that describes a change of configuration on the given staging. Setting will be applied on all available HTTP methods. """ if isinstance(value, bool): value = str(value).lower() return {...
[ "def", "get_patch_op", "(", "self", ",", "keypath", ",", "value", ",", "op", "=", "'replace'", ")", ":", "if", "isinstance", "(", "value", ",", "bool", ")", ":", "value", "=", "str", "(", "value", ")", ".", "lower", "(", ")", "return", "{", "'op'",...
Return an object that describes a change of configuration on the given staging. Setting will be applied on all available HTTP methods.
[ "Return", "an", "object", "that", "describes", "a", "change", "of", "configuration", "on", "the", "given", "staging", ".", "Setting", "will", "be", "applied", "on", "all", "available", "HTTP", "methods", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1963-L1970
train
Miserlou/Zappa
zappa/core.py
Zappa.get_rest_apis
def get_rest_apis(self, project_name): """ Generator that allows to iterate per every available apis. """ all_apis = self.apigateway_client.get_rest_apis( limit=500 ) for api in all_apis['items']: if api['name'] != project_name: co...
python
def get_rest_apis(self, project_name): """ Generator that allows to iterate per every available apis. """ all_apis = self.apigateway_client.get_rest_apis( limit=500 ) for api in all_apis['items']: if api['name'] != project_name: co...
[ "def", "get_rest_apis", "(", "self", ",", "project_name", ")", ":", "all_apis", "=", "self", ".", "apigateway_client", ".", "get_rest_apis", "(", "limit", "=", "500", ")", "for", "api", "in", "all_apis", "[", "'items'", "]", ":", "if", "api", "[", "'name...
Generator that allows to iterate per every available apis.
[ "Generator", "that", "allows", "to", "iterate", "per", "every", "available", "apis", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1972-L1983
train
Miserlou/Zappa
zappa/core.py
Zappa.undeploy_api_gateway
def undeploy_api_gateway(self, lambda_name, domain_name=None, base_path=None): """ Delete a deployed REST API Gateway. """ print("Deleting API Gateway..") api_id = self.get_api_id(lambda_name) if domain_name: # XXX - Remove Route53 smartly here? ...
python
def undeploy_api_gateway(self, lambda_name, domain_name=None, base_path=None): """ Delete a deployed REST API Gateway. """ print("Deleting API Gateway..") api_id = self.get_api_id(lambda_name) if domain_name: # XXX - Remove Route53 smartly here? ...
[ "def", "undeploy_api_gateway", "(", "self", ",", "lambda_name", ",", "domain_name", "=", "None", ",", "base_path", "=", "None", ")", ":", "print", "(", "\"Deleting API Gateway..\"", ")", "api_id", "=", "self", ".", "get_api_id", "(", "lambda_name", ")", "if", ...
Delete a deployed REST API Gateway.
[ "Delete", "a", "deployed", "REST", "API", "Gateway", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1985-L2014
train
Miserlou/Zappa
zappa/core.py
Zappa.update_stage_config
def update_stage_config( self, project_name, stage_name, cloudwatch_log_level, cloudwatch_data_trace, cloudwatch_metrics_enabled ...
python
def update_stage_config( self, project_name, stage_name, cloudwatch_log_level, cloudwatch_data_trace, cloudwatch_metrics_enabled ...
[ "def", "update_stage_config", "(", "self", ",", "project_name", ",", "stage_name", ",", "cloudwatch_log_level", ",", "cloudwatch_data_trace", ",", "cloudwatch_metrics_enabled", ")", ":", "if", "cloudwatch_log_level", "not", "in", "self", ".", "cloudwatch_log_levels", ":...
Update CloudWatch metrics configuration.
[ "Update", "CloudWatch", "metrics", "configuration", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2016-L2038
train
Miserlou/Zappa
zappa/core.py
Zappa.delete_stack
def delete_stack(self, name, wait=False): """ Delete the CF stack managed by Zappa. """ try: stack = self.cf_client.describe_stacks(StackName=name)['Stacks'][0] except: # pragma: no cover print('No Zappa stack named {0}'.format(name)) return Fa...
python
def delete_stack(self, name, wait=False): """ Delete the CF stack managed by Zappa. """ try: stack = self.cf_client.describe_stacks(StackName=name)['Stacks'][0] except: # pragma: no cover print('No Zappa stack named {0}'.format(name)) return Fa...
[ "def", "delete_stack", "(", "self", ",", "name", ",", "wait", "=", "False", ")", ":", "try", ":", "stack", "=", "self", ".", "cf_client", ".", "describe_stacks", "(", "StackName", "=", "name", ")", "[", "'Stacks'", "]", "[", "0", "]", "except", ":", ...
Delete the CF stack managed by Zappa.
[ "Delete", "the", "CF", "stack", "managed", "by", "Zappa", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2076-L2096
train
Miserlou/Zappa
zappa/core.py
Zappa.create_stack_template
def create_stack_template( self, lambda_arn, lambda_name, api_key_required, iam_authorization, authorizer, cors_options=None, ...
python
def create_stack_template( self, lambda_arn, lambda_name, api_key_required, iam_authorization, authorizer, cors_options=None, ...
[ "def", "create_stack_template", "(", "self", ",", "lambda_arn", ",", "lambda_name", ",", "api_key_required", ",", "iam_authorization", ",", "authorizer", ",", "cors_options", "=", "None", ",", "description", "=", "None", ",", "endpoint_configuration", "=", "None", ...
Build the entire CF stack. Just used for the API Gateway, but could be expanded in the future.
[ "Build", "the", "entire", "CF", "stack", ".", "Just", "used", "for", "the", "API", "Gateway", "but", "could", "be", "expanded", "in", "the", "future", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2098-L2140
train
Miserlou/Zappa
zappa/core.py
Zappa.update_stack
def update_stack(self, name, working_bucket, wait=False, update_only=False, disable_progress=False): """ Update or create the CF stack managed by Zappa. """ capabilities = [] template = name + '-template-' + str(int(time.time())) + '.json' with open(template, 'wb') as ou...
python
def update_stack(self, name, working_bucket, wait=False, update_only=False, disable_progress=False): """ Update or create the CF stack managed by Zappa. """ capabilities = [] template = name + '-template-' + str(int(time.time())) + '.json' with open(template, 'wb') as ou...
[ "def", "update_stack", "(", "self", ",", "name", ",", "working_bucket", ",", "wait", "=", "False", ",", "update_only", "=", "False", ",", "disable_progress", "=", "False", ")", ":", "capabilities", "=", "[", "]", "template", "=", "name", "+", "'-template-'...
Update or create the CF stack managed by Zappa.
[ "Update", "or", "create", "the", "CF", "stack", "managed", "by", "Zappa", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2142-L2237
train
Miserlou/Zappa
zappa/core.py
Zappa.stack_outputs
def stack_outputs(self, name): """ Given a name, describes CloudFront stacks and returns dict of the stack Outputs , else returns an empty dict. """ try: stack = self.cf_client.describe_stacks(StackName=name)['Stacks'][0] return {x['OutputKey']: x['OutputV...
python
def stack_outputs(self, name): """ Given a name, describes CloudFront stacks and returns dict of the stack Outputs , else returns an empty dict. """ try: stack = self.cf_client.describe_stacks(StackName=name)['Stacks'][0] return {x['OutputKey']: x['OutputV...
[ "def", "stack_outputs", "(", "self", ",", "name", ")", ":", "try", ":", "stack", "=", "self", ".", "cf_client", ".", "describe_stacks", "(", "StackName", "=", "name", ")", "[", "'Stacks'", "]", "[", "0", "]", "return", "{", "x", "[", "'OutputKey'", "...
Given a name, describes CloudFront stacks and returns dict of the stack Outputs , else returns an empty dict.
[ "Given", "a", "name", "describes", "CloudFront", "stacks", "and", "returns", "dict", "of", "the", "stack", "Outputs", "else", "returns", "an", "empty", "dict", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2239-L2248
train
Miserlou/Zappa
zappa/core.py
Zappa.get_api_url
def get_api_url(self, lambda_name, stage_name): """ Given a lambda_name and stage_name, return a valid API URL. """ api_id = self.get_api_id(lambda_name) if api_id: return "https://{}.execute-api.{}.amazonaws.com/{}".format(api_id, self.boto_session.region_name, stage...
python
def get_api_url(self, lambda_name, stage_name): """ Given a lambda_name and stage_name, return a valid API URL. """ api_id = self.get_api_id(lambda_name) if api_id: return "https://{}.execute-api.{}.amazonaws.com/{}".format(api_id, self.boto_session.region_name, stage...
[ "def", "get_api_url", "(", "self", ",", "lambda_name", ",", "stage_name", ")", ":", "api_id", "=", "self", ".", "get_api_id", "(", "lambda_name", ")", "if", "api_id", ":", "return", "\"https://{}.execute-api.{}.amazonaws.com/{}\"", ".", "format", "(", "api_id", ...
Given a lambda_name and stage_name, return a valid API URL.
[ "Given", "a", "lambda_name", "and", "stage_name", "return", "a", "valid", "API", "URL", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2251-L2259
train
Miserlou/Zappa
zappa/core.py
Zappa.get_api_id
def get_api_id(self, lambda_name): """ Given a lambda_name, return the API id. """ try: response = self.cf_client.describe_stack_resource(StackName=lambda_name, LogicalResourceId='Api') return response[...
python
def get_api_id(self, lambda_name): """ Given a lambda_name, return the API id. """ try: response = self.cf_client.describe_stack_resource(StackName=lambda_name, LogicalResourceId='Api') return response[...
[ "def", "get_api_id", "(", "self", ",", "lambda_name", ")", ":", "try", ":", "response", "=", "self", ".", "cf_client", ".", "describe_stack_resource", "(", "StackName", "=", "lambda_name", ",", "LogicalResourceId", "=", "'Api'", ")", "return", "response", "[",...
Given a lambda_name, return the API id.
[ "Given", "a", "lambda_name", "return", "the", "API", "id", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2261-L2282
train
Miserlou/Zappa
zappa/core.py
Zappa.create_domain_name
def create_domain_name(self, domain_name, certificate_name, certificate_body=None, certificate_private_key=None, certificate_chain=None, certificate_arn=None,...
python
def create_domain_name(self, domain_name, certificate_name, certificate_body=None, certificate_private_key=None, certificate_chain=None, certificate_arn=None,...
[ "def", "create_domain_name", "(", "self", ",", "domain_name", ",", "certificate_name", ",", "certificate_body", "=", "None", ",", "certificate_private_key", "=", "None", ",", "certificate_chain", "=", "None", ",", "certificate_arn", "=", "None", ",", "lambda_name", ...
Creates the API GW domain and returns the resulting DNS name.
[ "Creates", "the", "API", "GW", "domain", "and", "returns", "the", "resulting", "DNS", "name", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2284-L2326
train
Miserlou/Zappa
zappa/core.py
Zappa.update_route53_records
def update_route53_records(self, domain_name, dns_name): """ Updates Route53 Records following GW domain creation """ zone_id = self.get_hosted_zone_id_for_domain(domain_name) is_apex = self.route53.get_hosted_zone(Id=zone_id)['HostedZone']['Name'][:-1] == domain_name if...
python
def update_route53_records(self, domain_name, dns_name): """ Updates Route53 Records following GW domain creation """ zone_id = self.get_hosted_zone_id_for_domain(domain_name) is_apex = self.route53.get_hosted_zone(Id=zone_id)['HostedZone']['Name'][:-1] == domain_name if...
[ "def", "update_route53_records", "(", "self", ",", "domain_name", ",", "dns_name", ")", ":", "zone_id", "=", "self", ".", "get_hosted_zone_id_for_domain", "(", "domain_name", ")", "is_apex", "=", "self", ".", "route53", ".", "get_hosted_zone", "(", "Id", "=", ...
Updates Route53 Records following GW domain creation
[ "Updates", "Route53", "Records", "following", "GW", "domain", "creation" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2328-L2377
train
Miserlou/Zappa
zappa/core.py
Zappa.update_domain_name
def update_domain_name(self, domain_name, certificate_name=None, certificate_body=None, certificate_private_key=None, certificate_chain=None, certificate_arn=...
python
def update_domain_name(self, domain_name, certificate_name=None, certificate_body=None, certificate_private_key=None, certificate_chain=None, certificate_arn=...
[ "def", "update_domain_name", "(", "self", ",", "domain_name", ",", "certificate_name", "=", "None", ",", "certificate_body", "=", "None", ",", "certificate_private_key", "=", "None", ",", "certificate_chain", "=", "None", ",", "certificate_arn", "=", "None", ",", ...
This updates your certificate information for an existing domain, with similar arguments to boto's update_domain_name API Gateway api. It returns the resulting new domain information including the new certificate's ARN if created during this process. Previously, this method involved do...
[ "This", "updates", "your", "certificate", "information", "for", "an", "existing", "domain", "with", "similar", "arguments", "to", "boto", "s", "update_domain_name", "API", "Gateway", "api", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2379-L2429
train
Miserlou/Zappa
zappa/core.py
Zappa.update_domain_base_path_mapping
def update_domain_base_path_mapping(self, domain_name, lambda_name, stage, base_path): """ Update domain base path mapping on API Gateway if it was changed """ api_id = self.get_api_id(lambda_name) if not api_id: print("Warning! Can't update base path mapping!") ...
python
def update_domain_base_path_mapping(self, domain_name, lambda_name, stage, base_path): """ Update domain base path mapping on API Gateway if it was changed """ api_id = self.get_api_id(lambda_name) if not api_id: print("Warning! Can't update base path mapping!") ...
[ "def", "update_domain_base_path_mapping", "(", "self", ",", "domain_name", ",", "lambda_name", ",", "stage", ",", "base_path", ")", ":", "api_id", "=", "self", ".", "get_api_id", "(", "lambda_name", ")", "if", "not", "api_id", ":", "print", "(", "\"Warning! Ca...
Update domain base path mapping on API Gateway if it was changed
[ "Update", "domain", "base", "path", "mapping", "on", "API", "Gateway", "if", "it", "was", "changed" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2431-L2458
train
Miserlou/Zappa
zappa/core.py
Zappa.get_all_zones
def get_all_zones(self): """Same behaviour of list_host_zones, but transparently handling pagination.""" zones = {'HostedZones': []} new_zones = self.route53.list_hosted_zones(MaxItems='100') while new_zones['IsTruncated']: zones['HostedZones'] += new_zones['HostedZones'] ...
python
def get_all_zones(self): """Same behaviour of list_host_zones, but transparently handling pagination.""" zones = {'HostedZones': []} new_zones = self.route53.list_hosted_zones(MaxItems='100') while new_zones['IsTruncated']: zones['HostedZones'] += new_zones['HostedZones'] ...
[ "def", "get_all_zones", "(", "self", ")", ":", "zones", "=", "{", "'HostedZones'", ":", "[", "]", "}", "new_zones", "=", "self", ".", "route53", ".", "list_hosted_zones", "(", "MaxItems", "=", "'100'", ")", "while", "new_zones", "[", "'IsTruncated'", "]", ...
Same behaviour of list_host_zones, but transparently handling pagination.
[ "Same", "behaviour", "of", "list_host_zones", "but", "transparently", "handling", "pagination", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2460-L2470
train
Miserlou/Zappa
zappa/core.py
Zappa.get_domain_name
def get_domain_name(self, domain_name, route53=True): """ Scan our hosted zones for the record of a given name. Returns the record entry, else None. """ # Make sure api gateway domain is present try: self.apigateway_client.get_domain_name(domainName=domain_n...
python
def get_domain_name(self, domain_name, route53=True): """ Scan our hosted zones for the record of a given name. Returns the record entry, else None. """ # Make sure api gateway domain is present try: self.apigateway_client.get_domain_name(domainName=domain_n...
[ "def", "get_domain_name", "(", "self", ",", "domain_name", ",", "route53", "=", "True", ")", ":", "# Make sure api gateway domain is present", "try", ":", "self", ".", "apigateway_client", ".", "get_domain_name", "(", "domainName", "=", "domain_name", ")", "except",...
Scan our hosted zones for the record of a given name. Returns the record entry, else None.
[ "Scan", "our", "hosted", "zones", "for", "the", "record", "of", "a", "given", "name", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2472-L2513
train
Miserlou/Zappa
zappa/core.py
Zappa.get_credentials_arn
def get_credentials_arn(self): """ Given our role name, get and set the credentials_arn. """ role = self.iam.Role(self.role_name) self.credentials_arn = role.arn return role, self.credentials_arn
python
def get_credentials_arn(self): """ Given our role name, get and set the credentials_arn. """ role = self.iam.Role(self.role_name) self.credentials_arn = role.arn return role, self.credentials_arn
[ "def", "get_credentials_arn", "(", "self", ")", ":", "role", "=", "self", ".", "iam", ".", "Role", "(", "self", ".", "role_name", ")", "self", ".", "credentials_arn", "=", "role", ".", "arn", "return", "role", ",", "self", ".", "credentials_arn" ]
Given our role name, get and set the credentials_arn.
[ "Given", "our", "role", "name", "get", "and", "set", "the", "credentials_arn", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2519-L2526
train
Miserlou/Zappa
zappa/core.py
Zappa.create_iam_roles
def create_iam_roles(self): """ Create and defines the IAM roles and policies necessary for Zappa. If the IAM role already exists, it will be updated if necessary. """ attach_policy_obj = json.loads(self.attach_policy) assume_policy_obj = json.loads(self.assume_policy) ...
python
def create_iam_roles(self): """ Create and defines the IAM roles and policies necessary for Zappa. If the IAM role already exists, it will be updated if necessary. """ attach_policy_obj = json.loads(self.attach_policy) assume_policy_obj = json.loads(self.assume_policy) ...
[ "def", "create_iam_roles", "(", "self", ")", ":", "attach_policy_obj", "=", "json", ".", "loads", "(", "self", ".", "attach_policy", ")", "assume_policy_obj", "=", "json", ".", "loads", "(", "self", ".", "assume_policy", ")", "if", "self", ".", "extra_permis...
Create and defines the IAM roles and policies necessary for Zappa. If the IAM role already exists, it will be updated if necessary.
[ "Create", "and", "defines", "the", "IAM", "roles", "and", "policies", "necessary", "for", "Zappa", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2528-L2581
train
Miserlou/Zappa
zappa/core.py
Zappa._clear_policy
def _clear_policy(self, lambda_name): """ Remove obsolete policy statements to prevent policy from bloating over the limit after repeated updates. """ try: policy_response = self.lambda_client.get_policy( FunctionName=lambda_name ) if p...
python
def _clear_policy(self, lambda_name): """ Remove obsolete policy statements to prevent policy from bloating over the limit after repeated updates. """ try: policy_response = self.lambda_client.get_policy( FunctionName=lambda_name ) if p...
[ "def", "_clear_policy", "(", "self", ",", "lambda_name", ")", ":", "try", ":", "policy_response", "=", "self", ".", "lambda_client", ".", "get_policy", "(", "FunctionName", "=", "lambda_name", ")", "if", "policy_response", "[", "'ResponseMetadata'", "]", "[", ...
Remove obsolete policy statements to prevent policy from bloating over the limit after repeated updates.
[ "Remove", "obsolete", "policy", "statements", "to", "prevent", "policy", "from", "bloating", "over", "the", "limit", "after", "repeated", "updates", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2583-L2606
train
Miserlou/Zappa
zappa/core.py
Zappa.create_event_permission
def create_event_permission(self, lambda_name, principal, source_arn): """ Create permissions to link to an event. Related: http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-configure-event-source.html """ logger.debug('Adding new permission to invoke Lambda function: ...
python
def create_event_permission(self, lambda_name, principal, source_arn): """ Create permissions to link to an event. Related: http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-configure-event-source.html """ logger.debug('Adding new permission to invoke Lambda function: ...
[ "def", "create_event_permission", "(", "self", ",", "lambda_name", ",", "principal", ",", "source_arn", ")", ":", "logger", ".", "debug", "(", "'Adding new permission to invoke Lambda function: {}'", ".", "format", "(", "lambda_name", ")", ")", "permission_response", ...
Create permissions to link to an event. Related: http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-configure-event-source.html
[ "Create", "permissions", "to", "link", "to", "an", "event", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2612-L2631
train
Miserlou/Zappa
zappa/core.py
Zappa.schedule_events
def schedule_events(self, lambda_arn, lambda_name, events, default=True): """ Given a Lambda ARN, name and a list of events, schedule this as CloudWatch Events. 'events' is a list of dictionaries, where the dict must contains the string of a 'function' and the string of the event 'expre...
python
def schedule_events(self, lambda_arn, lambda_name, events, default=True): """ Given a Lambda ARN, name and a list of events, schedule this as CloudWatch Events. 'events' is a list of dictionaries, where the dict must contains the string of a 'function' and the string of the event 'expre...
[ "def", "schedule_events", "(", "self", ",", "lambda_arn", ",", "lambda_name", ",", "events", ",", "default", "=", "True", ")", ":", "# The stream sources - DynamoDB, Kinesis and SQS - are working differently than the other services (pull vs push)", "# and do not require event permi...
Given a Lambda ARN, name and a list of events, schedule this as CloudWatch Events. 'events' is a list of dictionaries, where the dict must contains the string of a 'function' and the string of the event 'expression', and an optional 'name' and 'description'. Expressions can be in rate or cron ...
[ "Given", "a", "Lambda", "ARN", "name", "and", "a", "list", "of", "events", "schedule", "this", "as", "CloudWatch", "Events", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2633-L2771
train
Miserlou/Zappa
zappa/core.py
Zappa.get_event_name
def get_event_name(lambda_name, name): """ Returns an AWS-valid Lambda event name. """ return '{prefix:.{width}}-{postfix}'.format(prefix=lambda_name, width=max(0, 63 - len(name)), postfix=name)[:64]
python
def get_event_name(lambda_name, name): """ Returns an AWS-valid Lambda event name. """ return '{prefix:.{width}}-{postfix}'.format(prefix=lambda_name, width=max(0, 63 - len(name)), postfix=name)[:64]
[ "def", "get_event_name", "(", "lambda_name", ",", "name", ")", ":", "return", "'{prefix:.{width}}-{postfix}'", ".", "format", "(", "prefix", "=", "lambda_name", ",", "width", "=", "max", "(", "0", ",", "63", "-", "len", "(", "name", ")", ")", ",", "postf...
Returns an AWS-valid Lambda event name.
[ "Returns", "an", "AWS", "-", "valid", "Lambda", "event", "name", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2790-L2795
train
Miserlou/Zappa
zappa/core.py
Zappa.get_hashed_rule_name
def get_hashed_rule_name(event, function, lambda_name): """ Returns an AWS-valid CloudWatch rule name using a digest of the event name, lambda name, and function. This allows support for rule names that may be longer than the 64 char limit. """ event_name = event.get('name', func...
python
def get_hashed_rule_name(event, function, lambda_name): """ Returns an AWS-valid CloudWatch rule name using a digest of the event name, lambda name, and function. This allows support for rule names that may be longer than the 64 char limit. """ event_name = event.get('name', func...
[ "def", "get_hashed_rule_name", "(", "event", ",", "function", ",", "lambda_name", ")", ":", "event_name", "=", "event", ".", "get", "(", "'name'", ",", "function", ")", "name_hash", "=", "hashlib", ".", "sha1", "(", "'{}-{}'", ".", "format", "(", "lambda_n...
Returns an AWS-valid CloudWatch rule name using a digest of the event name, lambda name, and function. This allows support for rule names that may be longer than the 64 char limit.
[ "Returns", "an", "AWS", "-", "valid", "CloudWatch", "rule", "name", "using", "a", "digest", "of", "the", "event", "name", "lambda", "name", "and", "function", ".", "This", "allows", "support", "for", "rule", "names", "that", "may", "be", "longer", "than", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2798-L2805
train
Miserlou/Zappa
zappa/core.py
Zappa.delete_rule
def delete_rule(self, rule_name): """ Delete a CWE rule. This deletes them, but they will still show up in the AWS console. Annoying. """ logger.debug('Deleting existing rule {}'.format(rule_name)) # All targets must be removed before # we can actually...
python
def delete_rule(self, rule_name): """ Delete a CWE rule. This deletes them, but they will still show up in the AWS console. Annoying. """ logger.debug('Deleting existing rule {}'.format(rule_name)) # All targets must be removed before # we can actually...
[ "def", "delete_rule", "(", "self", ",", "rule_name", ")", ":", "logger", ".", "debug", "(", "'Deleting existing rule {}'", ".", "format", "(", "rule_name", ")", ")", "# All targets must be removed before", "# we can actually delete the rule.", "try", ":", "targets", "...
Delete a CWE rule. This deletes them, but they will still show up in the AWS console. Annoying.
[ "Delete", "a", "CWE", "rule", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2807-L2836
train
Miserlou/Zappa
zappa/core.py
Zappa.get_event_rule_names_for_lambda
def get_event_rule_names_for_lambda(self, lambda_arn): """ Get all of the rule names associated with a lambda function. """ response = self.events_client.list_rule_names_by_target(TargetArn=lambda_arn) rule_names = response['RuleNames'] # Iterate when the results are pagi...
python
def get_event_rule_names_for_lambda(self, lambda_arn): """ Get all of the rule names associated with a lambda function. """ response = self.events_client.list_rule_names_by_target(TargetArn=lambda_arn) rule_names = response['RuleNames'] # Iterate when the results are pagi...
[ "def", "get_event_rule_names_for_lambda", "(", "self", ",", "lambda_arn", ")", ":", "response", "=", "self", ".", "events_client", ".", "list_rule_names_by_target", "(", "TargetArn", "=", "lambda_arn", ")", "rule_names", "=", "response", "[", "'RuleNames'", "]", "...
Get all of the rule names associated with a lambda function.
[ "Get", "all", "of", "the", "rule", "names", "associated", "with", "a", "lambda", "function", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2838-L2849
train
Miserlou/Zappa
zappa/core.py
Zappa.get_event_rules_for_lambda
def get_event_rules_for_lambda(self, lambda_arn): """ Get all of the rule details associated with this function. """ rule_names = self.get_event_rule_names_for_lambda(lambda_arn=lambda_arn) return [self.events_client.describe_rule(Name=r) for r in rule_names]
python
def get_event_rules_for_lambda(self, lambda_arn): """ Get all of the rule details associated with this function. """ rule_names = self.get_event_rule_names_for_lambda(lambda_arn=lambda_arn) return [self.events_client.describe_rule(Name=r) for r in rule_names]
[ "def", "get_event_rules_for_lambda", "(", "self", ",", "lambda_arn", ")", ":", "rule_names", "=", "self", ".", "get_event_rule_names_for_lambda", "(", "lambda_arn", "=", "lambda_arn", ")", "return", "[", "self", ".", "events_client", ".", "describe_rule", "(", "Na...
Get all of the rule details associated with this function.
[ "Get", "all", "of", "the", "rule", "details", "associated", "with", "this", "function", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2851-L2856
train
Miserlou/Zappa
zappa/core.py
Zappa.unschedule_events
def unschedule_events(self, events, lambda_arn=None, lambda_name=None, excluded_source_services=None): excluded_source_services = excluded_source_services or [] """ Given a list of events, unschedule these CloudWatch Events. 'events' is a list of dictionaries, where the dict must contai...
python
def unschedule_events(self, events, lambda_arn=None, lambda_name=None, excluded_source_services=None): excluded_source_services = excluded_source_services or [] """ Given a list of events, unschedule these CloudWatch Events. 'events' is a list of dictionaries, where the dict must contai...
[ "def", "unschedule_events", "(", "self", ",", "events", ",", "lambda_arn", "=", "None", ",", "lambda_name", "=", "None", ",", "excluded_source_services", "=", "None", ")", ":", "excluded_source_services", "=", "excluded_source_services", "or", "[", "]", "self", ...
Given a list of events, unschedule these CloudWatch Events. 'events' is a list of dictionaries, where the dict must contains the string of a 'function' and the string of the event 'expression', and an optional 'name' and 'description'.
[ "Given", "a", "list", "of", "events", "unschedule", "these", "CloudWatch", "Events", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2858-L2895
train
Miserlou/Zappa
zappa/core.py
Zappa.create_async_sns_topic
def create_async_sns_topic(self, lambda_name, lambda_arn): """ Create the SNS-based async topic. """ topic_name = get_topic_name(lambda_name) # Create SNS topic topic_arn = self.sns_client.create_topic( Name=topic_name)['TopicArn'] # Create subscriptio...
python
def create_async_sns_topic(self, lambda_name, lambda_arn): """ Create the SNS-based async topic. """ topic_name = get_topic_name(lambda_name) # Create SNS topic topic_arn = self.sns_client.create_topic( Name=topic_name)['TopicArn'] # Create subscriptio...
[ "def", "create_async_sns_topic", "(", "self", ",", "lambda_name", ",", "lambda_arn", ")", ":", "topic_name", "=", "get_topic_name", "(", "lambda_name", ")", "# Create SNS topic", "topic_arn", "=", "self", ".", "sns_client", ".", "create_topic", "(", "Name", "=", ...
Create the SNS-based async topic.
[ "Create", "the", "SNS", "-", "based", "async", "topic", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2901-L2931
train
Miserlou/Zappa
zappa/core.py
Zappa.remove_async_sns_topic
def remove_async_sns_topic(self, lambda_name): """ Remove the async SNS topic. """ topic_name = get_topic_name(lambda_name) removed_arns = [] for sub in self.sns_client.list_subscriptions()['Subscriptions']: if topic_name in sub['TopicArn']: se...
python
def remove_async_sns_topic(self, lambda_name): """ Remove the async SNS topic. """ topic_name = get_topic_name(lambda_name) removed_arns = [] for sub in self.sns_client.list_subscriptions()['Subscriptions']: if topic_name in sub['TopicArn']: se...
[ "def", "remove_async_sns_topic", "(", "self", ",", "lambda_name", ")", ":", "topic_name", "=", "get_topic_name", "(", "lambda_name", ")", "removed_arns", "=", "[", "]", "for", "sub", "in", "self", ".", "sns_client", ".", "list_subscriptions", "(", ")", "[", ...
Remove the async SNS topic.
[ "Remove", "the", "async", "SNS", "topic", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2933-L2943
train
Miserlou/Zappa
zappa/core.py
Zappa.create_async_dynamodb_table
def create_async_dynamodb_table(self, table_name, read_capacity, write_capacity): """ Create the DynamoDB table for async task return values """ try: dynamodb_table = self.dynamodb_client.describe_table(TableName=table_name) return False, dynamodb_table #...
python
def create_async_dynamodb_table(self, table_name, read_capacity, write_capacity): """ Create the DynamoDB table for async task return values """ try: dynamodb_table = self.dynamodb_client.describe_table(TableName=table_name) return False, dynamodb_table #...
[ "def", "create_async_dynamodb_table", "(", "self", ",", "table_name", ",", "read_capacity", ",", "write_capacity", ")", ":", "try", ":", "dynamodb_table", "=", "self", ".", "dynamodb_client", ".", "describe_table", "(", "TableName", "=", "table_name", ")", "return...
Create the DynamoDB table for async task return values
[ "Create", "the", "DynamoDB", "table", "for", "async", "task", "return", "values" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2960-L2997
train
Miserlou/Zappa
zappa/core.py
Zappa.fetch_logs
def fetch_logs(self, lambda_name, filter_pattern='', limit=10000, start_time=0): """ Fetch the CloudWatch logs for a given Lambda name. """ log_name = '/aws/lambda/' + lambda_name streams = self.logs_client.describe_log_streams( logGroupName=log_name, desc...
python
def fetch_logs(self, lambda_name, filter_pattern='', limit=10000, start_time=0): """ Fetch the CloudWatch logs for a given Lambda name. """ log_name = '/aws/lambda/' + lambda_name streams = self.logs_client.describe_log_streams( logGroupName=log_name, desc...
[ "def", "fetch_logs", "(", "self", ",", "lambda_name", ",", "filter_pattern", "=", "''", ",", "limit", "=", "10000", ",", "start_time", "=", "0", ")", ":", "log_name", "=", "'/aws/lambda/'", "+", "lambda_name", "streams", "=", "self", ".", "logs_client", "....
Fetch the CloudWatch logs for a given Lambda name.
[ "Fetch", "the", "CloudWatch", "logs", "for", "a", "given", "Lambda", "name", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L3010-L3049
train
Miserlou/Zappa
zappa/core.py
Zappa.remove_log_group
def remove_log_group(self, group_name): """ Filter all log groups that match the name given in log_filter. """ print("Removing log group: {}".format(group_name)) try: self.logs_client.delete_log_group(logGroupName=group_name) except botocore.exceptions.ClientE...
python
def remove_log_group(self, group_name): """ Filter all log groups that match the name given in log_filter. """ print("Removing log group: {}".format(group_name)) try: self.logs_client.delete_log_group(logGroupName=group_name) except botocore.exceptions.ClientE...
[ "def", "remove_log_group", "(", "self", ",", "group_name", ")", ":", "print", "(", "\"Removing log group: {}\"", ".", "format", "(", "group_name", ")", ")", "try", ":", "self", ".", "logs_client", ".", "delete_log_group", "(", "logGroupName", "=", "group_name", ...
Filter all log groups that match the name given in log_filter.
[ "Filter", "all", "log", "groups", "that", "match", "the", "name", "given", "in", "log_filter", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L3051-L3059
train
Miserlou/Zappa
zappa/core.py
Zappa.remove_api_gateway_logs
def remove_api_gateway_logs(self, project_name): """ Removed all logs that are assigned to a given rest api id. """ for rest_api in self.get_rest_apis(project_name): for stage in self.apigateway_client.get_stages(restApiId=rest_api['id'])['item']: self.remove_...
python
def remove_api_gateway_logs(self, project_name): """ Removed all logs that are assigned to a given rest api id. """ for rest_api in self.get_rest_apis(project_name): for stage in self.apigateway_client.get_stages(restApiId=rest_api['id'])['item']: self.remove_...
[ "def", "remove_api_gateway_logs", "(", "self", ",", "project_name", ")", ":", "for", "rest_api", "in", "self", ".", "get_rest_apis", "(", "project_name", ")", ":", "for", "stage", "in", "self", ".", "apigateway_client", ".", "get_stages", "(", "restApiId", "="...
Removed all logs that are assigned to a given rest api id.
[ "Removed", "all", "logs", "that", "are", "assigned", "to", "a", "given", "rest", "api", "id", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L3067-L3073
train
Miserlou/Zappa
zappa/core.py
Zappa.get_hosted_zone_id_for_domain
def get_hosted_zone_id_for_domain(self, domain): """ Get the Hosted Zone ID for a given domain. """ all_zones = self.get_all_zones() return self.get_best_match_zone(all_zones, domain)
python
def get_hosted_zone_id_for_domain(self, domain): """ Get the Hosted Zone ID for a given domain. """ all_zones = self.get_all_zones() return self.get_best_match_zone(all_zones, domain)
[ "def", "get_hosted_zone_id_for_domain", "(", "self", ",", "domain", ")", ":", "all_zones", "=", "self", ".", "get_all_zones", "(", ")", "return", "self", ".", "get_best_match_zone", "(", "all_zones", ",", "domain", ")" ]
Get the Hosted Zone ID for a given domain.
[ "Get", "the", "Hosted", "Zone", "ID", "for", "a", "given", "domain", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L3079-L3085
train
Miserlou/Zappa
zappa/core.py
Zappa.get_best_match_zone
def get_best_match_zone(all_zones, domain): """Return zone id which name is closer matched with domain name.""" # Related: https://github.com/Miserlou/Zappa/issues/459 public_zones = [zone for zone in all_zones['HostedZones'] if not zone['Config']['PrivateZone']] zones = {zone['Name'][...
python
def get_best_match_zone(all_zones, domain): """Return zone id which name is closer matched with domain name.""" # Related: https://github.com/Miserlou/Zappa/issues/459 public_zones = [zone for zone in all_zones['HostedZones'] if not zone['Config']['PrivateZone']] zones = {zone['Name'][...
[ "def", "get_best_match_zone", "(", "all_zones", ",", "domain", ")", ":", "# Related: https://github.com/Miserlou/Zappa/issues/459", "public_zones", "=", "[", "zone", "for", "zone", "in", "all_zones", "[", "'HostedZones'", "]", "if", "not", "zone", "[", "'Config'", "...
Return zone id which name is closer matched with domain name.
[ "Return", "zone", "id", "which", "name", "is", "closer", "matched", "with", "domain", "name", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L3088-L3099
train
Miserlou/Zappa
zappa/core.py
Zappa.remove_dns_challenge_txt
def remove_dns_challenge_txt(self, zone_id, domain, txt_challenge): """ Remove DNS challenge TXT. """ print("Deleting DNS challenge..") resp = self.route53.change_resource_record_sets( HostedZoneId=zone_id, ChangeBatch=self.get_dns_challenge_change_batch('...
python
def remove_dns_challenge_txt(self, zone_id, domain, txt_challenge): """ Remove DNS challenge TXT. """ print("Deleting DNS challenge..") resp = self.route53.change_resource_record_sets( HostedZoneId=zone_id, ChangeBatch=self.get_dns_challenge_change_batch('...
[ "def", "remove_dns_challenge_txt", "(", "self", ",", "zone_id", ",", "domain", ",", "txt_challenge", ")", ":", "print", "(", "\"Deleting DNS challenge..\"", ")", "resp", "=", "self", ".", "route53", ".", "change_resource_record_sets", "(", "HostedZoneId", "=", "zo...
Remove DNS challenge TXT.
[ "Remove", "DNS", "challenge", "TXT", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L3113-L3123
train
Miserlou/Zappa
zappa/core.py
Zappa.load_credentials
def load_credentials(self, boto_session=None, profile_name=None): """ Load AWS credentials. An optional boto_session can be provided, but that's usually for testing. An optional profile_name can be provided for config files that have multiple sets of credentials. """ ...
python
def load_credentials(self, boto_session=None, profile_name=None): """ Load AWS credentials. An optional boto_session can be provided, but that's usually for testing. An optional profile_name can be provided for config files that have multiple sets of credentials. """ ...
[ "def", "load_credentials", "(", "self", ",", "boto_session", "=", "None", ",", "profile_name", "=", "None", ")", ":", "# Automatically load credentials from config or environment", "if", "not", "boto_session", ":", "# If provided, use the supplied profile name.", "if", "pro...
Load AWS credentials. An optional boto_session can be provided, but that's usually for testing. An optional profile_name can be provided for config files that have multiple sets of credentials.
[ "Load", "AWS", "credentials", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L3161-L3204
train
Miserlou/Zappa
zappa/letsencrypt.py
get_cert_and_update_domain
def get_cert_and_update_domain( zappa_instance, lambda_name, api_stage, domain=None, manual=False, ): """ Main cert installe...
python
def get_cert_and_update_domain( zappa_instance, lambda_name, api_stage, domain=None, manual=False, ): """ Main cert installe...
[ "def", "get_cert_and_update_domain", "(", "zappa_instance", ",", "lambda_name", ",", "api_stage", ",", "domain", "=", "None", ",", "manual", "=", "False", ",", ")", ":", "try", ":", "create_domain_key", "(", ")", "create_domain_csr", "(", "domain", ")", "get_c...
Main cert installer path.
[ "Main", "cert", "installer", "path", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L47-L112
train
Miserlou/Zappa
zappa/letsencrypt.py
parse_account_key
def parse_account_key(): """Parse account key to get public key""" LOGGER.info("Parsing account key...") cmd = [ 'openssl', 'rsa', '-in', os.path.join(gettempdir(), 'account.key'), '-noout', '-text' ] devnull = open(os.devnull, 'wb') return subprocess.check_output...
python
def parse_account_key(): """Parse account key to get public key""" LOGGER.info("Parsing account key...") cmd = [ 'openssl', 'rsa', '-in', os.path.join(gettempdir(), 'account.key'), '-noout', '-text' ] devnull = open(os.devnull, 'wb') return subprocess.check_output...
[ "def", "parse_account_key", "(", ")", ":", "LOGGER", ".", "info", "(", "\"Parsing account key...\"", ")", "cmd", "=", "[", "'openssl'", ",", "'rsa'", ",", "'-in'", ",", "os", ".", "path", ".", "join", "(", "gettempdir", "(", ")", ",", "'account.key'", ")...
Parse account key to get public key
[ "Parse", "account", "key", "to", "get", "public", "key" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L151-L161
train
Miserlou/Zappa
zappa/letsencrypt.py
parse_csr
def parse_csr(): """ Parse certificate signing request for domains """ LOGGER.info("Parsing CSR...") cmd = [ 'openssl', 'req', '-in', os.path.join(gettempdir(), 'domain.csr'), '-noout', '-text' ] devnull = open(os.devnull, 'wb') out = subprocess.check_outp...
python
def parse_csr(): """ Parse certificate signing request for domains """ LOGGER.info("Parsing CSR...") cmd = [ 'openssl', 'req', '-in', os.path.join(gettempdir(), 'domain.csr'), '-noout', '-text' ] devnull = open(os.devnull, 'wb') out = subprocess.check_outp...
[ "def", "parse_csr", "(", ")", ":", "LOGGER", ".", "info", "(", "\"Parsing CSR...\"", ")", "cmd", "=", "[", "'openssl'", ",", "'req'", ",", "'-in'", ",", "os", ".", "path", ".", "join", "(", "gettempdir", "(", ")", ",", "'domain.csr'", ")", ",", "'-no...
Parse certificate signing request for domains
[ "Parse", "certificate", "signing", "request", "for", "domains" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L164-L187
train
Miserlou/Zappa
zappa/letsencrypt.py
get_boulder_header
def get_boulder_header(key_bytes): """ Use regular expressions to find crypto values from parsed account key, and return a header we can send to our Boulder instance. """ pub_hex, pub_exp = re.search( r"modulus:\n\s+00:([a-f0-9\:\s]+?)\npublicExponent: ([0-9]+)", key_bytes.decode('ut...
python
def get_boulder_header(key_bytes): """ Use regular expressions to find crypto values from parsed account key, and return a header we can send to our Boulder instance. """ pub_hex, pub_exp = re.search( r"modulus:\n\s+00:([a-f0-9\:\s]+?)\npublicExponent: ([0-9]+)", key_bytes.decode('ut...
[ "def", "get_boulder_header", "(", "key_bytes", ")", ":", "pub_hex", ",", "pub_exp", "=", "re", ".", "search", "(", "r\"modulus:\\n\\s+00:([a-f0-9\\:\\s]+?)\\npublicExponent: ([0-9]+)\"", ",", "key_bytes", ".", "decode", "(", "'utf8'", ")", ",", "re", ".", "MULTILINE...
Use regular expressions to find crypto values from parsed account key, and return a header we can send to our Boulder instance.
[ "Use", "regular", "expressions", "to", "find", "crypto", "values", "from", "parsed", "account", "key", "and", "return", "a", "header", "we", "can", "send", "to", "our", "Boulder", "instance", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L190-L209
train
Miserlou/Zappa
zappa/letsencrypt.py
register_account
def register_account(): """ Agree to LE TOS """ LOGGER.info("Registering account...") code, result = _send_signed_request(DEFAULT_CA + "/acme/new-reg", { "resource": "new-reg", "agreement": "https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf", }) if code == 201...
python
def register_account(): """ Agree to LE TOS """ LOGGER.info("Registering account...") code, result = _send_signed_request(DEFAULT_CA + "/acme/new-reg", { "resource": "new-reg", "agreement": "https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf", }) if code == 201...
[ "def", "register_account", "(", ")", ":", "LOGGER", ".", "info", "(", "\"Registering account...\"", ")", "code", ",", "result", "=", "_send_signed_request", "(", "DEFAULT_CA", "+", "\"/acme/new-reg\"", ",", "{", "\"resource\"", ":", "\"new-reg\"", ",", "\"agreemen...
Agree to LE TOS
[ "Agree", "to", "LE", "TOS" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L212-L226
train
Miserlou/Zappa
zappa/letsencrypt.py
get_cert
def get_cert(zappa_instance, log=LOGGER, CA=DEFAULT_CA): """ Call LE to get a new signed CA. """ out = parse_account_key() header = get_boulder_header(out) accountkey_json = json.dumps(header['jwk'], sort_keys=True, separators=(',', ':')) thumbprint = _b64(hashlib.sha256(accountkey_json.enco...
python
def get_cert(zappa_instance, log=LOGGER, CA=DEFAULT_CA): """ Call LE to get a new signed CA. """ out = parse_account_key() header = get_boulder_header(out) accountkey_json = json.dumps(header['jwk'], sort_keys=True, separators=(',', ':')) thumbprint = _b64(hashlib.sha256(accountkey_json.enco...
[ "def", "get_cert", "(", "zappa_instance", ",", "log", "=", "LOGGER", ",", "CA", "=", "DEFAULT_CA", ")", ":", "out", "=", "parse_account_key", "(", ")", "header", "=", "get_boulder_header", "(", "out", ")", "accountkey_json", "=", "json", ".", "dumps", "(",...
Call LE to get a new signed CA.
[ "Call", "LE", "to", "get", "a", "new", "signed", "CA", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L229-L293
train
Miserlou/Zappa
zappa/letsencrypt.py
verify_challenge
def verify_challenge(uri): """ Loop until our challenge is verified, else fail. """ while True: try: resp = urlopen(uri) challenge_status = json.loads(resp.read().decode('utf8')) except IOError as e: raise ValueError("Error checking challenge: {0} {1}"...
python
def verify_challenge(uri): """ Loop until our challenge is verified, else fail. """ while True: try: resp = urlopen(uri) challenge_status = json.loads(resp.read().decode('utf8')) except IOError as e: raise ValueError("Error checking challenge: {0} {1}"...
[ "def", "verify_challenge", "(", "uri", ")", ":", "while", "True", ":", "try", ":", "resp", "=", "urlopen", "(", "uri", ")", "challenge_status", "=", "json", ".", "loads", "(", "resp", ".", "read", "(", ")", ".", "decode", "(", "'utf8'", ")", ")", "...
Loop until our challenge is verified, else fail.
[ "Loop", "until", "our", "challenge", "is", "verified", "else", "fail", "." ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L296-L314
train