_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q244000
Reports.profile
train
def profile(self, name): """Return a specific profile.""" self.selected_profile
python
{ "resource": "" }
q244001
Group.add_file
train
def add_file(self, filename, file_content): """Add a file for Document and Report types. Example:: document = tcex.batch.group('Document', 'My Document') document.add_file('my_file.txt', 'my contents') Args: filename (str): The name of the file.
python
{ "resource": "" }
q244002
Group.add_key_value
train
def add_key_value(self, key, value): """Add custom field to Group object. .. note:: The key must be the exact name required by the batch schema. Example:: document = tcex.batch.group('Document', 'My Document') document.add_key_value('fileName', 'something.pdf') ...
python
{ "resource": "" }
q244003
Group.data
train
def data(self): """Return Group data.""" # add attributes if self._attributes: self._group_data['attribute'] = [] for attr in self._attributes: if attr.valid: self._group_data['attribute'].append(attr.data) # add security labels
python
{ "resource": "" }
q244004
Group.security_label
train
def security_label(self, name, description=None, color=None): """Return instance of SecurityLabel. .. note:: The provided security label will be create if it doesn't exist. If the security label already exists nothing will be changed. Args: name (str): The value for thi...
python
{ "resource": "" }
q244005
Group.tag
train
def tag(self, name, formatter=None): """Return instance of Tag. Args: name (str): The value for this tag. formatter (method, optional): A method that take a tag value and returns a formatted tag. Returns: obj: An instance of Tag. """ ...
python
{ "resource": "" }
q244006
Campaign.first_seen
train
def first_seen(self, first_seen): """Set Document first seen.""" self._group_data['firstSeen'] = self._utils.format_datetime(
python
{ "resource": "" }
q244007
Event.event_date
train
def event_date(self, event_date): """Set the Events "event date" value."""
python
{ "resource": "" }
q244008
Report.publish_date
train
def publish_date(self, publish_date): """Set Report publish date""" self._group_data['publishDate'] = self._utils.format_datetime(
python
{ "resource": "" }
q244009
AppLib.find_lib_directory
train
def find_lib_directory(self): """Find the optimal lib directory.""" lib_directory = None if self.lib_micro_version in self.lib_directories: lib_directory = self.lib_micro_version elif self.lib_minor_version in self.lib_directories: lib_directory = self.lib_minor_v...
python
{ "resource": "" }
q244010
AppLib.lib_directories
train
def lib_directories(self): """Get all "lib" directories.""" if self._lib_directories is None: self._lib_directories = [] app_path = os.getcwd() contents = os.listdir(app_path) for c in contents: # ensure content starts
python
{ "resource": "" }
q244011
File._set_unique_id
train
def _set_unique_id(self, json_response): """ Sets the unique_id provided a json response. Args: json_response: """ self.unique_id = ( json_response.get('md5')
python
{ "resource": "" }
q244012
Indicator.rating
train
def rating(self, value): """ Updates the Indicators rating Args: value: """ if not self.can_update():
python
{ "resource": "" }
q244013
Indicator.add_observers
train
def add_observers(self, count, date_observed): """ Adds a Indicator Observation Args: count: date_observed: """ if not self.can_update(): self._tcex.handle_error(910, [self.type]) data = { 'count': count,
python
{ "resource": "" }
q244014
Indicator.deleted
train
def deleted(self, deleted_since, filters=None, params=None): """ Gets the indicators deleted. Args: params: filters: deleted_since: Date since its been deleted """ return self.tc_requests.deleted(
python
{ "resource": "" }
q244015
Indicator.build_summary
train
def build_summary(val1=None, val2=None, val3=None): """ Constructs the summary given va1, va2, val3 Args: val1: val2: val3: Returns:
python
{ "resource": "" }
q244016
SecurityLabel.name
train
def name(self, name): """ Updates the security labels name. Args: name: """
python
{ "resource": "" }
q244017
SecurityLabel.color
train
def color(self, color): """ Updates the security labels color. Args: color:
python
{ "resource": "" }
q244018
SecurityLabel.description
train
def description(self, description): """ Updates the security labels description. Args: description: """ self._data['description'] = description request = self._base_request
python
{ "resource": "" }
q244019
SecurityLabel.date_added
train
def date_added(self, date_added): """ Updates the security labels date_added Args: date_added: Converted to %Y-%m-%dT%H:%M:%SZ date format """ date_added = self._utils.format_datetime(date_added, date_format='%Y-%m-%dT%H:%M:%SZ')
python
{ "resource": "" }
q244020
Campaign.first_seen
train
def first_seen(self, first_seen): """ Updates the campaign with the new first_seen date. Args: first_seen: The first_seen date. Converted to %Y-%m-%dT%H:%M:%SZ date format Returns: """ if not self.can_update(): self._tcex.handle_error(910, [self...
python
{ "resource": "" }
q244021
Filters.add_filter
train
def add_filter(self, filter_key, operator, value): """ Adds a filter given a key, operator, and value""" filter_key = self._metadata_map.get(filter_key, filter_key)
python
{ "resource": "" }
q244022
TcExNotificationV2.recipients
train
def recipients(self, notification_type, recipients, priority='Low'): """Set vars for the passed in data. Used for one or more recipient notification. .. code-block:: javascript { "notificationType": notification_type, "priority": priority "is...
python
{ "resource": "" }
q244023
TcExNotificationV2.org
train
def org(self, notification_type, priority='Low'): """Set vars for the passed in data. Used for org notification. .. code-block:: javascript { "notificationType": notification_type, "priority": priority "isOrganization": true } ...
python
{ "resource": "" }
q244024
TcExNotificationV2.send
train
def send(self, message): """Send our message Args: message (str): The message to be sent. Returns: requests.models.Response: The response from the request. """ body = { 'notificationType': self._notification_type, 'priority': sel...
python
{ "resource": "" }
q244025
Adversary.assets
train
def assets(self, asset_type=None): """ Retrieves all of the assets of a given asset_type Args: asset_type: (str) Either None, PHONE, HANDLER, or URL Returns: """ if not self.can_update(): self._tcex.handle_error(910, [self.type]) if not...
python
{ "resource": "" }
q244026
Adversary.delete_asset
train
def delete_asset(self, asset_id, asset_type): """ Delete the asset with the provided asset_id. Args: asset_id: The id of the asset. asset_type: The asset type.
python
{ "resource": "" }
q244027
TcExLib._build_command
train
def _build_command(self, python_executable, lib_dir_fq, proxy_enabled): """Build the pip command for installing dependencies. Args: python_executable (str): The fully qualified path of the Python executable. lib_dir_fq (str): The fully qualified path of the lib directory. ...
python
{ "resource": "" }
q244028
TcExLib._configure_proxy
train
def _configure_proxy(self): """Configure proxy settings using environment variables.""" if os.getenv('HTTP_PROXY') or os.getenv('HTTPS_PROXY'): # TODO: is this appropriate? # don't change proxy settings if the OS already has them configured. return True proxy...
python
{ "resource": "" }
q244029
TcExLib._create_temp_requirements
train
def _create_temp_requirements(self): """Create a temporary requirements.txt. This allows testing again a git branch instead of pulling from pypi. """ self.use_temp_requirements_file = True # Replace tcex version with develop branch of tcex with open(self.requirements_fil...
python
{ "resource": "" }
q244030
TcExBatch._gen_indicator_class
train
def _gen_indicator_class(self): """Generate Custom Indicator Classes.""" for entry in self.tcex.indicator_types_data.values(): name = entry.get('name') class_name = name.replace(' ', '') # temp fix for API issue where boolean are returned as strings entry...
python
{ "resource": "" }
q244031
TcExBatch._group
train
def _group(self, group_data): """Return previously stored group or new group. Args: group_data (dict|obj): An Group dict or instance of Group object. Returns: dict|obj: The new Group dict/object or the previously stored dict/object. """ if isinstance(gro...
python
{ "resource": "" }
q244032
TcExBatch._indicator
train
def _indicator(self, indicator_data): """Return previously stored indicator or new indicator. Args: indicator_data (dict|obj): An Indicator dict or instance of Indicator object. Returns: dict|obj: The new Indicator dict/object or the previously stored dict/object. ...
python
{ "resource": "" }
q244033
TcExBatch.add_indicator
train
def add_indicator(self, indicator_data): """Add an indicator to Batch Job. .. code-block:: javascript { "type": "File", "rating": 5.00, "confidence": 50, "summary": "53c3609411c83f363e051d455ade78a7 ...
python
{ "resource": "" }
q244034
TcExBatch.address
train
def address(self, ip, **kwargs): """Add Address data to Batch object. Args: ip (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp the Indicator was created. ...
python
{ "resource": "" }
q244035
TcExBatch.adversary
train
def adversary(self, name, **kwargs): """Add Adversary data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. xid (str, kwargs): The external id for this Group.
python
{ "resource": "" }
q244036
TcExBatch.asn
train
def asn(self, as_number, **kwargs): """Add ASN data to Batch object. Args: as_number (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp the Indicator was created. ...
python
{ "resource": "" }
q244037
TcExBatch.campaign
train
def campaign(self, name, **kwargs): """Add Campaign data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. first_seen (str, kwargs): The first seen datetime expression for this Group. ...
python
{ "resource": "" }
q244038
TcExBatch.cidr
train
def cidr(self, block, **kwargs): """Add CIDR data to Batch object. Args: block (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp the Indicator was created. ...
python
{ "resource": "" }
q244039
TcExBatch.close
train
def close(self): """Cleanup batch job.""" self.groups_shelf.close() self.indicators_shelf.close() if self.debug and self.enable_saved_file: fqfn = os.path.join(self.tcex.args.tc_temp_path, 'xids-saved') if os.path.isfile(fqfn): os.remove(fqfn) # r...
python
{ "resource": "" }
q244040
TcExBatch.data
train
def data(self): """Return the batch data to be sent to the ThreatConnect API. **Processing Order:** * Process groups in memory up to max batch size. * Process groups in shelf to max batch size. * Process indicators in memory up to max batch size. * Process indicators in ...
python
{ "resource": "" }
q244041
TcExBatch.data_group_association
train
def data_group_association(self, xid): """Return group dict array following all associations. Args: xid (str): The xid of the group to retrieve associations. Returns: list: A list of group dicts. """ groups = [] group_data = None # get g...
python
{ "resource": "" }
q244042
TcExBatch.data_group_type
train
def data_group_type(self, group_data): """Return dict representation of group data. Args: group_data (dict|obj): The group data dict or object. Returns: dict: The group data in dict format. """ if isinstance(group_data, dict): # process file ...
python
{ "resource": "" }
q244043
TcExBatch.data_groups
train
def data_groups(self, groups, entity_count): """Process Group data. Args: groups (list): The list of groups to process. Returns: list: A list of groups including associations """ data = []
python
{ "resource": "" }
q244044
TcExBatch.data_indicators
train
def data_indicators(self, indicators, entity_count): """Process Indicator data.""" data = [] # process indicator objects for xid, indicator_data in indicators.items(): entity_count += 1
python
{ "resource": "" }
q244045
TcExBatch.debug
train
def debug(self): """Return debug setting""" debug = False
python
{ "resource": "" }
q244046
TcExBatch.document
train
def document(self, name, file_name, **kwargs): """Add Document data to Batch object. Args: name (str): The name for this Group. file_name (str): The name for the attached file for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. ...
python
{ "resource": "" }
q244047
TcExBatch.email
train
def email(self, name, subject, header, body, **kwargs): """Add Email data to Batch object. Args: name (str): The name for this Group. subject (str): The subject for this Email. header (str): The header for this Email. body (str): The body for this Email. ...
python
{ "resource": "" }
q244048
TcExBatch.errors
train
def errors(self, batch_id, halt_on_error=True): """Retrieve Batch errors to ThreatConnect API. .. code-block:: javascript [{ "errorReason": "Incident incident-001 has an invalid status.", "errorSource": "incident-001 is not valid." }, { ...
python
{ "resource": "" }
q244049
TcExBatch.event
train
def event(self, name, **kwargs): """Add Event data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. event_date (str, kwargs): The event datetime expression for this Group. ...
python
{ "resource": "" }
q244050
TcExBatch.file
train
def file(self, md5=None, sha1=None, sha256=None, **kwargs): """Add File data to Batch object. .. note:: A least one file hash value must be specified. Args: md5 (str, optional): The md5 value for this Indicator. sha1 (str, optional): The sha1 value for this Indicator. ...
python
{ "resource": "" }
q244051
TcExBatch.generate_xid
train
def generate_xid(identifier=None): """Generate xid from provided identifiers. .. Important:: If no identifier is provided a unique xid will be returned, but it will not be reproducible. If a list of identifiers are provided they must be in the same order...
python
{ "resource": "" }
q244052
TcExBatch.group
train
def group(self, group_type, name, **kwargs): """Add Group data to Batch object. Args: group_type (str): The ThreatConnect define Group type. name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. xid
python
{ "resource": "" }
q244053
TcExBatch.group_shelf_fqfn
train
def group_shelf_fqfn(self): """Return groups shelf fully qualified filename. For testing/debugging a previous shelf file can be copied into the tc_temp_path directory instead of creating a new shelf file. """ if self._group_shelf_fqfn is None:
python
{ "resource": "" }
q244054
TcExBatch.groups_shelf
train
def groups_shelf(self): """Return dictionary of all Groups data.""" if self._groups_shelf is
python
{ "resource": "" }
q244055
TcExBatch.incident
train
def incident(self, name, **kwargs): """Add Incident data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. event_date (str, kwargs): The event datetime expression for this Group. ...
python
{ "resource": "" }
q244056
TcExBatch.indicator
train
def indicator(self, indicator_type, summary, **kwargs): """Add Indicator data to Batch object. Args: indicator_type (str): The ThreatConnect define Indicator type. summary (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this I...
python
{ "resource": "" }
q244057
TcExBatch.indicator_shelf_fqfn
train
def indicator_shelf_fqfn(self): """Return indicator shelf fully qualified filename. For testing/debugging a previous shelf file can be copied into the tc_temp_path directory instead of creating a new shelf file. """ if self._indicator_shelf_fqfn is None: # new shelf ...
python
{ "resource": "" }
q244058
TcExBatch.indicators_shelf
train
def indicators_shelf(self): """Return dictionary of all Indicator data.""" if self._indicators_shelf is
python
{ "resource": "" }
q244059
TcExBatch.intrusion_set
train
def intrusion_set(self, name, **kwargs): """Add Intrusion Set data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. xid (str, kwargs): The external id for this Group.
python
{ "resource": "" }
q244060
TcExBatch.mutex
train
def mutex(self, mutex, **kwargs): """Add Mutex data to Batch object. Args: mutex (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp the Indicator was created. ...
python
{ "resource": "" }
q244061
TcExBatch.poll
train
def poll(self, batch_id, retry_seconds=None, back_off=None, timeout=None, halt_on_error=True): """Poll Batch status to ThreatConnect API. .. code-block:: javascript { "status": "Success", "data": { "batchStatus": { ...
python
{ "resource": "" }
q244062
TcExBatch.registry_key
train
def registry_key(self, key_name, value_name, value_type, **kwargs): """Add Registry Key data to Batch object. Args: key_name (str): The key_name value for this Indicator. value_name (str): The value_name value for this Indicator. value_type (str): The value_type valu...
python
{ "resource": "" }
q244063
TcExBatch.report
train
def report(self, name, **kwargs): """Add Report data to Batch object. Args: name (str): The name for this Group. file_name (str): The name for the attached file for this Group. date_added (str, kwargs): The date timestamp the Indicator was created.
python
{ "resource": "" }
q244064
TcExBatch.save
train
def save(self, resource): """Save group|indicator dict or object to shelve. Best effort to save group/indicator data to disk. If for any reason the save fails the data will still be accessible from list in memory. Args: resource (dict|obj): The Group or Indicator dict or o...
python
{ "resource": "" }
q244065
TcExBatch.saved_groups
train
def saved_groups(self): """Return True if saved group files exits, else False.""" if self._saved_groups is None: self._saved_groups = False fqfn_saved = os.path.join(self.tcex.args.tc_temp_path, 'groups-saved')
python
{ "resource": "" }
q244066
TcExBatch.saved_xids
train
def saved_xids(self): """Return previously saved xids.""" if self._saved_xids is None: self._saved_xids = [] if self.debug: fpfn = os.path.join(self.tcex.args.tc_temp_path, 'xids-saved')
python
{ "resource": "" }
q244067
TcExBatch.settings
train
def settings(self): """Return batch job settings.""" _settings = { 'action': self._action, # not supported in v2 batch # 'attributeWriteType': self._attribute_write_type, 'attributeWriteType': 'Replace', 'haltOnError': str(self._halt_on_error)....
python
{ "resource": "" }
q244068
TcExBatch.signature
train
def signature(self, name, file_name, file_type, file_text, **kwargs): """Add Signature data to Batch object. Valid file_types: + Snort ® + Suricata + YARA + ClamAV ® + OpenIOC + CybOX ™ + Bro + Regex + SPL - Splunk ® Search Process...
python
{ "resource": "" }
q244069
TcExBatch.submit_files
train
def submit_files(self, halt_on_error=True): """Submit Files for Documents and Reports to ThreatConnect API. Critical Errors * There is insufficient document storage allocated to this account. Args: halt_on_error (bool, default:True): If True any exception will raise an err...
python
{ "resource": "" }
q244070
TcExBatch.submit_file_content
train
def submit_file_content(self, method, url, data, headers, params, halt_on_error=True): """Submit File Content for Documents and Reports to ThreatConnect API. Args: method (str): The HTTP method for the request (POST, PUT). url (str): The URL for the request. data (st...
python
{ "resource": "" }
q244071
TcExBatch.threat
train
def threat(self, name, **kwargs): """Add Threat data to Batch object Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. xid (str, kwargs): The external id for this Group.
python
{ "resource": "" }
q244072
TcExBatch.user_agent
train
def user_agent(self, text, **kwargs): """Add User Agent data to Batch object Args: text (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp the Indicator was created. ...
python
{ "resource": "" }
q244073
TcExBatch.url
train
def url(self, text, **kwargs): """Add URL Address data to Batch object. Args: text (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp the Indicator was created. ...
python
{ "resource": "" }
q244074
TcExBatch.write_batch_json
train
def write_batch_json(self, content): """Write batch json data to a file.""" timestamp = str(time.time()).replace('.', '') batch_json_file = os.path.join(
python
{ "resource": "" }
q244075
TIMappings.attribute_labels
train
def attribute_labels(self, attribute_id, params=None): """ Gets the security labels from a attribute Yields: Security label json """ if params is None: params = {} if not self.can_update(): self._tcex.handle_error(910, [self.type]) for a...
python
{ "resource": "" }
q244076
TIMappings.attribute_label
train
def attribute_label(self, attribute_id, label, action='GET', params=None): """ Gets a security labels from a attribute Args: attribute_id: label: action: params: Returns: Security label json """ if params is None: ...
python
{ "resource": "" }
q244077
TIMappings.add_attribute_label
train
def add_attribute_label(self, attribute_id, label): """ Adds a security labels to a attribute Args: attribute_id: label: Returns: A response json """ if not self.can_update(): self._tcex.handle_error(910,
python
{ "resource": "" }
q244078
TcExPackage.bundle
train
def bundle(self, bundle_name): """Bundle multiple Job or Playbook Apps into a single zip file. Args: bundle_name (str): The output name of the bundle zip file. """ if self.args.bundle or self.tcex_json.get('package', {}).get('bundle', False): if self.tcex_json.ge...
python
{ "resource": "" }
q244079
TcExPackage.commit_hash
train
def commit_hash(self): """Return the current commit hash if available. This is not a required task so best effort is fine. In other words this is not guaranteed to work 100% of the time. """ commit_hash = None branch = None branch_file = '.git/HEAD' # ref: refs/...
python
{ "resource": "" }
q244080
TcExPackage.print_results
train
def print_results(self): """Print results of the package command.""" # Updates if self.package_data.get('updates'): print('\n{}{}Updates:'.format(c.Style.BRIGHT, c.Fore.BLUE)) for p in self.package_data['updates']: print( '{!s:<20}{}{} ...
python
{ "resource": "" }
q244081
TcExPackage.zip_file
train
def zip_file(self, app_path, app_name, tmp_path): """Zip the App with tcex extension. Args: app_path (str): The path of the current project. app_name (str): The name of the App. tmp_path (str): The temp output path for the zip. """ # zip build directo...
python
{ "resource": "" }
q244082
TcExRequest.content_type
train
def content_type(self, data): """The Content-Type header value for this request."""
python
{ "resource": "" }
q244083
TcExRequest.set_basic_auth
train
def set_basic_auth(self, username, password): """Manually set basic auth in the header when normal method does not work."""
python
{ "resource": "" }
q244084
TcExRequest.http_method
train
def http_method(self, data): """The HTTP method for this request.""" data = data.upper() if data in ['DELETE', 'GET', 'POST', 'PUT']: self._http_method = data # set content type for commit methods (best guess) if self._headers.get('Content-Type') is None and ...
python
{ "resource": "" }
q244085
TcExRequest.send
train
def send(self, stream=False): """Send the HTTP request via Python Requests modules. This method will send the request to the remote endpoint. It will try to handle temporary communications issues by retrying the request automatically. Args: stream (bool): Boolean to enable...
python
{ "resource": "" }
q244086
App.run
train
def run(self): """Run the App main logic. This method should contain the core logic of the App. """ # read inputs indent = int(self.tcex.playbook.read(self.args.indent)) json_data = self.tcex.playbook.read(self.args.json_data) # get the playbook variable type ...
python
{ "resource": "" }
q244087
TcExPlaybook._parse_out_variable
train
def _parse_out_variable(self): """Internal method to parse the tc_playbook_out_variable arg. **Example Variable Format**:: #App:1234:status!String,#App:1234:status_code!String """ self._out_variables = {} self._out_variables_type = {} if self.tcex.default_ar...
python
{ "resource": "" }
q244088
TcExPlaybook._variable_pattern
train
def _variable_pattern(self): """Regex pattern to match and parse a playbook variable.""" variable_pattern = r'#([A-Za-z]+)' # match literal (#App) at beginning of String variable_pattern += r':([\d]+)' # app id (:7979) variable_pattern += r':([A-Za-z0-9_\.\-\[\]]+)' # variable name (:...
python
{ "resource": "" }
q244089
TcExPlaybook.add_output
train
def add_output(self, key, value, variable_type): """Dynamically add output to output_data dictionary to be written to DB later. This method provides an alternative and more dynamic way to create output variables in an App. Instead of storing the output data manually and writing all at once the ...
python
{ "resource": "" }
q244090
TcExPlaybook.aot_blpop
train
def aot_blpop(self): # pylint: disable=R1710 """Subscribe to AOT action channel.""" if self.tcex.default_args.tc_playbook_db_type == 'Redis': res = None try: self.tcex.log.info('Blocking for AOT message.') msg_data = self.db.blpop( ...
python
{ "resource": "" }
q244091
TcExPlaybook.aot_rpush
train
def aot_rpush(self, exit_code): """Push message to AOT action channel.""" if self.tcex.default_args.tc_playbook_db_type == 'Redis': try: self.db.rpush(self.tcex.default_args.tc_exit_channel, exit_code)
python
{ "resource": "" }
q244092
TcExPlaybook.check_output_variable
train
def check_output_variable(self, variable): """Check to see if output variable was requested by downstream app. Using the auto generated dictionary of output variables check to see if provided variable was requested by downstream app. Args: variable (string): The variable na...
python
{ "resource": "" }
q244093
TcExPlaybook.create
train
def create(self, key, value): """Create method of CRUD operation for working with KeyValue DB. This method will automatically determine the variable type and call the appropriate method to write the data. If a non standard type is provided the data will be written as RAW data. ...
python
{ "resource": "" }
q244094
TcExPlaybook.create_data_types
train
def create_data_types(self): """Map of standard playbook variable types to create method.""" return { 'Binary': self.create_binary, 'BinaryArray': self.create_binary_array, 'KeyValue': self.create_key_value, 'KeyValueArray': self.create_key_value_array, ...
python
{ "resource": "" }
q244095
TcExPlaybook.create_output
train
def create_output(self, key, value, variable_type=None): """Wrapper for Create method of CRUD operation for working with KeyValue DB. This method will automatically check to see if provided variable was requested by a downstream app and if so create the data in the KeyValue DB. Args: ...
python
{ "resource": "" }
q244096
TcExPlaybook.db
train
def db(self): """Return the correct KV store for this execution.""" if self._db is None: if self.tcex.default_args.tc_playbook_db_type == 'Redis': from .tcex_redis import TcExRedis self._db = TcExRedis( self.tcex.default_args.tc_playbook_d...
python
{ "resource": "" }
q244097
TcExPlaybook.delete
train
def delete(self, key): """Delete method of CRUD operation for all data types. Args: key (string): The variable to write to the DB. Returns:
python
{ "resource": "" }
q244098
TcExPlaybook.exit
train
def exit(self, code=None, msg=None): """Playbook wrapper on TcEx exit method Playbooks do not support partial failures so we change the exit method from 3 to 1 and call it a partial success instead. Args: code (Optional [integer]): The exit code value for the app. "...
python
{ "resource": "" }
q244099
TcExPlaybook.parse_variable
train
def parse_variable(self, variable): """Method to parse an input or output variable. **Example Variable**:: #App:1234:output!String Args: variable (string): The variable name to parse. Returns: (dictionary): Result of parsed string. """ ...
python
{ "resource": "" }