import json from sseapiclient.tornado import SyncClient client = SyncClient.connect('https://localhost', 'root', 'saltstack!2019', ssl_validate_cert=False) print(json.dumps(client.api.ret.get_jids(), indent=4)) print(json.dumps(client.api.ret.get_jid(jid='20191228000349422099'), indent=4)) print( json.dumps(client.api.ret.get_load(master_id='slb-master', jid='20191228000349422099'), indent=4))
from concurrent.futures import TimeoutError from sseapiclient.tornado import SyncClient conn_settings = { 'url': 'https://172.31.3.83', 'username': '******', 'password': '******', 'ssl_validation': False, 'DS_config_name': 'winad' } print("SSE - AD integration") try: client = SyncClient.connect( conn_settings['url'], conn_settings['username'], conn_settings['password'], ssl_validate_cert=conn_settings['ssl_validation']) print("Connected to SSE") except: print("Can't connect to SSE") sys.exit(1) # JUST GETTING INFO FROM MANUALLY C:REATED OBJECT def show_role_group_target(hostname): print("JUST GETTING SOME INFO FOR TESTING") # Get target print("TARGET INFO: ") try:
# cat del_auth_config.py import json from sseapiclient.tornado import SyncClient client = SyncClient.connect('https://X', 'root', 'XXX', ssl_validate_cert=False) print(json.dumps(client.api.settings.get_auth_config(), indent=4)) #ret = client.api.settings.delete_auth_config(config_name='fakewidad') #print(ret)
import json from sseapiclient.tornado import SyncClient client = SyncClient.connect('https://localhost', 'root', 'xxxxx', ssl_validate_cert=False) print(json.dumps(client.api.license.check_usage(), indent=4)) print(json.dumps(client.api.license.get_current_license(), indent=4))
from sseapiclient.tornado import SyncClient import json raas = 'http://localhost:8080' client = SyncClient.connect(raas, 'root', 'salt', rpc_api_version='2', force_restfull=False) with open('jobdata.json', 'r') as f: array = json.load(f) for i in range(0, 500): job = client.api.job.save_job(fun=array['job1']['fun'], name=array['job1']['name'], cmd=array['job1']['cmd']) print(job)
from sseapiclient.tornado import SyncClient host = 'https://192.168.50.11' user = '******' password = '******' client = SyncClient.connect(host, user, password, ssl_validate_cert=False) client.api.admin.trim_database( audit=5, events=5, jobs=5, schedule=5, test=False)