-
Notifications
You must be signed in to change notification settings - Fork 3
/
roles.d.ts
272 lines (270 loc) · 9.11 KB
/
roles.d.ts
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
import { A as ApiCallOptions } from './invoke-fetch-types-0Dw3a71T.js';
import './auth-types-PkN9CAF_.js';
type CreateRole = {
/** Selection of scopes to assign to role */
assignedScopes?: string[];
/** Role description */
description?: string;
/** Role name, needs to be unique */
name: string;
};
/**
* An error object describing the error.
*/
type Error = {
/** The error code. */
code: string;
/** A human-readable explanation specific to this occurrence of the problem. */
detail?: string;
/** Additional properties relating to the error. */
meta?: unknown;
/** References to the source of the error. */
source?: {
/** The URI query parameter that caused the error. */
parameter?: string;
/** A JSON Pointer to the property that caused the error. */
pointer?: string;
};
/** Summary of the problem. */
title: string;
};
/**
* The error response object describing the error from the handling of an HTTP request.
*/
type Errors = {
/** An array of errors related to the operation. */
errors?: Error[];
/** A unique identifier for tracing the error. */
traceId?: string;
};
/**
* Contains pagination links
*/
type Links = {
/** Link to the next page of items */
next?: {
href: string;
};
/** Link to the previous page of items */
prev?: {
href: string;
};
/** Link to the current page of items */
self: {
href: string;
};
};
type ListRolesResult = {
/** An array of roles. */
data: Role[];
/** Contains pagination links */
links: Links;
/** Indicates the total number of matching documents. Will only be returned if the query parameter "totalResults" is true. */
totalResults?: number;
};
/**
* A JSON Patch document as defined in http://tools.ietf.org/html/rfc6902.
*/
type PatchRole = {
op: "replace";
path: "/name" | "/description" | "/assignedScopes";
value: string | string[];
};
/**
* An array of JSON Patch documents
*/
type PatchRoles = PatchRole[];
type Role = {
/** Selection of scopes added to this Role */
assignedScopes?: string[];
/** Indicate if role can be deleted */
readonly canDelete?: boolean;
/** Indicate if role can be edited by tenant (Shown as Profile in MC) */
readonly canEdit?: boolean;
/** The timestamp for when the role was created. */
createdAt: string;
/** Id of user that created role */
readonly createdBy?: string;
/** Descriptive text for the role. */
description: string;
/** @deprecated
* DEPRECATED. Use userEntitlementType instead for impact of roles on user entitlements with a capacity-based subscription. */
readonly fullUser?: boolean;
/** The unique identifier for the role. */
readonly id: string;
/** The timestamp for when the role was last updated. */
lastUpdatedAt: string;
/** The level of access associated to the role. */
level?: "admin" | "user";
/** Contains links for the role. */
links: {
self: {
/** Link to the role. */
href: string;
};
};
/** The name of the role. */
name: string;
/** An array of permissions associated with the role. */
permissions?: string[];
/** The tenant unique identifier associated with the given Role. */
tenantId: string;
/** The type of role. */
type: "default" | "custom";
/** Id of user that last updated this role */
readonly updatedBy?: string;
/** Indicate whether this role will trigger promotion of a user from a basic to a full user on tenants with a capacity-based subscription. Does not apply to tenants with a user-based subscription. Returns fullUser if it will trigger promotion. */
readonly userEntitlementType?: string;
};
/**
* Returns a list of roles using cursor-based pagination.
*
* @param query an object with query parameters
* @throws GetRolesHttpError
*/
declare const getRoles: (query: {
/** The advanced filtering to use for the query. Refer to [RFC 7644](https://datatracker.ietf.org/doc/rfc7644/) for the syntax. All conditional statements within this query parameter are case insensitive. */
filter?: string;
/** The number of roles to retrieve. */
limit?: number;
/** The next page cursor. */
next?: string;
/** The previous page cursor. */
prev?: string;
/** Optional resource field name to sort on, eg. name. Can be prefixed with +/- to determine order, defaults to (+) ascending. */
sort?: string;
/** Determines wether to return a count of the total records matched in the query. Defaults to false. */
totalResults?: boolean;
}, options?: ApiCallOptions) => Promise<GetRolesHttpResponse>;
type GetRolesHttpResponse = {
data: ListRolesResult;
headers: Headers;
status: number;
prev?: (options?: ApiCallOptions) => Promise<GetRolesHttpResponse>;
next?: (options?: ApiCallOptions) => Promise<GetRolesHttpResponse>;
};
type GetRolesHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Creates a custom role. Role names must be unique, and there is a maximum of 500 custom roles per tenant. Requestor must be assigned the `TenantAdmin` role.
*
* @param body an object with the body content
* @throws CreateRoleHttpError
*/
declare const createRole: (body: CreateRole, options?: ApiCallOptions) => Promise<CreateRoleHttpResponse>;
type CreateRoleHttpResponse = {
data: Role;
headers: Headers;
status: number;
};
type CreateRoleHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Deletes the requested role. Role can only be deleted if it has been unassigned from all users and groups. Only applicable to roles of type `custom`. Requestor must be assigned the `TenantAdmin` role.
*
* @param id The unique identifier for the role.
* @throws DeleteRoleHttpError
*/
declare const deleteRole: (id: string, options?: ApiCallOptions) => Promise<DeleteRoleHttpResponse>;
type DeleteRoleHttpResponse = {
data: void;
headers: Headers;
status: number;
};
type DeleteRoleHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Returns the requested role.
*
* @param id The unique identifier for the role.
* @throws GetRoleHttpError
*/
declare const getRole: (id: string, options?: ApiCallOptions) => Promise<GetRoleHttpResponse>;
type GetRoleHttpResponse = {
data: Role;
headers: Headers;
status: number;
};
type GetRoleHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Updates the requested role. Only applicable to roles of type `custom`. Requestor must be assigned the `TenantAdmin` role.
*
* @param id The unique identifier for the role.
* @param body an object with the body content
* @throws PatchRoleHttpError
*/
declare const patchRole: (id: string, body: PatchRoles[], options?: ApiCallOptions) => Promise<PatchRoleHttpResponse>;
type PatchRoleHttpResponse = {
data: void;
headers: Headers;
status: number;
};
type PatchRoleHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Clears the cache for roles api requests.
*/
declare function clearCache(): void;
interface RolesAPI {
/**
* Returns a list of roles using cursor-based pagination.
*
* @param query an object with query parameters
* @throws GetRolesHttpError
*/
getRoles: typeof getRoles;
/**
* Creates a custom role. Role names must be unique, and there is a maximum of 500 custom roles per tenant. Requestor must be assigned the `TenantAdmin` role.
*
* @param body an object with the body content
* @throws CreateRoleHttpError
*/
createRole: typeof createRole;
/**
* Deletes the requested role. Role can only be deleted if it has been unassigned from all users and groups. Only applicable to roles of type `custom`. Requestor must be assigned the `TenantAdmin` role.
*
* @param id The unique identifier for the role.
* @throws DeleteRoleHttpError
*/
deleteRole: typeof deleteRole;
/**
* Returns the requested role.
*
* @param id The unique identifier for the role.
* @throws GetRoleHttpError
*/
getRole: typeof getRole;
/**
* Updates the requested role. Only applicable to roles of type `custom`. Requestor must be assigned the `TenantAdmin` role.
*
* @param id The unique identifier for the role.
* @param body an object with the body content
* @throws PatchRoleHttpError
*/
patchRole: typeof patchRole;
/**
* Clears the cache for roles api requests.
*/
clearCache: typeof clearCache;
}
/**
* Functions for the roles api
*/
declare const rolesExport: RolesAPI;
export { type CreateRole, type CreateRoleHttpError, type CreateRoleHttpResponse, type DeleteRoleHttpError, type DeleteRoleHttpResponse, type Error, type Errors, type GetRoleHttpError, type GetRoleHttpResponse, type GetRolesHttpError, type GetRolesHttpResponse, type Links, type ListRolesResult, type PatchRole, type PatchRoleHttpError, type PatchRoleHttpResponse, type PatchRoles, type Role, type RolesAPI, clearCache, createRole, rolesExport as default, deleteRole, getRole, getRoles, patchRole };