-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(access_key): Implement teamId in create_access_key and implement…
… update_access_key (#251) Signed-off-by: Daniele De Lorenzi <daniele.delorenzi@sysdig.com>
- Loading branch information
Showing
3 changed files
with
130 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env python | ||
# | ||
# List all the access keys in a Sysdig Monitor environment. The token you provide must | ||
# have Admin rights. | ||
# | ||
|
||
import sys | ||
|
||
from sdcclient import SdcClient | ||
|
||
# | ||
# Parse arguments | ||
# | ||
if len(sys.argv) != 2: | ||
print('usage: %s <sysdig-token>' % sys.argv[0]) | ||
print('You can find your token at https://app.sysdigcloud.com/#/settings/user') | ||
print('For this script to work, the user for the token must have Admin rights') | ||
sys.exit(1) | ||
|
||
sdc_token = sys.argv[1] | ||
|
||
# Maximum number of agents allowed to connect for this access key. Set to '' if not required | ||
agent_limit = '' | ||
# Number of agent licenses that are ALWAYS available to this access key. This directly counts against the maximum number of available licenses. Set to '' if not required. | ||
agent_reserved = '' | ||
# Team ID to which to assign the access key. Team ID must be valid. Set to '' if not required. | ||
team_id = '' | ||
|
||
|
||
# | ||
# Instantiate the SDC client | ||
# | ||
sdclient = SdcClient(sdc_token, 'https://app.sysdigcloud.com') | ||
|
||
# | ||
# Get the configuration | ||
# | ||
ok, res = sdclient.create_access_key( | ||
agent_limit, | ||
agent_reserved, | ||
team_id) | ||
|
||
if ok: | ||
print('Access Key: {}\nTeam ID: {}\nAgent Limit: {}\nAgent Reserved: {}\n==========='.format(res['customerAccessKey']['accessKey'], res['customerAccessKey']['teamId'], res['customerAccessKey']['limit'], res['customerAccessKey']['reservation'])) | ||
else: | ||
print(res) | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env python | ||
# | ||
# List all the access keys in a Sysdig Monitor environment. The token you provide must | ||
# have Admin rights. | ||
# | ||
|
||
import sys | ||
|
||
from sdcclient import SdcClient | ||
|
||
# | ||
# Parse arguments | ||
# | ||
if len(sys.argv) != 2: | ||
print('usage: %s <sysdig-token>' % sys.argv[0]) | ||
print('You can find your token at https://app.sysdigcloud.com/#/settings/user') | ||
print('For this script to work, the user for the token must have Admin rights') | ||
sys.exit(1) | ||
|
||
sdc_token = sys.argv[1] | ||
|
||
# Access Key that needs to be updated | ||
accessKey = '' | ||
# Maximum number of agents allowed to connect for this access key. Set to '' if not required | ||
agent_limit = '' | ||
# Number of agent licenses that are ALWAYS available to this access key. This directly counts against the maximum number of available licenses. Set to '' if not required. | ||
agent_reserved = '' | ||
# Team ID to which to assign the access key. Team ID must be valid. Set to '' if not required. | ||
team_id = '' | ||
|
||
|
||
# | ||
# Instantiate the SDC client | ||
# | ||
sdclient = SdcClient(sdc_token, 'https://app.sysdigcloud.com') | ||
|
||
# | ||
# Get the configuration | ||
# | ||
if accessKey: | ||
ok, res = sdclient.update_access_key( | ||
accessKey, | ||
agent_limit, | ||
agent_reserved, | ||
team_id) | ||
else: | ||
print('Please specify the Access Key that you would like to be updated') | ||
sys.exit(1) | ||
|
||
if ok: | ||
print('Access Key: {}\nTeam ID: {}\nAgent Limit: {}\nAgent Reserved: {}\n==========='.format(res['customerAccessKey']['accessKey'], res['customerAccessKey']['teamId'], res['customerAccessKey']['limit'], res['customerAccessKey']['reservation'])) | ||
else: | ||
print(res) | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters