Beispiel #1
0
def import_plugin(url='',
                  org='',
                  account='',
                  key='',
                  plugin_path='',
                  timeout=60,
                  **kwargs):
    plugin_name = os.path.splitext(os.path.basename(plugin_path))[0]
    plugin_extension = os.path.splitext(os.path.basename(plugin_path))[1]
    plugin_content = utils.read_file_content(plugin_path)
    payload = {
        "name": plugin_name,
        "extension": plugin_extension.replace('.', ''),
        "content": base64.b64encode(plugin_content)
    }
    print "restoring plugin %s" % plugin_name
    resp = requests.post(utils.build_api_url(url,
                                             org,
                                             account,
                                             endpoint='plugins'),
                         headers={'Authorization': "Bearer " + key},
                         data=payload,
                         timeout=timeout)

    if resp.status_code == 422:
        resp = requests.patch(utils.build_api_url(url,
                                                  org,
                                                  account,
                                                  endpoint='plugins/%s' %
                                                  plugin_name),
                              headers={'Authorization': "Bearer " + key},
                              data=payload,
                              timeout=timeout)
    return resp
Beispiel #2
0
def import_rule(url='', org='', account='', key='', rule_path='', timeout=60, **kwargs):
    rule_name = os.path.splitext(os.path.basename(rule_path))[0]
    rule_content = utils.read_file_content(rule_path)
    click.echo("restoring rule %s" % rule_name)
    post(utils.build_api_url(url, org, account,
                             endpoint='rules'),
         headers={'Authorization': "Bearer " + key},
         data={"name": rule_name}, timeout=timeout)
    return requests.put(
        utils.build_api_url(url, org, account,
                            endpoint='rules/%s' % rule_name),
        headers={'Authorization': "Bearer " + key, "Content-Type": "application/yaml"},
        data=rule_content, timeout=timeout)
Beispiel #3
0
def delete_agent(url='', org='', account='', key='', agent_name='', timeout=60, **kwargs):
    agent_map = get_agents(url, org, account, key)
    for agent in agent_map:
        if agent['name'] == agent_name:
            return requests.delete(utils.build_api_url(url, org, account,
                                                       endpoint='agents/%s' % agent['id']),
                                   headers={'Authorization': "Bearer " + key}, timeout=timeout)
Beispiel #4
0
def update_agents_metric_paths(url='', org='', account='', key='', agents='', metric='',
                               status='', timeout=60, **kwargs):
    return put(utils.build_api_url(url, org, account,
                                   endpoint='metrics/%s/series' % metric),
               headers={'Authorization': "Bearer " + key},
               params={"source": agents},
               data={'status': status}, timeout=timeout).json()
Beispiel #5
0
def get_agent_name_from_id(url='', org='', account='', key='', agent_id='', timeout=60, **kwargs):
    agents = get(utils.build_api_url(url, org, account,
                                     endpoint='agents'),
                 headers={'Authorization': "Bearer " + key}, timeout=timeout).json()
    for a in agents:
        if a['id'] == agent_id:
            return a['name']
Beispiel #6
0
def delete_template(url='', org='', account='', key='', name='', **kwargs):
    return requests.delete(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='templates/private/%s' % name),
        headers={'Authorization': "Bearer " + key})
Beispiel #7
0
def get_agent_series(url='', org='', account='', key='', agent_id='', metric='', resolution='', period='', **kwargs):
    return requests.get(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='metrics' + '/' + metric + '/series?source=' + agent_id + '&resolution=' + str(resolution) + '&period=' + str(period)),
        headers={'Authorization': "Bearer " + key}).json()
Beispiel #8
0
def delete_org(url='', org='', account='', key='', org_name='', **kwargs):
    return requests.delete(
        utils.build_api_url(url,
                            org,
                            account,
                            orglevel=True) + '/' + org_name,
        headers={'Authorization': "Bearer " + key})
Beispiel #9
0
def get_accounts(url='', org='', key='', **kwargs):
    return requests.get(
        utils.build_api_url(url,
                            org,
                            account='',
                            accountlevel=True),
        headers={'Authorization': "Bearer " + key}).json()
