repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
crunchyroll/ef-open
efopen/ef_utils.py
create_aws_clients
def create_aws_clients(region, profile, *clients): """ Create boto3 clients for one or more AWS services. These are the services used within the libs: cloudformation, cloudfront, ec2, iam, lambda, route53, waf Args: region: the region in which to create clients that are region-specific (all but IAM) p...
python
def create_aws_clients(region, profile, *clients): """ Create boto3 clients for one or more AWS services. These are the services used within the libs: cloudformation, cloudfront, ec2, iam, lambda, route53, waf Args: region: the region in which to create clients that are region-specific (all but IAM) p...
[ "def", "create_aws_clients", "(", "region", ",", "profile", ",", "*", "clients", ")", ":", "if", "not", "profile", ":", "profile", "=", "None", "client_key", "=", "(", "region", ",", "profile", ")", "aws_clients", "=", "client_cache", ".", "get", "(", "c...
Create boto3 clients for one or more AWS services. These are the services used within the libs: cloudformation, cloudfront, ec2, iam, lambda, route53, waf Args: region: the region in which to create clients that are region-specific (all but IAM) profile: Name of profile (in .aws/credentials). Pass the val...
[ "Create", "boto3", "clients", "for", "one", "or", "more", "AWS", "services", ".", "These", "are", "the", "services", "used", "within", "the", "libs", ":", "cloudformation", "cloudfront", "ec2", "iam", "lambda", "route53", "waf", "Args", ":", "region", ":", ...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_utils.py#L197-L236
crunchyroll/ef-open
efopen/ef_utils.py
get_account_alias
def get_account_alias(env): """ Given an env, return <account_alias> if env is valid Args: env: an environment, such as "prod", "staging", "proto<N>", "mgmt.<account_alias>" Returns: the alias of the AWS account that holds the env Raises: ValueError if env is misformatted or doesn't name a known e...
python
def get_account_alias(env): """ Given an env, return <account_alias> if env is valid Args: env: an environment, such as "prod", "staging", "proto<N>", "mgmt.<account_alias>" Returns: the alias of the AWS account that holds the env Raises: ValueError if env is misformatted or doesn't name a known e...
[ "def", "get_account_alias", "(", "env", ")", ":", "env_valid", "(", "env", ")", "# Env is a global env of the form \"env.<account_alias>\" (e.g. \"mgmt.<account_alias>\")", "if", "env", ".", "find", "(", "\".\"", ")", ">", "-", "1", ":", "base", ",", "ext", "=", "...
Given an env, return <account_alias> if env is valid Args: env: an environment, such as "prod", "staging", "proto<N>", "mgmt.<account_alias>" Returns: the alias of the AWS account that holds the env Raises: ValueError if env is misformatted or doesn't name a known environment
[ "Given", "an", "env", "return", "<account_alias", ">", "if", "env", "is", "valid", "Args", ":", "env", ":", "an", "environment", "such", "as", "prod", "staging", "proto<N", ">", "mgmt", ".", "<account_alias", ">", "Returns", ":", "the", "alias", "of", "t...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_utils.py#L238-L258
crunchyroll/ef-open
efopen/ef_utils.py
get_env_short
def get_env_short(env): """ Given an env, return <env_short> if env is valid Args: env: an environment, such as "prod", "staging", "proto<N>", "mgmt.<account_alias>" Returns: the shortname of the env, such as "prod", "staging", "proto", "mgmt" Raises: ValueError if env is misformatted or doesn't n...
python
def get_env_short(env): """ Given an env, return <env_short> if env is valid Args: env: an environment, such as "prod", "staging", "proto<N>", "mgmt.<account_alias>" Returns: the shortname of the env, such as "prod", "staging", "proto", "mgmt" Raises: ValueError if env is misformatted or doesn't n...
[ "def", "get_env_short", "(", "env", ")", ":", "env_valid", "(", "env", ")", "if", "env", ".", "find", "(", "\".\"", ")", ">", "-", "1", ":", "env_short", ",", "ext", "=", "env", ".", "split", "(", "\".\"", ")", "else", ":", "env_short", "=", "env...
Given an env, return <env_short> if env is valid Args: env: an environment, such as "prod", "staging", "proto<N>", "mgmt.<account_alias>" Returns: the shortname of the env, such as "prod", "staging", "proto", "mgmt" Raises: ValueError if env is misformatted or doesn't name a known environment
[ "Given", "an", "env", "return", "<env_short", ">", "if", "env", "is", "valid", "Args", ":", "env", ":", "an", "environment", "such", "as", "prod", "staging", "proto<N", ">", "mgmt", ".", "<account_alias", ">", "Returns", ":", "the", "shortname", "of", "t...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_utils.py#L267-L282
crunchyroll/ef-open
efopen/ef_utils.py
env_valid
def env_valid(env): """ Given an env, determine if it's valid Args: env: the env to check Returns: True if the env is valid Raises: ValueError with message if the env is not valid """ if env not in EFConfig.ENV_LIST: raise ValueError("unknown env: {}; env must be one of: ".format(env) + ",...
python
def env_valid(env): """ Given an env, determine if it's valid Args: env: the env to check Returns: True if the env is valid Raises: ValueError with message if the env is not valid """ if env not in EFConfig.ENV_LIST: raise ValueError("unknown env: {}; env must be one of: ".format(env) + ",...
[ "def", "env_valid", "(", "env", ")", ":", "if", "env", "not", "in", "EFConfig", ".", "ENV_LIST", ":", "raise", "ValueError", "(", "\"unknown env: {}; env must be one of: \"", ".", "format", "(", "env", ")", "+", "\", \"", ".", "join", "(", "EFConfig", ".", ...
Given an env, determine if it's valid Args: env: the env to check Returns: True if the env is valid Raises: ValueError with message if the env is not valid
[ "Given", "an", "env", "determine", "if", "it", "s", "valid", "Args", ":", "env", ":", "the", "env", "to", "check", "Returns", ":", "True", "if", "the", "env", "is", "valid", "Raises", ":", "ValueError", "with", "message", "if", "the", "env", "is", "n...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_utils.py#L284-L296
crunchyroll/ef-open
efopen/ef_utils.py
global_env_valid
def global_env_valid(env): """ Given an env, determine if it's a valid "global" or "mgmt" env as listed in EFConfig Args: env: the env to check Returns: True if the env is a valid global env in EFConfig Raises: ValueError with message if the env is not valid """ if env not in EFConfig.ACCOUNT_...
python
def global_env_valid(env): """ Given an env, determine if it's a valid "global" or "mgmt" env as listed in EFConfig Args: env: the env to check Returns: True if the env is a valid global env in EFConfig Raises: ValueError with message if the env is not valid """ if env not in EFConfig.ACCOUNT_...
[ "def", "global_env_valid", "(", "env", ")", ":", "if", "env", "not", "in", "EFConfig", ".", "ACCOUNT_SCOPED_ENVS", ":", "raise", "ValueError", "(", "\"Invalid global env: {}; global envs are: {}\"", ".", "format", "(", "env", ",", "EFConfig", ".", "ACCOUNT_SCOPED_EN...
Given an env, determine if it's a valid "global" or "mgmt" env as listed in EFConfig Args: env: the env to check Returns: True if the env is a valid global env in EFConfig Raises: ValueError with message if the env is not valid
[ "Given", "an", "env", "determine", "if", "it", "s", "a", "valid", "global", "or", "mgmt", "env", "as", "listed", "in", "EFConfig", "Args", ":", "env", ":", "the", "env", "to", "check", "Returns", ":", "True", "if", "the", "env", "is", "a", "valid", ...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_utils.py#L298-L310
crunchyroll/ef-open
efopen/ef_utils.py
kms_encrypt
def kms_encrypt(kms_client, service, env, secret): """ Encrypt string for use by a given service/environment Args: kms_client (boto3 kms client object): Instantiated kms client object. Usually created through create_aws_clients. service (string): name of the service that the secret is being encrypted for....
python
def kms_encrypt(kms_client, service, env, secret): """ Encrypt string for use by a given service/environment Args: kms_client (boto3 kms client object): Instantiated kms client object. Usually created through create_aws_clients. service (string): name of the service that the secret is being encrypted for....
[ "def", "kms_encrypt", "(", "kms_client", ",", "service", ",", "env", ",", "secret", ")", ":", "# Converting all periods to underscores because they are invalid in KMS alias names", "key_alias", "=", "'{}-{}'", ".", "format", "(", "env", ",", "service", ".", "replace", ...
Encrypt string for use by a given service/environment Args: kms_client (boto3 kms client object): Instantiated kms client object. Usually created through create_aws_clients. service (string): name of the service that the secret is being encrypted for. env (string): environment that the secret is being enc...
[ "Encrypt", "string", "for", "use", "by", "a", "given", "service", "/", "environment", "Args", ":", "kms_client", "(", "boto3", "kms", "client", "object", ")", ":", "Instantiated", "kms", "client", "object", ".", "Usually", "created", "through", "create_aws_cli...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_utils.py#L312-L339
crunchyroll/ef-open
efopen/ef_utils.py
kms_decrypt
def kms_decrypt(kms_client, secret): """ Decrypt kms-encrypted string Args: kms_client (boto3 kms client object): Instantiated kms client object. Usually created through create_aws_clients. secret (string): base64 encoded value to be decrypted Returns: a populated EFPWContext object Raises: Sy...
python
def kms_decrypt(kms_client, secret): """ Decrypt kms-encrypted string Args: kms_client (boto3 kms client object): Instantiated kms client object. Usually created through create_aws_clients. secret (string): base64 encoded value to be decrypted Returns: a populated EFPWContext object Raises: Sy...
[ "def", "kms_decrypt", "(", "kms_client", ",", "secret", ")", ":", "try", ":", "decrypted_secret", "=", "kms_client", ".", "decrypt", "(", "CiphertextBlob", "=", "base64", ".", "b64decode", "(", "secret", ")", ")", "[", "'Plaintext'", "]", "except", "TypeErro...
Decrypt kms-encrypted string Args: kms_client (boto3 kms client object): Instantiated kms client object. Usually created through create_aws_clients. secret (string): base64 encoded value to be decrypted Returns: a populated EFPWContext object Raises: SystemExit(1): If there is an error with the bo...
[ "Decrypt", "kms", "-", "encrypted", "string", "Args", ":", "kms_client", "(", "boto3", "kms", "client", "object", ")", ":", "Instantiated", "kms", "client", "object", ".", "Usually", "created", "through", "create_aws_clients", ".", "secret", "(", "string", ")"...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_utils.py#L341-L364
crunchyroll/ef-open
efopen/ef_utils.py
kms_key_arn
def kms_key_arn(kms_client, alias): """ Obtain the full key arn based on the key alias provided Args: kms_client (boto3 kms client object): Instantiated kms client object. Usually created through create_aws_clients. alias (string): alias of key, example alias/proto0-evs-drm. Returns: string of the ...
python
def kms_key_arn(kms_client, alias): """ Obtain the full key arn based on the key alias provided Args: kms_client (boto3 kms client object): Instantiated kms client object. Usually created through create_aws_clients. alias (string): alias of key, example alias/proto0-evs-drm. Returns: string of the ...
[ "def", "kms_key_arn", "(", "kms_client", ",", "alias", ")", ":", "try", ":", "response", "=", "kms_client", ".", "describe_key", "(", "KeyId", "=", "alias", ")", "key_arn", "=", "response", "[", "\"KeyMetadata\"", "]", "[", "\"Arn\"", "]", "except", "Clien...
Obtain the full key arn based on the key alias provided Args: kms_client (boto3 kms client object): Instantiated kms client object. Usually created through create_aws_clients. alias (string): alias of key, example alias/proto0-evs-drm. Returns: string of the full key arn
[ "Obtain", "the", "full", "key", "arn", "based", "on", "the", "key", "alias", "provided", "Args", ":", "kms_client", "(", "boto3", "kms", "client", "object", ")", ":", "Instantiated", "kms", "client", "object", ".", "Usually", "created", "through", "create_aw...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_utils.py#L366-L382
crunchyroll/ef-open
efopen/ef_utils.py
get_template_parameters_file
def get_template_parameters_file(template_full_path): """ Checks for existance of parameters file against supported suffixes and returns parameters file path if found Args: template_full_path: full filepath for template file Returns: filename of parameters file if it exists """ for s...
python
def get_template_parameters_file(template_full_path): """ Checks for existance of parameters file against supported suffixes and returns parameters file path if found Args: template_full_path: full filepath for template file Returns: filename of parameters file if it exists """ for s...
[ "def", "get_template_parameters_file", "(", "template_full_path", ")", ":", "for", "suffix", "in", "EFConfig", ".", "PARAMETER_FILE_SUFFIXES", ":", "parameters_file", "=", "template_full_path", ".", "replace", "(", "\"/templates\"", ",", "\"/parameters\"", ")", "+", "...
Checks for existance of parameters file against supported suffixes and returns parameters file path if found Args: template_full_path: full filepath for template file Returns: filename of parameters file if it exists
[ "Checks", "for", "existance", "of", "parameters", "file", "against", "supported", "suffixes", "and", "returns", "parameters", "file", "path", "if", "found", "Args", ":", "template_full_path", ":", "full", "filepath", "for", "template", "file", "Returns", ":", "f...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_utils.py#L384-L398
crunchyroll/ef-open
efopen/ef_utils.py
get_template_parameters_s3
def get_template_parameters_s3(template_key, s3_resource): """ Checks for existance of parameters object in S3 against supported suffixes and returns parameters file key if found Args: template_key: S3 key for template file. omit bucket. s3_resource: a boto3 s3 resource Returns: filename of paramete...
python
def get_template_parameters_s3(template_key, s3_resource): """ Checks for existance of parameters object in S3 against supported suffixes and returns parameters file key if found Args: template_key: S3 key for template file. omit bucket. s3_resource: a boto3 s3 resource Returns: filename of paramete...
[ "def", "get_template_parameters_s3", "(", "template_key", ",", "s3_resource", ")", ":", "for", "suffix", "in", "EFConfig", ".", "PARAMETER_FILE_SUFFIXES", ":", "parameters_key", "=", "template_key", ".", "replace", "(", "\"/templates\"", ",", "\"/parameters\"", ")", ...
Checks for existance of parameters object in S3 against supported suffixes and returns parameters file key if found Args: template_key: S3 key for template file. omit bucket. s3_resource: a boto3 s3 resource Returns: filename of parameters file if it exists
[ "Checks", "for", "existance", "of", "parameters", "object", "in", "S3", "against", "supported", "suffixes", "and", "returns", "parameters", "file", "key", "if", "found", "Args", ":", "template_key", ":", "S3", "key", "for", "template", "file", ".", "omit", "...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_utils.py#L400-L417
crunchyroll/ef-open
efopen/ef_utils.py
get_autoscaling_group_properties
def get_autoscaling_group_properties(asg_client, env, service): """ Gets the autoscaling group properties based on the service name that is provided. This function will attempt the find the autoscaling group base on the following logic: 1. If the service name provided matches the autoscaling group name 2....
python
def get_autoscaling_group_properties(asg_client, env, service): """ Gets the autoscaling group properties based on the service name that is provided. This function will attempt the find the autoscaling group base on the following logic: 1. If the service name provided matches the autoscaling group name 2....
[ "def", "get_autoscaling_group_properties", "(", "asg_client", ",", "env", ",", "service", ")", ":", "try", ":", "# See if {{ENV}}-{{SERVICE}} matches ASG name", "response", "=", "asg_client", ".", "describe_auto_scaling_groups", "(", "AutoScalingGroupNames", "=", "[", "\"...
Gets the autoscaling group properties based on the service name that is provided. This function will attempt the find the autoscaling group base on the following logic: 1. If the service name provided matches the autoscaling group name 2. If the service name provided matches the Name tag of the autoscaling gr...
[ "Gets", "the", "autoscaling", "group", "properties", "based", "on", "the", "service", "name", "that", "is", "provided", ".", "This", "function", "will", "attempt", "the", "find", "the", "autoscaling", "group", "base", "on", "the", "following", "logic", ":", ...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_utils.py#L419-L449
penguinmenac3/starttf
starttf/utils/session_config.py
get_default_config
def get_default_config(gpu_memory_usage=0.75, allow_growth=False): """ A helper to create sessions easily. :param gpu_memory_usage: How much of the gpu should be used for your project. :param allow_growth: If you want to have a fixed gpus size or if it should grow and use just as much as it needs. :...
python
def get_default_config(gpu_memory_usage=0.75, allow_growth=False): """ A helper to create sessions easily. :param gpu_memory_usage: How much of the gpu should be used for your project. :param allow_growth: If you want to have a fixed gpus size or if it should grow and use just as much as it needs. :...
[ "def", "get_default_config", "(", "gpu_memory_usage", "=", "0.75", ",", "allow_growth", "=", "False", ")", ":", "config", "=", "tf", ".", "ConfigProto", "(", ")", "config", ".", "gpu_options", ".", "per_process_gpu_memory_fraction", "=", "gpu_memory_usage", "confi...
A helper to create sessions easily. :param gpu_memory_usage: How much of the gpu should be used for your project. :param allow_growth: If you want to have a fixed gpus size or if it should grow and use just as much as it needs. :return: A configuration you can pass to your session when creating it.
[ "A", "helper", "to", "create", "sessions", "easily", ".", ":", "param", "gpu_memory_usage", ":", "How", "much", "of", "the", "gpu", "should", "be", "used", "for", "your", "project", ".", ":", "param", "allow_growth", ":", "If", "you", "want", "to", "have...
train
https://github.com/penguinmenac3/starttf/blob/f4086489d169757c0504e822165db2fea534b944/starttf/utils/session_config.py#L26-L37
penguinmenac3/starttf
starttf/utils/model_io.py
export_graph
def export_graph(checkpoint_path, output_nodes): """ Export a graph stored in a checkpoint as a *.pb file. :param checkpoint_path: The checkpoint path which should be frozen. :param output_nodes: The output nodes you care about as a list of strings (their names). :return: """ if not tf.gfile...
python
def export_graph(checkpoint_path, output_nodes): """ Export a graph stored in a checkpoint as a *.pb file. :param checkpoint_path: The checkpoint path which should be frozen. :param output_nodes: The output nodes you care about as a list of strings (their names). :return: """ if not tf.gfile...
[ "def", "export_graph", "(", "checkpoint_path", ",", "output_nodes", ")", ":", "if", "not", "tf", ".", "gfile", ".", "Exists", "(", "checkpoint_path", ")", ":", "raise", "AssertionError", "(", "\"Export directory doesn't exists. Please specify an export \"", "\"directory...
Export a graph stored in a checkpoint as a *.pb file. :param checkpoint_path: The checkpoint path which should be frozen. :param output_nodes: The output nodes you care about as a list of strings (their names). :return:
[ "Export", "a", "graph", "stored", "in", "a", "checkpoint", "as", "a", "*", ".", "pb", "file", ".", ":", "param", "checkpoint_path", ":", "The", "checkpoint", "path", "which", "should", "be", "frozen", ".", ":", "param", "output_nodes", ":", "The", "outpu...
train
https://github.com/penguinmenac3/starttf/blob/f4086489d169757c0504e822165db2fea534b944/starttf/utils/model_io.py#L26-L72
penguinmenac3/starttf
starttf/utils/model_io.py
load_graph
def load_graph(frozen_graph_filename, namespace_prefix="", placeholders=None): """ Loads a frozen graph from a *.pb file. :param frozen_graph_filename: The file which graph to load. :param namespace_prefix: A namespace for your graph to live in. This is useful when having multiple models. :param pla...
python
def load_graph(frozen_graph_filename, namespace_prefix="", placeholders=None): """ Loads a frozen graph from a *.pb file. :param frozen_graph_filename: The file which graph to load. :param namespace_prefix: A namespace for your graph to live in. This is useful when having multiple models. :param pla...
[ "def", "load_graph", "(", "frozen_graph_filename", ",", "namespace_prefix", "=", "\"\"", ",", "placeholders", "=", "None", ")", ":", "# Load graph def from protobuff and import the definition", "with", "tf", ".", "gfile", ".", "GFile", "(", "frozen_graph_filename", ",",...
Loads a frozen graph from a *.pb file. :param frozen_graph_filename: The file which graph to load. :param namespace_prefix: A namespace for your graph to live in. This is useful when having multiple models. :param placeholders: A dict containing the new placeholders that replace the old inputs. :return:...
[ "Loads", "a", "frozen", "graph", "from", "a", "*", ".", "pb", "file", ".", ":", "param", "frozen_graph_filename", ":", "The", "file", "which", "graph", "to", "load", ".", ":", "param", "namespace_prefix", ":", "A", "namespace", "for", "your", "graph", "t...
train
https://github.com/penguinmenac3/starttf/blob/f4086489d169757c0504e822165db2fea534b944/starttf/utils/model_io.py#L75-L94
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver._elbv2_load_balancer
def _elbv2_load_balancer(self, lookup): """ Args: lookup: the friendly name of the V2 elb to look up Returns: A dict with the load balancer description Raises: botocore.exceptions.ClientError: no such load-balancer """ client = EFAwsResolver.__CLIENTS['elbv2'] elbs = client...
python
def _elbv2_load_balancer(self, lookup): """ Args: lookup: the friendly name of the V2 elb to look up Returns: A dict with the load balancer description Raises: botocore.exceptions.ClientError: no such load-balancer """ client = EFAwsResolver.__CLIENTS['elbv2'] elbs = client...
[ "def", "_elbv2_load_balancer", "(", "self", ",", "lookup", ")", ":", "client", "=", "EFAwsResolver", ".", "__CLIENTS", "[", "'elbv2'", "]", "elbs", "=", "client", ".", "describe_load_balancers", "(", "Names", "=", "[", "lookup", "]", ")", "# getting the first ...
Args: lookup: the friendly name of the V2 elb to look up Returns: A dict with the load balancer description Raises: botocore.exceptions.ClientError: no such load-balancer
[ "Args", ":", "lookup", ":", "the", "friendly", "name", "of", "the", "V2", "elb", "to", "look", "up", "Returns", ":", "A", "dict", "with", "the", "load", "balancer", "description", "Raises", ":", "botocore", ".", "exceptions", ".", "ClientError", ":", "no...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L53-L66
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.acm_certificate_arn
def acm_certificate_arn(self, lookup, default=None): """ Args: lookup: region/domain on the certificate to be looked up default: the optional value to return if lookup failed; returns None if not set Returns: ARN of a certificate with status "Issued" for the region/domain, if found, or def...
python
def acm_certificate_arn(self, lookup, default=None): """ Args: lookup: region/domain on the certificate to be looked up default: the optional value to return if lookup failed; returns None if not set Returns: ARN of a certificate with status "Issued" for the region/domain, if found, or def...
[ "def", "acm_certificate_arn", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "# @todo: Only searches the first 100 certificates in the account", "try", ":", "# This a region-specific client, so we'll make a new client in the right place using existing SESSION", "r...
Args: lookup: region/domain on the certificate to be looked up default: the optional value to return if lookup failed; returns None if not set Returns: ARN of a certificate with status "Issued" for the region/domain, if found, or default/None if no match If more than one "Issued" certificate...
[ "Args", ":", "lookup", ":", "region", "/", "domain", "on", "the", "certificate", "to", "be", "looked", "up", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not", "set", "Returns", ":",...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L68-L109
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.ec2_elasticip_elasticip_id
def ec2_elasticip_elasticip_id(self, lookup, default=None): """ Args: lookup: the CloudFormation resource name of the Elastic IP ID to look up default: the optional value to return if lookup failed; returns None if not set Returns: The ID of the first Elastic IP found with a description ma...
python
def ec2_elasticip_elasticip_id(self, lookup, default=None): """ Args: lookup: the CloudFormation resource name of the Elastic IP ID to look up default: the optional value to return if lookup failed; returns None if not set Returns: The ID of the first Elastic IP found with a description ma...
[ "def", "ec2_elasticip_elasticip_id", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "public_ip", "=", "self", ".", "ec2_elasticip_elasticip_ipaddress", "(", "lookup", ")", "if", "public_ip", "is", "None", ":", "return", "default", "try", ":...
Args: lookup: the CloudFormation resource name of the Elastic IP ID to look up default: the optional value to return if lookup failed; returns None if not set Returns: The ID of the first Elastic IP found with a description matching 'lookup' or default/None if no match found
[ "Args", ":", "lookup", ":", "the", "CloudFormation", "resource", "name", "of", "the", "Elastic", "IP", "ID", "to", "look", "up", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not", "s...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L111-L131
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.ec2_elasticip_elasticip_ipaddress
def ec2_elasticip_elasticip_ipaddress(self, lookup, default=None): """ Args: lookup: the CloudFormation resource name of the Elastic IP address to look up default: the optional value to return if lookup failed; returns None if not set Returns: The IP address of the first Elastic IP found w...
python
def ec2_elasticip_elasticip_ipaddress(self, lookup, default=None): """ Args: lookup: the CloudFormation resource name of the Elastic IP address to look up default: the optional value to return if lookup failed; returns None if not set Returns: The IP address of the first Elastic IP found w...
[ "def", "ec2_elasticip_elasticip_ipaddress", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "# Extract environment from resource ID to build stack name", "m", "=", "re", ".", "search", "(", "'ElasticIp([A-Z]?[a-z]+[0-9]?)\\w+'", ",", "lookup", ")", "#...
Args: lookup: the CloudFormation resource name of the Elastic IP address to look up default: the optional value to return if lookup failed; returns None if not set Returns: The IP address of the first Elastic IP found with a description matching 'lookup' or default/None if no match
[ "Args", ":", "lookup", ":", "the", "CloudFormation", "resource", "name", "of", "the", "Elastic", "IP", "address", "to", "look", "up", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not",...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L133-L163
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.ec2_eni_eni_id
def ec2_eni_eni_id(self, lookup, default=None): """ Args: lookup: the description of the Elastic Network Interface (ENI) to look up default: the optional value to return if lookup failed; returns None if not set Returns: The ID of the first ENI found with a description matching 'lookup' or...
python
def ec2_eni_eni_id(self, lookup, default=None): """ Args: lookup: the description of the Elastic Network Interface (ENI) to look up default: the optional value to return if lookup failed; returns None if not set Returns: The ID of the first ENI found with a description matching 'lookup' or...
[ "def", "ec2_eni_eni_id", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "enis", "=", "EFAwsResolver", ".", "__CLIENTS", "[", "\"ec2\"", "]", ".", "describe_network_interfaces", "(", "Filters", "=", "[", "{", "'Name'", ":", "'description'"...
Args: lookup: the description of the Elastic Network Interface (ENI) to look up default: the optional value to return if lookup failed; returns None if not set Returns: The ID of the first ENI found with a description matching 'lookup' or default/None if no match found
[ "Args", ":", "lookup", ":", "the", "description", "of", "the", "Elastic", "Network", "Interface", "(", "ENI", ")", "to", "look", "up", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "no...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L165-L180
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.ec2_network_network_acl_id
def ec2_network_network_acl_id(self, lookup, default=None): """ Args: lookup: the friendly name of the network ACL we are looking up default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the network ACL, or None if no match found """ net...
python
def ec2_network_network_acl_id(self, lookup, default=None): """ Args: lookup: the friendly name of the network ACL we are looking up default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the network ACL, or None if no match found """ net...
[ "def", "ec2_network_network_acl_id", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "network_acl_id", "=", "EFAwsResolver", ".", "__CLIENTS", "[", "\"ec2\"", "]", ".", "describe_network_acls", "(", "Filters", "=", "[", "{", "'Name'", ":", ...
Args: lookup: the friendly name of the network ACL we are looking up default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the network ACL, or None if no match found
[ "Args", ":", "lookup", ":", "the", "friendly", "name", "of", "the", "network", "ACL", "we", "are", "looking", "up", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not", "set", "Returns...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L182-L197
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.ec2_security_group_security_group_id
def ec2_security_group_security_group_id(self, lookup, default=None): """ Args: lookup: the friendly name of a security group to look up default: the optional value to return if lookup failed; returns None if not set Returns: Security group ID if target found or default/None if no match ...
python
def ec2_security_group_security_group_id(self, lookup, default=None): """ Args: lookup: the friendly name of a security group to look up default: the optional value to return if lookup failed; returns None if not set Returns: Security group ID if target found or default/None if no match ...
[ "def", "ec2_security_group_security_group_id", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "try", ":", "response", "=", "EFAwsResolver", ".", "__CLIENTS", "[", "\"ec2\"", "]", ".", "describe_security_groups", "(", "Filters", "=", "[", "{...
Args: lookup: the friendly name of a security group to look up default: the optional value to return if lookup failed; returns None if not set Returns: Security group ID if target found or default/None if no match
[ "Args", ":", "lookup", ":", "the", "friendly", "name", "of", "a", "security", "group", "to", "look", "up", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not", "set", "Returns", ":", ...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L199-L216
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.ec2_subnet_subnet_id
def ec2_subnet_subnet_id(self, lookup, default=None): """ Return: the ID of a single subnet or default/None if no match Args: lookup: the friendly name of the subnet to look up (subnet-<env>-a or subnet-<env>-b) default: the optional value to return if lookup failed; returns None if not se...
python
def ec2_subnet_subnet_id(self, lookup, default=None): """ Return: the ID of a single subnet or default/None if no match Args: lookup: the friendly name of the subnet to look up (subnet-<env>-a or subnet-<env>-b) default: the optional value to return if lookup failed; returns None if not se...
[ "def", "ec2_subnet_subnet_id", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "subnets", "=", "EFAwsResolver", ".", "__CLIENTS", "[", "\"ec2\"", "]", ".", "describe_subnets", "(", "Filters", "=", "[", "{", "'Name'", ":", "'tag:Name'", "...
Return: the ID of a single subnet or default/None if no match Args: lookup: the friendly name of the subnet to look up (subnet-<env>-a or subnet-<env>-b) default: the optional value to return if lookup failed; returns None if not set
[ "Return", ":", "the", "ID", "of", "a", "single", "subnet", "or", "default", "/", "None", "if", "no", "match", "Args", ":", "lookup", ":", "the", "friendly", "name", "of", "the", "subnet", "to", "look", "up", "(", "subnet", "-", "<env", ">", "-", "a...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L218-L233
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.ec2_vpc_availabilityzones
def ec2_vpc_availabilityzones(self, lookup, default=None): """ Args: lookup: the friendly name of a VPC to look up default: the optional value to return if lookup failed; returns None if not set Returns: A comma-separated list of availability zones in use in the named VPC or default/None i...
python
def ec2_vpc_availabilityzones(self, lookup, default=None): """ Args: lookup: the friendly name of a VPC to look up default: the optional value to return if lookup failed; returns None if not set Returns: A comma-separated list of availability zones in use in the named VPC or default/None i...
[ "def", "ec2_vpc_availabilityzones", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "vpc_id", "=", "self", ".", "ec2_vpc_vpc_id", "(", "lookup", ")", "if", "vpc_id", "is", "None", ":", "return", "default", "subnets", "=", "EFAwsResolver", ...
Args: lookup: the friendly name of a VPC to look up default: the optional value to return if lookup failed; returns None if not set Returns: A comma-separated list of availability zones in use in the named VPC or default/None if no match
[ "Args", ":", "lookup", ":", "the", "friendly", "name", "of", "a", "VPC", "to", "look", "up", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not", "set", "Returns", ":", "A", "comma",...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L252-L273
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.ec2_vpc_subnets
def ec2_vpc_subnets(self, lookup, default=None): """ Args: lookup - the friendly name of the VPC whose subnets we want Returns: A comma-separated list of all subnets in use in the named VPC or default/None if no match found """ vpc_id = self.ec2_vpc_vpc_id(lookup) if vpc_id is None: ...
python
def ec2_vpc_subnets(self, lookup, default=None): """ Args: lookup - the friendly name of the VPC whose subnets we want Returns: A comma-separated list of all subnets in use in the named VPC or default/None if no match found """ vpc_id = self.ec2_vpc_vpc_id(lookup) if vpc_id is None: ...
[ "def", "ec2_vpc_subnets", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "vpc_id", "=", "self", ".", "ec2_vpc_vpc_id", "(", "lookup", ")", "if", "vpc_id", "is", "None", ":", "return", "default", "subnets", "=", "EFAwsResolver", ".", "...
Args: lookup - the friendly name of the VPC whose subnets we want Returns: A comma-separated list of all subnets in use in the named VPC or default/None if no match found
[ "Args", ":", "lookup", "-", "the", "friendly", "name", "of", "the", "VPC", "whose", "subnets", "we", "want", "Returns", ":", "A", "comma", "-", "separated", "list", "of", "all", "subnets", "in", "use", "in", "the", "named", "VPC", "or", "default", "/",...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L275-L295
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.ec2_vpc_cidrblock
def ec2_vpc_cidrblock(self, lookup, default=None): """ Args: lookup - the friendly name of the VPC whose CIDR block we want Returns: The CIDR block of the named VPC, or default/None if no match found """ vpcs = EFAwsResolver.__CLIENTS["ec2"].describe_vpcs(Filters=[{ 'Name': 'tag:Na...
python
def ec2_vpc_cidrblock(self, lookup, default=None): """ Args: lookup - the friendly name of the VPC whose CIDR block we want Returns: The CIDR block of the named VPC, or default/None if no match found """ vpcs = EFAwsResolver.__CLIENTS["ec2"].describe_vpcs(Filters=[{ 'Name': 'tag:Na...
[ "def", "ec2_vpc_cidrblock", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "vpcs", "=", "EFAwsResolver", ".", "__CLIENTS", "[", "\"ec2\"", "]", ".", "describe_vpcs", "(", "Filters", "=", "[", "{", "'Name'", ":", "'tag:Name'", ",", "'V...
Args: lookup - the friendly name of the VPC whose CIDR block we want Returns: The CIDR block of the named VPC, or default/None if no match found
[ "Args", ":", "lookup", "-", "the", "friendly", "name", "of", "the", "VPC", "whose", "CIDR", "block", "we", "want", "Returns", ":", "The", "CIDR", "block", "of", "the", "named", "VPC", "or", "default", "/", "None", "if", "no", "match", "found" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L297-L311
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.elbv2_load_balancer_hosted_zone
def elbv2_load_balancer_hosted_zone(self, lookup, default=None): """ Args: lookup: the friendly name of the V2 elb to look up default: value to return in case of no match Returns: The hosted zone ID of the ELB found with a name matching 'lookup'. """ try: elb = self._elbv2_lo...
python
def elbv2_load_balancer_hosted_zone(self, lookup, default=None): """ Args: lookup: the friendly name of the V2 elb to look up default: value to return in case of no match Returns: The hosted zone ID of the ELB found with a name matching 'lookup'. """ try: elb = self._elbv2_lo...
[ "def", "elbv2_load_balancer_hosted_zone", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "try", ":", "elb", "=", "self", ".", "_elbv2_load_balancer", "(", "lookup", ")", "return", "elb", "[", "'CanonicalHostedZoneId'", "]", "except", "Clien...
Args: lookup: the friendly name of the V2 elb to look up default: value to return in case of no match Returns: The hosted zone ID of the ELB found with a name matching 'lookup'.
[ "Args", ":", "lookup", ":", "the", "friendly", "name", "of", "the", "V2", "elb", "to", "look", "up", "default", ":", "value", "to", "return", "in", "case", "of", "no", "match", "Returns", ":", "The", "hosted", "zone", "ID", "of", "the", "ELB", "found...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L330-L342
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.elbv2_load_balancer_dns_name
def elbv2_load_balancer_dns_name(self, lookup, default=None): """ Args: lookup: the friendly name of the V2 elb to look up default: value to return in case of no match Returns: The hosted zone ID of the ELB found with a name matching 'lookup'. """ try: elb = self._elbv2_load_...
python
def elbv2_load_balancer_dns_name(self, lookup, default=None): """ Args: lookup: the friendly name of the V2 elb to look up default: value to return in case of no match Returns: The hosted zone ID of the ELB found with a name matching 'lookup'. """ try: elb = self._elbv2_load_...
[ "def", "elbv2_load_balancer_dns_name", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "try", ":", "elb", "=", "self", ".", "_elbv2_load_balancer", "(", "lookup", ")", "return", "elb", "[", "'DNSName'", "]", "except", "ClientError", ":", ...
Args: lookup: the friendly name of the V2 elb to look up default: value to return in case of no match Returns: The hosted zone ID of the ELB found with a name matching 'lookup'.
[ "Args", ":", "lookup", ":", "the", "friendly", "name", "of", "the", "V2", "elb", "to", "look", "up", "default", ":", "value", "to", "return", "in", "case", "of", "no", "match", "Returns", ":", "The", "hosted", "zone", "ID", "of", "the", "ELB", "found...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L344-L356
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.elbv2_load_balancer_arn_suffix
def elbv2_load_balancer_arn_suffix(self, lookup, default=None): """ Args: lookup: the friendly name of the v2 elb to look up default: value to return in case of no match Returns: The shorthand fragment of the ALB's ARN, of the form `app/*/*` """ try: elb = self._elbv2_load_ba...
python
def elbv2_load_balancer_arn_suffix(self, lookup, default=None): """ Args: lookup: the friendly name of the v2 elb to look up default: value to return in case of no match Returns: The shorthand fragment of the ALB's ARN, of the form `app/*/*` """ try: elb = self._elbv2_load_ba...
[ "def", "elbv2_load_balancer_arn_suffix", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "try", ":", "elb", "=", "self", ".", "_elbv2_load_balancer", "(", "lookup", ")", "m", "=", "re", ".", "search", "(", "r'.+?(app\\/[^\\/]+\\/[^\\/]+)$'",...
Args: lookup: the friendly name of the v2 elb to look up default: value to return in case of no match Returns: The shorthand fragment of the ALB's ARN, of the form `app/*/*`
[ "Args", ":", "lookup", ":", "the", "friendly", "name", "of", "the", "v2", "elb", "to", "look", "up", "default", ":", "value", "to", "return", "in", "case", "of", "no", "match", "Returns", ":", "The", "shorthand", "fragment", "of", "the", "ALB", "s", ...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L358-L371
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.elbv2_target_group_arn_suffix
def elbv2_target_group_arn_suffix(self, lookup, default=None): """ Args: lookup: the friendly name of the v2 elb target group default: value to return in case of no match Returns: The shorthand fragment of the target group's ARN, of the form `targetgroup/*/*` """ try: c...
python
def elbv2_target_group_arn_suffix(self, lookup, default=None): """ Args: lookup: the friendly name of the v2 elb target group default: value to return in case of no match Returns: The shorthand fragment of the target group's ARN, of the form `targetgroup/*/*` """ try: c...
[ "def", "elbv2_target_group_arn_suffix", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "try", ":", "client", "=", "EFAwsResolver", ".", "__CLIENTS", "[", "'elbv2'", "]", "elbs", "=", "client", ".", "describe_target_groups", "(", "Names", ...
Args: lookup: the friendly name of the v2 elb target group default: value to return in case of no match Returns: The shorthand fragment of the target group's ARN, of the form `targetgroup/*/*`
[ "Args", ":", "lookup", ":", "the", "friendly", "name", "of", "the", "v2", "elb", "target", "group", "default", ":", "value", "to", "return", "in", "case", "of", "no", "match", "Returns", ":", "The", "shorthand", "fragment", "of", "the", "target", "group"...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L373-L389
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.waf_rule_id
def waf_rule_id(self, lookup, default=None): """ Args: lookup: the friendly name of a WAF rule default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the WAF rule whose name matches 'lookup' or default/None if no match found """ # list_ru...
python
def waf_rule_id(self, lookup, default=None): """ Args: lookup: the friendly name of a WAF rule default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the WAF rule whose name matches 'lookup' or default/None if no match found """ # list_ru...
[ "def", "waf_rule_id", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "# list_rules returns at most 100 rules per request", "list_limit", "=", "100", "rules", "=", "EFAwsResolver", ".", "__CLIENTS", "[", "\"waf\"", "]", ".", "list_rules", "(", ...
Args: lookup: the friendly name of a WAF rule default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the WAF rule whose name matches 'lookup' or default/None if no match found
[ "Args", ":", "lookup", ":", "the", "friendly", "name", "of", "a", "WAF", "rule", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not", "set", "Returns", ":", "the", "ID", "of", "the",...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L391-L409
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.waf_web_acl_id
def waf_web_acl_id(self, lookup, default=None): """ Args: lookup: the friendly name of a Web ACL default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the WAF Web ACL whose name matches rule_name or default/None if no match found """ # l...
python
def waf_web_acl_id(self, lookup, default=None): """ Args: lookup: the friendly name of a Web ACL default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the WAF Web ACL whose name matches rule_name or default/None if no match found """ # l...
[ "def", "waf_web_acl_id", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "# list_rules returns at most 100 rules per request", "list_limit", "=", "100", "acls", "=", "EFAwsResolver", ".", "__CLIENTS", "[", "\"waf\"", "]", ".", "list_web_acls", "...
Args: lookup: the friendly name of a Web ACL default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the WAF Web ACL whose name matches rule_name or default/None if no match found
[ "Args", ":", "lookup", ":", "the", "friendly", "name", "of", "a", "Web", "ACL", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not", "set", "Returns", ":", "the", "ID", "of", "the", ...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L411-L429
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.route53_public_hosted_zone_id
def route53_public_hosted_zone_id(self, lookup, default=None): """ Args: lookup: The zone name to look up. Must end with "." default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the public hosted zone for the 'lookup' domain, or default/None if...
python
def route53_public_hosted_zone_id(self, lookup, default=None): """ Args: lookup: The zone name to look up. Must end with "." default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the public hosted zone for the 'lookup' domain, or default/None if...
[ "def", "route53_public_hosted_zone_id", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "list_limit", "=", "\"100\"", "# enforce terminal '.' in name, otherwise we could get a partial match of the incorrect zones", "if", "lookup", "[", "-", "1", "]", "!...
Args: lookup: The zone name to look up. Must end with "." default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the public hosted zone for the 'lookup' domain, or default/None if no match found
[ "Args", ":", "lookup", ":", "The", "zone", "name", "to", "look", "up", ".", "Must", "end", "with", ".", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not", "set", "Returns", ":", ...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L431-L455
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.ec2_route_table_main_route_table_id
def ec2_route_table_main_route_table_id(self, lookup, default=None): """ Args: lookup: the friendly name of the VPC whose main route table we are looking up default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the main route table of the named ...
python
def ec2_route_table_main_route_table_id(self, lookup, default=None): """ Args: lookup: the friendly name of the VPC whose main route table we are looking up default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the main route table of the named ...
[ "def", "ec2_route_table_main_route_table_id", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "vpc_id", "=", "self", ".", "ec2_vpc_vpc_id", "(", "lookup", ")", "if", "vpc_id", "is", "None", ":", "return", "default", "route_table", "=", "EF...
Args: lookup: the friendly name of the VPC whose main route table we are looking up default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the main route table of the named VPC, or default if no match/multiple matches found
[ "Args", ":", "lookup", ":", "the", "friendly", "name", "of", "the", "VPC", "whose", "main", "route", "table", "we", "are", "looking", "up", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if"...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L483-L500
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.ec2_route_table_tagged_route_table_id
def ec2_route_table_tagged_route_table_id(self, lookup, default=None): """ Args: lookup: the tagged route table name, should be unique default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the route table, or default if no match/multiple matches...
python
def ec2_route_table_tagged_route_table_id(self, lookup, default=None): """ Args: lookup: the tagged route table name, should be unique default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the route table, or default if no match/multiple matches...
[ "def", "ec2_route_table_tagged_route_table_id", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "route_table", "=", "EFAwsResolver", ".", "__CLIENTS", "[", "\"ec2\"", "]", ".", "describe_route_tables", "(", "Filters", "=", "[", "{", "'Name'", ...
Args: lookup: the tagged route table name, should be unique default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the route table, or default if no match/multiple matches found
[ "Args", ":", "lookup", ":", "the", "tagged", "route", "table", "name", "should", "be", "unique", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not", "set", "Returns", ":", "the", "ID"...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L502-L516
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.cloudfront_domain_name
def cloudfront_domain_name(self, lookup, default=None): """ Args: lookup: any CNAME on the Cloudfront distribution default: the optional value to return if lookup failed; returns None if not set Returns: The domain name (FQDN) of the Cloudfront distrinbution, or default/None if no match ...
python
def cloudfront_domain_name(self, lookup, default=None): """ Args: lookup: any CNAME on the Cloudfront distribution default: the optional value to return if lookup failed; returns None if not set Returns: The domain name (FQDN) of the Cloudfront distrinbution, or default/None if no match ...
[ "def", "cloudfront_domain_name", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "# list_distributions returns at most 100 distributions per request", "list_limit", "=", "\"100\"", "distributions", "=", "EFAwsResolver", ".", "__CLIENTS", "[", "\"cloudfr...
Args: lookup: any CNAME on the Cloudfront distribution default: the optional value to return if lookup failed; returns None if not set Returns: The domain name (FQDN) of the Cloudfront distrinbution, or default/None if no match
[ "Args", ":", "lookup", ":", "any", "CNAME", "on", "the", "Cloudfront", "distribution", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not", "set", "Returns", ":", "The", "domain", "name"...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L518-L540
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.cloudfront_origin_access_identity_oai_canonical_user_id
def cloudfront_origin_access_identity_oai_canonical_user_id(self, lookup, default=None): """ Args: lookup: the FQDN of the Origin Access Identity (from its comments) default: the optional value to return if lookup failed; returns None if not set Returns: the S3 Canonical User ID of the OAI...
python
def cloudfront_origin_access_identity_oai_canonical_user_id(self, lookup, default=None): """ Args: lookup: the FQDN of the Origin Access Identity (from its comments) default: the optional value to return if lookup failed; returns None if not set Returns: the S3 Canonical User ID of the OAI...
[ "def", "cloudfront_origin_access_identity_oai_canonical_user_id", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "# list_cloud_front_origin_access_identities returns at most 100 oai's per request", "list_limit", "=", "\"100\"", "oais", "=", "EFAwsResolver", ...
Args: lookup: the FQDN of the Origin Access Identity (from its comments) default: the optional value to return if lookup failed; returns None if not set Returns: the S3 Canonical User ID of the OAI associated with the named FQDN in 'lookup', or default/None if no match
[ "Args", ":", "lookup", ":", "the", "FQDN", "of", "the", "Origin", "Access", "Identity", "(", "from", "its", "comments", ")", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not", "set",...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L567-L590
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.cognito_identity_identity_pool_arn
def cognito_identity_identity_pool_arn(self, lookup, default=None): """ Args: lookup: Cognito Federated Identity name, proto0-cms-identity-pool default: the optional value to return if lookup failed; returns None if not set Returns: the constructed ARN for the cognito identity pool,...
python
def cognito_identity_identity_pool_arn(self, lookup, default=None): """ Args: lookup: Cognito Federated Identity name, proto0-cms-identity-pool default: the optional value to return if lookup failed; returns None if not set Returns: the constructed ARN for the cognito identity pool,...
[ "def", "cognito_identity_identity_pool_arn", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "identity_pool_id", "=", "self", ".", "cognito_identity_identity_pool_id", "(", "lookup", ",", "default", ")", "if", "identity_pool_id", "==", "default", ...
Args: lookup: Cognito Federated Identity name, proto0-cms-identity-pool default: the optional value to return if lookup failed; returns None if not set Returns: the constructed ARN for the cognito identity pool, else default/None
[ "Args", ":", "lookup", ":", "Cognito", "Federated", "Identity", "name", "proto0", "-", "cms", "-", "identity", "-", "pool", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not", "set" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L592-L607
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.cognito_identity_identity_pool_id
def cognito_identity_identity_pool_id(self, lookup, default=None): """ Args: lookup: Cognito Federated Identity name, proto0-cms-identity-pool default: the optional value to return if lookup failed; returns None if not set Returns: the Cognito Identity Pool ID corresponding to the g...
python
def cognito_identity_identity_pool_id(self, lookup, default=None): """ Args: lookup: Cognito Federated Identity name, proto0-cms-identity-pool default: the optional value to return if lookup failed; returns None if not set Returns: the Cognito Identity Pool ID corresponding to the g...
[ "def", "cognito_identity_identity_pool_id", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "# List size cannot be greater than 60", "list_limit", "=", "60", "client", "=", "EFAwsResolver", ".", "__CLIENTS", "[", "\"cognito-identity\"", "]", "respon...
Args: lookup: Cognito Federated Identity name, proto0-cms-identity-pool default: the optional value to return if lookup failed; returns None if not set Returns: the Cognito Identity Pool ID corresponding to the given lookup, else default/None
[ "Args", ":", "lookup", ":", "Cognito", "Federated", "Identity", "name", "proto0", "-", "cms", "-", "identity", "-", "pool", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not", "set" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L609-L635
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.cognito_idp_user_pool_arn
def cognito_idp_user_pool_arn(self, lookup, default=None): """ Args: lookup: Cognito User Pool name, proto0-cms-user-pool default: the optional value to return if lookup failed; returns None if not set Returns: the User Pool ARN corresponding to the given lookup, else default/None ...
python
def cognito_idp_user_pool_arn(self, lookup, default=None): """ Args: lookup: Cognito User Pool name, proto0-cms-user-pool default: the optional value to return if lookup failed; returns None if not set Returns: the User Pool ARN corresponding to the given lookup, else default/None ...
[ "def", "cognito_idp_user_pool_arn", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "client", "=", "EFAwsResolver", ".", "__CLIENTS", "[", "\"cognito-idp\"", "]", "user_pool_id", "=", "self", ".", "cognito_idp_user_pool_id", "(", "lookup", ","...
Args: lookup: Cognito User Pool name, proto0-cms-user-pool default: the optional value to return if lookup failed; returns None if not set Returns: the User Pool ARN corresponding to the given lookup, else default/None
[ "Args", ":", "lookup", ":", "Cognito", "User", "Pool", "name", "proto0", "-", "cms", "-", "user", "-", "pool", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not", "set" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L637-L656
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.kms_decrypt_value
def kms_decrypt_value(self, lookup): """ Args: lookup: the encrypted value to be decrypted by KMS; base64 encoded Returns: The decrypted lookup value """ decrypted_lookup = ef_utils.kms_decrypt(EFAwsResolver.__CLIENTS["kms"], lookup) return decrypted_lookup
python
def kms_decrypt_value(self, lookup): """ Args: lookup: the encrypted value to be decrypted by KMS; base64 encoded Returns: The decrypted lookup value """ decrypted_lookup = ef_utils.kms_decrypt(EFAwsResolver.__CLIENTS["kms"], lookup) return decrypted_lookup
[ "def", "kms_decrypt_value", "(", "self", ",", "lookup", ")", ":", "decrypted_lookup", "=", "ef_utils", ".", "kms_decrypt", "(", "EFAwsResolver", ".", "__CLIENTS", "[", "\"kms\"", "]", ",", "lookup", ")", "return", "decrypted_lookup" ]
Args: lookup: the encrypted value to be decrypted by KMS; base64 encoded Returns: The decrypted lookup value
[ "Args", ":", "lookup", ":", "the", "encrypted", "value", "to", "be", "decrypted", "by", "KMS", ";", "base64", "encoded", "Returns", ":", "The", "decrypted", "lookup", "value" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L686-L694
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.kms_key_arn
def kms_key_arn(self, lookup): """ Args: lookup: The key alias, EX: alias/proto0-evs-drm Returns: The full key arn """ key_arn = ef_utils.kms_key_arn(EFAwsResolver.__CLIENTS["kms"], lookup) return key_arn
python
def kms_key_arn(self, lookup): """ Args: lookup: The key alias, EX: alias/proto0-evs-drm Returns: The full key arn """ key_arn = ef_utils.kms_key_arn(EFAwsResolver.__CLIENTS["kms"], lookup) return key_arn
[ "def", "kms_key_arn", "(", "self", ",", "lookup", ")", ":", "key_arn", "=", "ef_utils", ".", "kms_key_arn", "(", "EFAwsResolver", ".", "__CLIENTS", "[", "\"kms\"", "]", ",", "lookup", ")", "return", "key_arn" ]
Args: lookup: The key alias, EX: alias/proto0-evs-drm Returns: The full key arn
[ "Args", ":", "lookup", ":", "The", "key", "alias", "EX", ":", "alias", "/", "proto0", "-", "evs", "-", "drm", "Returns", ":", "The", "full", "key", "arn" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L696-L704
crunchyroll/ef-open
efopen/ef_generate.py
handle_args_and_set_context
def handle_args_and_set_context(args): """ Args: args: the command line args, probably passed from main() as sys.argv[1:] Returns: a populated EFContext object Raises: IOError: if service registry file can't be found or can't be opened RuntimeError: if repo or branch isn't as spec'd in ef_config...
python
def handle_args_and_set_context(args): """ Args: args: the command line args, probably passed from main() as sys.argv[1:] Returns: a populated EFContext object Raises: IOError: if service registry file can't be found or can't be opened RuntimeError: if repo or branch isn't as spec'd in ef_config...
[ "def", "handle_args_and_set_context", "(", "args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "\"env\"", ",", "help", "=", "\", \"", ".", "join", "(", "EFConfig", ".", "ENV_LIST", ")", ")", "pa...
Args: args: the command line args, probably passed from main() as sys.argv[1:] Returns: a populated EFContext object Raises: IOError: if service registry file can't be found or can't be opened RuntimeError: if repo or branch isn't as spec'd in ef_config.EF_REPO and ef_config.EF_REPO_BRANCH Calle...
[ "Args", ":", "args", ":", "the", "command", "line", "args", "probably", "passed", "from", "main", "()", "as", "sys", ".", "argv", "[", "1", ":", "]", "Returns", ":", "a", "populated", "EFContext", "object", "Raises", ":", "IOError", ":", "if", "service...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_generate.py#L105-L135
crunchyroll/ef-open
efopen/ef_generate.py
conditionally_create_security_groups
def conditionally_create_security_groups(env, service_name, service_type): """ Create security groups as needed; name and number created depend on service_type Args: env: the environment the SG will be created in service_name: name of the service in service registry service_type: service registry serv...
python
def conditionally_create_security_groups(env, service_name, service_type): """ Create security groups as needed; name and number created depend on service_type Args: env: the environment the SG will be created in service_name: name of the service in service registry service_type: service registry serv...
[ "def", "conditionally_create_security_groups", "(", "env", ",", "service_name", ",", "service_type", ")", ":", "if", "service_type", "not", "in", "SG_SERVICE_TYPES", ":", "print_if_verbose", "(", "\"not eligible for security group(s); service type: {}\"", ".", "format", "("...
Create security groups as needed; name and number created depend on service_type Args: env: the environment the SG will be created in service_name: name of the service in service registry service_type: service registry service type: 'aws_ec2', 'aws_lambda', 'aws_security_group', or 'http_service'
[ "Create", "security", "groups", "as", "needed", ";", "name", "and", "number", "created", "depend", "on", "service_type", "Args", ":", "env", ":", "the", "environment", "the", "SG", "will", "be", "created", "in", "service_name", ":", "name", "of", "the", "s...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_generate.py#L206-L248
crunchyroll/ef-open
efopen/ef_generate.py
conditionally_create_role
def conditionally_create_role(role_name, sr_entry): """ Create role_name if a role by that name does not already exist; attach a custom list of Principals to its AssumeRolePolicy Args: role_name: the name for the role to create sr_entry: service registry entry Example of a (complex) AssumeRole policy...
python
def conditionally_create_role(role_name, sr_entry): """ Create role_name if a role by that name does not already exist; attach a custom list of Principals to its AssumeRolePolicy Args: role_name: the name for the role to create sr_entry: service registry entry Example of a (complex) AssumeRole policy...
[ "def", "conditionally_create_role", "(", "role_name", ",", "sr_entry", ")", ":", "service_type", "=", "sr_entry", "[", "'type'", "]", "if", "service_type", "not", "in", "SERVICE_TYPE_ROLE", ":", "print_if_verbose", "(", "\"not eligible for role (and possibly instance prof...
Create role_name if a role by that name does not already exist; attach a custom list of Principals to its AssumeRolePolicy Args: role_name: the name for the role to create sr_entry: service registry entry Example of a (complex) AssumeRole policy document comprised of two IAM entities and a service: { ...
[ "Create", "role_name", "if", "a", "role", "by", "that", "name", "does", "not", "already", "exist", ";", "attach", "a", "custom", "list", "of", "Principals", "to", "its", "AssumeRolePolicy", "Args", ":", "role_name", ":", "the", "name", "for", "the", "role"...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_generate.py#L250-L310
crunchyroll/ef-open
efopen/ef_generate.py
conditionally_create_profile
def conditionally_create_profile(role_name, service_type): """ Check that there is a 1:1 correspondence with an InstanceProfile having the same name as the role, and that the role is contained in it. Create InstanceProfile and attach to role if needed. """ # make instance profile if this service_type gets an ...
python
def conditionally_create_profile(role_name, service_type): """ Check that there is a 1:1 correspondence with an InstanceProfile having the same name as the role, and that the role is contained in it. Create InstanceProfile and attach to role if needed. """ # make instance profile if this service_type gets an ...
[ "def", "conditionally_create_profile", "(", "role_name", ",", "service_type", ")", ":", "# make instance profile if this service_type gets an instance profile", "if", "service_type", "not", "in", "INSTANCE_PROFILE_SERVICE_TYPES", ":", "print_if_verbose", "(", "\"service type: {} no...
Check that there is a 1:1 correspondence with an InstanceProfile having the same name as the role, and that the role is contained in it. Create InstanceProfile and attach to role if needed.
[ "Check", "that", "there", "is", "a", "1", ":", "1", "correspondence", "with", "an", "InstanceProfile", "having", "the", "same", "name", "as", "the", "role", "and", "that", "the", "role", "is", "contained", "in", "it", ".", "Create", "InstanceProfile", "and...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_generate.py#L312-L341
crunchyroll/ef-open
efopen/ef_generate.py
conditionally_attach_managed_policies
def conditionally_attach_managed_policies(role_name, sr_entry): """ If 'aws_managed_policies' key lists the names of AWS managed policies to bind to the role, attach them to the role Args: role_name: name of the role to attach the policies to sr_entry: service registry entry """ service_type = sr_en...
python
def conditionally_attach_managed_policies(role_name, sr_entry): """ If 'aws_managed_policies' key lists the names of AWS managed policies to bind to the role, attach them to the role Args: role_name: name of the role to attach the policies to sr_entry: service registry entry """ service_type = sr_en...
[ "def", "conditionally_attach_managed_policies", "(", "role_name", ",", "sr_entry", ")", ":", "service_type", "=", "sr_entry", "[", "'type'", "]", "if", "not", "(", "service_type", "in", "SERVICE_TYPE_ROLE", "and", "\"aws_managed_policies\"", "in", "sr_entry", ")", "...
If 'aws_managed_policies' key lists the names of AWS managed policies to bind to the role, attach them to the role Args: role_name: name of the role to attach the policies to sr_entry: service registry entry
[ "If", "aws_managed_policies", "key", "lists", "the", "names", "of", "AWS", "managed", "policies", "to", "bind", "to", "the", "role", "attach", "them", "to", "the", "role", "Args", ":", "role_name", ":", "name", "of", "the", "role", "to", "attach", "the", ...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_generate.py#L343-L364
crunchyroll/ef-open
efopen/ef_generate.py
conditionally_inline_policies
def conditionally_inline_policies(role_name, sr_entry): """ If 'policies' key lists the filename prefixes of policies to bind to the role, load them from the expected path and inline them onto the role Args: role_name: name of the role to attach the policies to sr_entry: service registry entry """ s...
python
def conditionally_inline_policies(role_name, sr_entry): """ If 'policies' key lists the filename prefixes of policies to bind to the role, load them from the expected path and inline them onto the role Args: role_name: name of the role to attach the policies to sr_entry: service registry entry """ s...
[ "def", "conditionally_inline_policies", "(", "role_name", ",", "sr_entry", ")", ":", "service_type", "=", "sr_entry", "[", "'type'", "]", "if", "not", "(", "service_type", "in", "SERVICE_TYPE_ROLE", "and", "\"policies\"", "in", "sr_entry", ")", ":", "print_if_verb...
If 'policies' key lists the filename prefixes of policies to bind to the role, load them from the expected path and inline them onto the role Args: role_name: name of the role to attach the policies to sr_entry: service registry entry
[ "If", "policies", "key", "lists", "the", "filename", "prefixes", "of", "policies", "to", "bind", "to", "the", "role", "load", "them", "from", "the", "expected", "path", "and", "inline", "them", "onto", "the", "role", "Args", ":", "role_name", ":", "name", ...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_generate.py#L366-L392
crunchyroll/ef-open
efopen/ef_generate.py
conditionally_create_kms_key
def conditionally_create_kms_key(role_name, service_type): """ Create KMS Master Key for encryption/decryption of sensitive values in cf templates and latebind configs Args: role_name: name of the role that kms key is being created for; it will be given decrypt privileges. service_type: service regist...
python
def conditionally_create_kms_key(role_name, service_type): """ Create KMS Master Key for encryption/decryption of sensitive values in cf templates and latebind configs Args: role_name: name of the role that kms key is being created for; it will be given decrypt privileges. service_type: service regist...
[ "def", "conditionally_create_kms_key", "(", "role_name", ",", "service_type", ")", ":", "if", "service_type", "not", "in", "KMS_SERVICE_TYPES", ":", "print_if_verbose", "(", "\"not eligible for kms; service_type: {} is not valid for kms\"", ".", "format", "(", "service_type",...
Create KMS Master Key for encryption/decryption of sensitive values in cf templates and latebind configs Args: role_name: name of the role that kms key is being created for; it will be given decrypt privileges. service_type: service registry service type: 'aws_ec2', 'aws_fixture', 'aws_lambda', or 'http_s...
[ "Create", "KMS", "Master", "Key", "for", "encryption", "/", "decryption", "of", "sensitive", "values", "in", "cf", "templates", "and", "latebind", "configs", "Args", ":", "role_name", ":", "name", "of", "the", "role", "that", "kms", "key", "is", "being", "...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_generate.py#L394-L514
penguinmenac3/starttf
starttf/losses/basic_losses.py
sum_abs_distance
def sum_abs_distance(labels, preds): """ Compute the sum of abs distances. :param labels: A float tensor of shape [batch_size, ..., X] representing the labels. :param preds: A float tensor of shape [batch_size, ..., X] representing the predictions. :return: A float tensor of shape [batch_size, ...]...
python
def sum_abs_distance(labels, preds): """ Compute the sum of abs distances. :param labels: A float tensor of shape [batch_size, ..., X] representing the labels. :param preds: A float tensor of shape [batch_size, ..., X] representing the predictions. :return: A float tensor of shape [batch_size, ...]...
[ "def", "sum_abs_distance", "(", "labels", ",", "preds", ")", ":", "with", "tf", ".", "variable_scope", "(", "\"sum_abs_distance\"", ")", ":", "return", "tf", ".", "reduce_sum", "(", "tf", ".", "abs", "(", "preds", "-", "labels", ")", ",", "axis", "=", ...
Compute the sum of abs distances. :param labels: A float tensor of shape [batch_size, ..., X] representing the labels. :param preds: A float tensor of shape [batch_size, ..., X] representing the predictions. :return: A float tensor of shape [batch_size, ...] representing the summed absolute distance.
[ "Compute", "the", "sum", "of", "abs", "distances", "." ]
train
https://github.com/penguinmenac3/starttf/blob/f4086489d169757c0504e822165db2fea534b944/starttf/losses/basic_losses.py#L26-L35
penguinmenac3/starttf
starttf/losses/basic_losses.py
l1_distance
def l1_distance(labels, preds): """ Compute the l1_distance. :param labels: A float tensor of shape [batch_size, ..., X] representing the labels. :param preds: A float tensor of shape [batch_size, ..., X] representing the predictions. :return: A float tensor of shape [batch_size, ...] representing ...
python
def l1_distance(labels, preds): """ Compute the l1_distance. :param labels: A float tensor of shape [batch_size, ..., X] representing the labels. :param preds: A float tensor of shape [batch_size, ..., X] representing the predictions. :return: A float tensor of shape [batch_size, ...] representing ...
[ "def", "l1_distance", "(", "labels", ",", "preds", ")", ":", "with", "tf", ".", "variable_scope", "(", "\"l1_distance\"", ")", ":", "return", "tf", ".", "norm", "(", "preds", "-", "labels", ",", "ord", "=", "1", ")" ]
Compute the l1_distance. :param labels: A float tensor of shape [batch_size, ..., X] representing the labels. :param preds: A float tensor of shape [batch_size, ..., X] representing the predictions. :return: A float tensor of shape [batch_size, ...] representing the l1 distance.
[ "Compute", "the", "l1_distance", "." ]
train
https://github.com/penguinmenac3/starttf/blob/f4086489d169757c0504e822165db2fea534b944/starttf/losses/basic_losses.py#L38-L47
penguinmenac3/starttf
starttf/losses/basic_losses.py
smooth_l1_distance
def smooth_l1_distance(labels, preds, delta=1.0): """ Compute the smooth l1_distance. :param labels: A float tensor of shape [batch_size, ..., X] representing the labels. :param preds: A float tensor of shape [batch_size, ..., X] representing the predictions. :param delta: `float`, the point where ...
python
def smooth_l1_distance(labels, preds, delta=1.0): """ Compute the smooth l1_distance. :param labels: A float tensor of shape [batch_size, ..., X] representing the labels. :param preds: A float tensor of shape [batch_size, ..., X] representing the predictions. :param delta: `float`, the point where ...
[ "def", "smooth_l1_distance", "(", "labels", ",", "preds", ",", "delta", "=", "1.0", ")", ":", "with", "tf", ".", "variable_scope", "(", "\"smooth_l1\"", ")", ":", "return", "tf", ".", "reduce_sum", "(", "tf", ".", "losses", ".", "huber_loss", "(", "label...
Compute the smooth l1_distance. :param labels: A float tensor of shape [batch_size, ..., X] representing the labels. :param preds: A float tensor of shape [batch_size, ..., X] representing the predictions. :param delta: `float`, the point where the huber loss function changes from a quadratic to linear. ...
[ "Compute", "the", "smooth", "l1_distance", "." ]
train
https://github.com/penguinmenac3/starttf/blob/f4086489d169757c0504e822165db2fea534b944/starttf/losses/basic_losses.py#L50-L66
penguinmenac3/starttf
starttf/losses/basic_losses.py
l2_distance
def l2_distance(labels, preds): """ Compute the l2_distance. :param labels: A float tensor of shape [batch_size, ..., X] representing the labels. :param preds: A float tensor of shape [batch_size, ..., X] representing the predictions. :return: A float tensor of shape [batch_size, ...] representing ...
python
def l2_distance(labels, preds): """ Compute the l2_distance. :param labels: A float tensor of shape [batch_size, ..., X] representing the labels. :param preds: A float tensor of shape [batch_size, ..., X] representing the predictions. :return: A float tensor of shape [batch_size, ...] representing ...
[ "def", "l2_distance", "(", "labels", ",", "preds", ")", ":", "with", "tf", ".", "variable_scope", "(", "\"l2_distance\"", ")", ":", "return", "tf", ".", "norm", "(", "preds", "-", "labels", ",", "ord", "=", "2", ")" ]
Compute the l2_distance. :param labels: A float tensor of shape [batch_size, ..., X] representing the labels. :param preds: A float tensor of shape [batch_size, ..., X] representing the predictions. :return: A float tensor of shape [batch_size, ...] representing the l2 distance.
[ "Compute", "the", "l2_distance", "." ]
train
https://github.com/penguinmenac3/starttf/blob/f4086489d169757c0504e822165db2fea534b944/starttf/losses/basic_losses.py#L69-L78
penguinmenac3/starttf
starttf/losses/basic_losses.py
cross_entropy
def cross_entropy(labels, logits): """ Calculate the cross_entropy. :param labels: A float tensor of shape [batch_size, ..., num_classes] representing the label class probabilities. :param logits: A float tensor of shape [batch_size, ..., num_classes] representing the logits. :return: A tensor repr...
python
def cross_entropy(labels, logits): """ Calculate the cross_entropy. :param labels: A float tensor of shape [batch_size, ..., num_classes] representing the label class probabilities. :param logits: A float tensor of shape [batch_size, ..., num_classes] representing the logits. :return: A tensor repr...
[ "def", "cross_entropy", "(", "labels", ",", "logits", ")", ":", "with", "tf", ".", "variable_scope", "(", "\"cross_entropy\"", ")", ":", "return", "tf", ".", "nn", ".", "softmax_cross_entropy_with_logits", "(", "labels", "=", "labels", ",", "logits", "=", "l...
Calculate the cross_entropy. :param labels: A float tensor of shape [batch_size, ..., num_classes] representing the label class probabilities. :param logits: A float tensor of shape [batch_size, ..., num_classes] representing the logits. :return: A tensor representing the cross entropy.
[ "Calculate", "the", "cross_entropy", "." ]
train
https://github.com/penguinmenac3/starttf/blob/f4086489d169757c0504e822165db2fea534b944/starttf/losses/basic_losses.py#L81-L90
crunchyroll/ef-open
efopen/ef_cf.py
handle_args_and_set_context
def handle_args_and_set_context(args): """ Args: args: the command line args, probably passed from main() as sys.argv[1:] Returns: a populated EFCFContext object (extends EFContext) Raises: IOError: if service registry file can't be found or can't be opened RuntimeError: if repo or branch isn't ...
python
def handle_args_and_set_context(args): """ Args: args: the command line args, probably passed from main() as sys.argv[1:] Returns: a populated EFCFContext object (extends EFContext) Raises: IOError: if service registry file can't be found or can't be opened RuntimeError: if repo or branch isn't ...
[ "def", "handle_args_and_set_context", "(", "args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "\"template_file\"", ",", "help", "=", "\"/path/to/template_file.json\"", ")", "parser", ".", "add_argument",...
Args: args: the command line args, probably passed from main() as sys.argv[1:] Returns: a populated EFCFContext object (extends EFContext) Raises: IOError: if service registry file can't be found or can't be opened RuntimeError: if repo or branch isn't as spec'd in ef_config.EF_REPO and ef_config.EF...
[ "Args", ":", "args", ":", "the", "command", "line", "args", "probably", "passed", "from", "main", "()", "as", "sys", ".", "argv", "[", "1", ":", "]", "Returns", ":", "a", "populated", "EFCFContext", "object", "(", "extends", "EFContext", ")", "Raises", ...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_cf.py#L95-L140
crunchyroll/ef-open
efopen/ef_instanceinit.py
merge_files
def merge_files(service, skip_on_user_group_error=False): """ Given a prefix, find all templates below; merge with parameters; write to "dest" Args: service: "<service>", "all", or "ssh" skip_on_user_group_error: True or False For S3, full path becomes: s3://ellation-cx-global-configs/<service>/tem...
python
def merge_files(service, skip_on_user_group_error=False): """ Given a prefix, find all templates below; merge with parameters; write to "dest" Args: service: "<service>", "all", or "ssh" skip_on_user_group_error: True or False For S3, full path becomes: s3://ellation-cx-global-configs/<service>/tem...
[ "def", "merge_files", "(", "service", ",", "skip_on_user_group_error", "=", "False", ")", ":", "if", "WHERE", "==", "\"ec2\"", ":", "config_reader", "=", "EFInstanceinitConfigReader", "(", "\"s3\"", ",", "service", ",", "log_info", ",", "RESOURCES", "[", "\"s3\"...
Given a prefix, find all templates below; merge with parameters; write to "dest" Args: service: "<service>", "all", or "ssh" skip_on_user_group_error: True or False For S3, full path becomes: s3://ellation-cx-global-configs/<service>/templates/<filename> s3://ellation-cx-global-configs/<service>/pa...
[ "Given", "a", "prefix", "find", "all", "templates", "below", ";", "merge", "with", "parameters", ";", "write", "to", "dest", "Args", ":", "service", ":", "<service", ">", "all", "or", "ssh", "skip_on_user_group_error", ":", "True", "or", "False" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_instanceinit.py#L85-L169
crunchyroll/ef-open
efopen/ef_template_resolver.py
get_metadata_or_fail
def get_metadata_or_fail(metadata_key): """ Call get_metadata; halt with fail() if it raises an exception """ try: return http_get_metadata(metadata_key) except IOError as error: fail("Exception in http_get_metadata {} {}".format(metadata_key, repr(error)))
python
def get_metadata_or_fail(metadata_key): """ Call get_metadata; halt with fail() if it raises an exception """ try: return http_get_metadata(metadata_key) except IOError as error: fail("Exception in http_get_metadata {} {}".format(metadata_key, repr(error)))
[ "def", "get_metadata_or_fail", "(", "metadata_key", ")", ":", "try", ":", "return", "http_get_metadata", "(", "metadata_key", ")", "except", "IOError", "as", "error", ":", "fail", "(", "\"Exception in http_get_metadata {} {}\"", ".", "format", "(", "metadata_key", "...
Call get_metadata; halt with fail() if it raises an exception
[ "Call", "get_metadata", ";", "halt", "with", "fail", "()", "if", "it", "raises", "an", "exception" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_template_resolver.py#L39-L46
crunchyroll/ef-open
efopen/ef_template_resolver.py
EFTemplateResolver.load
def load(self, template, parameters=None): """ 'template' Loads template text from a 'string' or 'file' type Template text contains {{TOKEN}} symbols to be replaced 'parameters' parameters contains environment-specific sections as discussed in the class documentation. the 'parameters' arg c...
python
def load(self, template, parameters=None): """ 'template' Loads template text from a 'string' or 'file' type Template text contains {{TOKEN}} symbols to be replaced 'parameters' parameters contains environment-specific sections as discussed in the class documentation. the 'parameters' arg c...
[ "def", "load", "(", "self", ",", "template", ",", "parameters", "=", "None", ")", ":", "# load template", "if", "isinstance", "(", "template", ",", "str", ")", ":", "self", ".", "template", "=", "template", "elif", "isinstance", "(", "template", ",", "fi...
'template' Loads template text from a 'string' or 'file' type Template text contains {{TOKEN}} symbols to be replaced 'parameters' parameters contains environment-specific sections as discussed in the class documentation. the 'parameters' arg can be None, a 'string', 'file', or 'dictionary' Wh...
[ "template", "Loads", "template", "text", "from", "a", "string", "or", "file", "type", "Template", "text", "contains", "{{", "TOKEN", "}}", "symbols", "to", "be", "replaced" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_template_resolver.py#L323-L376
crunchyroll/ef-open
efopen/ef_template_resolver.py
EFTemplateResolver.search_parameters
def search_parameters(self, symbol): """ Hierarchically searches for 'symbol' in the parameters blob if there is one (would have been retrieved by 'load()'). Order is: default, <env_short>, <env> Returns Hierarchically resolved value for 'symbol', or None if a match is not found or there are no pa...
python
def search_parameters(self, symbol): """ Hierarchically searches for 'symbol' in the parameters blob if there is one (would have been retrieved by 'load()'). Order is: default, <env_short>, <env> Returns Hierarchically resolved value for 'symbol', or None if a match is not found or there are no pa...
[ "def", "search_parameters", "(", "self", ",", "symbol", ")", ":", "if", "not", "self", ".", "parameters", ":", "return", "None", "# Hierarchically lookup the key", "result", "=", "None", "if", "\"default\"", "in", "self", ".", "parameters", "and", "symbol", "i...
Hierarchically searches for 'symbol' in the parameters blob if there is one (would have been retrieved by 'load()'). Order is: default, <env_short>, <env> Returns Hierarchically resolved value for 'symbol', or None if a match is not found or there are no parameters
[ "Hierarchically", "searches", "for", "symbol", "in", "the", "parameters", "blob", "if", "there", "is", "one", "(", "would", "have", "been", "retrieved", "by", "load", "()", ")", ".", "Order", "is", ":", "default", "<env_short", ">", "<env", ">", "Returns",...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_template_resolver.py#L378-L396
crunchyroll/ef-open
efopen/ef_template_resolver.py
EFTemplateResolver.render
def render(self): """ Find {{}} tokens; resolve then replace them as described elsewhere Resolution is multi-pass: tokens may be nested to form parts of other tokens. Token search steps when resolving symbols - 1. lookups of AWS resource identifiers, such as a security group ID - 2. secure ...
python
def render(self): """ Find {{}} tokens; resolve then replace them as described elsewhere Resolution is multi-pass: tokens may be nested to form parts of other tokens. Token search steps when resolving symbols - 1. lookups of AWS resource identifiers, such as a security group ID - 2. secure ...
[ "def", "render", "(", "self", ")", ":", "# Ensure that our symbols are clean and are not from a previous template that was rendered", "self", ".", "symbols", "=", "set", "(", ")", "# Until all symbols are resolved or it is determined that some cannot be resolved, repeat:", "go_again", ...
Find {{}} tokens; resolve then replace them as described elsewhere Resolution is multi-pass: tokens may be nested to form parts of other tokens. Token search steps when resolving symbols - 1. lookups of AWS resource identifiers, such as a security group ID - 2. secure credentials - 3. version...
[ "Find", "{{", "}}", "tokens", ";", "resolve", "then", "replace", "them", "as", "described", "elsewhere", "Resolution", "is", "multi", "-", "pass", ":", "tokens", "may", "be", "nested", "to", "form", "parts", "of", "other", "tokens", "." ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_template_resolver.py#L398-L451
crunchyroll/ef-open
efopen/ef_template_resolver.py
EFTemplateResolver.count_braces
def count_braces(self): """ returns a count of "{{" and "}}" in the template, as (N_left_braces, N_right_braces) Useful to check after resolve() has run, to infer that template has an error since no {{ or }} should be present in the template after resolve() """ n_left = len(re.findall("{{", self...
python
def count_braces(self): """ returns a count of "{{" and "}}" in the template, as (N_left_braces, N_right_braces) Useful to check after resolve() has run, to infer that template has an error since no {{ or }} should be present in the template after resolve() """ n_left = len(re.findall("{{", self...
[ "def", "count_braces", "(", "self", ")", ":", "n_left", "=", "len", "(", "re", ".", "findall", "(", "\"{{\"", ",", "self", ".", "template", ")", ")", "n_right", "=", "len", "(", "re", ".", "findall", "(", "\"}}\"", ",", "self", ".", "template", ")"...
returns a count of "{{" and "}}" in the template, as (N_left_braces, N_right_braces) Useful to check after resolve() has run, to infer that template has an error since no {{ or }} should be present in the template after resolve()
[ "returns", "a", "count", "of", "{{", "and", "}}", "in", "the", "template", "as", "(", "N_left_braces", "N_right_braces", ")", "Useful", "to", "check", "after", "resolve", "()", "has", "run", "to", "infer", "that", "template", "has", "an", "error", "since",...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_template_resolver.py#L456-L464
crunchyroll/ef-open
efopen/ef_template_resolver.py
EFTemplateResolver.resolved_ok
def resolved_ok(self): """ Shortcut to testing unresolved_symbols and count_braces separately. Returns false if there are unresolved symbols or {{ or }} braces remaining, true otherwise """ left_braces, right_braces = self.count_braces() return len(self.unresolved_symbols()) == left_braces == ri...
python
def resolved_ok(self): """ Shortcut to testing unresolved_symbols and count_braces separately. Returns false if there are unresolved symbols or {{ or }} braces remaining, true otherwise """ left_braces, right_braces = self.count_braces() return len(self.unresolved_symbols()) == left_braces == ri...
[ "def", "resolved_ok", "(", "self", ")", ":", "left_braces", ",", "right_braces", "=", "self", ".", "count_braces", "(", ")", "return", "len", "(", "self", ".", "unresolved_symbols", "(", ")", ")", "==", "left_braces", "==", "right_braces", "==", "0" ]
Shortcut to testing unresolved_symbols and count_braces separately. Returns false if there are unresolved symbols or {{ or }} braces remaining, true otherwise
[ "Shortcut", "to", "testing", "unresolved_symbols", "and", "count_braces", "separately", ".", "Returns", "false", "if", "there", "are", "unresolved", "symbols", "or", "{{", "or", "}}", "braces", "remaining", "true", "otherwise" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_template_resolver.py#L466-L472
crunchyroll/ef-open
efopen/ef_resolve_config.py
handle_args_and_set_context
def handle_args_and_set_context(args): """ Args: args: the command line args, probably passed from main() as sys.argv[1:] Returns: a populated Context object based on CLI args """ parser = argparse.ArgumentParser() parser.add_argument("env", help="environment") parser.add_argument("path_to_templat...
python
def handle_args_and_set_context(args): """ Args: args: the command line args, probably passed from main() as sys.argv[1:] Returns: a populated Context object based on CLI args """ parser = argparse.ArgumentParser() parser.add_argument("env", help="environment") parser.add_argument("path_to_templat...
[ "def", "handle_args_and_set_context", "(", "args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "\"env\"", ",", "help", "=", "\"environment\"", ")", "parser", ".", "add_argument", "(", "\"path_to_templ...
Args: args: the command line args, probably passed from main() as sys.argv[1:] Returns: a populated Context object based on CLI args
[ "Args", ":", "args", ":", "the", "command", "line", "args", "probably", "passed", "from", "main", "()", "as", "sys", ".", "argv", "[", "1", ":", "]", "Returns", ":", "a", "populated", "Context", "object", "based", "on", "CLI", "args" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_resolve_config.py#L61-L89
crunchyroll/ef-open
efopen/ef_resolve_config.py
merge_files
def merge_files(context): """ Given a context containing path to template, env, and service: merge config into template and output the result to stdout Args: context: a populated context object """ resolver = EFTemplateResolver( profile=context.profile, region=context.region, env=conte...
python
def merge_files(context): """ Given a context containing path to template, env, and service: merge config into template and output the result to stdout Args: context: a populated context object """ resolver = EFTemplateResolver( profile=context.profile, region=context.region, env=conte...
[ "def", "merge_files", "(", "context", ")", ":", "resolver", "=", "EFTemplateResolver", "(", "profile", "=", "context", ".", "profile", ",", "region", "=", "context", ".", "region", ",", "env", "=", "context", ".", "env", ",", "service", "=", "context", "...
Given a context containing path to template, env, and service: merge config into template and output the result to stdout Args: context: a populated context object
[ "Given", "a", "context", "containing", "path", "to", "template", "env", "and", "service", ":", "merge", "config", "into", "template", "and", "output", "the", "result", "to", "stdout", "Args", ":", "context", ":", "a", "populated", "context", "object" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_resolve_config.py#L92-L175
crunchyroll/ef-open
efopen/ef_check_config.py
handle_args
def handle_args(args): """ Handle command line arguments Raises: Exception if the config path wasn't explicitly state and dead reckoning based on script location fails """ parser = argparse.ArgumentParser() parser.add_argument("configpath", default=None, nargs="?", help="/path/to/c...
python
def handle_args(args): """ Handle command line arguments Raises: Exception if the config path wasn't explicitly state and dead reckoning based on script location fails """ parser = argparse.ArgumentParser() parser.add_argument("configpath", default=None, nargs="?", help="/path/to/c...
[ "def", "handle_args", "(", "args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "\"configpath\"", ",", "default", "=", "None", ",", "nargs", "=", "\"?\"", ",", "help", "=", "\"/path/to/configs (alw...
Handle command line arguments Raises: Exception if the config path wasn't explicitly state and dead reckoning based on script location fails
[ "Handle", "command", "line", "arguments", "Raises", ":", "Exception", "if", "the", "config", "path", "wasn", "t", "explicitly", "state", "and", "dead", "reckoning", "based", "on", "script", "location", "fails" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_check_config.py#L38-L60
crunchyroll/ef-open
efopen/ef_check_config.py
load_json
def load_json(json_filespec): """ Loads JSON from a config file Args: json_filespec: path/to/file.json Returns: a dict made from the JSON read, if successful Raises: IOError if the file could not be opened ValueError if the JSON could not be read successfully RuntimeError if something else...
python
def load_json(json_filespec): """ Loads JSON from a config file Args: json_filespec: path/to/file.json Returns: a dict made from the JSON read, if successful Raises: IOError if the file could not be opened ValueError if the JSON could not be read successfully RuntimeError if something else...
[ "def", "load_json", "(", "json_filespec", ")", ":", "json_fh", "=", "open", "(", "json_filespec", ")", "config_dict", "=", "json", ".", "load", "(", "json_fh", ")", "json_fh", ".", "close", "(", ")", "return", "config_dict" ]
Loads JSON from a config file Args: json_filespec: path/to/file.json Returns: a dict made from the JSON read, if successful Raises: IOError if the file could not be opened ValueError if the JSON could not be read successfully RuntimeError if something else went wrong
[ "Loads", "JSON", "from", "a", "config", "file", "Args", ":", "json_filespec", ":", "path", "/", "to", "/", "file", ".", "json", "Returns", ":", "a", "dict", "made", "from", "the", "JSON", "read", "if", "successful", "Raises", ":", "IOError", "if", "the...
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_check_config.py#L62-L77
crunchyroll/ef-open
efopen/ef_version_resolver.py
EFVersionResolver.lookup
def lookup(self, token): """ Return key version if found, None otherwise Lookup should look like this: pattern: <key>,<env>/<service> example: ami-id,staging/core """ # get search key and env/service from token try: key, envservice = token.split(",") except Valu...
python
def lookup(self, token): """ Return key version if found, None otherwise Lookup should look like this: pattern: <key>,<env>/<service> example: ami-id,staging/core """ # get search key and env/service from token try: key, envservice = token.split(",") except Valu...
[ "def", "lookup", "(", "self", ",", "token", ")", ":", "# get search key and env/service from token", "try", ":", "key", ",", "envservice", "=", "token", ".", "split", "(", "\",\"", ")", "except", "ValueError", ":", "return", "None", "# get env, service from value"...
Return key version if found, None otherwise Lookup should look like this: pattern: <key>,<env>/<service> example: ami-id,staging/core
[ "Return", "key", "version", "if", "found", "None", "otherwise", "Lookup", "should", "look", "like", "this", ":", "pattern", ":", "<key", ">", "<env", ">", "/", "<service", ">", "example", ":", "ami", "-", "id", "staging", "/", "core" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_version_resolver.py#L66-L86
crunchyroll/ef-open
plugins_available/newrelic/interface.py
NewRelic.alert_policy_exists
def alert_policy_exists(self, policy_name): """Check to see if an alert policy exists in NewRelic. Return True if so, False if not""" if next((policy for policy in self.all_alerts if policy['name'] == policy_name), False): return True
python
def alert_policy_exists(self, policy_name): """Check to see if an alert policy exists in NewRelic. Return True if so, False if not""" if next((policy for policy in self.all_alerts if policy['name'] == policy_name), False): return True
[ "def", "alert_policy_exists", "(", "self", ",", "policy_name", ")", ":", "if", "next", "(", "(", "policy", "for", "policy", "in", "self", ".", "all_alerts", "if", "policy", "[", "'name'", "]", "==", "policy_name", ")", ",", "False", ")", ":", "return", ...
Check to see if an alert policy exists in NewRelic. Return True if so, False if not
[ "Check", "to", "see", "if", "an", "alert", "policy", "exists", "in", "NewRelic", ".", "Return", "True", "if", "so", "False", "if", "not" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/plugins_available/newrelic/interface.py#L111-L114
crunchyroll/ef-open
plugins_available/newrelic/interface.py
NewRelic.create_alert_policy
def create_alert_policy(self, policy_name): """Creates an alert policy in NewRelic""" policy_data = { 'policy': { 'incident_preference': 'PER_POLICY', 'name': policy_name } } create_policy = requests.post( 'https://api.newrelic.com/v2/alerts_policies.json', headers=self.auth_header, data=j...
python
def create_alert_policy(self, policy_name): """Creates an alert policy in NewRelic""" policy_data = { 'policy': { 'incident_preference': 'PER_POLICY', 'name': policy_name } } create_policy = requests.post( 'https://api.newrelic.com/v2/alerts_policies.json', headers=self.auth_header, data=j...
[ "def", "create_alert_policy", "(", "self", ",", "policy_name", ")", ":", "policy_data", "=", "{", "'policy'", ":", "{", "'incident_preference'", ":", "'PER_POLICY'", ",", "'name'", ":", "policy_name", "}", "}", "create_policy", "=", "requests", ".", "post", "(...
Creates an alert policy in NewRelic
[ "Creates", "an", "alert", "policy", "in", "NewRelic" ]
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/plugins_available/newrelic/interface.py#L116-L126
gabstopper/smc-python
smc/actions/_search.py
element_href
def element_href(name): """ Get specified element href by element name :param name: name of element :return: string href location of object, else None """ if name: element = fetch_meta_by_name(name) if element.href: return element.href
python
def element_href(name): """ Get specified element href by element name :param name: name of element :return: string href location of object, else None """ if name: element = fetch_meta_by_name(name) if element.href: return element.href
[ "def", "element_href", "(", "name", ")", ":", "if", "name", ":", "element", "=", "fetch_meta_by_name", "(", "name", ")", "if", "element", ".", "href", ":", "return", "element", ".", "href" ]
Get specified element href by element name :param name: name of element :return: string href location of object, else None
[ "Get", "specified", "element", "href", "by", "element", "name" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L44-L53
gabstopper/smc-python
smc/actions/_search.py
element_as_json
def element_as_json(name): """ Get specified element json data by name :param name: name of element :return: json data representing element, else None """ if name: element = fetch_json_by_name(name) if element.json: return element.json
python
def element_as_json(name): """ Get specified element json data by name :param name: name of element :return: json data representing element, else None """ if name: element = fetch_json_by_name(name) if element.json: return element.json
[ "def", "element_as_json", "(", "name", ")", ":", "if", "name", ":", "element", "=", "fetch_json_by_name", "(", "name", ")", "if", "element", ".", "json", ":", "return", "element", ".", "json" ]
Get specified element json data by name :param name: name of element :return: json data representing element, else None
[ "Get", "specified", "element", "json", "data", "by", "name" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L56-L65
gabstopper/smc-python
smc/actions/_search.py
element_as_json_with_filter
def element_as_json_with_filter(name, _filter): """ Get specified element json data by name with filter. Filter can be any valid element type. :param name: name of element :param _filter: element filter, host, network, tcp_service, network_elements, services, services_and_applic...
python
def element_as_json_with_filter(name, _filter): """ Get specified element json data by name with filter. Filter can be any valid element type. :param name: name of element :param _filter: element filter, host, network, tcp_service, network_elements, services, services_and_applic...
[ "def", "element_as_json_with_filter", "(", "name", ",", "_filter", ")", ":", "if", "name", ":", "element_href", "=", "element_href_use_filter", "(", "name", ",", "_filter", ")", "if", "element_href", ":", "return", "element_by_href_as_json", "(", "element_href", "...
Get specified element json data by name with filter. Filter can be any valid element type. :param name: name of element :param _filter: element filter, host, network, tcp_service, network_elements, services, services_and_applications, etc :return: json data representing element, els...
[ "Get", "specified", "element", "json", "data", "by", "name", "with", "filter", ".", "Filter", "can", "be", "any", "valid", "element", "type", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L68-L81
gabstopper/smc-python
smc/actions/_search.py
element_info_as_json
def element_info_as_json(name): """ Get specified element META data based on search query This is the base level search that returns basic object info with the following attributes: * href: link to element * name: name of element * type: type of element :param str name: name of element...
python
def element_info_as_json(name): """ Get specified element META data based on search query This is the base level search that returns basic object info with the following attributes: * href: link to element * name: name of element * type: type of element :param str name: name of element...
[ "def", "element_info_as_json", "(", "name", ")", ":", "if", "name", ":", "element", "=", "fetch_meta_by_name", "(", "name", ")", "if", "element", ".", "json", ":", "return", "element", ".", "json" ]
Get specified element META data based on search query This is the base level search that returns basic object info with the following attributes: * href: link to element * name: name of element * type: type of element :param str name: name of element :return: list dict with meta (href, nam...
[ "Get", "specified", "element", "META", "data", "based", "on", "search", "query", "This", "is", "the", "base", "level", "search", "that", "returns", "basic", "object", "info", "with", "the", "following", "attributes", ":" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L94-L110
gabstopper/smc-python
smc/actions/_search.py
element_info_as_json_with_filter
def element_info_as_json_with_filter(name, _filter): """ Top level json meta data (href, name, type) for element :param str name: name of element :param str _filter: filter of entry point :return: list dict with metadata, otherwise None """ if name and _filter: element = fetch_meta_...
python
def element_info_as_json_with_filter(name, _filter): """ Top level json meta data (href, name, type) for element :param str name: name of element :param str _filter: filter of entry point :return: list dict with metadata, otherwise None """ if name and _filter: element = fetch_meta_...
[ "def", "element_info_as_json_with_filter", "(", "name", ",", "_filter", ")", ":", "if", "name", "and", "_filter", ":", "element", "=", "fetch_meta_by_name", "(", "name", ",", "filter_context", "=", "_filter", ")", "if", "element", ".", "json", ":", "return", ...
Top level json meta data (href, name, type) for element :param str name: name of element :param str _filter: filter of entry point :return: list dict with metadata, otherwise None
[ "Top", "level", "json", "meta", "data", "(", "href", "name", "type", ")", "for", "element" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L113-L124
gabstopper/smc-python
smc/actions/_search.py
element_href_use_wildcard
def element_href_use_wildcard(name): """ Get element href using a wildcard rather than matching only on the name field. This will likely return multiple results. :param name: name of element :return: list of matched elements """ if name: element = fetch_meta_by_name(name, exact_match=Fa...
python
def element_href_use_wildcard(name): """ Get element href using a wildcard rather than matching only on the name field. This will likely return multiple results. :param name: name of element :return: list of matched elements """ if name: element = fetch_meta_by_name(name, exact_match=Fa...
[ "def", "element_href_use_wildcard", "(", "name", ")", ":", "if", "name", ":", "element", "=", "fetch_meta_by_name", "(", "name", ",", "exact_match", "=", "False", ")", "return", "element", ".", "json" ]
Get element href using a wildcard rather than matching only on the name field. This will likely return multiple results. :param name: name of element :return: list of matched elements
[ "Get", "element", "href", "using", "a", "wildcard", "rather", "than", "matching", "only", "on", "the", "name", "field", ".", "This", "will", "likely", "return", "multiple", "results", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L127-L136
gabstopper/smc-python
smc/actions/_search.py
element_href_use_filter
def element_href_use_filter(name, _filter): """ Get element href using filter Filter should be a valid entry point value, ie host, router, network, single_fw, etc :param name: name of element :param _filter: filter type, unknown filter will result in no matches :return: element href (if found)...
python
def element_href_use_filter(name, _filter): """ Get element href using filter Filter should be a valid entry point value, ie host, router, network, single_fw, etc :param name: name of element :param _filter: filter type, unknown filter will result in no matches :return: element href (if found)...
[ "def", "element_href_use_filter", "(", "name", ",", "_filter", ")", ":", "if", "name", "and", "_filter", ":", "element", "=", "fetch_meta_by_name", "(", "name", ",", "filter_context", "=", "_filter", ")", "if", "element", ".", "json", ":", "return", "element...
Get element href using filter Filter should be a valid entry point value, ie host, router, network, single_fw, etc :param name: name of element :param _filter: filter type, unknown filter will result in no matches :return: element href (if found), else None
[ "Get", "element", "href", "using", "filter" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L139-L152
gabstopper/smc-python
smc/actions/_search.py
element_by_href_as_json
def element_by_href_as_json(href, params=None): """ Get specified element by href :param href: link to object :param params: optional search query parameters :return: json data representing element, else None """ if href: element = fetch_json_by_href(href, params=params) if elem...
python
def element_by_href_as_json(href, params=None): """ Get specified element by href :param href: link to object :param params: optional search query parameters :return: json data representing element, else None """ if href: element = fetch_json_by_href(href, params=params) if elem...
[ "def", "element_by_href_as_json", "(", "href", ",", "params", "=", "None", ")", ":", "if", "href", ":", "element", "=", "fetch_json_by_href", "(", "href", ",", "params", "=", "params", ")", "if", "element", ":", "return", "element", ".", "json" ]
Get specified element by href :param href: link to object :param params: optional search query parameters :return: json data representing element, else None
[ "Get", "specified", "element", "by", "href" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L155-L165
gabstopper/smc-python
smc/actions/_search.py
element_name_by_href
def element_name_by_href(href): """ The element href is known, possibly from a reference in an elements json. You want to retrieve the name of this element. :param str href: href of element :return: str name of element, or None """ if href: element = fetch_json_by_href(href) ...
python
def element_name_by_href(href): """ The element href is known, possibly from a reference in an elements json. You want to retrieve the name of this element. :param str href: href of element :return: str name of element, or None """ if href: element = fetch_json_by_href(href) ...
[ "def", "element_name_by_href", "(", "href", ")", ":", "if", "href", ":", "element", "=", "fetch_json_by_href", "(", "href", ")", "if", "element", ".", "json", ":", "return", "element", ".", "json", ".", "get", "(", "'name'", ")" ]
The element href is known, possibly from a reference in an elements json. You want to retrieve the name of this element. :param str href: href of element :return: str name of element, or None
[ "The", "element", "href", "is", "known", "possibly", "from", "a", "reference", "in", "an", "elements", "json", ".", "You", "want", "to", "retrieve", "the", "name", "of", "this", "element", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L168-L179
gabstopper/smc-python
smc/actions/_search.py
element_name_and_type_by_href
def element_name_and_type_by_href(href): """ Retrieve the element name and type of element based on the href. You may have a href that is within another element reference and want more information on that reference. :param str href: href of element :return: tuple (name, type) """ if hre...
python
def element_name_and_type_by_href(href): """ Retrieve the element name and type of element based on the href. You may have a href that is within another element reference and want more information on that reference. :param str href: href of element :return: tuple (name, type) """ if hre...
[ "def", "element_name_and_type_by_href", "(", "href", ")", ":", "if", "href", ":", "element", "=", "fetch_json_by_href", "(", "href", ")", "if", "element", ".", "json", ":", "for", "entries", "in", "element", ".", "json", ".", "get", "(", "'link'", ")", "...
Retrieve the element name and type of element based on the href. You may have a href that is within another element reference and want more information on that reference. :param str href: href of element :return: tuple (name, type)
[ "Retrieve", "the", "element", "name", "and", "type", "of", "element", "based", "on", "the", "href", ".", "You", "may", "have", "a", "href", "that", "is", "within", "another", "element", "reference", "and", "want", "more", "information", "on", "that", "refe...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L182-L199
gabstopper/smc-python
smc/actions/_search.py
element_attribute_by_href
def element_attribute_by_href(href, attr_name): """ The element href is known and you want to retrieve a specific attribute from that element. For example, if you want a specific attribute by it's name:: search.element_attribute_by_href(href_to_resource, 'name') :param str href: href of e...
python
def element_attribute_by_href(href, attr_name): """ The element href is known and you want to retrieve a specific attribute from that element. For example, if you want a specific attribute by it's name:: search.element_attribute_by_href(href_to_resource, 'name') :param str href: href of e...
[ "def", "element_attribute_by_href", "(", "href", ",", "attr_name", ")", ":", "if", "href", ":", "element", "=", "fetch_json_by_href", "(", "href", ")", "if", "element", ".", "json", ":", "return", "element", ".", "json", ".", "get", "(", "attr_name", ")" ]
The element href is known and you want to retrieve a specific attribute from that element. For example, if you want a specific attribute by it's name:: search.element_attribute_by_href(href_to_resource, 'name') :param str href: href of element :param str attr_name: name of attribute :retu...
[ "The", "element", "href", "is", "known", "and", "you", "want", "to", "retrieve", "a", "specific", "attribute", "from", "that", "element", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L202-L218
gabstopper/smc-python
smc/actions/_search.py
element_by_href_as_smcresult
def element_by_href_as_smcresult(href, params=None): """ Get specified element returned as an SMCResult object :param href: href direct link to object :return: :py:class:`smc.api.web.SMCResult` with etag, href and element field holding json, else None """ if href: element = fet...
python
def element_by_href_as_smcresult(href, params=None): """ Get specified element returned as an SMCResult object :param href: href direct link to object :return: :py:class:`smc.api.web.SMCResult` with etag, href and element field holding json, else None """ if href: element = fet...
[ "def", "element_by_href_as_smcresult", "(", "href", ",", "params", "=", "None", ")", ":", "if", "href", ":", "element", "=", "fetch_json_by_href", "(", "href", ",", "params", "=", "params", ")", "if", "element", ":", "return", "element" ]
Get specified element returned as an SMCResult object :param href: href direct link to object :return: :py:class:`smc.api.web.SMCResult` with etag, href and element field holding json, else None
[ "Get", "specified", "element", "returned", "as", "an", "SMCResult", "object" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L221-L231
gabstopper/smc-python
smc/actions/_search.py
element_as_smcresult_use_filter
def element_as_smcresult_use_filter(name, _filter): """ Return SMCResult object and use search filter to find object :param name: name of element to find :param _filter: filter to use, i.e. tcp_service, host, etc :return: :py:class:`smc.api.web.SMCResult` """ if name: element = fetc...
python
def element_as_smcresult_use_filter(name, _filter): """ Return SMCResult object and use search filter to find object :param name: name of element to find :param _filter: filter to use, i.e. tcp_service, host, etc :return: :py:class:`smc.api.web.SMCResult` """ if name: element = fetc...
[ "def", "element_as_smcresult_use_filter", "(", "name", ",", "_filter", ")", ":", "if", "name", ":", "element", "=", "fetch_meta_by_name", "(", "name", ",", "filter_context", "=", "_filter", ")", "if", "element", ".", "msg", ":", "return", "element", "if", "e...
Return SMCResult object and use search filter to find object :param name: name of element to find :param _filter: filter to use, i.e. tcp_service, host, etc :return: :py:class:`smc.api.web.SMCResult`
[ "Return", "SMCResult", "object", "and", "use", "search", "filter", "to", "find", "object" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L246-L259
gabstopper/smc-python
smc/actions/_search.py
element_href_by_batch
def element_href_by_batch(list_to_find, filter=None): # @ReservedAssignment """ Find batch of entries by name. Reduces number of find calls from calling class. :param list list_to_find: list of names to find :param filter: optional filter, i.e. 'tcp_service', 'host', etc :return: list: {name: href...
python
def element_href_by_batch(list_to_find, filter=None): # @ReservedAssignment """ Find batch of entries by name. Reduces number of find calls from calling class. :param list list_to_find: list of names to find :param filter: optional filter, i.e. 'tcp_service', 'host', etc :return: list: {name: href...
[ "def", "element_href_by_batch", "(", "list_to_find", ",", "filter", "=", "None", ")", ":", "# @ReservedAssignment", "try", ":", "if", "filter", ":", "return", "[", "{", "k", ":", "element_href_use_filter", "(", "k", ",", "filter", ")", "for", "k", "in", "l...
Find batch of entries by name. Reduces number of find calls from calling class. :param list list_to_find: list of names to find :param filter: optional filter, i.e. 'tcp_service', 'host', etc :return: list: {name: href, name: href}, href may be None if not found
[ "Find", "batch", "of", "entries", "by", "name", ".", "Reduces", "number", "of", "find", "calls", "from", "calling", "class", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L262-L276
gabstopper/smc-python
smc/actions/_search.py
all_elements_by_type
def all_elements_by_type(name): """ Get specified elements based on the entry point verb from SMC api To get the entry points available, you can get these from the session:: session.cache.entry_points Execution will get the entry point for the element type, then get all elements that match. ...
python
def all_elements_by_type(name): """ Get specified elements based on the entry point verb from SMC api To get the entry points available, you can get these from the session:: session.cache.entry_points Execution will get the entry point for the element type, then get all elements that match. ...
[ "def", "all_elements_by_type", "(", "name", ")", ":", "if", "name", ":", "entry", "=", "element_entry_point", "(", "name", ")", "if", "entry", ":", "# in case an invalid entry point is specified", "result", "=", "element_by_href_as_json", "(", "entry", ")", "return"...
Get specified elements based on the entry point verb from SMC api To get the entry points available, you can get these from the session:: session.cache.entry_points Execution will get the entry point for the element type, then get all elements that match. For example:: search.all_ele...
[ "Get", "specified", "elements", "based", "on", "the", "entry", "point", "verb", "from", "SMC", "api", "To", "get", "the", "entry", "points", "available", "you", "can", "get", "these", "from", "the", "session", "::" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L279-L300
gabstopper/smc-python
smc/actions/_search.py
fetch_json_by_name
def fetch_json_by_name(name): """ Fetch json based on the element name First gets the href based on a search by name, then makes a second query to obtain the element json :method: GET :param str name: element name :return: :py:class:`smc.api.web.SMCResult` """ result = fetch_meta_by...
python
def fetch_json_by_name(name): """ Fetch json based on the element name First gets the href based on a search by name, then makes a second query to obtain the element json :method: GET :param str name: element name :return: :py:class:`smc.api.web.SMCResult` """ result = fetch_meta_by...
[ "def", "fetch_json_by_name", "(", "name", ")", ":", "result", "=", "fetch_meta_by_name", "(", "name", ")", "if", "result", ".", "href", ":", "result", "=", "fetch_json_by_href", "(", "result", ".", "href", ")", "return", "result" ]
Fetch json based on the element name First gets the href based on a search by name, then makes a second query to obtain the element json :method: GET :param str name: element name :return: :py:class:`smc.api.web.SMCResult`
[ "Fetch", "json", "based", "on", "the", "element", "name", "First", "gets", "the", "href", "based", "on", "a", "search", "by", "name", "then", "makes", "a", "second", "query", "to", "obtain", "the", "element", "json" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L342-L355
gabstopper/smc-python
smc/actions/_search.py
fetch_json_by_href
def fetch_json_by_href(href, params=None): """ Fetch json for element by using href. Params should be key/value pairs. For example {'filter': 'myfilter'} :method: GET :param str href: href of the element :params dict params: optional search query parameters :return: :py:class:`smc.api.web.S...
python
def fetch_json_by_href(href, params=None): """ Fetch json for element by using href. Params should be key/value pairs. For example {'filter': 'myfilter'} :method: GET :param str href: href of the element :params dict params: optional search query parameters :return: :py:class:`smc.api.web.S...
[ "def", "fetch_json_by_href", "(", "href", ",", "params", "=", "None", ")", ":", "result", "=", "SMCRequest", "(", "href", "=", "href", ",", "params", "=", "params", ")", ".", "read", "(", ")", "if", "result", ":", "result", ".", "href", "=", "href", ...
Fetch json for element by using href. Params should be key/value pairs. For example {'filter': 'myfilter'} :method: GET :param str href: href of the element :params dict params: optional search query parameters :return: :py:class:`smc.api.web.SMCResult`
[ "Fetch", "json", "for", "element", "by", "using", "href", ".", "Params", "should", "be", "key", "/", "value", "pairs", ".", "For", "example", "{", "filter", ":", "myfilter", "}" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/actions/_search.py#L358-L371
gabstopper/smc-python
smc/vpn/elements.py
GatewaySettings.create
def create(cls, name, negotiation_expiration=200000, negotiation_retry_timer=500, negotiation_retry_max_number=32, negotiation_retry_timer_max=7000, certificate_cache_crl_validity=90000, mobike_after_sa_update=False, mobike_before...
python
def create(cls, name, negotiation_expiration=200000, negotiation_retry_timer=500, negotiation_retry_max_number=32, negotiation_retry_timer_max=7000, certificate_cache_crl_validity=90000, mobike_after_sa_update=False, mobike_before...
[ "def", "create", "(", "cls", ",", "name", ",", "negotiation_expiration", "=", "200000", ",", "negotiation_retry_timer", "=", "500", ",", "negotiation_retry_max_number", "=", "32", ",", "negotiation_retry_timer_max", "=", "7000", ",", "certificate_cache_crl_validity", ...
Create a new gateway setting profile. :param str name: name of profile :param int negotiation_expiration: expire after (ms) :param int negotiation_retry_timer: retry time length (ms) :param int negotiation_retry_max_num: max number of retries allowed :param int negotiation_retry...
[ "Create", "a", "new", "gateway", "setting", "profile", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/elements.py#L65-L102
gabstopper/smc-python
smc/vpn/elements.py
ExternalGateway.create
def create(cls, name, trust_all_cas=True): """ Create new External Gateway :param str name: name of test_external gateway :param bool trust_all_cas: whether to trust all internal CA's (default: True) :return: instance with meta :rtype: ExternalGateway ...
python
def create(cls, name, trust_all_cas=True): """ Create new External Gateway :param str name: name of test_external gateway :param bool trust_all_cas: whether to trust all internal CA's (default: True) :return: instance with meta :rtype: ExternalGateway ...
[ "def", "create", "(", "cls", ",", "name", ",", "trust_all_cas", "=", "True", ")", ":", "json", "=", "{", "'name'", ":", "name", ",", "'trust_all_cas'", ":", "trust_all_cas", "}", "return", "ElementCreator", "(", "cls", ",", "json", ")" ]
Create new External Gateway :param str name: name of test_external gateway :param bool trust_all_cas: whether to trust all internal CA's (default: True) :return: instance with meta :rtype: ExternalGateway
[ "Create", "new", "External", "Gateway" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/elements.py#L136-L149
gabstopper/smc-python
smc/vpn/elements.py
ExternalGateway.update_or_create
def update_or_create(cls, name, external_endpoint=None, vpn_site=None, trust_all_cas=True, with_status=False): """ Update or create an ExternalGateway. The ``external_endpoint`` and ``vpn_site`` parameters are expected to be a list of dicts with key/value pairs to satisfy the res...
python
def update_or_create(cls, name, external_endpoint=None, vpn_site=None, trust_all_cas=True, with_status=False): """ Update or create an ExternalGateway. The ``external_endpoint`` and ``vpn_site`` parameters are expected to be a list of dicts with key/value pairs to satisfy the res...
[ "def", "update_or_create", "(", "cls", ",", "name", ",", "external_endpoint", "=", "None", ",", "vpn_site", "=", "None", ",", "trust_all_cas", "=", "True", ",", "with_status", "=", "False", ")", ":", "if", "external_endpoint", ":", "for", "endpoint", "in", ...
Update or create an ExternalGateway. The ``external_endpoint`` and ``vpn_site`` parameters are expected to be a list of dicts with key/value pairs to satisfy the respective elements create constructor. VPN Sites will represent the final state of the VPN site list. ExternalEndpoint that are ...
[ "Update", "or", "create", "an", "ExternalGateway", ".", "The", "external_endpoint", "and", "vpn_site", "parameters", "are", "expected", "to", "be", "a", "list", "of", "dicts", "with", "key", "/", "value", "pairs", "to", "satisfy", "the", "respective", "element...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/elements.py#L152-L214
gabstopper/smc-python
smc/vpn/elements.py
ExternalEndpoint.create
def create(self, name, address=None, enabled=True, balancing_mode='active', ipsec_vpn=True, nat_t=False, force_nat_t=False, dynamic=False, ike_phase1_id_type=None, ike_phase1_id_value=None): """ Create an test_external endpoint. Define common settings for that speci...
python
def create(self, name, address=None, enabled=True, balancing_mode='active', ipsec_vpn=True, nat_t=False, force_nat_t=False, dynamic=False, ike_phase1_id_type=None, ike_phase1_id_value=None): """ Create an test_external endpoint. Define common settings for that speci...
[ "def", "create", "(", "self", ",", "name", ",", "address", "=", "None", ",", "enabled", "=", "True", ",", "balancing_mode", "=", "'active'", ",", "ipsec_vpn", "=", "True", ",", "nat_t", "=", "False", ",", "force_nat_t", "=", "False", ",", "dynamic", "=...
Create an test_external endpoint. Define common settings for that specify the address, enabled, nat_t, name, etc. You can also omit the IP address if the endpoint is dynamic. In that case, you must also specify the ike_phase1 settings. :param str name: name of test_external endpoint ...
[ "Create", "an", "test_external", "endpoint", ".", "Define", "common", "settings", "for", "that", "specify", "the", "address", "enabled", "nat_t", "name", "etc", ".", "You", "can", "also", "omit", "the", "IP", "address", "if", "the", "endpoint", "is", "dynami...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/elements.py#L273-L316
gabstopper/smc-python
smc/vpn/elements.py
ExternalEndpoint.update_or_create
def update_or_create(cls, external_gateway, name, with_status=False, **kw): """ Update or create external endpoints for the specified external gateway. An ExternalEndpoint is considered unique based on the IP address for the endpoint (you cannot add two external endpoints with the same I...
python
def update_or_create(cls, external_gateway, name, with_status=False, **kw): """ Update or create external endpoints for the specified external gateway. An ExternalEndpoint is considered unique based on the IP address for the endpoint (you cannot add two external endpoints with the same I...
[ "def", "update_or_create", "(", "cls", ",", "external_gateway", ",", "name", ",", "with_status", "=", "False", ",", "*", "*", "kw", ")", ":", "if", "'address'", "in", "kw", ":", "external_endpoint", "=", "external_gateway", ".", "external_endpoint", ".", "ge...
Update or create external endpoints for the specified external gateway. An ExternalEndpoint is considered unique based on the IP address for the endpoint (you cannot add two external endpoints with the same IP). If the external endpoint is dynamic, then the name is the unique identifier. ...
[ "Update", "or", "create", "external", "endpoints", "for", "the", "specified", "external", "gateway", ".", "An", "ExternalEndpoint", "is", "considered", "unique", "based", "on", "the", "IP", "address", "for", "the", "endpoint", "(", "you", "cannot", "add", "two...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/elements.py#L319-L363
gabstopper/smc-python
smc/vpn/elements.py
ExternalEndpoint.enable_disable
def enable_disable(self): """ Enable or disable this endpoint. If enabled, it will be disabled and vice versa. :return: None """ if self.enabled: self.data['enabled'] = False else: self.data['enabled'] = True self.update()
python
def enable_disable(self): """ Enable or disable this endpoint. If enabled, it will be disabled and vice versa. :return: None """ if self.enabled: self.data['enabled'] = False else: self.data['enabled'] = True self.update()
[ "def", "enable_disable", "(", "self", ")", ":", "if", "self", ".", "enabled", ":", "self", ".", "data", "[", "'enabled'", "]", "=", "False", "else", ":", "self", ".", "data", "[", "'enabled'", "]", "=", "True", "self", ".", "update", "(", ")" ]
Enable or disable this endpoint. If enabled, it will be disabled and vice versa. :return: None
[ "Enable", "or", "disable", "this", "endpoint", ".", "If", "enabled", "it", "will", "be", "disabled", "and", "vice", "versa", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/elements.py#L383-L394
gabstopper/smc-python
smc/vpn/elements.py
ExternalEndpoint.enable_disable_force_nat_t
def enable_disable_force_nat_t(self): """ Enable or disable NAT-T on this endpoint. If enabled, it will be disabled and vice versa. :return: None """ if self.force_nat_t: self.data['force_nat_t'] = False else: self.data['force_nat_t'] = Tr...
python
def enable_disable_force_nat_t(self): """ Enable or disable NAT-T on this endpoint. If enabled, it will be disabled and vice versa. :return: None """ if self.force_nat_t: self.data['force_nat_t'] = False else: self.data['force_nat_t'] = Tr...
[ "def", "enable_disable_force_nat_t", "(", "self", ")", ":", "if", "self", ".", "force_nat_t", ":", "self", ".", "data", "[", "'force_nat_t'", "]", "=", "False", "else", ":", "self", ".", "data", "[", "'force_nat_t'", "]", "=", "True", "self", ".", "updat...
Enable or disable NAT-T on this endpoint. If enabled, it will be disabled and vice versa. :return: None
[ "Enable", "or", "disable", "NAT", "-", "T", "on", "this", "endpoint", ".", "If", "enabled", "it", "will", "be", "disabled", "and", "vice", "versa", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/elements.py#L396-L407
gabstopper/smc-python
smc/vpn/elements.py
VPNSite.create
def create(self, name, site_element): """ Create a VPN site for an internal or external gateway :param str name: name of site :param list site_element: list of protected networks/hosts :type site_element: list[str,Element] :raises CreateElementFailed: create element fail...
python
def create(self, name, site_element): """ Create a VPN site for an internal or external gateway :param str name: name of site :param list site_element: list of protected networks/hosts :type site_element: list[str,Element] :raises CreateElementFailed: create element fail...
[ "def", "create", "(", "self", ",", "name", ",", "site_element", ")", ":", "site_element", "=", "element_resolver", "(", "site_element", ")", "json", "=", "{", "'name'", ":", "name", ",", "'site_element'", ":", "site_element", "}", "return", "ElementCreator", ...
Create a VPN site for an internal or external gateway :param str name: name of site :param list site_element: list of protected networks/hosts :type site_element: list[str,Element] :raises CreateElementFailed: create element failed with reason :return: href of new element ...
[ "Create", "a", "VPN", "site", "for", "an", "internal", "or", "external", "gateway" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/elements.py#L436-L455
gabstopper/smc-python
smc/vpn/elements.py
VPNSite.update_or_create
def update_or_create(cls, external_gateway, name, site_element=None, with_status=False): """ Update or create a VPN Site elements or modify an existing VPN site based on value of provided site_element list. The resultant VPN site end result will be what is provided in the sit...
python
def update_or_create(cls, external_gateway, name, site_element=None, with_status=False): """ Update or create a VPN Site elements or modify an existing VPN site based on value of provided site_element list. The resultant VPN site end result will be what is provided in the sit...
[ "def", "update_or_create", "(", "cls", ",", "external_gateway", ",", "name", ",", "site_element", "=", "None", ",", "with_status", "=", "False", ")", ":", "site_element", "=", "[", "]", "if", "not", "site_element", "else", "site_element", "site_elements", "=",...
Update or create a VPN Site elements or modify an existing VPN site based on value of provided site_element list. The resultant VPN site end result will be what is provided in the site_element argument (can also be an empty list to clear existing). :param ExternalGateway externa...
[ "Update", "or", "create", "a", "VPN", "Site", "elements", "or", "modify", "an", "existing", "VPN", "site", "based", "on", "value", "of", "provided", "site_element", "list", ".", "The", "resultant", "VPN", "site", "end", "result", "will", "be", "what", "is"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/elements.py#L458-L494
gabstopper/smc-python
smc/vpn/elements.py
VPNSite.add_site_element
def add_site_element(self, element): """ Add a site element or list of elements to this VPN. :param list element: list of Elements or href's of vpn site elements :type element: list(str,Network) :raises UpdateElementFailed: fails due to reason :return: None ...
python
def add_site_element(self, element): """ Add a site element or list of elements to this VPN. :param list element: list of Elements or href's of vpn site elements :type element: list(str,Network) :raises UpdateElementFailed: fails due to reason :return: None ...
[ "def", "add_site_element", "(", "self", ",", "element", ")", ":", "element", "=", "element_resolver", "(", "element", ")", "self", ".", "data", "[", "'site_element'", "]", ".", "extend", "(", "element", ")", "self", ".", "update", "(", ")" ]
Add a site element or list of elements to this VPN. :param list element: list of Elements or href's of vpn site elements :type element: list(str,Network) :raises UpdateElementFailed: fails due to reason :return: None
[ "Add", "a", "site", "element", "or", "list", "of", "elements", "to", "this", "VPN", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/elements.py#L514-L526
gabstopper/smc-python
smc/elements/helpers.py
location_helper
def location_helper(name, search_only=False): """ Location finder by name. If location doesn't exist, create it and return the href :param str,Element name: location to resolve. If the location is by name, it will be retrieved or created, if href, returned and if Location, href returned...
python
def location_helper(name, search_only=False): """ Location finder by name. If location doesn't exist, create it and return the href :param str,Element name: location to resolve. If the location is by name, it will be retrieved or created, if href, returned and if Location, href returned...
[ "def", "location_helper", "(", "name", ",", "search_only", "=", "False", ")", ":", "try", ":", "return", "name", ".", "href", "except", "AttributeError", ":", "if", "name", "and", "name", ".", "startswith", "(", "'http'", ")", ":", "return", "name", "exc...
Location finder by name. If location doesn't exist, create it and return the href :param str,Element name: location to resolve. If the location is by name, it will be retrieved or created, if href, returned and if Location, href returned. If None, settings an elements location to None w...
[ "Location", "finder", "by", "name", ".", "If", "location", "doesn", "t", "exist", "create", "it", "and", "return", "the", "href" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/helpers.py#L12-L42
gabstopper/smc-python
smc/elements/helpers.py
zone_helper
def zone_helper(zone): """ Zone finder by name. If zone doesn't exist, create it and return the href :param str zone: name of zone (if href, will be returned as is) :return str href: href of zone """ if zone is None: return None elif isinstance(zone, Zone): return zone.h...
python
def zone_helper(zone): """ Zone finder by name. If zone doesn't exist, create it and return the href :param str zone: name of zone (if href, will be returned as is) :return str href: href of zone """ if zone is None: return None elif isinstance(zone, Zone): return zone.h...
[ "def", "zone_helper", "(", "zone", ")", ":", "if", "zone", "is", "None", ":", "return", "None", "elif", "isinstance", "(", "zone", ",", "Zone", ")", ":", "return", "zone", ".", "href", "elif", "zone", ".", "startswith", "(", "'http'", ")", ":", "retu...
Zone finder by name. If zone doesn't exist, create it and return the href :param str zone: name of zone (if href, will be returned as is) :return str href: href of zone
[ "Zone", "finder", "by", "name", ".", "If", "zone", "doesn", "t", "exist", "create", "it", "and", "return", "the", "href" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/helpers.py#L45-L59
gabstopper/smc-python
smc/elements/helpers.py
logical_intf_helper
def logical_intf_helper(interface): """ Logical Interface finder by name. Create if it doesn't exist. This is useful when adding logical interfaces to for inline or capture interfaces. :param interface: logical interface name :return str href: href of logical interface """ if interface ...
python
def logical_intf_helper(interface): """ Logical Interface finder by name. Create if it doesn't exist. This is useful when adding logical interfaces to for inline or capture interfaces. :param interface: logical interface name :return str href: href of logical interface """ if interface ...
[ "def", "logical_intf_helper", "(", "interface", ")", ":", "if", "interface", "is", "None", ":", "return", "LogicalInterface", ".", "get_or_create", "(", "name", "=", "'default_eth'", ")", ".", "href", "elif", "isinstance", "(", "interface", ",", "LogicalInterfac...
Logical Interface finder by name. Create if it doesn't exist. This is useful when adding logical interfaces to for inline or capture interfaces. :param interface: logical interface name :return str href: href of logical interface
[ "Logical", "Interface", "finder", "by", "name", ".", "Create", "if", "it", "doesn", "t", "exist", ".", "This", "is", "useful", "when", "adding", "logical", "interfaces", "to", "for", "inline", "or", "capture", "interfaces", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/helpers.py#L62-L77
gabstopper/smc-python
smc/elements/user.py
UserMixin.change_password
def change_password(self, password): """ Change user password. Change is committed immediately. :param str password: new password :return: None """ self.make_request( ModificationFailed, method='update', resource='change_password', ...
python
def change_password(self, password): """ Change user password. Change is committed immediately. :param str password: new password :return: None """ self.make_request( ModificationFailed, method='update', resource='change_password', ...
[ "def", "change_password", "(", "self", ",", "password", ")", ":", "self", ".", "make_request", "(", "ModificationFailed", ",", "method", "=", "'update'", ",", "resource", "=", "'change_password'", ",", "params", "=", "{", "'password'", ":", "password", "}", ...
Change user password. Change is committed immediately. :param str password: new password :return: None
[ "Change", "user", "password", ".", "Change", "is", "committed", "immediately", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/user.py#L71-L82
gabstopper/smc-python
smc/elements/user.py
UserMixin.add_permission
def add_permission(self, permission): """ Add a permission to this Admin User. A role defines permissions that can be enabled or disabled. Elements define the target for permission operations and can be either Access Control Lists, Engines or Policy elements. Domain specifies whe...
python
def add_permission(self, permission): """ Add a permission to this Admin User. A role defines permissions that can be enabled or disabled. Elements define the target for permission operations and can be either Access Control Lists, Engines or Policy elements. Domain specifies whe...
[ "def", "add_permission", "(", "self", ",", "permission", ")", ":", "if", "'permissions'", "not", "in", "self", ".", "data", ":", "self", ".", "data", "[", "'superuser'", "]", "=", "False", "self", ".", "data", "[", "'permissions'", "]", "=", "{", "'per...
Add a permission to this Admin User. A role defines permissions that can be enabled or disabled. Elements define the target for permission operations and can be either Access Control Lists, Engines or Policy elements. Domain specifies where the access is granted. The Shared Domain is def...
[ "Add", "a", "permission", "to", "this", "Admin", "User", ".", "A", "role", "defines", "permissions", "that", "can", "be", "enabled", "or", "disabled", ".", "Elements", "define", "the", "target", "for", "permission", "operations", "and", "can", "be", "either"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/user.py#L97-L117