File: accounts.py

package info (click to toggle)
python-duo-client 4.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 536 kB
  • sloc: python: 5,044; sh: 6; makefile: 3
file content (42 lines) | stat: -rw-r--r-- 1,287 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
Duo Security Accounts API reference client implementation.

<http://www.duosecurity.com/docs/accountsapi>
"""
from __future__ import absolute_import
from . import client

class Accounts(client.Client):
    def get_child_accounts(self):
        """
        Return a list of all child accounts of the integration's account.
        """
        params = {}
        response = self.json_api_call('POST',
                                      '/accounts/v1/account/list',
                                      params)
        return response

    def create_account(self, name):
        """
        Create a new child account of the integration's account.
        """
        params = {
            'name': name,
        }
        response = self.json_api_call('POST',
                                      '/accounts/v1/account/create',
                                      params)
        return response

    def delete_account(self, account_id):
        """
        Delete a child account of the integration's account.
        """
        params = {
            'account_id': account_id,
        }
        response = self.json_api_call('POST',
                                      '/accounts/v1/account/delete',
                                      params)
        return response