Beispiel #10
0
def put_dashboard(url='', org='', account='', key='', path='', template='', timeout=60, **kwargs):
    dashboard_name = os.path.splitext(os.path.basename(path))[0]
    dashboard_yaml = utils.read_file_content(path)
    return put(utils.build_api_url(url, org, account,
                                   endpoint='/templates/private/%s/dashboards/%s' % (template, dashboard_name)),
               headers={'Authorization': "Bearer " + key, "Content-Type": "application/yaml"},
               data=dashboard_yaml, timeout=timeout)
Beispiel #11
0
def put_plugin(url='',
               org='',
               account='',
               key='',
               path='',
               template='',
               timeout=60,
               type='INPROCESS',
               **kwargs):
    plugin_name = os.path.splitext(os.path.basename(path))[0]
    plugin_extension = os.path.splitext(os.path.basename(path))[1]
    plugin_content = utils.read_file_content(path)
    payload = {
        "name": plugin_name,
        "extension": plugin_extension.replace('.', ''),
        "content": base64.b64encode(plugin_content),
        "type": type
    }
    resp = post(utils.build_api_url(url,
                                    org,
                                    account,
                                    endpoint='/templates/private/%s/plugins' %
                                    template),
                headers={'Authorization': "Bearer " + key},
                data=payload,
                timeout=timeout)
    return resp
Beispiel #12
0
def delete_dashboard(url='', org='', account='', key='', dashboard='', **kwargs):
    return requests.delete(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='dashboards') + '/' + dashboard,
        headers={'Authorization': "Bearer " + key})
Beispiel #13
0
def put_rule(url='', org='', account='', key='', path='', template='', timeout=60, **kwargs):
    rule_name = os.path.splitext(os.path.basename(path))[0]
    rule_content = utils.read_file_content(path)
    return post(utils.build_api_url(url, org, account,
                                    endpoint='/templates/private/%s/rules' % template),
                headers={'Authorization': "Bearer " + key, "Content-Type": "application/yaml"},
                data=rule_content, timeout=timeout)
Beispiel #14
0
def export_dashboard(url='', org='', account='', key='', dashboard='', **kwargs):
    return requests.get(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='dashboards') + '/' + dashboard,
        headers={'Authorization': "Bearer " + key, "Accept": "application/yaml"}).content
Beispiel #15
0
def delete_tag(url='', org='', account='', key='', tag='', **kwargs):
    return requests.delete(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='tags') + '/' + tag,
        headers={'Authorization': "Bearer " + key})
Beispiel #16
0
def get_tags(url='', org='', account='', key='', **kwargs):
    return requests.get(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='tags'),
        headers={'Authorization': "Bearer " + key}).json()
Beispiel #17
0
def get_criteria(url='', org='', account='', key='', rule='', **kwargs):
    return requests.get(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='rules' + '/' + rule + '/criteria'),
        headers={'Authorization': "Bearer " + key}).json()
Beispiel #18
0
def get_agent_series(url='', org='', account='', key='', agent_id='', metric='',
                     resolution='', period='', timeout=60, **kwargs):
    return get(
        utils.build_api_url(url, org, account,
                            endpoint='metrics/%s/series?source=%s&resolution=%s&period=%s' % (
                                metric, agent_id, resolution, period)),
        headers={'Authorization': "Bearer " + key}, timeout=timeout).json()
Beispiel #19
0
def import_rule(url='', org='', account='', key='', rule_path='', **kwargs):
    rule_name = os.path.splitext(os.path.basename(rule_path))[0]
    rule_content = utils.read_file_content(rule_path)
    requests.post(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='rules'),
        headers={'Authorization': "Bearer " + key},
        data={"name": rule_name})
    requests.put(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='rules' + '/' + rule_name),
        headers={'Authorization': "Bearer " + key, "Content-Type": "application/yaml"},
        data=rule_content)
Beispiel #20
0
def install_template(url='', org='', account='', key='', name='', **kwargs):
    return requests.post(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='/packs'),
        headers={'Authorization': "Bearer " + key},
        json={"name": name, "force": True, "email": "", "repo": "private"})
