-
Notifications
You must be signed in to change notification settings - Fork 13
/
get-DatasetsAsAdminWithUsers&Datasources.pq
75 lines (75 loc) · 3.19 KB
/
get-DatasetsAsAdminWithUsers&Datasources.pq
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
let
output =
(generatedToken as text) =>
let
apiCall =
Json.Document(
Web.Contents(
"https://api.powerbi.com/v1.0/myorg",
[
RelativePath = "admin/datasets",
Headers = [
#"Content-Type" = "application/json",
Authorization = generatedToken
]
]
)
)
in
#table(
type table [
id = text,
name = text,
addRowsAPIEnabled = logical,
configuredBy = text,
isRefreshable = logical,
isEffectiveIdentityRequired = logical,
isEffectiveIdentityRolesRequired = logical,
isOnPremGatewayRequired = logical,
webUrl = text,
targetStorageMode = text,
createdDate = datetime,
createReportEmbedURL = text,
qnaEmbedURL = text,
upstreamDatasets = list,
users = table,
datasources = table
],
List.Transform(
apiCall[value],
each
{
_[id]?,
_[name]?,
_[addRowsAPIEnabled]?,
_[configuredBy]?,
_[isRefreshable]?,
_[isEffectiveIdentityRequired]?,
_[isEffectiveIdentityRolesRequired]?,
_[isOnPremGatewayRequired]?,
_[webUrl]?,
_[targetStorageMode]?,
DateTime.From(_[createdDate]?),
_[createReportEmbedURL]?,
_[qnaEmbedURL]?,
_[upstreamDatasets]?,
#"get-DatasetUsersAsAdmin"(generatedToken,_[id]),
#"get-DatasourcesOfDatasetAsAdmin"(generatedToken,_[id])
}
)
),
documentation = [
Documentation.Name = " get-DatasetsAsAdminWithUsers&Datasources.pq ",
Documentation.Description = " Get all datasets with their users and datasources. IF YOU HAVE LOT OF DATASETS THEN I AM STRONGLY NOT RECCOMENDING USING THIS FUNCTION, BECAUSE OF THE LIMITS OF THE API CALLS PER HOUR. ",
Documentation.Source = "https://www.jaknapowerbi.cz",
Documentation.Version = " 1.0 ",
Documentation.Author = " Štěpán Rešl "
]
in
Value.ReplaceType(
output,
Value.ReplaceMetadata(
Value.Type(output),
documentation
)
)