INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Checks if the new span fits in the max payload size.
def fits(self, current_count, current_size, max_size, new_span): """Checks if the new span fits in the max payload size.""" return current_size + len(new_span) <= max_size
Encodes a single span to protobuf.
def encode_span(self, span): """Encodes a single span to protobuf.""" if not protobuf.installed(): raise ZipkinError( 'protobuf encoding requires installing the protobuf\'s extra ' 'requirements. Use py-zipkin[protobuf] in your requirements.txt.' )...
Creates encoder object for the given encoding.
def get_decoder(encoding): """Creates encoder object for the given encoding. :param encoding: desired output encoding protocol :type encoding: Encoding :return: corresponding IEncoder object :rtype: IEncoder """ if encoding == Encoding.V1_THRIFT: return _V1ThriftDecoder() if enc...
Decodes an encoded list of spans.
def decode_spans(self, spans): """Decodes an encoded list of spans. :param spans: encoded list of spans :type spans: bytes :return: list of spans :rtype: list of Span """ decoded_spans = [] transport = TMemoryBuffer(spans) if six.byte2int(spans) ...
Accepts a thrift decoded endpoint and converts it to an Endpoint.
def _convert_from_thrift_endpoint(self, thrift_endpoint): """Accepts a thrift decoded endpoint and converts it to an Endpoint. :param thrift_endpoint: thrift encoded endpoint :type thrift_endpoint: thrift endpoint :returns: decoded endpoint :rtype: Encoding """ i...
Accepts a thrift annotation and converts it to a v1 annotation.
def _decode_thrift_annotations(self, thrift_annotations): """Accepts a thrift annotation and converts it to a v1 annotation. :param thrift_annotations: list of thrift annotations. :type thrift_annotations: list of zipkin_core.Span.Annotation :returns: (annotations, local_endpoint, kind)...
Accepts a thrift decoded binary annotation and converts it to a v1 binary annotation.
def _convert_from_thrift_binary_annotations(self, thrift_binary_annotations): """Accepts a thrift decoded binary annotation and converts it to a v1 binary annotation. """ tags = {} local_endpoint = None remote_endpoint = None for binary_annotation in thrift_binar...
Decodes a thrift span.
def _decode_thrift_span(self, thrift_span): """Decodes a thrift span. :param thrift_span: thrift span :type thrift_span: thrift Span object :returns: span builder representing this span :rtype: Span """ parent_id = None local_endpoint = None annot...
Converts the provided traceId hex value with optional high bits to a string.
def _convert_trace_id_to_string(self, trace_id, trace_id_high=None): """ Converts the provided traceId hex value with optional high bits to a string. :param trace_id: the value of the trace ID :type trace_id: int :param trace_id_high: the high bits of the trace ID ...
Converts the provided unsigned long value to a hex string.
def _convert_unsigned_long_to_lower_hex(self, value): """ Converts the provided unsigned long value to a hex string. :param value: the value to convert :type value: unsigned long :returns: value as a hex string """ result = bytearray(16) self._write_hex_l...
Writes an unsigned long value across a byte array.
def _write_hex_long(self, data, pos, value): """ Writes an unsigned long value across a byte array. :param data: the buffer to write the value to :type data: bytearray :param pos: the starting position :type pos: int :param value: the value to write :type...
Replace illegal February 29 30 dates with the last day of February.
def date_fixup_pre_processor(transactions, tag, tag_dict, *args): """ Replace illegal February 29, 30 dates with the last day of February. German banks use a variant of the 30/360 interest rate calculation, where each month has always 30 days even February. Python's datetime module won't accept suc...
mBank Collect uses transaction code 911 to distinguish icoming mass payments transactions adding transaction_code may be helpful in further processing
def mBank_set_transaction_code(transactions, tag, tag_dict, *args): """ mBank Collect uses transaction code 911 to distinguish icoming mass payments transactions, adding transaction_code may be helpful in further processing """ tag_dict['transaction_code'] = int( tag_dict[tag.slug].split...
mBank Collect uses ID IPH to distinguish between virtual accounts adding iph_id may be helpful in further processing
def mBank_set_iph_id(transactions, tag, tag_dict, *args): """ mBank Collect uses ID IPH to distinguish between virtual accounts, adding iph_id may be helpful in further processing """ matches = iph_id_re.search(tag_dict[tag.slug]) if matches: # pragma no branch tag_dict['iph_id'] = mat...
mBank Collect states TNR in transaction details as unique id for transactions that may be used to identify the same transactions in different statement files eg. partial mt942 and full mt940 Information about tnr uniqueness has been obtained from mBank support it lacks in mt940 mBank specification.
def mBank_set_tnr(transactions, tag, tag_dict, *args): """ mBank Collect states TNR in transaction details as unique id for transactions, that may be used to identify the same transactions in different statement files eg. partial mt942 and full mt940 Information about tnr uniqueness has been obtaine...
Parses mt940 data expects a string with data
def parse(self, data): '''Parses mt940 data, expects a string with data Args: data (str): The MT940 data Returns: :py:class:`list` of :py:class:`Transaction` ''' # Remove extraneous whitespace and such data = '\n'.join(self.strip(data.split('\n'))) ...
Parses mt940 data and returns transactions object
def parse(src, encoding=None): ''' Parses mt940 data and returns transactions object :param src: file handler to read, filename to read or raw data as string :return: Collection of transactions :rtype: Transactions ''' def safe_is_file(filename): try: return os.path.isf...
Join strings together and strip whitespace in between if needed
def join_lines(string, strip=Strip.BOTH): ''' Join strings together and strip whitespace in between if needed ''' lines = [] for line in string.splitlines(): if strip & Strip.RIGHT: line = line.rstrip() if strip & Strip.LEFT: line = line.lstrip() li...
Turns response into a properly formatted json or text object
async def json_or_text(response): """Turns response into a properly formatted json or text object""" text = await response.text() if response.headers['Content-Type'] == 'application/json; charset=utf-8': return json.loads(text) return text
Handles the message shown when we are ratelimited
async def limited(until): """Handles the message shown when we are ratelimited""" duration = int(round(until - time.time())) mins = duration / 60 fmt = 'We have exhausted a ratelimit quota. Retrying in %.2f seconds (%.3f minutes).' log.warn(fmt, duration, mins)
Handles requests to the API
async def request(self, method, url, **kwargs): """Handles requests to the API""" rate_limiter = RateLimiter(max_calls=59, period=60, callback=limited) # handles ratelimits. max_calls is set to 59 because current implementation will retry in 60s after 60 calls is reached. DBL has a 1h block so o...
Gets the information of the given Bot ID
async def get_bot_info(self, bot_id): '''Gets the information of the given Bot ID''' resp = await self.request('GET', '{}/bots/{}'.format(self.BASE, bot_id)) resp['date'] = datetime.strptime(resp['date'], '%Y-%m-%dT%H:%M:%S.%fZ') for k in resp: if resp[k] == '': ...
Gets an object of bots on DBL
async def get_bots(self, limit, offset): '''Gets an object of bots on DBL''' if limit > 500: limit = 50 return await self.request('GET', '{}/bots?limit={}&offset={}'.format(self.BASE, limit, offset))
Gets the guild count from the Client/ Bot object
def guild_count(self): """Gets the guild count from the Client/Bot object""" try: return len(self.bot.guilds) except AttributeError: return len(self.bot.servers)
This function is a coroutine.
async def post_guild_count( self, shard_count: int = None, shard_no: int = None ): """This function is a coroutine. Posts the guild count to discordbots.org .. _0 based indexing : https://en.wikipedia.org/wiki/Zero-based_numbering Parameters ...
This function is a coroutine.
async def get_guild_count(self, bot_id: int=None): """This function is a coroutine. Gets a guild count from discordbots.org Parameters ========== bot_id: int[Optional] The bot_id of the bot you want to lookup. Defaults to the Bot provided in Client init...
This function is a coroutine.
async def get_bot_info(self, bot_id: int = None): """This function is a coroutine. Gets information about a bot from discordbots.org Parameters ========== bot_id: int[Optional] The bot_id of the bot you want to lookup. Returns ======= bot_...
This function is a coroutine.
async def get_bots(self, limit: int = 50, offset: int = 0): """This function is a coroutine. Gets information about listed bots on discordbots.org Parameters ========== limit: int[Optional] The number of results you wish to lookup. Defaults to 50. Max 500. ...
This function is a coroutine.
async def generate_widget_large( self, bot_id: int = None, top: str = '2C2F33', mid: str = '23272A', user: str = 'FFFFFF', cert: str = 'FFFFFF', data: str = 'FFFFFF', label: str = '99AAB5', highlight: str = '2C2F...
This function is a coroutine.
async def get_widget_large(self, bot_id: int = None): """This function is a coroutine. Generates the default large widget. Parameters ========== bot_id: int The bot_id of the bot you wish to make a widget for. Returns ======= URL of the wi...
This function is a coroutine.
async def generate_widget_small( self, bot_id: int = None, avabg: str = '2C2F33', lcol: str = '23272A', rcol: str = '2C2F33', ltxt: str = 'FFFFFF', rtxt: str = 'FFFFFF' ): """This function is a coroutine. Generates ...
This function is a coroutine.
async def get_widget_small(self, bot_id: int = None): """This function is a coroutine. Generates the default small widget. Parameters ========== bot_id: int The bot_id of the bot you wish to make a widget for. Returns ======= URL of the wi...
This function is a coroutine.
async def close(self): """This function is a coroutine. Closes all connections.""" if self._is_closed: return else: await self.http.close() self._is_closed = True
Read incoming message.
def read(self): """Read incoming message.""" packet = self.packet with self.__read_lock: buffer = self.__buffer while len(buffer) < packet: buffer += self._read_data() length = self.__unpack(buffer[:packet])[0] + packet while len(bu...
Write outgoing message.
def write(self, message): """Write outgoing message.""" data = encode(message, compressed=self.compressed) length = len(data) data = self.__pack(length) + data with self.__write_lock: while data: try: n = os.write(self.out_d, data) ...
Close port.
def close(self): """Close port.""" os.close(self.in_d) os.close(self.out_d)
Decode Erlang external term.
def decode(string): """Decode Erlang external term.""" if not string: raise IncompleteData(string) if string[0] != 131: raise ValueError("unknown protocol version: %r" % string[0]) if string[1:2] == b'P': # compressed term if len(string) < 16: raise Incomplete...
Encode Erlang external term.
def encode(term, compressed=False): """Encode Erlang external term.""" encoded_term = encode_term(term) # False and 0 do not attempt compression. if compressed: if compressed is True: # default compression level of 6 compressed = 6 elif compressed < 0 or compresse...
** Description ** Get the set of falco rules files from the backend. The _files programs and endpoints are a replacement for the system_file endpoints and allow for publishing multiple files instead of a single file as well as publishing multiple variants of a given file that are compatible with different agent version...
def get_default_falco_rules_files(self): '''**Description** Get the set of falco rules files from the backend. The _files programs and endpoints are a replacement for the system_file endpoints and allow for publishing multiple files instead of a single file as well as p...
** Description ** Given a dict returned from get_default_falco_rules_files save those files to a set of files below save_dir. The first level below save_dir is a directory with the tag name. The second level is a directory per file. The third level is a directory per variant. Finally the files are at the lowest level i...
def save_default_falco_rules_files(self, fsobj, save_dir): '''**Description** Given a dict returned from get_default_falco_rules_files, save those files to a set of files below save_dir. The first level below save_dir is a directory with the tag name. The second level is a directory p...
** Description ** Given a file and directory layout as described in save_default_falco_rules_files () load those files and return a dict representing the contents. This dict is suitable for passing to set_default_falco_rules_files ().
def load_default_falco_rules_files(self, save_dir): '''**Description** Given a file and directory layout as described in save_default_falco_rules_files(), load those files and return a dict representing the contents. This dict is suitable for passing to set_default_falco_rules_files(). ...
** Description ** Fetch all policy events that occurred in the last duration_sec seconds. This method is used in conjunction with: func: ~sdcclient. SdSecureClient. get_more_policy_events to provide paginated access to policy events.
def get_policy_events_duration(self, duration_sec, sampling=None, aggregations=None, scope_filter=None, event_filter=None): '''**Description** Fetch all policy events that occurred in the last duration_sec seconds. This method is used in conjunction with :func:`~sdcclient.SdSecureClient....
** Description ** Fetch all policy events with id that occurred in the time range [ from_sec: to_sec ]. This method is used in conjunction with: func: ~sdcclient. SdSecureClient. get_more_policy_events to provide paginated access to policy events.
def get_policy_events_id_range(self, id, from_sec, to_sec, sampling=None, aggregations=None, scope_filter=None, event_filter=None): '''**Description** Fetch all policy events with id that occurred in the time range [from_sec:to_sec]. This method is used in conjunction with :func:`~sdccli...
** Description ** Create a set of default policies using the current system falco rules file as a reference. For every falco rule in the system falco rules file one policy will be created. The policy will take the name and description from the name and description of the corresponding falco rule. If a policy already ex...
def create_default_policies(self): '''**Description** Create a set of default policies using the current system falco rules file as a reference. For every falco rule in the system falco rules file, one policy will be created. The policy will take the name and description from the name an...
** Description ** Delete all existing policies. The falco rules file is unchanged.
def delete_all_policies(self): '''**Description** Delete all existing policies. The falco rules file is unchanged. **Arguments** - None **Success Return Value** The string "Policies Deleted" **Example** `examples/delete_all_policies.py <...
** Description ** Change the policy evaluation order
def set_policy_priorities(self, priorities_json): '''**Description** Change the policy evaluation order **Arguments** - priorities_json: a description of the new policy order. **Success Return Value** A JSON object representing the updated list of policy ids...
** Description ** Find the policy with name <name > and return its json description.
def get_policy(self, name): '''**Description** Find the policy with name <name> and return its json description. **Arguments** - name: the name of the policy to fetch **Success Return Value** A JSON object containing the description of the policy. If there i...
** Description ** Add a new policy using the provided json.
def add_policy(self, policy_json): '''**Description** Add a new policy using the provided json. **Arguments** - policy_json: a description of the new policy **Success Return Value** The string "OK" **Example** `examples/add_policy.py <ht...
** Description ** Delete the policy with the given name.
def delete_policy_name(self, name): '''**Description** Delete the policy with the given name. **Arguments** - name: the name of the policy to delete **Success Return Value** The JSON object representing the now-deleted policy. **Example** ...
** Description ** Delete the policy with the given id
def delete_policy_id(self, id): '''**Description** Delete the policy with the given id **Arguments** - id: the id of the policy to delete **Success Return Value** The JSON object representing the now-deleted policy. **Example** `examples...
** Description ** Add a new compliance task.
def add_compliance_task(self, name, module_name='docker-bench-security', schedule='06:00:00Z/PT12H', scope=None, enabled=True): '''**Description** Add a new compliance task. **Arguments** - name: The name of the task e.g. 'Check Docker Compliance'. - module_name: The...
** Description ** Get the list of all compliance tasks.
def list_compliance_tasks(self): '''**Description** Get the list of all compliance tasks. **Arguments** - None **Success Return Value** A JSON list with the representation of each compliance task. ''' res = requests.get(self.url + '/api/compl...
** Description ** Get a compliance task.
def get_compliance_task(self, id): '''**Description** Get a compliance task. **Arguments** - id: the id of the compliance task to get. **Success Return Value** A JSON representation of the compliance task. ''' res = requests.get(self.url + '/...
** Description ** Update an existing compliance task.
def update_compliance_task(self, id, name=None, module_name=None, schedule=None, scope=None, enabled=None): '''**Description** Update an existing compliance task. **Arguments** - id: the id of the compliance task to be updated. - name: The name of the task e.g. 'Chec...
** Description ** Delete the compliance task with the given id
def delete_compliance_task(self, id): '''**Description** Delete the compliance task with the given id **Arguments** - id: the id of the compliance task to delete ''' res = requests.delete(self.url + '/api/complianceTasks/{}'.format(id), headers=self.hdrs, verify=...
** Description ** Get the list of all compliance tasks runs.
def list_compliance_results(self, limit=50, direction=None, cursor=None, filter=""): '''**Description** Get the list of all compliance tasks runs. **Arguments** - limit: Maximum number of alerts in the response. - direction: the direction (PREV or NEXT) that determin...
** Description ** Retrieve the details for a specific compliance task run result in csv.
def get_compliance_results_csv(self, id): '''**Description** Retrieve the details for a specific compliance task run result in csv. **Arguments** - id: the id of the compliance task run to get. **Success Return Value** A CSV representation of the compliance ...
** Description ** List the commands audit.
def list_commands_audit(self, from_sec=None, to_sec=None, scope_filter=None, command_filter=None, limit=100, offset=0, metrics=[]): '''**Description** List the commands audit. **Arguments** - from_sec: the start of the timerange for which to get commands audit. - end...
** Description ** Get a command audit.
def get_command_audit(self, id, metrics=[]): '''**Description** Get a command audit. **Arguments** - id: the id of the command audit to get. **Success Return Value** A JSON representation of the command audit. ''' url = "{url}/api/commands/{i...
** Description ** Returns the list of Sysdig Monitor alert notifications.
def get_notifications(self, from_ts, to_ts, state=None, resolved=None): '''**Description** Returns the list of Sysdig Monitor alert notifications. **Arguments** - **from_ts**: filter events by start time. Timestamp format is in UTC (seconds). - **to_ts**: filter even...
** Description ** Updates the resolution status of an alert notification.
def update_notification_resolution(self, notification, resolved): '''**Description** Updates the resolution status of an alert notification. **Arguments** - **notification**: notification object as returned by :func:`~SdcClient.get_notifications`. - **resolved**: new...
** Description ** Create a threshold - based alert.
def create_alert(self, name=None, description=None, severity=None, for_atleast_s=None, condition=None, segmentby=[], segment_condition='ANY', user_filter='', notify=None, enabled=True, annotations={}, alert_obj=None): '''**Description** Create a threshold-ba...
** Description ** Update a modified threshold - based alert.
def update_alert(self, alert): '''**Description** Update a modified threshold-based alert. **Arguments** - **alert**: one modified alert object of the same format as those in the list returned by :func:`~SdcClient.get_alerts`. **Success Return Value** The up...
** Description ** Deletes an alert.
def delete_alert(self, alert): '''**Description** Deletes an alert. **Arguments** - **alert**: the alert dictionary as returned by :func:`~SdcClient.get_alerts`. **Success Return Value** ``None``. **Example** `examples/delete_alert.py <h...
** Description ** Return the user s current grouping hierarchy as visible in the Explore tab of Sysdig Monitor.
def get_explore_grouping_hierarchy(self): '''**Description** Return the user's current grouping hierarchy as visible in the Explore tab of Sysdig Monitor. **Success Return Value** A list containing the list of the user's Explore grouping criteria. **Example** ...
** Description ** Changes the grouping hierarchy in the Explore panel of the current user.
def set_explore_grouping_hierarchy(self, new_hierarchy): '''**Description** Changes the grouping hierarchy in the Explore panel of the current user. **Arguments** - **new_hierarchy**: a list of sysdig segmentation metrics indicating the new grouping hierarchy. ''' ...
** Description ** Return the list of dashboards available under the given user account. This includes the dashboards created by the user and the ones shared with her by other users.
def get_dashboards(self): '''**Description** Return the list of dashboards available under the given user account. This includes the dashboards created by the user and the ones shared with her by other users. **Success Return Value** A dictionary containing the list of available...
** Description ** Finds dashboards with the specified name. You can then delete the dashboard ( with: func: ~SdcClient. delete_dashboard ) or edit panels ( with: func: ~SdcClient. add_dashboard_panel and: func: ~SdcClient. remove_dashboard_panel )
def find_dashboard_by(self, name=None): '''**Description** Finds dashboards with the specified name. You can then delete the dashboard (with :func:`~SdcClient.delete_dashboard`) or edit panels (with :func:`~SdcClient.add_dashboard_panel` and :func:`~SdcClient.remove_dashboard_panel`) **Argu...
** Description ** Removes a panel from the dashboard. The panel to remove is identified by the specified name.
def remove_dashboard_panel(self, dashboard, panel_name): '''**Description** Removes a panel from the dashboard. The panel to remove is identified by the specified ``name``. **Arguments** - **name**: name of the panel to find and remove **Success Return Value** ...
** Description ** Create a new dasboard using one of the Sysdig Monitor views as a template. You will be able to define the scope of the new dashboard.
def create_dashboard_from_view(self, newdashname, viewname, filter, shared=False, public=False): '''**Description** Create a new dasboard using one of the Sysdig Monitor views as a template. You will be able to define the scope of the new dashboard. **Arguments** - **newdashname...
** Description ** Create a new dasboard using one of the existing dashboards as a template. You will be able to define the scope of the new dasboard.
def create_dashboard_from_dashboard(self, newdashname, templatename, filter, shared=False, public=False): '''**Description** Create a new dasboard using one of the existing dashboards as a template. You will be able to define the scope of the new dasboard. **Arguments** - **newd...
** Description ** Create a new dasboard using a dashboard template saved to disk. See: func: ~SdcClient. save_dashboard_to_file to use the file to create a dashboard ( usefl to create and restore backups ).
def create_dashboard_from_file(self, dashboard_name, filename, filter, shared=False, public=False): ''' **Description** Create a new dasboard using a dashboard template saved to disk. See :func:`~SdcClient.save_dashboard_to_file` to use the file to create a dashboard (usefl to create and res...
** Description ** Save a dashboard to disk. See: func: ~SdcClient. create_dashboard_from_file to use the file to create a dashboard ( usefl to create and restore backups ).
def save_dashboard_to_file(self, dashboard, filename): ''' **Description** Save a dashboard to disk. See :func:`~SdcClient.create_dashboard_from_file` to use the file to create a dashboard (usefl to create and restore backups). The file will contain a JSON object with the follow...
** Description ** Deletes a dashboard.
def delete_dashboard(self, dashboard): '''**Description** Deletes a dashboard. **Arguments** - **dashboard**: the dashboard object as returned by :func:`~SdcClient.get_dashboards`. **Success Return Value** `None`. **Example** `examples/d...
** Description ** Internal function to convert a filter string to a filter object to be used with dashboards.
def convert_scope_string_to_expression(scope): '''**Description** Internal function to convert a filter string to a filter object to be used with dashboards. ''' # # NOTE: The supported grammar is not perfectly aligned with the grammar supported by the Sysdig backend. ...
** Description ** Get an array of all configured Notification Channel IDs or a filtered subset of them.
def get_notification_ids(self, channels=None): '''**Description** Get an array of all configured Notification Channel IDs, or a filtered subset of them. **Arguments** - **channels**: an optional array of dictionaries to limit the set of Notification Channel IDs returned. If not ...
** Description ** Send an event to Sysdig Monitor. The events you post are available in the Events tab in the Sysdig Monitor UI and can be overlied to charts.
def post_event(self, name, description=None, severity=None, event_filter=None, tags=None): '''**Description** Send an event to Sysdig Monitor. The events you post are available in the Events tab in the Sysdig Monitor UI and can be overlied to charts. **Arguments** - **name**: th...
** Description ** Returns the list of Sysdig Monitor events.
def get_events(self, name=None, from_ts=None, to_ts=None, tags=None): '''**Description** Returns the list of Sysdig Monitor events. **Arguments** - **name**: filter events by name. - **from_ts**: filter events by start time. Timestamp format is in UTC (seconds). ...
** Description ** Deletes an event.
def delete_event(self, event): '''**Description** Deletes an event. **Arguments** - **event**: the event object as returned by :func:`~SdcClient.get_events`. **Success Return Value** `None`. **Example** `examples/delete_event.py <https:/...
** Description ** Export metric data ( both time - series and table - based ).
def get_data(self, metrics, start_ts, end_ts=0, sampling_s=0, filter='', datasource_type='host', paging=None): '''**Description** Export metric data (both time-series and table-based). **Arguments** - **metrics**: a list of dictionaries, specifying the metrics a...
** Description ** Returns the list of sysdig captures for the user.
def get_sysdig_captures(self, from_sec=None, to_sec=None, scope_filter=None): '''**Description** Returns the list of sysdig captures for the user. **Arguments** - from_sec: the start of the timerange for which to get the captures - end_sec: the end of the timerange f...
** Description ** Fetch the updated state of a sysdig capture. Can be used to poll the status of a capture that has been previously created and started with: func: ~SdcClient. create_sysdig_capture.
def poll_sysdig_capture(self, capture): '''**Description** Fetch the updated state of a sysdig capture. Can be used to poll the status of a capture that has been previously created and started with :func:`~SdcClient.create_sysdig_capture`. **Arguments** - **capture**: the captur...
** Description ** Create a new sysdig capture. The capture will be immediately started.
def create_sysdig_capture(self, hostname, capture_name, duration, capture_filter='', folder='/'): '''**Description** Create a new sysdig capture. The capture will be immediately started. **Arguments** - **hostname**: the hostname of the instrumented host where the capture will b...
** Description ** Download a sysdig capture by id.
def download_sysdig_capture(self, capture_id): '''**Description** Download a sysdig capture by id. **Arguments** - **capture_id**: the capture id to download. **Success Return Value** The bytes of the scap ''' url = '{url}/api/sysdig/{id}/dow...
** Description ** Invites a new user to use Sysdig Monitor. This should result in an email notification to the specified address.
def create_user_invite(self, user_email, first_name=None, last_name=None, system_role=None): '''**Description** Invites a new user to use Sysdig Monitor. This should result in an email notification to the specified address. **Arguments** - **user_email**: the email address of th...
** Description ** Deletes a user from Sysdig Monitor.
def delete_user(self, user_email): '''**Description** Deletes a user from Sysdig Monitor. **Arguments** - **user_email**: the email address of the user that will be deleted from Sysdig Monitor **Example** `examples/user_team_mgmt.py <https://github.com/draio...
** Description ** Return the set of teams that match the filter specified. The * team_filter * should be a substring of the names of the teams to be returned.
def get_teams(self, team_filter=''): '''**Description** Return the set of teams that match the filter specified. The *team_filter* should be a substring of the names of the teams to be returned. **Arguments** - **team_filter**: the team filter to match when returning the list of...
** Description ** Return the team with the specified team name if it is present.
def get_team(self, name): '''**Description** Return the team with the specified team name, if it is present. **Arguments** - **name**: the name of the team to return **Success Return Value** The requested team. **Example** `examples/user...
** Description ** Creates a new team
def create_team(self, name, memberships=None, filter='', description='', show='host', theme='#7BB0B2', perm_capture=False, perm_custom_events=False, perm_aws_data=False): ''' **Description** Creates a new team **Arguments** - **name**: the name of the...
** Description ** Edits an existing team. All arguments are optional. Team settings for any arguments unspecified will remain at their current settings.
def edit_team(self, name, memberships=None, filter=None, description=None, show=None, theme=None, perm_capture=None, perm_custom_events=None, perm_aws_data=None): ''' **Description** Edits an existing team. All arguments are optional. Team settings for any arguments unspecif...
** Description ** Deletes a team from Sysdig Monitor.
def delete_team(self, name): '''**Description** Deletes a team from Sysdig Monitor. **Arguments** - **name**: the name of the team that will be deleted from Sysdig Monitor **Example** `examples/user_team_mgmt.py <https://github.com/draios/python-sdc-client/b...
** Description ** List all memberships for specified team.
def list_memberships(self, team): ''' **Description** List all memberships for specified team. **Arguments** - **team**: the name of the team for which we want to see memberships **Result** Dictionary of (user-name, team-role) pairs that should descr...
** Description ** Create new user team memberships or update existing ones.
def save_memberships(self, team, memberships): ''' **Description** Create new user team memberships or update existing ones. **Arguments** - **team**: the name of the team for which we are creating new memberships - **memberships**: dictionary of (user-name, ...
** Description ** Remove user memberships from specified team.
def remove_memberships(self, team, users): ''' **Description** Remove user memberships from specified team. **Arguments** - **team**: the name of the team from which user memberships are removed - **users**: list of usernames which should be removed from team...
** Description ** Creates an empty dashboard. You can then add panels by using add_dashboard_panel.
def create_dashboard(self, name): ''' **Description** Creates an empty dashboard. You can then add panels by using ``add_dashboard_panel``. **Arguments** - **name**: the name of the dashboard that will be created. **Success Return Value** A dictionar...
** Description ** Adds a panel to the dashboard. A panel can be a time series or a top chart ( i. e. bar chart ) or a number panel.
def add_dashboard_panel(self, dashboard, name, panel_type, metrics, scope=None, sort_by=None, limit=None, layout=None): """**Description** Adds a panel to the dashboard. A panel can be a time series, or a top chart (i.e. bar chart), or a number panel. **Arguments** - **dashboard...
** Description ** Add an image to the scanner
def add_image(self, image, force=False, dockerfile=None, annotations={}, autosubscribe=True): '''**Description** Add an image to the scanner **Arguments** - image: Input image can be in the following formats: registry/repo:tag - dockerfile: The contents of the docker...
** Description ** Import an image from the scanner export
def import_image(self, image_data): '''**Description** Import an image from the scanner export **Arguments** - image_data: A JSON with the image information. **Success Return Value** A JSON object representing the image that was imported. ''' ...
** Description ** Find the image with the tag <image > and return its json description
def get_image(self, image, show_history=False): '''**Description** Find the image with the tag <image> and return its json description **Arguments** - image: Input image can be in the following formats: registry/repo:tag **Success Return Value** A JSON objec...
** Description ** Find the image with the tag <image > and return its content.
def query_image_content(self, image, content_type=""): '''**Description** Find the image with the tag <image> and return its content. **Arguments** - image: Input image can be in the following formats: registry/repo:tag - content_type: The content type can be one of ...