Beispiel #21
0
def get_agent_metrics(url='', org='', account='', key='', agent_id='', **kwargs):
    return requests.get(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='metrics'),
        headers={'Authorization': "Bearer " + key},
        params={"source": agent_id}).json()
Beispiel #22
0
def get_tag_metrics(url='', org='', account='', key='', tag_name='', **kwargs):
    return requests.get(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='metrics'),
        headers={'Authorization': "Bearer " + key},
        params={"tag": tag_name}).json()
Beispiel #23
0
def export_plugin(url='', org='', account='', key='', plugin='', **kwargs):
    resp = requests.get(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='plugins') + '/' + plugin,
        headers={'Authorization': "Bearer " + key}).json()
    return base64.b64decode(resp['content'])
Beispiel #24
0
def create_template(url='', org='', account='', key='', name='', **kwargs):
    return requests.post(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='templates/private'),
        data={"name": name},
        headers={'Authorization': "Bearer " + key})
Beispiel #25
0
def delete_stream(url='', org='', account='', key='', stream='', **kwargs):
    return requests.delete(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='annotations/%s' % stream
                            ),
        headers={'Authorization': "Bearer " + key})
Beispiel #26
0
def create_annotation(url='', org='', account='', key='', stream='', name='', description='', **kwargs):
    return requests.post(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='annotations/%s' % stream
                            ),
        headers={'Authorization': "Bearer " + key},
        json={"name": name, "description": description})
Beispiel #27
0
def import_dashboard(url='', org='', account='', key='', file_path='', timeout=60, **kwargs):
    dashboard_name = os.path.splitext(os.path.basename(file_path))[0]
    dashboard_yaml = utils.read_file_content(file_path)
    print "restoring dashboard %s" % dashboard_name
    return put(utils.build_api_url(url, org, account,
                                   endpoint='dashboards/%s' % dashboard_name),
               headers={'Authorization': "Bearer " + key, "Content-Type": "application/yaml",
                        "Accept-Encoding": "identity"},
               data=dashboard_yaml, timeout=timeout)
Beispiel #28
0
def put_manifest(url='', org='', account='', key='', name='', path='', **kwargs):
    content = yaml.safe_load(utils.read_file_content(os.path.join(path, 'package.yaml')))
    return requests.put(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='templates/private/%s' % name),
        headers={'Authorization': "Bearer " + key, "Content-Type": "application/json"},
        data=json.dumps(content))
Beispiel #29
0
def import_dashboard(url='', org='', account='', key='', file_path='', **kwargs):
    dashboard_name = os.path.splitext(os.path.basename(file_path))[0]
    dashboard_yaml = utils.read_file_content(file_path)
    return requests.put(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='dashboards') + '/' + dashboard_name,
        headers={'Authorization': "Bearer " + key, "Content-Type": "application/yaml"},
        data=dashboard_yaml)
Beispiel #30
0
def import_plugin(url='', org='', account='', key='', plugin_path='', timeout=60, **kwargs):
    plugin_name = os.path.splitext(os.path.basename(plugin_path))[0]
    plugin_extension = os.path.splitext(os.path.basename(plugin_path))[1]
    plugin_content = utils.read_file_content(plugin_path)
    payload = {
        "name": plugin_name,
        "extension": plugin_extension.replace('.', ''),
        "content": base64.b64encode(plugin_content)
    }
    print "restoring plugin %s" % plugin_name
    resp = requests.post(utils.build_api_url(url, org, account,
                                             endpoint='plugins'),
                         headers={'Authorization': "Bearer " + key},
                         data=payload, timeout=timeout)

    if resp.status_code == 422:
        resp = requests.patch(utils.build_api_url(url, org, account,
                                                  endpoint='plugins/%s' % plugin_name),
                              headers={'Authorization': "Bearer " + key},
                              data=payload, timeout=timeout)
    return resp
Beispiel #31
0
def delete_template(url='',
                    org='',
                    account='',
                    key='',
                    name='',
                    timeout=60,
                    **kwargs):
    return delete(utils.build_api_url(url,
                                      org,
                                      account,
                                      endpoint='templates/private/%s' % name),
                  headers={'Authorization': "Bearer " + key},
                  timeout=timeout)
