desc
stringlengths
3
26.7k
decl
stringlengths
11
7.89k
bodies
stringlengths
8
553k
':returns: item_list - list of IAMServiceAccounts. :returns: exception _map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
@record_exception() def slurp(self):
self.prep_for_slurp() project_creds = get_gcp_project_creds(self.accounts) @iter_project(projects=project_creds) def slurp_items(**kwargs): item_list = [] kwargs['user_agent'] = self.user_agent service_accounts = list_serviceaccounts(**kwargs) for service_account in servi...
':returns: item_list - list of GCSBuckets. :returns: exception _map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
@record_exception() def slurp(self):
self.prep_for_slurp() project_creds = get_gcp_project_creds(self.accounts) @iter_project(projects=project_creds) def slurp_items(**kwargs): item_list = [] kwargs['user_agent'] = self.user_agent buckets = list_buckets(**kwargs) for bucket in buckets: resource_i...
':returns: item_list - list of SNSItem\'s. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() item_list = [] exception_map = {} for account in self.accounts: for region in regions(): try: (sns, topics) = self.get_all_topics_in_region(account, region) except Exception as e: if (region.name not in TROUBLE_REGIONS...
':returns: item_list - list of EBS volumes in use by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() @iter_account_region(index=self.index, accounts=self.accounts, service_name='ec2') def slurp_items(**kwargs): item_list = [] exception_map = {} kwargs['exception_map'] = exception_map app.logger.debug('Checking {}/{}/{}'.format(self.index, kwargs['acc...
':returns: item_list - list of available EC2 images defined by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() @iter_account_region(index=self.index, accounts=self.accounts, service_name='ec2') def slurp_items(**kwargs): item_list = [] exception_map = {} kwargs['exception_map'] = exception_map app.logger.debug('Checking {}/{}/{}'.format(self.index, kwargs['acc...
':returns: item_list - list of EC2 instances in use by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() @iter_account_region(index=self.index, accounts=self.accounts, service_name='ec2') def slurp_items(**kwargs): item_list = [] exception_map = {} kwargs['exception_map'] = exception_map app.logger.debug('Checking {}/{}/{}'.format(self.index, kwargs['acc...
':returns: item_list - list of available EBS snapshots defined by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() @iter_account_region(index=self.index, accounts=self.accounts, service_name='ec2') def slurp_items(**kwargs): item_list = [] exception_map = {} kwargs['exception_map'] = exception_map app.logger.debug('Checking {}/{}/{}'.format(self.index, kwargs['acc...
':returns: item_list - list of SQS Policies. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() item_list = [] exception_map = {} from security_monkey.common.sts_connect import connect for account in self.accounts: account_db = Account.query.filter((Account.name == account)).first() account_number = account_db.identifier for region in regions(): ...
':returns: item_list - list of RDS Security Groups. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() @iter_account_region(index=self.index, accounts=self.accounts, service_name='rds') def slurp_items(**kwargs): item_list = [] exception_map = {} kwargs['exception_map'] = exception_map app.logger.debug('Checking {}/{}/{}'.format(self.index, kwargs['acc...
':returns: item_list - list of RDS DB Clusters. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() item_list = [] exception_map = {} from security_monkey.common.sts_connect import connect for account in self.accounts: for region in regions(): app.logger.debug('Checking {}/{}/{}'.format(self.index, account, region.name)) clusters = [] ...
':returns: item_list - list of RDS snapshots in use by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() from security_monkey.common.sts_connect import connect item_list = [] exception_map = {} for account in self.accounts: for region in regions(): app.logger.debug('Checking {}/{}/{}'.format(self.index, account, region.name)) snapshots = [] ...
':returns: item_list - list of RDS DB Instances. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() @iter_account_region(index=self.index, accounts=self.accounts, service_name='rds') def slurp_items(**kwargs): item_list = [] exception_map = {} kwargs['exception_map'] = exception_map app.logger.debug('Checking {}/{}/{}'.format(self.index, kwargs['acc...
':returns: item_list - list of RDS Subnet Groups. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() @iter_account_region(index=self.index, accounts=self.accounts, service_name='rds') def slurp_items(**kwargs): item_list = [] exception_map = {} kwargs['exception_map'] = exception_map app.logger.debug('Checking {}/{}/{}'.format(self.index, kwargs['acc...
':returns: item_list - list of RDS Cluster Snapshots. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() from security_monkey.common.sts_connect import connect item_list = [] exception_map = {} for account in self.accounts: for region in regions(): app.logger.debug('Checking {}/{}/{}'.format(self.index, account, region.name)) rds_cluster_snapshot...
':returns: item_list - list of ElasticSearchService Items :return: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() @iter_account_region(index=self.index, accounts=self.accounts, service_name='es') def slurp_items(**kwargs): item_list = [] exception_map = {} kwargs['exception_map'] = exception_map account_db = Account.query.filter((Account.name == kwargs['account_name...
'Return details level: \'NONE\' / \'SUMMARY\' / \'FULL\''
def get_detail_level(self):
if self.instance_detail: return self.instance_detail else: return 'NONE'
':returns: item_list - list of Security Groups. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() item_list = [] exception_map = {} from security_monkey.common.sts_connect import connect for account in self.accounts: account_db = Account.query.filter((Account.name == account)).first() account_number = account_db.identifier try: ec2 = conn...
':returns: item_list - list of IAM SSL Certificates. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
item_list = [] exception_map = {} for account in self.accounts: for region in ['universal']: all_certs = self.get_all_certs_in_region(account, 'us-east-1', exception_map) for cert in all_certs: name = cert['server_certificate_name'] item = IAMS...
':returns: item_list - list of Managed Policies. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() item_list = [] exception_map = {} from security_monkey.common.sts_connect import connect for account in self.accounts: all_policies = [] try: iam = connect(account, 'boto3.iam.resource') for policy in iam.policies.all(): a...
':returns: item_list - list of IAM Groups. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() item_list = [] exception_map = {} from security_monkey.common.sts_connect import connect for account in self.accounts: try: boto3_iam_resource = connect(account, 'boto3.iam.resource') managed_policies = all_managed_policies(boto3_iam_resource) ...
':returns: item_list - list of ACM Certificates with details. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() item_list = [] exception_map = {} from security_monkey.common.sts_connect import connect for account in self.accounts: try: ec2 = connect(account, 'ec2') regions = ec2.get_all_regions() except Exception as e: exc = BotoConnect...
':returns: item_list - list of virtual gateways :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() from security_monkey.common.sts_connect import connect item_list = [] exception_map = {} for account in self.accounts: for region in regions(): app.logger.debug('Checking {}/{}/{}'.format(self.index, account, region.name)) try: ...
':returns: item_list - list of connections :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() from security_monkey.common.sts_connect import connect item_list = [] exception_map = {} for account in self.accounts: for region in regions(): app.logger.debug('Checking {}/{}/{}'.format(self.index, account, region.name)) try: ...
':returns: item_list - list of networkinterface items. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() item_list = [] exception_map = {} from security_monkey.common.sts_connect import connect for account in self.accounts: try: ec2 = connect(account, 'ec2') app.logger.debug('Checking {}/{}/{}'.format(self.index, account, 'universal')) ...
':returns: item_list - list of Elastic IPs. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() item_list = [] exception_map = {} from security_monkey.common.sts_connect import connect for account in self.accounts: try: ec2 = connect(account, 'ec2') regions = ec2.get_all_regions() except Exception as e: exc = BotoConnect...
':returns: item_list - list of Flow Logs in use by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() from security_monkey.common.sts_connect import connect item_list = [] exception_map = {} for account in self.accounts: for region in regions(): app.logger.debug('Checking {}/{}/{}'.format(self.index, account, region.name)) response_items = [] ...
':returns: item_list - list of nat_gateways. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() item_list = [] exception_map = {} from security_monkey.common.sts_connect import connect for account in self.accounts: for region in regions(): app.logger.debug('Checking {}/{}/{}'.format(self.index, account, region.name)) try: ...
':returns: item_list - list of vpn connections. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() @iter_account_region(index=self.index, accounts=self.accounts, service_name='ec2') def slurp_items(**kwargs): item_list = [] exception_map = {} kwargs['exception_map'] = exception_map app.logger.debug('Checking {}/{}/{}'.format(self.index, kwargs['acc...
':returns: item_list - list of vpc peerings. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() @iter_account_region(index=self.index, accounts=self.accounts, service_name='ec2') def slurp_items(**kwargs): item_list = [] exception_map = {} kwargs['exception_map'] = exception_map app.logger.debug('Checking {}/{}/{}'.format(self.index, kwargs['acc...
':returns: item_list - list of network acls. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() @iter_account_region(index=self.index, accounts=self.accounts, service_name='ec2') def slurp_items(**kwargs): item_list = [] exception_map = {} kwargs['exception_map'] = exception_map app.logger.debug('Checking {}/{}/{}'.format(self.index, kwargs['acc...
':returns: item_list - list of VPCs. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() item_list = [] exception_map = {} from security_monkey.common.sts_connect import connect for account in self.accounts: account_db = Account.query.filter((Account.name == account)).first() account_number = account_db.identifier for region in regions(): ...
':returns: item_list - list of dhcp option sets. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() @iter_account_region(index=self.index, accounts=self.accounts, service_name='ec2') def slurp_items(**kwargs): item_list = [] exception_map = {} kwargs['exception_map'] = exception_map app.logger.debug('Checking {}/{}/{}'.format(self.index, kwargs['acc...
':returns: item_list - list of subnets. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() @iter_account_region(index=self.index, accounts=self.accounts, service_name='ec2') def slurp_items(**kwargs): item_list = [] exception_map = {} kwargs['exception_map'] = exception_map app.logger.debug('Checking {}/{}/{}'.format(self.index, kwargs['acc...
':returns: item_list - list of endpoints. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() item_list = [] exception_map = {} from security_monkey.common.sts_connect import connect for account in self.accounts: for region in regions(): app.logger.debug('Checking {}/{}/{}'.format(self.index, account, region.name)) try: ...
':returns: item_list - list of route tables. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() @iter_account_region(index=self.index, accounts=self.accounts, service_name='ec2') def slurp_items(**kwargs): item_list = [] exception_map = {} kwargs['exception_map'] = exception_map app.logger.debug('Checking {}/{}/{}'.format(self.index, kwargs['acc...
':returns: item_list - list of SES Identities. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() from security_monkey.common.sts_connect import connect item_list = [] exception_map = {} for account in self.accounts: for region in regions(): if (region.name == 'eu-central-1'): continue app.logger.debug('Checking {}/{}/{}'.f...
':returns: item_list - list of domain names. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() @iter_account_region(index=self.index, accounts=self.accounts, service_name='route53domains') def slurp_items(**kwargs): app.logger.debug('Checking {}/{}/{}'.format(Route53Domains.index, kwargs['account_name'], kwargs['region'])) item_list = [] r53 = self.con...
':returns: item_list - list of cloud_trail items. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception'
def slurp(self):
self.prep_for_slurp() item_list = [] exception_map = {} from security_monkey.common.sts_connect import connect for account in self.accounts: for region in regions(): app.logger.debug('Checking {}/{}/{}'.format(self.index, account, region.name)) try: ...
'envs are list of environments where we care about changes'
def __init__(self, watchers_auditors=[], account=None, debug=False):
self.account = account self.notifications = '' self.new = [] self.delete = [] self.changed = [] self.watchers_auditors = watchers_auditors users = User.query.filter(User.accounts.any(name=account)).filter((User.change_reports == 'ALL')).all() self.emails = [user.email for user in users] ...
'Collect change summaries from watchers defined and send out an email'
def report(self):
changed_watchers = [watcher_auditor.watcher for watcher_auditor in self.watchers_auditors if watcher_auditor.watcher.is_changed()] has_issues = has_new_issue = has_unjustified_issue = False for watcher in changed_watchers: (has_issues, has_new_issue, has_unjustified_issue) = watcher.issues_found() ...
'Overrides the lookup to also check the number for backwards compatibility'
def lookup_account_by_identifier(self, identifier):
account = super(GCPAccountManager, self).lookup_account_by_identifier(identifier) return account
'# TODO(supertom): look into this. Overrides create and update to also save the number, s3_name and role_name for backwards compatibility'
def _populate_account(self, account, account_type, name, active, third_party, notes, identifier, custom_fields=None):
account = super(GCPAccountManager, self)._populate_account(account, account_type, name, active, third_party, notes, identifier, custom_fields) return account
'AWS identifer sanitization will strip and remove any hyphens. Returns: stripped identifier with hyphens removed'
def sanitize_account_identifier(self, identifier):
return identifier.replace('-', '').strip()
'Searches for existing tickets based on the summary. If one exists, it will update the count and preserve any leading description text. If not, it will create a ticket.'
def add_or_update_issue(self, issue, technology, account, count):
summary = '{0} - {1} - {2}'.format(issue, technology, account) summary_search = summary.replace('- ', '') jql = 'project={0} and summary~"{1}"'.format(self.project, summary_search) issues = self.client.search_issues(jql) url = '{0}/#/issues/-/{1}/{2}/-/-/True/{3}/1/25'.format(se...
'Runs add_or_update_issue for every AuditorSetting, filtered by technology and accounts, if provided.'
def sync_issues(self, accounts=None, tech_name=None):
query = AuditorSettings.query.join((Technology, (Technology.id == AuditorSettings.tech_id))).join((Account, (Account.id == AuditorSettings.account_id))).filter((AuditorSettings.disabled == False)) if accounts: query = query.filter(Account.name.in_(accounts)) if tech_name: query = query.filte...
'Override base class method to make the new log file group writable.'
def doRollover(self):
handlers.RotatingFileHandler.doRollover(self) try: currMode = os.stat(self.baseFilename).st_mode os.chmod(self.baseFilename, (currMode | stat.S_IWGRP)) except OSError: pass
'The cloudaux iter_account_region decorator returns a list of tuples. Each tuple contains two members. 1) The result. 2) The exception map. This method combines that list of tuples into a single result list and a single exception map.'
def _flatten_iter_response(self, response):
items = list() exception_map = dict() for result in response: items.extend(result[0]) exception_map.update(result[1]) return (items, exception_map)
'Tests that if exceptions are encountered, the watcher continues. Unfortunately -- moto lacks all of the S3 methods that we need. So this is just a test to ensure that exception handling works OK. :return:'
def test_watcher_exceptions(self):
mock_sts().start() s3_watcher = S3(accounts=[self.account.name]) s3_watcher.slurp() assert (len(ExceptionLogs.query.all()) == 3) mock_s3().stop() mock_sts().stop()
'If the exception is deleted, the parent (tech., item, account) should not be deleted. :return:'
def test_doesnt_delete_parent_cascade(self):
try: raise ValueError('This is a test') except ValueError as e: test_exception = e location = ('iamrole', 'testing', 'us-west-2', 'testrole') store_exception('tests', location, test_exception) exc = ExceptionLogs.query.all() db.session.delete(exc[0]) db.session.commi...
'If the exception object is deleted, then the parent object (items, account, tech.) should NOT be deleted. :return:'
def test_child_deletion_cascade_check(self):
try: raise ValueError('This is a test') except ValueError as e: test_exception = e location = ('iamrole', 'testing', 'us-west-2', 'testrole') store_exception('tests', location, test_exception) assert (len(self.item.exceptions) == 1) assert (len(self.account.exceptions) =...
'If the parent is deleted (item, account, tech.), the exception should be deleted, BUT the other parents should remain. :return:'
def test_safe_child_deletion_cascade(self):
try: raise ValueError('This is a test') except ValueError as e: test_exception = e location = ('iamrole', 'testing', 'us-west-2', 'testrole') store_exception('tests', location, test_exception) db.session.delete(self.item) db.session.commit() exc = ExceptionLogs.query...
'This will test the entry point via the find_changes() method vs. the find_changes_batch() method. This will also use the IAMRole watcher, since that already has batching support. :return:'
def test_find_changes_batch(self):
from security_monkey.watchers.iam.iam_role import IAMRole self.setup_batch_db() watcher = IAMRole(accounts=[self.account.name]) watcher.current_account = (self.account, 0) watcher.technology = self.technology items = [] for x in range(0, 5): mod_conf = dict(ACTIVE_CONF) mod_c...
'This will use the IAMRole watcher, since that already has batching support. :return:'
def test_find_deleted_batch(self):
from security_monkey.watchers.iam.iam_role import IAMRole self.setup_batch_db() watcher = IAMRole(accounts=[self.account.name]) watcher.current_account = (self.account, 0) watcher.technology = self.technology items = [] for x in range(0, 5): mod_conf = dict(ACTIVE_CONF) mod_c...
'If an interval is passed to reporter.run(), the reporter will run all watchers in the interval along with their auditors. It will also reaudit all existing items of watchers that are not in the interval but are dependent on watchers/auditors in the interval. This is done because any changes to the dependencies could c...
@patch('security_monkey.alerter.Alerter.report', new=mock_report) def test_run_with_interval_no_dependencies(self):
from security_monkey.reporter import Reporter build_mock_result(watcher_configs, auditor_configs_no_external_dependencies) reporter = Reporter(account='TEST_ACCOUNT') reporter.run('TEST_ACCOUNT', 15) watcher_keys = RUNTIME_WATCHERS.keys() self.assertEqual(first=2, second=len(watcher_keys), msg='...
'If an interval is passed to reporter.run(), the reporter will run all watchers in the interval along with their auditors. It will also reaudit all existing items of watchers that are not in the interval but are dependent on watchers/auditors in the interval. This is done because any changes to the dependencies could c...
@patch('security_monkey.alerter.Alerter.report', new=mock_report) def test_run_with_interval_auditor_dependencies(self):
from security_monkey.reporter import Reporter build_mock_result(watcher_configs, auditor_configs_with_auditor_dependencies) reporter = Reporter(account='TEST_ACCOUNT') reporter.run('TEST_ACCOUNT', 15) watcher_keys = RUNTIME_WATCHERS.keys() self.assertEqual(first=2, second=len(watcher_keys), msg=...
'If an interval is passed to reporter.run(), the reporter will run all watchers in the interval along with their auditors. It will also reaudit all existing items of watchers that are not in the interval but are dependent on watchers/auditors in the interval. This is done because any changes to the dependencies could c...
@patch('security_monkey.alerter.Alerter.report', new=mock_report) def test_run_with_interval_watcher_dependencies(self):
from security_monkey.reporter import Reporter build_mock_result(watcher_configs, auditor_configs_with_watcher_dependencies) reporter = Reporter(account='TEST_ACCOUNT') reporter.run('TEST_ACCOUNT', 15) watcher_keys = RUNTIME_WATCHERS.keys() self.assertEqual(first=2, second=len(watcher_keys), msg=...
'Runs through a full find job via the IAMRole watcher, as that supports batching. However, this is mostly testing the logic through each function call -- this is not going to do any boto work and that will instead be mocked out. :return:'
def test_find_batch_changes(self):
from security_monkey.scheduler import find_changes from security_monkey.monitors import Monitor from security_monkey.watchers.iam.iam_role import IAMRole from security_monkey.auditors.iam.iam_role import IAMRoleAuditor test_account = Account(name='TEST_ACCOUNT1') watcher = IAMRole(accounts=[test...
'.. http:post:: /api/1/issues/1234/justification Justify an audit issue on a specific item. **Example Request**: .. sourcecode:: http POST /api/1/issues/1234/justification HTTP/1.1 Host: example.com Accept: application/json \'justification\': \'I promise not to abuse this.\' **Example Response**: .. sourcecode:: http H...
def post(self, audit_id):
self.reqparse.add_argument('justification', required=False, type=str, help='Must provide justification', location='json') args = self.reqparse.parse_args() item = ItemAudit.query.filter((ItemAudit.id == audit_id)).first() if (not item): return ({'Error': 'Item with audit_id {} ...
'.. http:delete:: /api/1/issues/1234/justification Remove a justification on an audit issue on a specific item. **Example Request**: .. sourcecode:: http DELETE /api/1/issues/1234/justification HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. sourcecode:: http HTTP/1.1 202 OK Vary: Accept Co...
def delete(self, audit_id):
item = ItemAudit.query.filter((ItemAudit.id == audit_id)).first() if (not item): return ({'Error': 'Item with audit_id {} not found'.format(audit_id)}, 404) item.justified_user_id = None item.justified = False item.justified_date = None item.justification = None db.ses...
'.. http:get:: /api/1/revision/1234 Get a specific revision. **Example Request**: .. sourcecode:: http GET /api/1/revision/123 HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: application/json "auth": { "authentica...
def get(self, revision_id):
query = ItemRevision.query.filter((ItemRevision.id == revision_id)) result = query.first() comments = [] for comment in result.comments: comment_marshaled = marshal(comment, REVISION_COMMENT_FIELDS) comments.append(dict((comment_marshaled.items() + {'user': comment.user.email}.items())))...
'.. http:get:: /api/1/revisions Get a list of revisions **Example Request**: .. sourcecode:: http GET /api/1/revisions?count=1 HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: application/json "items": [ "account": "example_account...
def get(self):
self.reqparse.add_argument('count', type=int, default=30, location='args') self.reqparse.add_argument('page', type=int, default=1, location='args') self.reqparse.add_argument('active', type=str, default=None, location='args') self.reqparse.add_argument('regions', type=str, default=None, location='args')...
'.. http:get:: /api/1/distinct Get a list of distinct regions, names, accounts, accounttypes or technologies **Example Request**: .. sourcecode:: http GET /api/1/distinct/name HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Con...
def get(self, key_id):
self.reqparse.add_argument('count', type=int, default=30, location='args') self.reqparse.add_argument('page', type=int, default=1, location='args') self.reqparse.add_argument('select2', type=str, default='', location='args') self.reqparse.add_argument('searchconfig', type=str, default='', location='args...
'.. http:get:: /api/1/whitelistcidrs Get a list of CIDR\'s whitelisted to be used in security groups. **Example Request**: .. sourcecode:: http GET /api/1/whitelistcidrs HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-T...
def get(self):
self.reqparse.add_argument('count', type=int, default=30, location='args') self.reqparse.add_argument('page', type=int, default=1, location='args') args = self.reqparse.parse_args() page = args.pop('page', None) count = args.pop('count', None) result = NetworkWhitelistEntry.query.order_by(Networ...
'.. http:post:: /api/1/whitelistcidrs Create a new CIDR whitelist entry. **Example Request**: .. sourcecode:: http POST /api/1/whitelistcidrs HTTP/1.1 Host: example.com Accept: application/json "name": "Corp", "notes": "Corporate Network", "cidr": "1.2.3.4/22" **Example Response**: .. sourcecode:: http HTTP/1.1 201 Cre...
def post(self):
self.reqparse.add_argument('name', required=True, type=unicode, help='Must provide account name', location='json') self.reqparse.add_argument('cidr', required=True, type=unicode, help='Network CIDR required.', location='json') self.reqparse.add_argument('notes', required=False, type=unicode, ...
'.. http:get:: /api/1/whitelistcidrs/<int:id> Get the whitelist entry with the given ID. **Example Request**: .. sourcecode:: http GET /api/1/whitelistcidrs/123 HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: appl...
def get(self, item_id):
result = NetworkWhitelistEntry.query.filter((NetworkWhitelistEntry.id == item_id)).first() if (not result): return ({'status': 'Whitelist entry with the given ID not found.'}, 404) whitelistentry_marshaled = marshal(result.__dict__, WHITELIST_FIELDS) whitelistentry_marshaled...
'.. http:get:: /api/1/whitelistcidrs/<int:id> Update the whitelist entry with the given ID. **Example Request**: .. sourcecode:: http PUT /api/1/whitelistcidrs/123 HTTP/1.1 Host: example.com Accept: application/json, text/javascript "id": 123, "name": "Corp", "notes": "Corporate Network - New", "cidr": "2.2.0.0/16" **E...
def put(self, item_id):
self.reqparse.add_argument('name', required=True, type=unicode, help='Must provide account name', location='json') self.reqparse.add_argument('cidr', required=True, type=unicode, help='Network CIDR required.', location='json') self.reqparse.add_argument('notes', required=False, type=unicode, ...
'.. http:delete:: /api/1/whitelistcidrs/123 Delete a network whitelist entry. **Example Request**: .. sourcecode:: http DELETE /api/1/whitelistcidrs/123 HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. sourcecode:: http HTTP/1.1 202 Accepted Vary: Accept Content-Type: application/json \'stat...
def delete(self, item_id):
NetworkWhitelistEntry.query.filter((NetworkWhitelistEntry.id == item_id)).delete() db.session.commit() return ({'status': 'deleted'}, 202)
'.. http:get:: /api/1/auditscores Get a list of override scores for audit items. **Example Request**: .. sourcecode:: http GET /api/1/auditscores HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: application/json co...
def get(self):
self.reqparse.add_argument('count', type=int, default=30, location='args') self.reqparse.add_argument('page', type=int, default=1, location='args') args = self.reqparse.parse_args() page = args.pop('page', None) count = args.pop('count', None) result = ItemAuditScore.query.order_by(ItemAuditScor...
'.. http:post:: /api/1/auditscores Create a new override audit score. **Example Request**: .. sourcecode:: http POST /api/1/auditscores HTTP/1.1 Host: example.com Accept: application/json "method": "check_xxx", "technology": "policy", "score": 1 **Example Response**: .. sourcecode:: http HTTP/1.1 201 Created Vary: Acce...
def post(self):
self.reqparse.add_argument('method', required=True, type=unicode, help='Must provide method name', location='json') self.reqparse.add_argument('technology', required=True, type=unicode, help='Technology required.', location='json') self.reqparse.add_argument('score', required=False, type=unicode...
'.. http:get:: /api/1/auditscores/<int:id> Get the overide audit score with given ID. **Example Request**: .. sourcecode:: http GET /api/1/auditscores/123 HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: applicatio...
def get(self, id):
result = ItemAuditScore.query.filter((ItemAuditScore.id == id)).first() if (not result): return ({'status': 'Override Audit Score with the given ID not found.'}, 404) auditscore_marshaled = marshal(result.__dict__, AUDIT_SCORE_FIELDS) auditscore_marshaled['auth'] = self.a...
'.. http:get:: /api/1/auditscores/<int:id> Update override audit score with the given ID. **Example Request**: .. sourcecode:: http PUT /api/1/auditscores/123 HTTP/1.1 Host: example.com Accept: application/json, text/javascript "id": 123, "method": "check_xxx", "technology": "policy", "Score": "1" **Example Response**:...
def put(self, id):
self.reqparse.add_argument('method', required=True, type=unicode, help='Must provide method name', location='json') self.reqparse.add_argument('technology', required=True, type=unicode, help='Technology required.', location='json') self.reqparse.add_argument('score', required=False, type=unicode...
'.. http:delete:: /api/1/auditscores/123 Delete an override audit score **Example Request**: .. sourcecode:: http DELETE /api/1/auditscores/123 HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. sourcecode:: http HTTP/1.1 202 Accepted Vary: Accept Content-Type: application/json \'status\': \'d...
def delete(self, id):
result = ItemAuditScore.query.filter((ItemAuditScore.id == id)).first() db.session.delete(result) db.session.commit() return ({'status': 'deleted'}, 202)
'.. http:get:: /api/1/item/1234 Get a specific item **Example Request**: .. sourcecode:: http GET /api/1/item/1234 HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: application/json "item": { "account": "example_account", "region": ...
def get(self, item_id):
query = Item.query.filter((Item.id == item_id)) result = query.first() retval = {} item_marshaled = marshal(result.__dict__, ITEM_FIELDS) item_marshaled = dict((((item_marshaled.items() + {'account': result.account.name}.items()) + {'account_type': result.account.account_type.name}.items()) + {'tech...
'.. http:get:: /api/1/items Get a list of items matching the given criteria. **Example Request**: .. sourcecode:: http GET /api/1/items HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: application/json "items": [ "account": "exampl...
def get(self):
self.reqparse.add_argument('count', type=int, default=30, location='args') self.reqparse.add_argument('page', type=int, default=1, location='args') self.reqparse.add_argument('regions', type=str, default=None, location='args') self.reqparse.add_argument('accounts', type=str, default=None, location='args...
'.. http:get:: /api/1/settings Get the settings for the given user. **Example Request**: .. sourcecode:: http GET /api/1/settings HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: application/json "auth": { "authenticated": true, "u...
def get(self):
return_dict = {'auth': self.auth_dict, 'settings': []} user = User.query.filter((User.id == current_user.get_id())).first() if user: sub_marshaled = marshal(user.__dict__, USER_SETTINGS_FIELDS) account_ids = [] for account in user.accounts: account_ids.append(account.id) ...
'.. http:post:: /api/1/settings Change the settings for the current user. **Example Request**: .. sourcecode:: http POST /api/1/settings HTTP/1.1 Host: example.com Accept: application/json "accounts": [ 1, 2, 3, 6, 17, 21, 22 "daily_audit_email": true, "change_report_setting": "ALL" **Example Response**: .. sourcecode:...
def post(self):
self.reqparse.add_argument('accounts', required=True, type=list, help='Must provide accounts', location='json') self.reqparse.add_argument('change_report_setting', required=True, type=str, help='Must provide change_report_setting', location='json') self.reqparse.add_argument('daily_audit_email',...
'.. http:delete:: /api/1/items/<int:item_id>/comment/<int:comment_id> Deletes an item comment. **Example Request**: .. sourcecode:: http DELETE /api/1/items/1234/comment/7718 HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. sourcecode:: http HTTP/1.1 202 OK Vary: Accept Content-Type: applica...
def delete(self, item_id, comment_id):
query = ItemComment.query.filter((ItemComment.id == comment_id)) query.filter((ItemComment.user_id == current_user.id)).delete() db.session.commit() return ({'result': 'success'}, 202)
'.. http:get:: /api/1/items/<int:item_id>/comment/<int:comment_id> Retrieves an item comment. **Example Request**: .. sourcecode:: http GET /api/1/items/1234/comment/7718 HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: application...
def get(self, item_id, comment_id):
query = ItemComment.query.filter((ItemComment.id == comment_id)) query = query.filter((ItemComment.item_id == item_id)) ic = query.first() if (ic is None): return ({'status': 'Item Comment Not Found'}, 404) comment_marshaled = marshal(ic.__dict__, ITEM_COMMENT_FIELDS) comment_ma...
'.. http:post:: /api/1/items/<int:item_id>/comments Adds an item comment. **Example Request**: .. sourcecode:: http POST /api/1/items/1234/comments HTTP/1.1 Host: example.com Accept: application/json "text": "This item is my favorite." **Example Response**: .. sourcecode:: http HTTP/1.1 201 OK Vary: Accept Content-Type...
def post(self, item_id):
self.reqparse.add_argument('text', required=False, type=unicode, help='Must provide comment', location='json') args = self.reqparse.parse_args() ic = ItemComment() ic.user_id = current_user.id ic.item_id = item_id ic.text = args['text'] ic.date_created = datetime.datetime.utcnow() ...
'.. http:get:: /api/1/ignorelistentries/<int:id> Get the ignorelist entry with the given ID. **Example Request**: .. sourcecode:: http GET /api/1/ignorelistentries/123 HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Typ...
def get(self, item_id):
result = IgnoreListEntry.query.filter((IgnoreListEntry.id == item_id)).first() if (not result): return ({'status': 'Ignorelist entry with the given ID not found.'}, 404) ignorelistentry_marshaled = marshal(result.__dict__, IGNORELIST_FIELDS) ignorelistentry_marshaled['techno...
'.. http:get:: /api/1/ignorelistentries/<int:id> Update the ignorelist entry with the given ID. **Example Request**: .. sourcecode:: http PUT /api/1/ignorelistentries/123 HTTP/1.1 Host: example.com Accept: application/json, text/javascript "id": 123, "prefix": "noisy_", "notes": "Security Monkey shouldn\'t track noisy_...
def put(self, item_id):
self.reqparse.add_argument('prefix', required=True, type=unicode, help='A prefix must be provided which matches the objects you wish to ignore.', location='json') self.reqparse.add_argument('notes', required=False, type=unicode, help='Add context.', location='json') se...
'.. http:delete:: /api/1/ignorelistentries/123 Delete a ignorelist entry. **Example Request**: .. sourcecode:: http DELETE /api/1/ignorelistentries/123 HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. sourcecode:: http HTTP/1.1 202 Accepted Vary: Accept Content-Type: application/json \'statu...
def delete(self, item_id):
IgnoreListEntry.query.filter((IgnoreListEntry.id == item_id)).delete() db.session.commit() return ({'status': 'deleted'}, 202)
'.. http:get:: /api/1/ignorelistentries Get a list of Ignorelist entries. **Example Request**: .. sourcecode:: http GET /api/1/ignorelistentries HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: application/json cou...
def get(self):
self.reqparse.add_argument('count', type=int, default=30, location='args') self.reqparse.add_argument('page', type=int, default=1, location='args') args = self.reqparse.parse_args() page = args.pop('page', None) count = args.pop('count', None) result = IgnoreListEntry.query.order_by(IgnoreListEn...
'.. http:post:: /api/1/ignorelistentries Create a new ignore list entry. **Example Request**: .. sourcecode:: http POST /api/1/ignorelistentries HTTP/1.1 Host: example.com Accept: application/json "prefix": "noisy_", "notes": "Security Monkey shouldn\'t track noisy_* objects", "technology": "securitygroup" **Example Re...
def post(self):
self.reqparse.add_argument('prefix', required=True, type=unicode, help='A prefix must be provided which matches the objects you wish to ignore.', location='json') self.reqparse.add_argument('notes', required=False, type=unicode, help='Add context.', location='json') se...
'.. http:get:: /api/1/techmethods Get a list of technologies and associated auditor check methods **Example Request**: .. sourcecode:: http GET /api/1/techmethods HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: ap...
def get(self, tech_ids):
tech_methods = {} for key in auditor_registry.keys(): methods = [] for auditor_class in auditor_registry[key]: auditor = auditor_class('') for method_name in dir(auditor): method_name = (((method_name + ' (') + auditor.__class__.__name__) + ')') ...
'.. http:get:: /api/1/account/<int:id> Get a list of Accounts matching the given criteria **Example Request**: .. sourcecode:: http GET /api/1/account/1 HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: application/...
def get(self, account_id):
result = get_account_by_id(account_id) account_marshaled = marshal(result.__dict__, ACCOUNT_FIELDS) account_marshaled = dict((account_marshaled.items() + {'account_type': result.account_type.name}.items())) custom_fields_marshaled = [] for field in result.custom_fields: field_marshaled = {'n...
'.. http:put:: /api/1/account/1 Edit an existing account. **Example Request**: .. sourcecode:: http PUT /api/1/account/1 HTTP/1.1 Host: example.com Accept: application/json \'name\': \'edited_account\' \'identifier\': \'0123456789\', \'notes\': \'this account is for ...\', \'active\': true, \'third_party\': false **Exa...
def put(self, account_id):
args = json.loads(request.json) account_type = args['account_type'] name = args['name'] identifier = args['identifier'] notes = args['notes'] active = args['active'] third_party = args['third_party'] custom_fields = args['custom_fields'] from security_monkey.account_manager import ac...
'.. http:delete:: /api/1/account/1 Delete an account. **Example Request**: .. sourcecode:: http DELETE /api/1/account/1 HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. sourcecode:: http HTTP/1.1 202 Accepted Vary: Accept Content-Type: application/json \'status\': \'deleted\' :statuscode 202...
def delete(self, account_id):
delete_account_by_id(account_id) return ({'status': 'deleted'}, 202)
'.. http:post:: /api/1/account/ Create a new account. **Example Request**: .. sourcecode:: http POST /api/1/account/ HTTP/1.1 Host: example.com Accept: application/json \'name\': \'new_account\' \'identifier\': \'0123456789\', \'notes\': \'this account is for ...\', \'active\': true, \'third_party\': false \'account_ty...
def post(self):
args = json.loads(request.json) account_type = args['account_type'] name = args['name'] identifier = args['identifier'] notes = args['notes'] active = args['active'] third_party = args['third_party'] custom_fields = args['custom_fields'] from security_monkey.account_manager import ac...
'.. http:get:: /api/1/accounts Get a list of Accounts matching the given criteria **Example Request**: .. sourcecode:: http GET /api/1/accounts HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: application/json coun...
def get(self):
self.reqparse.add_argument('count', type=int, default=30, location='args') self.reqparse.add_argument('page', type=int, default=1, location='args') self.reqparse.add_argument('order_by', type=str, default=None, location='args') self.reqparse.add_argument('order_dir', type=str, default='desc', location='...
'.. http:get:: /api/1/issues Get a list of Audit Issues matching the given criteria **Example Request**: .. sourcecode:: http GET /api/1/issues HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: application/json item...
def get(self):
self.reqparse.add_argument('count', type=int, default=30, location='args') self.reqparse.add_argument('page', type=int, default=1, location='args') self.reqparse.add_argument('regions', type=str, default=None, location='args') self.reqparse.add_argument('accounts', type=str, default=None, location='args...
'.. http:get:: /api/1/issue/1234 Get a specific issue **Example Request**: .. sourcecode:: http GET /api/1/issue/1234 HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: application/json justification: null, name: "example_name", issu...
def get(self, audit_id):
query = ItemAudit.query.join('item').filter((ItemAudit.id == audit_id)) result = query.first() issue_marshaled = marshal(result, AUDIT_FIELDS) item_marshaled = marshal(result.item, ITEM_FIELDS) issue_marshaled = dict(((issue_marshaled.items() + item_marshaled.items()) + {'auth': self.auth_dict}.item...
'.. http:get:: /api/1/revisions/<int:revision_id>/comments/<int:comment_id> Get a specific Revision Comment **Example Request**: .. sourcecode:: http GET /api/1/revisions/1141/comments/22 HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-...
def get(self, revision_id, comment_id):
query = ItemRevisionComment.query.filter((ItemRevisionComment.id == comment_id)) query = query.filter((ItemRevisionComment.revision_id == revision_id)) irc = query.first() if (irc is None): return ({'status': 'Revision Comment Not Found'}, 404) revision_marshaled = marshal(irc.__dic...
'.. http:delete:: /api/1/revisions/<int:revision_id>/comments/<int:comment_id> Delete a specific Revision Comment **Example Request**: .. sourcecode:: http DELETE /api/1/revisions/1141/comments/22 HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept...
def delete(self, revision_id, comment_id):
query = ItemRevisionComment.query.filter((ItemRevisionComment.id == comment_id)) query = query.filter((ItemRevisionComment.revision_id == revision_id)) irc = query.first() if (irc is None): return ({'status': 'Revision Comment Not Found'}, 404) query.delete() db.session.commit()...
'.. http:post:: /api/1/revisions/<int:revision_id>/comments Create a new Revision Comment. **Example Request**: .. sourcecode:: http POST /api/1/revisions/1141/comments HTTP/1.1 Host: example.com Accept: application/json "text": "This is a Revision Comment." **Example Response**: .. sourcecode:: http HTTP/1.1 201 OK Va...
def post(self, revision_id):
self.reqparse.add_argument('text', required=False, type=unicode, help='Must provide comment', location='json') args = self.reqparse.parse_args() irc = ItemRevisionComment() irc.user_id = current_user.id irc.revision_id = revision_id irc.text = args['text'] irc.date_created = datetime.d...
'.. http:get:: /api/1/auditscores/<int:auditscores_id>/accountpatternauditscores Get a list of override scores for account pattern audit scores. **Example Request**: .. sourcecode:: http GET /api/1/auditscores/123/accountpatternauditscores HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example R...
def get(self, auditscores_id):
result = ItemAuditScore.query.filter((ItemAuditScore.id == auditscores_id)).first() if (not result): return ({'status': 'Override Audit Score with the given ID not found.'}, 404) self.reqparse.add_argument('count', type=int, default=30, location='args') self.reqparse.add_...
'.. http:post:: /api/1/accountpatternauditscores Create a new override account pattern audit score. **Example Request**: .. sourcecode:: http POST /api/1/accountpatternauditscores HTTP/1.1 Host: example.com Accept: application/json "account_pattern": "AccountPattern", "score": 8, "itemauditscores_id": 123 **Example Res...
def post(self):
self.reqparse.add_argument('account_type', required=False, type=unicode, location='json') self.reqparse.add_argument('account_field', required=True, type=unicode, help='Must provide account field', location='json') self.reqparse.add_argument('account_pattern', required=True, type=unicode, help='Mus...
'.. http:get:: /api/1/accountpatternauditscores/<int:id> Get the overide account pattern audit score with given ID. **Example Request**: .. sourcecode:: http GET /api/1/accountpatternauditscores/234 HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example Response**: .. sourcecode:: http HTTP/1.1 ...
def get(self, id):
app.logger.info(('ID: ' + str(id))) result = AccountPatternAuditScore.query.filter((AccountPatternAuditScore.id == id)).first() if (not result): return ({'status': 'Override Account Pattern Audit Score with the given ID not found.'}, 404) app.logger.info(('RESULT...
'.. http:put:: /api/1/accountpatternauditscores/<int:id> Update override account pattern audit score with the given ID. **Example Request**: .. sourcecode:: http PUT /api/1/accountpatternauditscores/234 HTTP/1.1 Host: example.com Accept: application/json, text/javascript "id": 234, "account_pattern": "AccountPattern", ...
def put(self, id):
self.reqparse.add_argument('account_type', required=False, type=unicode, help='Must provide account type.', location='json') self.reqparse.add_argument('account_field', required=False, type=unicode, help='Must provide account field.', location='json') self.reqparse.add_argument('account_pa...
'.. http:delete:: /api/1/accountpatternauditscores/<int:id> Delete an override account pattern audit score **Example Request**: .. sourcecode:: http DELETE /api/1/accountpatternauditscores/234 HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. sourcecode:: http HTTP/1.1 202 Accepted Vary: Acce...
def delete(self, id):
AccountPatternAuditScore.query.filter((AccountPatternAuditScore.id == id)).delete() db.session.commit() return ({'status': 'deleted'}, 202)