forked from DataDog/datadogpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusers.py
More file actions
50 lines (40 loc) · 1.41 KB
/
users.py
File metadata and controls
50 lines (40 loc) · 1.41 KB
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
43
44
45
46
47
48
49
50
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2015-Present Datadog, Inc
from datadog.api.resources import (
ActionAPIResource,
GetableAPIResource,
CreateableAPIResource,
UpdatableAPIResource,
ListableAPIResource,
DeletableAPIResource,
)
class User(
ActionAPIResource,
GetableAPIResource,
CreateableAPIResource,
UpdatableAPIResource,
ListableAPIResource,
DeletableAPIResource,
):
_resource_name = "user"
"""
A wrapper around User HTTP API.
"""
@classmethod
def invite(cls, emails):
"""
Send an invite to join datadog to each of the email addresses in the
*emails* list. If *emails* is a string, it will be wrapped in a list and
sent. Returns a list of email addresses for which an email was sent.
:param emails: emails addresses to invite to join datadog
:type emails: string list
:returns: Dictionary representing the API's JSON response
"""
print("[DEPRECATION] User.invite() is deprecated. Use `create` instead.")
if not isinstance(emails, list):
emails = [emails]
body = {
"emails": emails,
}
return super(User, cls)._trigger_action("POST", "/invite_users", **body)