Beispiel #32
0
def delete_dashboard(url='',
                     org='',
                     account='',
                     key='',
                     dashboard='',
                     timeout=60,
                     **kwargs):
    return delete(utils.build_api_url(url,
                                      org,
                                      account,
                                      endpoint='dashboards/%s' % dashboard),
                  headers={'Authorization': "Bearer " + key},
                  timeout=timeout)
Beispiel #33
0
def delete_plugin(url='',
                  org='',
                  account='',
                  key='',
                  plugin='',
                  timeout=60,
                  **kwargs):
    return delete(utils.build_api_url(url,
                                      org,
                                      account,
                                      endpoint='plugins/%s' % plugin),
                  headers={'Authorization': "Bearer " + key},
                  timeout=timeout)
Beispiel #34
0
def get_private_templates(url='',
                          org='',
                          account='',
                          key='',
                          timeout=60,
                          **kwargs):
    return get(utils.build_api_url(url,
                                   org,
                                   account,
                                   endpoint='templates/private'),
               headers={
                   'Authorization': "Bearer " + key
               },
               timeout=timeout).json()
Beispiel #35
0
def create_template(url='',
                    org='',
                    account='',
                    key='',
                    name='',
                    timeout=60,
                    **kwargs):
    return post(utils.build_api_url(url,
                                    org,
                                    account,
                                    endpoint='templates/private'),
                data={"name": name},
                headers={'Authorization': "Bearer " + key},
                timeout=timeout)
Beispiel #36
0
def get_agent_name_from_id(url='',
                           org='',
                           account='',
                           key='',
                           agent_id='',
                           timeout=60,
                           **kwargs):
    agents = get(utils.build_api_url(url, org, account, endpoint='agents'),
                 headers={
                     'Authorization': "Bearer " + key
                 },
                 timeout=timeout).json()
    for a in agents:
        if a['id'] == agent_id:
            return a['name']
Beispiel #37
0
def put_plugin(url='', org='', account='', key='', path='', template='', timeout=60, type='INPROCESS', **kwargs):
    plugin_name = os.path.splitext(os.path.basename(path))[0]
    plugin_extension = os.path.splitext(os.path.basename(path))[1]
    plugin_content = utils.read_file_content(path)
    payload = {
        "name": plugin_name,
        "extension": plugin_extension.replace('.', ''),
        "content": base64.b64encode(plugin_content),
        "type": type
    }
    resp = post(utils.build_api_url(url, org, account,
                                    endpoint='/templates/private/%s/plugins' % template),
                headers={'Authorization': "Bearer " + key},
                data=payload, timeout=timeout)
    return resp
Beispiel #38
0
def ping_agent(url='',
               org='',
               account='',
               key='',
               payload='',
               finger='',
               timeout=60,
               **kwargs):
    return post(utils.build_api_url(url,
                                    org,
                                    account,
                                    endpoint='agents/%s/ping' % finger),
                headers={'Authorization': "Bearer " + key},
                data=payload,
                timeout=timeout)
Beispiel #39
0
def get_agent(url='',
              org='',
              account='',
              key='',
              agent_name='',
              timeout=60,
              **kwargs):
    agent_map = get_agents(url=url, org=org, account=account, key=key)
    for agent in agent_map:
        if agent['name'] == agent_name:
            return get(utils.build_api_url(url,
                                           org,
                                           account,
                                           endpoint='agents/%s' % agent['id']),
                       headers={'Authorization': "Bearer " + key},
                       timeout=timeout)
Beispiel #40
0
def export_plugin(url='',
                  org='',
                  account='',
                  key='',
                  plugin='',
                  timeout=60,
                  **kwargs):
    resp = get(utils.build_api_url(url,
                                   org,
                                   account,
                                   endpoint='plugins/%s' % plugin),
               headers={
                   'Authorization': "Bearer " + key
               },
               timeout=timeout).json()
    return base64.b64decode(resp['content'])
Beispiel #41
0
def install_template(url='',
                     org='',
                     account='',
                     key='',
                     name='',
                     timeout=60,
                     **kwargs):
    return post(utils.build_api_url(url, org, account, endpoint='/packs'),
                headers={'Authorization': "Bearer " + key},
                json={
                    "name": name,
                    "force": True,
                    "email": "",
                    "repo": "private"
                },
                timeout=timeout)
