Skip to content

Commit 6210a7f

Browse files
authored
Secure beta changes (#41)
* Split sdc into monitor and common First step towards adding support for sysdig secure in the python sdc client--splitting existing api into common and monitor-only halves. The new terminology is that "sdc" refers to the common code for both monitor and secure. _SdcCommon is the (private) base class that has endpoints/methods common to both monitor and secure. SdMonClient is the class that provides all sysdig monitor capabilities, inheriting from _SdcCommon. SdSecureClient will implement sysdig secure. Split all the methods into the two classes as follows based on endpoint: Common endpoints: - /api/user/me - /api/token (and /api/token/<user>/<id>) - /api/agents/connected - /api/notificationChannels - /api/history/timelines - /api/data - /api/events - /api/sysdig - /api/users - /api/teams - /api/user - /api/agents/config Monitor-only endpoints: - /api/data/metrics - /api/alerts - /api/notifications - /data/drilldownDashboardDescriptors.json - /data/drilldownDashboards - /ui/dashboards - /api/groupConfigurations - /api/agents/falco_rules Add __init__.py changes so all 3 objects are imported. Change __checkResponse so it's simply hidden instead of hidden + mangled with the class name. Allows sharing in inherited classes. * Add secure methods and tests. Add methods SdSecureClient.{get_set}_{user,system}_rules(new-rules-content). Set actually only works for on-premise deployments. New examples {get,set}_secure_{user,sytem}_falco_rules.py corespond to the SdSecureClient methods. Add new methods SdSecureClient.get_policy_events_{range,duration} to fetch policy events. The API allows for an initial query based either on duration or from/to. It returns a context dict containing the current offset for pagination. That context can be provided to get_more_policy_events() which increments the offset. The caller should stop when the number of returned events is 0. Also add a test script test/test_secure_apis.sh that can be used for travis, and run that test script in travis. This script depends on a staging account [email protected]. The API key and customer id are passed to travis via environment variables. The test script tests the following: - Trying to set the system falco rules file. This will fail with a 405 (method not allowed) error, as this account is saas. - Trying to get the system falco rules file. This is compared to a known system rules file in test/sample-falco-rules.yaml. - Trying to set and get the user falco rules file. This uses the date as part of the rule name to ensure a fresh value is set/read. - Starting an agent with the python-sdc-testing account and triggering policy events, while checking for recent policy events. It should eventually find some policy events. Also, for consistency's sake switch to external env variables for all keys--instead of using a mix of embedded and externally provided environment variables for api keys/access keys, use externally provided keys everywhere. * Add methods to manage security policies Add methods/example programs for limited management of security policies: - create default policies from corresponding system falco rules file - list all policies - delete all policies Add tests to use these example programs in conjunction with the system rules file for the python-sdc-testing staging account. * Add sphinx docs Add docs for all SdSecureClient methods. Also update the docs specification to properly handle both the SdSecureClient and SdMonClient objects (thanks @philrz!). I was able to run "make docs" and browse the docs for both objects. Shared methods for both objects are actually listed twice, under each object. This seems ok for now as long as they're pulling docs from a single location. * Add ability to summarize policy events Add the ability to summarize policy events by output string. This removes any likely container information (xxx (id=yyy)) from output strings, and then sorts by frequency descending. New option --summarize controls whether to print summary or raw outputs, and --limit allows you to print only the first <limit> entries. * Make sure ssl_verify is honored for all methods. Make sure the instance variable self.ssl_verify, which is set from the environment variable SDC_SSL_VERIFY, is actually used for any call to requests. This is necessary to handle communicating with servers using self-signed certificates. * Add programs/methods to manipulate secure policies Add methods and example programs to manipulate policies, specifically: - Get a policy - Add a policy - Modify a policy - Delete a policy The methods all work on json objects so they are dependent on the data format. But they allow for some scriptability. * Add missing newline. Summary output was all being printed on one line. * Move to monitor/common Was put under secure as a part of merge. * call hidden unmangled checkResponse Part of changes for secure/monitor split.
1 parent 9d2bee3 commit 6210a7f

19 files changed

+1973
-830
lines changed

.travis.yml

Lines changed: 57 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,68 @@
11
language: python
2-
env:
3-
global:
4-
secure: h6qCuQnKi7fIzR53XqePRg2Hh0NrypqLyvYlJ+GEegEIP2PsPEwXMXZbswD7r+P4zsx7z2mBbR6VVYcjm1s0Zlf8RM2CNJ6IluAzDsg5Er7X7MAPaDEsfGJohZiTOPJvJNOV1BU7Qc4Y8Sqmd5ujVIJ4pL67oMegtmD36QBUAr7ERNrzbDXnPupIkcU/vf3z3vvCnH7/DIyP5hs1P+OAsgHY49bBMXxMEeMYQc0rtCN3F9yCmqh2f1mfEPouQnegKwcVFf3H08WQhYulAyNtrN0kcipMwF9+7cpLWtVyVMKepXvxXC0ltbaUTUqjvg5Op8WLOTG2xwXRdj6Fi985JPCvmsnX9teWT8WyxMex8ig7BVpontPajrhZJPfPWqj+oypqu8GMo/G0xD0uBGIVkadIQI4DQC1xFjKBBwntLdukeOApiAMhBEQtjQ5tO8vZw3kXifBdRHVuVHUjW6Lxd2R0xCKI0ZUmNggDaidsDRSU0C0HmHPHJELfGVm9Ohbsc01dYGiPczplV7Nxc4OKiPBZ5cvoKyNZFmM7ABtMKfGZR9PFv3A+6zzjnqIbHVdszzKN6ODKeotdVRt/VV7cMwZknwUqf7+fE/pjaHGpQ5ubX8wxhPzyxfcJHzKzYklFGCT8Rv/+VooYWJaKyjZ/e63fsjRTfTX84KRpSdWe4U8=
2+
services:
3+
- docker
54
python:
65
- '2.7'
6+
install:
7+
- sudo apt-get install linux-headers-$(uname -r) dkms gcc-multilib g++-multilib
8+
- pip install pyyaml requests
79
script:
810
- echo "Testing source version"
9-
- examples/create_alert.py XXX
10-
- examples/update_alert.py XXX
11-
- examples/delete_alert.py XXX
12-
- examples/dashboard.py XXX
13-
- examples/create_dashboard.py XXX
14-
- examples/delete_dashboard.py XXX
15-
- examples/get_data_advanced.py XXX ip-10-0-1-140.ec2.internal
16-
- examples/get_data_datasource.py XXX
17-
- examples/get_data_simple.py XXX
18-
- examples/list_alerts.py XXX
19-
- examples/list_alert_notifications.py XXX
20-
- examples/resolve_alert_notifications.py XXX 1
21-
- examples/list_dashboards.py XXX
22-
- examples/list_hosts.py XXX
23-
- examples/list_metrics.py XXX
24-
- examples/post_event.py XXX "test_event_name" -d "test event description"
25-
- examples/post_event_simple.py XXX "test_event_name" "test event description"
26-
- examples/list_events.py XXX
27-
- examples/delete_event.py XXX
28-
- examples/print_data_retention_info.py XXX
29-
- examples/print_explore_grouping.py XXX
30-
- examples/print_user_info.py XXX
31-
- examples/list_users.py XXX
32-
- examples/list_sysdig_captures.py XXX
33-
- examples/create_sysdig_capture.py XXX ip-10-0-1-115.ec2.internal apicapture 10
34-
- examples/notification_channels.py XXX
35-
- examples/user_team_mgmt.py XXX example-team [email protected]
11+
- examples/create_alert.py $DEMO_KUBE_API_TOKEN
12+
- examples/update_alert.py $DEMO_KUBE_API_TOKEN
13+
- examples/delete_alert.py $DEMO_KUBE_API_TOKEN
14+
- examples/dashboard.py $DEMO_KUBE_API_TOKEN
15+
- examples/create_dashboard.py $DEMO_KUBE_API_TOKEN
16+
- examples/delete_dashboard.py $DEMO_KUBE_API_TOKEN
17+
- examples/get_data_advanced.py $DEMO_KUBE_API_TOKEN ip-10-0-1-140.ec2.internal
18+
- examples/get_data_datasource.py $DEMO_KUBE_API_TOKEN
19+
- examples/get_data_simple.py $DEMO_KUBE_API_TOKEN
20+
- examples/list_alerts.py $DEMO_KUBE_API_TOKEN
21+
- examples/list_alert_notifications.py $DEMO_KUBE_API_TOKEN
22+
- examples/resolve_alert_notifications.py $DEMO_KUBE_API_TOKEN 1
23+
- examples/list_dashboards.py $DEMO_KUBE_API_TOKEN
24+
- examples/list_hosts.py $DEMO_KUBE_API_TOKEN
25+
- examples/list_metrics.py $DEMO_KUBE_API_TOKEN
26+
- examples/post_event.py $DEMO_KUBE_API_TOKEN "test_event_name" -d "test event description"
27+
- examples/post_event_simple.py $DEMO_KUBE_API_TOKEN "test_event_name" "test event description"
28+
- examples/list_events.py $DEMO_KUBE_API_TOKEN
29+
- examples/delete_event.py $DEMO_KUBE_API_TOKEN
30+
- examples/print_data_retention_info.py $DEMO_KUBE_API_TOKEN
31+
- examples/print_explore_grouping.py $DEMO_KUBE_API_TOKEN
32+
- examples/print_user_info.py $DEMO_KUBE_API_TOKEN
33+
- examples/list_users.py $DEMO_KUBE_API_TOKEN
34+
- examples/list_sysdig_captures.py $DEMO_KUBE_API_TOKEN
35+
- examples/create_sysdig_capture.py $DEMO_KUBE_API_TOKEN ip-10-0-1-115.ec2.internal apicapture 10
36+
- examples/notification_channels.py $DEMO_KUBE_API_TOKEN
37+
- examples/user_team_mgmt.py $DEMO_KUBE_API_TOKEN example-team [email protected]
38+
- unset SDC_TOKEN
39+
- bash test/test_secure_apis.sh
3640
- echo "Testing pip version"
3741
- rm -rf sdcclient
3842
- pip install sdcclient
39-
# - examples/create_alert.py XXX
40-
# - examples/delete_alert.py XXX
41-
# - examples/dashboard.py XXX
42-
# - examples/create_dashboard.py XXX
43-
# - examples/delete_dashboard.py XXX
44-
# - examples/get_data_advanced.py XXX ip-10-0-2-180.ec2.internal
45-
# - examples/get_data_datasource.py XXX
46-
# - examples/get_data_simple.py XXX
47-
# - examples/list_alerts.py XXX
48-
# - examples/list_alert_notifications.py XXX
49-
# - examples/resolve_alert_notifications.py XXX 1
50-
# - examples/list_dashboards.py XXX
51-
# - examples/list_hosts.py XXX
52-
# - examples/list_metrics.py XXX
53-
# - examples/post_event.py XXX "test event name" -d "test event description"
54-
# - examples/post_event_simple.py XXX "test event name" "test event description"
55-
# - examples/list_events.py XXX
56-
# - examples/delete_event.py XXX
57-
# - examples/print_data_retention_info.py XXX
58-
# - examples/print_explore_grouping.py XXX
59-
# - examples/print_user_info.py XXX
60-
# - examples/list_sysdig_captures.py XXX
61-
# - examples/create_sysdig_capture.py XXX ip-10-0-2-202.ec2.internal apicapture 10
43+
# - examples/create_alert.py $DEMO_KUBE_API_TOKEN
44+
# - examples/delete_alert.py $DEMO_KUBE_API_TOKEN
45+
# - examples/dashboard.py $DEMO_KUBE_API_TOKEN
46+
# - examples/create_dashboard.py $DEMO_KUBE_API_TOKEN
47+
# - examples/delete_dashboard.py $DEMO_KUBE_API_TOKEN
48+
# - examples/get_data_advanced.py $DEMO_KUBE_API_TOKEN ip-10-0-2-180.ec2.internal
49+
# - examples/get_data_datasource.py $DEMO_KUBE_API_TOKEN
50+
# - examples/get_data_simple.py $DEMO_KUBE_API_TOKEN
51+
# - examples/list_alerts.py $DEMO_KUBE_API_TOKEN
52+
# - examples/list_alert_notifications.py $DEMO_KUBE_API_TOKEN
53+
# - examples/resolve_alert_notifications.py $DEMO_KUBE_API_TOKEN 1
54+
# - examples/list_dashboards.py $DEMO_KUBE_API_TOKEN
55+
# - examples/list_hosts.py $DEMO_KUBE_API_TOKEN
56+
# - examples/list_metrics.py $DEMO_KUBE_API_TOKEN
57+
# - examples/post_event.py $DEMO_KUBE_API_TOKEN "test event name" -d "test event description"
58+
# - examples/post_event_simple.py $DEMO_KUBE_API_TOKEN "test event name" "test event description"
59+
# - examples/list_events.py $DEMO_KUBE_API_TOKEN
60+
# - examples/delete_event.py $DEMO_KUBE_API_TOKEN
61+
# - examples/print_data_retention_info.py $DEMO_KUBE_API_TOKEN
62+
# - examples/print_explore_grouping.py $DEMO_KUBE_API_TOKEN
63+
# - examples/print_user_info.py $DEMO_KUBE_API_TOKEN
64+
# - examples/list_sysdig_captures.py $DEMO_KUBE_API_TOKEN
65+
# - examples/create_sysdig_capture.py $DEMO_KUBE_API_TOKEN ip-10-0-2-202.ec2.internal apicapture 10
6266
notifications:
6367
slack:
6468
secure: GJ0H2wAaW67t3+x+cCjOVLw/b+YAZjH9rebAfluCFJklJS9u+V6/qqIyiNDAkMPIcgilFyhiyOQCZYXapgthQ1ieFbZZo//mrRtuGo2wuxCAwcOx2mXAZpZ4I5b3+Q/znVqSuqkwFRid1d138z4TW7sYSIburouDX3QUNoUOy+g7VJxCFQCcqlN8LYxGJHQYdOZa9zIGCtKrOtZ/B8C1TLgXmDMwAAVNO2WzL4GiBTLCGuMsQWMTLw2Qmv1ayZPztmeDWo1C9oa7HIH8Bg2YVjssR87el28X+EqEO533mgYjPmW2/hii30WVFOUE5hMdvKeQLBvy5N3/OCch1np0RQBd8eYEtaPv38rc5L2wAnUq9G5Zzr252z7vnwSLi6lap9jWU8tOerSTEPU+jG05PnuCnufVDXVNPyiPsH6BDP4qxHmLjooNpxfe63Df7NNyUi2I3QoroLj/UzI7zZVQjJEqsTrr5BbsH4z6NTGY91+ZqobBn62+hV3ESAam0ivQgC7s2AKko0qkKyIUGjj7ozU8ebo1UpagNvKC/J9szMqtdXJgKtG8BeonyLMeN6MEEyEvcMJbB4dCcfet+1Sb9AZWnGvYVdajhVLb1HE6OrbzZyhC3KqCe06J9O5BCY9ncy+l16i7MyIfcKTibHQlxPU+Id/VijD97JSRXxnd2i4=

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
Sysdig Cloud Python client library
1+
Sysdig Monitor/Secure Python client library
22
===
33

44
[![Build Status](https://travis-ci.org/draios/python-sdc-client.png?branch=master)](https://travis-ci.org/draios/python-sdc-client)
55
[![Current version on PyPI](http://img.shields.io/pypi/v/sdcclient.svg)](https://pypi.python.org/pypi/sdcclient)
66

7-
A Python client API for Sysdig Cloud.
7+
A Python client API for Sysdig Monitor/Sysdig Secure.
88

9-
This module is a wrapper around the Sysdig Cloud API, which is documented [here](http://support.sysdigcloud.com/hc/en-us/articles/205233166-The-Sysdig-Cloud-API-Specification). It exposes most of the sysdig REST API functionality as an easy to use and easy to install Python interface. The repository includes a rich set of examples (in the [examples](examples/) subdir) that quickly address several use cases.
9+
This module is a wrapper around the Sysdig Monitor/Sysdig Secure APIs, which are documented [here](http://support.sysdigcloud.com/hc/en-us/articles/205233166-The-Sysdig-Cloud-API-Specification). It exposes most of the sysdig REST API functionality as an easy to use and easy to install Python interface. The repository includes a rich set of examples (in the [examples](examples/) subdir) that quickly address several use cases.
1010

1111
Installation
1212
------------
@@ -20,36 +20,38 @@ Installation
2020

2121
Quick start
2222
-----------
23-
- If you are interested in exporting metrics data from Sysdig Cloud, take a look at [examples/get_data_simple.py](examples/get_data_simple.py) and [examples/get_data_advanced.py](examples/get_data_advanced.py).
23+
- If you are interested in exporting metrics data from Sysdig Monitor, take a look at [examples/get_data_simple.py](examples/get_data_simple.py) and [examples/get_data_advanced.py](examples/get_data_advanced.py).
2424
- If you want to programmatically create an alert, refer to [examples/create_alert.py](examples/create_alert.py)
2525
- If you want to programmatically create a dashboard, refer to [examples/create_dashboard.py](examples/create_dashboard.py)
2626

2727
Usage
2828
-----
2929

30-
_Note:_ in order to use this API you must obtain a Sysdig Cloud token. You can get your user's token in the _Sysdig Cloud API_ section of the [settings](https://app.sysdigcloud.com/#/settings/user) page.
30+
_Note:_ in order to use this API you must obtain a Sysdig Monitor/Secure API token. You can get your user's token in the _Sysdig Monitor API_ section of the settings page for [monitor](https://app.sysdigcloud.com/#/settings/user) or [secure](https://secure.sysdig.com/#/settings/user).
3131

32-
The library exports a single class, `SdcClient`, that is used to connect to Sysdig Cloud and execute actions. It can be instantiated like this:
32+
The library exports two classes, `SdMonClient` and `SdSecureClient` that are used to connect to Sysdig Monitor/Secure and execute actions. They can be instantiated like this:
3333

3434
``` python
35-
from sdcclient import SdcClient
35+
from sdcclient import SdMonClient
3636

37-
sdc_token = "MY_API_TOKEN"
37+
api_token = "MY_API_TOKEN"
3838

3939
#
40-
# Instantiate the SDC client
40+
# Instantiate the Sysdig Monitor client
4141
#
42-
sdclient = SdcClient(sdc_token)
42+
client = SdMonClient(api_token)
4343
```
4444

45+
For backwards compatibility purposes, a third class `SdcClient` is exported which is an alias of `SdMonClient`.
46+
4547
Once instantiated, all the methods documented below can be called on the object.
4648

47-
####Return Values
48-
Every method in the SdcClient class returns **a list with two entries**. The first one is a boolean value indicating if the call was successful. The second entry depends on the result:
49+
#### Return Values
50+
Every method in the SdMonClient/SdSecureClient classes returns **a list with two entries**. The first one is a boolean value indicating if the call was successful. The second entry depends on the result:
4951
- If the call was successful, it's a dictionary reflecting the json returned by the underlying REST call
5052
- If the call failed, it's a string describing the error
5153

52-
For an example on how to parse this output, take a look at a simple example like [get_data_simple.py](examples/get_data_simple.py)
54+
For an example on how to parse this output, take a look at a simple example like [get_data_simple.py](examples/get_data_simple.py)
5355

5456
Function List
5557
-------------
@@ -58,7 +60,7 @@ Please Refer to the [Python Script Library documentation page](http://python-sdc
5860

5961
On-Premises Installs
6062
--------------------
61-
For [On-Premises Sysdig Cloud installs](https://support.sysdigcloud.com/hc/en-us/articles/206519903-On-Premises-Installation-Guide), additional configuration is necessary to point to your API server rather than the default SaaS-based one, and also to easily connect when using a self-signed certificate for SSL. One way to handle this is by setting environment variables before running your Python scripts:
63+
For [On-Premises Sysdig Monitor installs](https://support.sysdigcloud.com/hc/en-us/articles/206519903-On-Premises-Installation-Guide), additional configuration is necessary to point to your API server rather than the default SaaS-based one, and also to easily connect when using a self-signed certificate for SSL. One way to handle this is by setting environment variables before running your Python scripts:
6264

6365
```
6466
export SDC_URL='https://<YOUR-API-SERVER-HOSTNAME-OR-IP>'
@@ -68,7 +70,7 @@ export SDC_SSL_VERIFY='false'
6870
Alternatively, you can specify the additional arguments in your Python scripts as you instantiate the SDC client:
6971

7072
```
71-
sdclient = SdcClient(sdc_token, sdc_url='https://<YOUR-API-SERVER-HOSTNAME-OR-IP>', ssl_verify=False)
73+
client = SdMonClient(api_token, sdc_url='https://<YOUR-API-SERVER-HOSTNAME-OR-IP>', ssl_verify=False)
7274
```
7375

7476

doc/index.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ This page documents the functions available in the `Python Script Library <https
1616
Function List
1717
=============
1818
.. py:module:: sdcclient
19-
.. autoclass:: SdcClient
19+
.. autoclass:: SdMonClient
2020
:members:
21+
:inherited-members:
22+
:undoc-members:
23+
.. autoclass:: SdSecureClient
24+
:members:
25+
:inherited-members:
2126
:undoc-members:

examples/add_policy.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env python
2+
#
3+
# Add a new policy
4+
#
5+
6+
import os
7+
import sys
8+
import json
9+
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), '..'))
10+
from sdcclient import SdSecureClient
11+
12+
def usage():
13+
print 'usage: %s <sysdig-token>' % sys.argv[0]
14+
print 'Reads policy json from standard input'
15+
print 'You can find your token at https://secure.sysdig.com/#/settings/user'
16+
sys.exit(1)
17+
18+
#
19+
# Parse arguments
20+
#
21+
if len(sys.argv) != 2:
22+
usage()
23+
24+
sdc_token = sys.argv[1]
25+
26+
policy_json = sys.stdin.read()
27+
28+
#
29+
# Instantiate the SDC client
30+
#
31+
sdclient = SdSecureClient(sdc_token, 'https://secure.sysdig.com')
32+
33+
res = sdclient.add_policy(policy_json)
34+
35+
#
36+
# Return the result
37+
#
38+
if res[0]:
39+
print json.dumps(res[1], indent=2)
40+
else:
41+
print res[1]
42+
sys.exit(1)
43+
44+

examples/create_default_policies.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env python
2+
#
3+
# Create the default set of policies given the falco rules file.
4+
# Existing policies with the same name are unchanged. New policies
5+
# as needed will be added. Returns JSON representing the new
6+
# policies created.
7+
#
8+
9+
import os
10+
import sys
11+
import json
12+
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), '..'))
13+
from sdcclient import SdSecureClient
14+
15+
def usage():
16+
print 'usage: %s <sysdig-token>' % sys.argv[0]
17+
print 'You can find your token at https://secure.sysdig.com/#/settings/user'
18+
sys.exit(1)
19+
20+
#
21+
# Parse arguments
22+
#
23+
if len(sys.argv) != 2:
24+
usage()
25+
26+
sdc_token = sys.argv[1]
27+
28+
#
29+
# Instantiate the SDC client
30+
#
31+
sdclient = SdSecureClient(sdc_token, 'https://secure.sysdig.com')
32+
33+
res = sdclient.create_default_policies()
34+
35+
#
36+
# Return the result
37+
#
38+
if res[0]:
39+
print json.dumps(res[1], indent=2)
40+
else:
41+
print res[1]
42+
sys.exit(1)
43+
44+

examples/delete_all_policies.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env python
2+
#
3+
# Delete all secure policies.
4+
#
5+
6+
import os
7+
import sys
8+
import json
9+
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), '..'))
10+
from sdcclient import SdSecureClient
11+
12+
def usage():
13+
print 'usage: %s <sysdig-token>' % sys.argv[0]
14+
print 'You can find your token at https://secure.sysdig.com/#/settings/user'
15+
sys.exit(1)
16+
17+
#
18+
# Parse arguments
19+
#
20+
if len(sys.argv) != 2:
21+
usage()
22+
23+
sdc_token = sys.argv[1]
24+
25+
#
26+
# Instantiate the SDC client
27+
#
28+
sdclient = SdSecureClient(sdc_token, 'https://secure.sysdig.com')
29+
30+
res = sdclient.delete_all_policies()
31+
32+
#
33+
# Return the result
34+
#
35+
if res[0]:
36+
print res[1]
37+
else:
38+
print res[1]
39+
sys.exit(1)
40+
41+

0 commit comments

Comments
 (0)