forked from meraki/dashboard-api-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsaml_roles.py
More file actions
106 lines (81 loc) · 3.62 KB
/
Copy pathsaml_roles.py
File metadata and controls
106 lines (81 loc) · 3.62 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
class SAMLRoles(object):
def __init__(self, session):
super(SAMLRoles, self).__init__()
self._session = session
def getOrganizationSamlRoles(self, organizationId: str):
"""
**List the SAML roles for this organization**
https://api.meraki.com/api_docs#list-the-saml-roles-for-this-organization
- organizationId (string)
"""
metadata = {
'tags': ['SAML roles'],
'operation': 'getOrganizationSamlRoles',
}
resource = f'/organizations/{organizationId}/samlRoles'
return self._session.get(metadata, resource)
def createOrganizationSamlRole(self, organizationId: str, **kwargs):
"""
**Create a SAML role**
https://api.meraki.com/api_docs#create-a-saml-role
- organizationId (string)
- role (string): The role of the SAML administrator
- orgAccess (string): The privilege of the SAML administrator on the organization
- tags (array): The list of tags that the SAML administrator has privleges on
- networks (array): The list of networks that the SAML administrator has privileges on
"""
kwargs.update(locals())
metadata = {
'tags': ['SAML roles'],
'operation': 'createOrganizationSamlRole',
}
resource = f'/organizations/{organizationId}/samlRoles'
body_params = ['role', 'orgAccess', 'tags', 'networks']
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
return self._session.post(metadata, resource, payload)
def getOrganizationSamlRole(self, organizationId: str, samlRoleId: str):
"""
**Return a SAML role**
https://api.meraki.com/api_docs#return-a-saml-role
- organizationId (string)
- samlRoleId (string)
"""
metadata = {
'tags': ['SAML roles'],
'operation': 'getOrganizationSamlRole',
}
resource = f'/organizations/{organizationId}/samlRoles/{samlRoleId}'
return self._session.get(metadata, resource)
def updateOrganizationSamlRole(self, organizationId: str, samlRoleId: str, **kwargs):
"""
**Update a SAML role**
https://api.meraki.com/api_docs#update-a-saml-role
- organizationId (string)
- samlRoleId (string)
- role (string): The role of the SAML administrator
- orgAccess (string): The privilege of the SAML administrator on the organization
- tags (array): The list of tags that the SAML administrator has privleges on
- networks (array): The list of networks that the SAML administrator has privileges on
"""
kwargs.update(locals())
metadata = {
'tags': ['SAML roles'],
'operation': 'updateOrganizationSamlRole',
}
resource = f'/organizations/{organizationId}/samlRoles/{samlRoleId}'
body_params = ['role', 'orgAccess', 'tags', 'networks']
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
return self._session.put(metadata, resource, payload)
def deleteOrganizationSamlRole(self, organizationId: str, samlRoleId: str):
"""
**Remove a SAML role**
https://api.meraki.com/api_docs#remove-a-saml-role
- organizationId (string)
- samlRoleId (string)
"""
metadata = {
'tags': ['SAML roles'],
'operation': 'deleteOrganizationSamlRole',
}
resource = f'/organizations/{organizationId}/samlRoles/{samlRoleId}'
return self._session.delete(metadata, resource)