Beispiel #42
0
def export_dashboard(url='',
                     org='',
                     account='',
                     key='',
                     dashboard='',
                     timeout=60,
                     **kwargs):
    return get(utils.build_api_url(url,
                                   org,
                                   account,
                                   endpoint='dashboards/%s' % dashboard),
               headers={
                   'Authorization': "Bearer " + key,
                   "Accept": "application/yaml"
               },
               timeout=timeout).content
Beispiel #43
0
def update_tag_metrics(url='',
                       org='',
                       account='',
                       key='',
                       tag='',
                       status='',
                       timeout=60,
                       **kwargs):
    return put(utils.build_api_url(url,
                                   org,
                                   account,
                                   endpoint='metrics/series?tag=%s' % tag),
               headers={
                   'Authorization': "Bearer " + key
               },
               data={
                   'status': status
               },
               timeout=timeout).json()
Beispiel #44
0
def get_agent_series(url='',
                     org='',
                     account='',
                     key='',
                     agent_id='',
                     metric='',
                     resolution='',
                     period='',
                     timeout=60,
                     **kwargs):
    return get(utils.build_api_url(
        url,
        org,
        account,
        endpoint='metrics/%s/series?source=%s&resolution=%s&period=%s' %
        (metric, agent_id, resolution, period)),
               headers={
                   'Authorization': "Bearer " + key
               },
               timeout=timeout).json()
Beispiel #45
0
def put_manifest(url='',
                 org='',
                 account='',
                 key='',
                 name='',
                 path='',
                 timeout=60,
                 **kwargs):
    content = yaml.safe_load(
        utils.read_file_content(os.path.join(path, 'package.yaml')))
    return put(utils.build_api_url(url,
                                   org,
                                   account,
                                   endpoint='templates/private/%s' % name),
               headers={
                   'Authorization': "Bearer " + key,
                   "Content-Type": "application/json"
               },
               data=json.dumps(content),
               timeout=timeout)
Beispiel #46
0
def put_rule(url='',
             org='',
             account='',
             key='',
             path='',
             template='',
             timeout=60,
             **kwargs):
    rule_name = os.path.splitext(os.path.basename(path))[0]
    rule_content = utils.read_file_content(path)
    return post(utils.build_api_url(url,
                                    org,
                                    account,
                                    endpoint='/templates/private/%s/rules' %
                                    template),
                headers={
                    'Authorization': "Bearer " + key,
                    "Content-Type": "application/yaml"
                },
                data=rule_content,
                timeout=timeout)
Beispiel #47
0
def run_command(url='', org='', account='', key='', command='', agent_list='', **kwargs):
    plugin_content = '#!/usr/bin/env bash \n' + command
    requests = (grequests.post(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='rpc' + '/run'),
        data={
            'name': 'temp.sh',
            'agent': agent_id,
            'content': base64.b64encode(plugin_content),
            'encoding': 'base64',
            'params': '',
            'type': 'SCRIPT'
        },
        callback=set_meta(agent_id),
        headers={'Authorization': "Bearer " + key}) for agent_id in agent_list)
    data = []
    for resp in grequests.imap(requests, size=10):
        data.append([resp.meta, resp.json()])
    return data
Beispiel #48
0
def import_dashboard(url='',
                     org='',
                     account='',
                     key='',
                     file_path='',
                     timeout=60,
                     **kwargs):
    dashboard_name = os.path.splitext(os.path.basename(file_path))[0]
    dashboard_yaml = utils.read_file_content(file_path)
    print "restoring dashboard %s" % dashboard_name
    return put(utils.build_api_url(url,
                                   org,
                                   account,
                                   endpoint='dashboards/%s' % dashboard_name),
               headers={
                   'Authorization': "Bearer " + key,
                   "Content-Type": "application/yaml",
                   "Accept-Encoding": "identity"
               },
               data=dashboard_yaml,
               timeout=timeout)
Beispiel #49
0
def put_dashboard(url='',
                  org='',
                  account='',
                  key='',
                  path='',
                  template='',
                  timeout=60,
                  **kwargs):
    dashboard_name = os.path.splitext(os.path.basename(path))[0]
    dashboard_yaml = utils.read_file_content(path)
    return put(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='/templates/private/%s/dashboards/%s' %
                            (template, dashboard_name)),
        headers={
            'Authorization': "Bearer " + key,
            "Content-Type": "application/yaml"
        },
        data=dashboard_yaml,
        timeout=timeout)
Beispiel #50
0
def update_agents_metric_paths(url='',
                               org='',
                               account='',
                               key='',
                               agents='',
                               metric='',
                               status='',
                               timeout=60,
                               **kwargs):
    return put(utils.build_api_url(url,
                                   org,
                                   account,
                                   endpoint='metrics/%s/series' % metric),
               headers={
                   'Authorization': "Bearer " + key
               },
               params={
                   "source": agents
               },
               data={
                   'status': status
               },
               timeout=timeout).json()
Beispiel #51
0
def run_local(url='', org='', account='', key='', plugin_path='', agent_list='', **kwargs):
    plugin_name = os.path.splitext(os.path.basename(plugin_path))
    plugin_content = utils.read_file_content(plugin_path)
    requests = (grequests.post(
        utils.build_api_url(url,
                            org,
                            account,
                            endpoint='rpc' + '/run'),
        data={
            'name': plugin_name,
            'agent': agent_id,
            'content': base64.b64encode(plugin_content),
            'encoding': 'base64',
            'shell': '',
            'params': '',
            'type': 'INPROCESS'
        },
        callback=set_meta(agent_id),
        headers={'Authorization': "Bearer " + key}) for agent_id in agent_list)
    data = []
    for resp in grequests.imap(requests, size=10):
        data.append([resp.meta, resp.json()])
    return data
Beispiel #52
0
def get_dashboards(url='', org='', account='', key='', timeout=60, **kwargs):
    return get(utils.build_api_url(url, org, account, endpoint='dashboards'),
               headers={
                   'Authorization': "Bearer " + key
               },
               timeout=timeout).json()
Beispiel #53
0
def get_agent_metrics(url='', org='', account='', key='', agent_id='', timeout=60, **kwargs):
    return get(utils.build_api_url(url, org, account,
                                   endpoint='metrics'),
               headers={'Authorization': "Bearer " + key},
               params={"source": agent_id}, timeout=timeout).json()
Beispiel #54
0
def get_tag_metrics(url='', org='', account='', key='', tag_name='', timeout=60, **kwargs):
    return get(utils.build_api_url(url, org, account,
                                   endpoint='metrics'),
               headers={'Authorization': "Bearer " + key},
               params={"tag": tag_name}, timeout=timeout).json()
Beispiel #55
0
def unmute_rule(url='', org='', account='', key='', rule='', timeout=60, **kwargs):
    click.echo("unmuting rule %s" % rule)
    return patch(utils.build_api_url(url, org, account,
                                     endpoint='rules/%s' % rule),
                 headers={'Authorization': "Bearer " + key}, data={'mute': False}, timeout=timeout)
Beispiel #56
0
def delete_rule(url='', org='', account='', key='', rule='', timeout=60, **kwargs):
    return delete(utils.build_api_url(url, org, account,
                                      endpoint='rules/%s' % rule),
                  headers={'Authorization': "Bearer " + key}, timeout=timeout)
Beispiel #57
0
def get_criteria(url='', org='', account='', key='', rule='', timeout=60, **kwargs):
    return get(utils.build_api_url(url, org, account,
                                   endpoint='rules/%s/criteria' % rule),
               headers={'Authorization': "Bearer " + key}, timeout=timeout).json()
Beispiel #58
0
def get_accounts(url='', org='', key='', timeout=60, **kwargs):
    return get(utils.build_api_url(url, org, account='', account_level=True),
               headers={
                   'Authorization': "Bearer " + key
               },
               timeout=timeout).json()
Beispiel #59
0
def delete_account(url='', org='', account='', key='', timeout=60, **kwargs):
    return delete(utils.build_api_url(url, org, account, account_level=True) +
                  '/' + account,
                  headers={'Authorization': "Bearer " + key},
                  timeout=timeout)