@pnp/cli-microsoft365 5.0.0-beta.5a0b256 → 5.0.0-beta.6be8a88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +1 -0
- package/dist/api.d.ts +11 -0
- package/dist/api.js +17 -0
- package/dist/cli/Cli.js +19 -4
- package/dist/m365/aad/commands/app/app-add.js +43 -7
- package/dist/m365/aad/commands/user/user-list.js +7 -4
- package/dist/m365/planner/commands/task/task-details-get.js +39 -0
- package/dist/m365/planner/commands/task/task-get.js +37 -0
- package/dist/m365/planner/commands.js +2 -0
- package/dist/m365/spo/commands/group/group-user-remove.js +100 -0
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-get.js +57 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-list.js +56 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-get.js +39 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +38 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-get.js +51 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +38 -0
- package/dist/m365/tenant/commands.js +6 -0
- package/docs/docs/cmd/aad/user/user-list.md +9 -0
- package/docs/docs/cmd/planner/task/task-details-get.md +24 -0
- package/docs/docs/cmd/planner/task/task-get.md +24 -0
- package/docs/docs/cmd/search/externalconnection/externalconnection-add.md +3 -3
- package/docs/docs/cmd/spo/group/group-user-remove.md +39 -0
- package/docs/docs/cmd/teams/channel/channel-get.md +1 -1
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.md +33 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.md +30 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.md +24 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.md +34 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.md +28 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.md +34 -0
- package/npm-shrinkwrap.json +808 -770
- package/package.json +19 -18
- package/dist/m365/base/AadCommand.js +0 -10
package/.eslintrc.js
CHANGED
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface CommandOutput {
|
|
2
|
+
error?: {
|
|
3
|
+
message: string;
|
|
4
|
+
code?: number;
|
|
5
|
+
}
|
|
6
|
+
stdout: string;
|
|
7
|
+
stderr: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export declare function executeCommand(commandName: string, options: any): Promise<CommandOutput>;
|
|
11
|
+
export declare function on(eventName: string, listener: (...args: any[]) => void): void;
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeCommand = void 0;
|
|
4
|
+
const cli_1 = require("./cli");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
function executeCommand(commandName, options, listener) {
|
|
7
|
+
const cli = cli_1.Cli.getInstance();
|
|
8
|
+
cli.commandsFolder = path.join(__dirname, 'm365');
|
|
9
|
+
cli.commands = [];
|
|
10
|
+
cli.loadCommandFromArgs(commandName.split(' '));
|
|
11
|
+
if (cli.commands.length !== 1) {
|
|
12
|
+
return Promise.reject(`Command not found: ${commandName}`);
|
|
13
|
+
}
|
|
14
|
+
return cli_1.Cli.executeCommandWithOutput(cli.commands[0].command, { options: options !== null && options !== void 0 ? options : {} }, listener);
|
|
15
|
+
}
|
|
16
|
+
exports.executeCommand = executeCommand;
|
|
17
|
+
//# sourceMappingURL=api.js.map
|
package/dist/cli/Cli.js
CHANGED
|
@@ -189,23 +189,38 @@ class Cli {
|
|
|
189
189
|
});
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
|
-
static executeCommandWithOutput(command, args) {
|
|
192
|
+
static executeCommandWithOutput(command, args, listener) {
|
|
193
193
|
return new Promise((resolve, reject) => {
|
|
194
194
|
const log = [];
|
|
195
195
|
const logErr = [];
|
|
196
196
|
const logger = {
|
|
197
197
|
log: (message) => {
|
|
198
|
-
|
|
198
|
+
const formattedMessage = Cli.formatOutput(message, args.options);
|
|
199
|
+
if (listener && listener.stdout) {
|
|
200
|
+
listener.stdout(formattedMessage);
|
|
201
|
+
}
|
|
202
|
+
log.push(formattedMessage);
|
|
199
203
|
},
|
|
200
204
|
logRaw: (message) => {
|
|
201
|
-
|
|
205
|
+
const formattedMessage = Cli.formatOutput(message, args.options);
|
|
206
|
+
if (listener && listener.stdout) {
|
|
207
|
+
listener.stdout(formattedMessage);
|
|
208
|
+
}
|
|
209
|
+
log.push(formattedMessage);
|
|
202
210
|
},
|
|
203
211
|
logToStderr: (message) => {
|
|
212
|
+
if (listener && listener.stderr) {
|
|
213
|
+
listener.stderr(message);
|
|
214
|
+
}
|
|
204
215
|
logErr.push(message);
|
|
205
216
|
}
|
|
206
217
|
};
|
|
207
218
|
if (args.options.debug) {
|
|
208
|
-
|
|
219
|
+
const message = `Executing command ${command.name} with options ${JSON.stringify(args)}`;
|
|
220
|
+
if (listener && listener.stderr) {
|
|
221
|
+
listener.stderr(message);
|
|
222
|
+
}
|
|
223
|
+
logErr.push(message);
|
|
209
224
|
}
|
|
210
225
|
// store the current command name, if any and set the name to the name of
|
|
211
226
|
// the command to execute
|
|
@@ -105,21 +105,49 @@ class AadAppAddCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
|
105
105
|
if (!args.options.manifest) {
|
|
106
106
|
return Promise.resolve(appInfo);
|
|
107
107
|
}
|
|
108
|
-
const
|
|
108
|
+
const v2Manifest = JSON.parse(args.options.manifest);
|
|
109
109
|
// remove properties that might be coming from the original app that was
|
|
110
110
|
// used to create the manifest and which can't be updated
|
|
111
|
-
delete
|
|
112
|
-
delete
|
|
113
|
-
delete
|
|
111
|
+
delete v2Manifest.id;
|
|
112
|
+
delete v2Manifest.appId;
|
|
113
|
+
delete v2Manifest.publisherDomain;
|
|
114
114
|
// Azure Portal returns v2 manifest whereas the Graph API expects a v1.6
|
|
115
|
-
const
|
|
115
|
+
const graphManifest = this.transformManifest(v2Manifest);
|
|
116
116
|
const updateAppRequestOptions = {
|
|
117
117
|
url: `${this.resource}/v1.0/myorganization/applications/${appInfo.id}`,
|
|
118
118
|
headers: {
|
|
119
119
|
'content-type': 'application/json'
|
|
120
120
|
},
|
|
121
121
|
responseType: 'json',
|
|
122
|
-
data:
|
|
122
|
+
data: graphManifest
|
|
123
|
+
};
|
|
124
|
+
return request_1.default
|
|
125
|
+
.patch(updateAppRequestOptions)
|
|
126
|
+
.then(_ => this.updatePreAuthorizedAppsFromManifest(v2Manifest, appInfo))
|
|
127
|
+
.then(_ => Promise.resolve(appInfo));
|
|
128
|
+
}
|
|
129
|
+
updatePreAuthorizedAppsFromManifest(manifest, appInfo) {
|
|
130
|
+
if (!manifest ||
|
|
131
|
+
!manifest.preAuthorizedApplications ||
|
|
132
|
+
manifest.preAuthorizedApplications.length === 0) {
|
|
133
|
+
return Promise.resolve(appInfo);
|
|
134
|
+
}
|
|
135
|
+
const graphManifest = {
|
|
136
|
+
api: {
|
|
137
|
+
preAuthorizedApplications: manifest.preAuthorizedApplications
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
graphManifest.api.preAuthorizedApplications.forEach((p) => {
|
|
141
|
+
p.delegatedPermissionIds = p.permissionIds;
|
|
142
|
+
delete p.permissionIds;
|
|
143
|
+
});
|
|
144
|
+
const updateAppRequestOptions = {
|
|
145
|
+
url: `${this.resource}/v1.0/myorganization/applications/${appInfo.id}`,
|
|
146
|
+
headers: {
|
|
147
|
+
'content-type': 'application/json'
|
|
148
|
+
},
|
|
149
|
+
responseType: 'json',
|
|
150
|
+
data: graphManifest
|
|
123
151
|
};
|
|
124
152
|
return request_1.default
|
|
125
153
|
.patch(updateAppRequestOptions)
|
|
@@ -180,8 +208,16 @@ class AadAppAddCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
|
180
208
|
delete graphManifest.oauth2AllowIdTokenImplicitFlow;
|
|
181
209
|
graphManifest.api.oauth2PermissionScopes = v2Manifest.oauth2Permissions;
|
|
182
210
|
delete graphManifest.oauth2Permissions;
|
|
211
|
+
if (graphManifest.api.oauth2PermissionScopes) {
|
|
212
|
+
graphManifest.api.oauth2PermissionScopes.forEach((scope) => {
|
|
213
|
+
delete scope.lang;
|
|
214
|
+
delete scope.origin;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
183
217
|
delete graphManifest.oauth2RequiredPostResponse;
|
|
184
|
-
|
|
218
|
+
// MS Graph doesn't support creating OAuth2 permissions and pre-authorized
|
|
219
|
+
// apps in one request. This is why we need to remove it here and do it in
|
|
220
|
+
// the next request
|
|
185
221
|
delete graphManifest.preAuthorizedApplications;
|
|
186
222
|
if (v2Manifest.replyUrlsWithType) {
|
|
187
223
|
v2Manifest.replyUrlsWithType.forEach((urlWithType) => {
|
|
@@ -15,6 +15,7 @@ class AadUserListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
|
15
15
|
getTelemetryProperties(args) {
|
|
16
16
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
17
17
|
telemetryProps.properties = args.options.properties;
|
|
18
|
+
telemetryProps.deleted = typeof args.options.deleted !== 'undefined';
|
|
18
19
|
return telemetryProps;
|
|
19
20
|
}
|
|
20
21
|
commandAction(logger, args, cb) {
|
|
@@ -22,7 +23,8 @@ class AadUserListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
|
22
23
|
args.options.properties.split(',').map(p => p.trim()) :
|
|
23
24
|
['userPrincipalName', 'displayName'];
|
|
24
25
|
const filter = this.getFilter(args.options);
|
|
25
|
-
const
|
|
26
|
+
const endpoint = args.options.deleted ? 'directory/deletedItems/microsoft.graph.user' : 'users';
|
|
27
|
+
const url = `${this.resource}/v1.0/${endpoint}?$select=${properties.join(',')}${(filter.length > 0 ? '&' + filter : '')}&$top=100`;
|
|
26
28
|
this
|
|
27
29
|
.getAllItems(url, logger, true)
|
|
28
30
|
.then(() => {
|
|
@@ -35,6 +37,8 @@ class AadUserListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
|
35
37
|
const excludeOptions = [
|
|
36
38
|
'properties',
|
|
37
39
|
'p',
|
|
40
|
+
'deleted',
|
|
41
|
+
'd',
|
|
38
42
|
'debug',
|
|
39
43
|
'verbose',
|
|
40
44
|
'output',
|
|
@@ -55,9 +59,8 @@ class AadUserListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
|
55
59
|
}
|
|
56
60
|
options() {
|
|
57
61
|
const options = [
|
|
58
|
-
{
|
|
59
|
-
|
|
60
|
-
}
|
|
62
|
+
{ option: '-p, --properties [properties]' },
|
|
63
|
+
{ option: '-d, --deleted' }
|
|
61
64
|
];
|
|
62
65
|
const parentOptions = super.options();
|
|
63
66
|
return options.concat(parentOptions);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const GraphItemsListCommand_1 = require("../../../base/GraphItemsListCommand");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
class PlannerTaskDetailsGetCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.TASK_DETAILS_GET;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Retrieve the details of the specified planner task';
|
|
12
|
+
}
|
|
13
|
+
commandAction(logger, args, cb) {
|
|
14
|
+
const requestOptions = {
|
|
15
|
+
url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(args.options.taskId)}/details`,
|
|
16
|
+
headers: {
|
|
17
|
+
accept: 'application/json;odata.metadata=none'
|
|
18
|
+
},
|
|
19
|
+
responseType: 'json'
|
|
20
|
+
};
|
|
21
|
+
request_1.default
|
|
22
|
+
.get(requestOptions)
|
|
23
|
+
.then((res) => {
|
|
24
|
+
logger.log(res);
|
|
25
|
+
cb();
|
|
26
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
27
|
+
}
|
|
28
|
+
options() {
|
|
29
|
+
const options = [
|
|
30
|
+
{
|
|
31
|
+
option: '-i, --taskId <taskId>'
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
const parentOptions = super.options();
|
|
35
|
+
return options.concat(parentOptions);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
module.exports = new PlannerTaskDetailsGetCommand();
|
|
39
|
+
//# sourceMappingURL=task-details-get.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.TASK_GET;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Retrieve the the specified planner task';
|
|
12
|
+
}
|
|
13
|
+
commandAction(logger, args, cb) {
|
|
14
|
+
const requestOptions = {
|
|
15
|
+
url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(args.options.id)}`,
|
|
16
|
+
headers: {
|
|
17
|
+
accept: 'application/json;odata.metadata=none'
|
|
18
|
+
},
|
|
19
|
+
responseType: 'json'
|
|
20
|
+
};
|
|
21
|
+
request_1.default
|
|
22
|
+
.get(requestOptions)
|
|
23
|
+
.then((res) => {
|
|
24
|
+
logger.log(res);
|
|
25
|
+
cb();
|
|
26
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
27
|
+
}
|
|
28
|
+
options() {
|
|
29
|
+
const options = [
|
|
30
|
+
{ option: '-i, --id <id>' }
|
|
31
|
+
];
|
|
32
|
+
const parentOptions = super.options();
|
|
33
|
+
return options.concat(parentOptions);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
module.exports = new PlannerTaskGetCommand();
|
|
37
|
+
//# sourceMappingURL=task-get.js.map
|
|
@@ -8,6 +8,8 @@ exports.default = {
|
|
|
8
8
|
PLAN_GET: `${prefix} plan get`,
|
|
9
9
|
PLAN_LIST: `${prefix} plan list`,
|
|
10
10
|
TASK_ADD: `${prefix} task add`,
|
|
11
|
+
TASK_DETAILS_GET: `${prefix} task details get`,
|
|
12
|
+
TASK_GET: `${prefix} task get`,
|
|
11
13
|
TASK_LIST: `${prefix} task list`,
|
|
12
14
|
TASK_SET: `${prefix} task set`
|
|
13
15
|
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_1 = require("../../../../cli");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
6
|
+
const commands_1 = require("../../commands");
|
|
7
|
+
class SpoGroupUserRemoveCommand extends SpoCommand_1.default {
|
|
8
|
+
get name() {
|
|
9
|
+
return commands_1.default.GROUP_USER_REMOVE;
|
|
10
|
+
}
|
|
11
|
+
get description() {
|
|
12
|
+
return 'Removes the specified user from a SharePoint group';
|
|
13
|
+
}
|
|
14
|
+
getTelemetryProperties(args) {
|
|
15
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
16
|
+
telemetryProps.groupId = (!(!args.options.groupId)).toString();
|
|
17
|
+
telemetryProps.groupName = (!(!args.options.groupName)).toString();
|
|
18
|
+
telemetryProps.confirm = (!(!args.options.confirm)).toString();
|
|
19
|
+
return telemetryProps;
|
|
20
|
+
}
|
|
21
|
+
commandAction(logger, args, cb) {
|
|
22
|
+
const removeUserfromSPGroup = () => {
|
|
23
|
+
if (this.verbose) {
|
|
24
|
+
logger.logToStderr(`Removing User with Username ${args.options.userName} from Group: ${args.options.groupId ? args.options.groupId : args.options.groupName}`);
|
|
25
|
+
}
|
|
26
|
+
const loginName = `i:0#.f|membership|${args.options.userName}`;
|
|
27
|
+
const requestUrl = `${args.options.webUrl}/_api/web/sitegroups/${args.options.groupId
|
|
28
|
+
? `GetById('${encodeURIComponent(args.options.groupId)}')`
|
|
29
|
+
: `GetByName('${encodeURIComponent(args.options.groupName)}')`}/users/removeByLoginName(@LoginName)?@LoginName='${encodeURIComponent(loginName)}'`;
|
|
30
|
+
const requestOptions = {
|
|
31
|
+
url: requestUrl,
|
|
32
|
+
headers: {
|
|
33
|
+
'accept': 'application/json;odata=nometadata'
|
|
34
|
+
},
|
|
35
|
+
responseType: 'json'
|
|
36
|
+
};
|
|
37
|
+
request_1.default
|
|
38
|
+
.post(requestOptions)
|
|
39
|
+
.then(() => {
|
|
40
|
+
cb();
|
|
41
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
42
|
+
};
|
|
43
|
+
if (args.options.confirm) {
|
|
44
|
+
if (this.debug) {
|
|
45
|
+
logger.logToStderr('Confirmation bypassed by entering confirm option. Removing the user from SharePoint Group...');
|
|
46
|
+
}
|
|
47
|
+
removeUserfromSPGroup();
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
cli_1.Cli.prompt({
|
|
51
|
+
type: 'confirm',
|
|
52
|
+
name: 'continue',
|
|
53
|
+
default: false,
|
|
54
|
+
message: `Are you sure you want to remove user User ${args.options.userName} from SharePoint group?`
|
|
55
|
+
}, (result) => {
|
|
56
|
+
if (!result.continue) {
|
|
57
|
+
cb();
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
removeUserfromSPGroup();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
options() {
|
|
66
|
+
const options = [
|
|
67
|
+
{
|
|
68
|
+
option: '-u, --webUrl <webUrl>'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
option: '--groupId [groupId]'
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
option: '--groupName [groupName]'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
option: '--userName <userName>'
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
option: '--confirm'
|
|
81
|
+
}
|
|
82
|
+
];
|
|
83
|
+
const parentOptions = super.options();
|
|
84
|
+
return options.concat(parentOptions);
|
|
85
|
+
}
|
|
86
|
+
validate(args) {
|
|
87
|
+
if (args.options.groupId && args.options.groupName) {
|
|
88
|
+
return 'Use either "groupName" or "groupId", but not both';
|
|
89
|
+
}
|
|
90
|
+
if (!args.options.groupId && !args.options.groupName) {
|
|
91
|
+
return 'Either "groupName" or "groupId" is required';
|
|
92
|
+
}
|
|
93
|
+
if (args.options.groupId && isNaN(args.options.groupId)) {
|
|
94
|
+
return `Specified "groupId" ${args.options.groupId} is not valid`;
|
|
95
|
+
}
|
|
96
|
+
return SpoCommand_1.default.isValidSharePointUrl(args.options.webUrl);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
module.exports = new SpoGroupUserRemoveCommand();
|
|
100
|
+
//# sourceMappingURL=group-user-remove.js.map
|
|
@@ -64,6 +64,7 @@ exports.default = {
|
|
|
64
64
|
GROUP_REMOVE: `${prefix} group remove`,
|
|
65
65
|
GROUP_USER_ADD: `${prefix} group user add`,
|
|
66
66
|
GROUP_USER_LIST: `${prefix} group user list`,
|
|
67
|
+
GROUP_USER_REMOVE: `${prefix} group user remove`,
|
|
67
68
|
HIDEDEFAULTTHEMES_GET: `${prefix} hidedefaultthemes get`,
|
|
68
69
|
HIDEDEFAULTTHEMES_SET: `${prefix} hidedefaultthemes set`,
|
|
69
70
|
HOMESITE_GET: `${prefix} homesite get`,
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
class TenantServiceAnnouncementHealthGetCommand extends GraphCommand_1.default {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.SERVICEANNOUNCEMENT_HEALTH_GET;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'This operation provides the health information of a specified service for a tenant';
|
|
12
|
+
}
|
|
13
|
+
getTelemetryProperties(args) {
|
|
14
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
15
|
+
telemetryProps.issues = typeof args.options.issues !== 'undefined';
|
|
16
|
+
return telemetryProps;
|
|
17
|
+
}
|
|
18
|
+
defaultProperties() {
|
|
19
|
+
return ['id', 'status', 'service'];
|
|
20
|
+
}
|
|
21
|
+
commandAction(logger, args, cb) {
|
|
22
|
+
this
|
|
23
|
+
.getServiceHealth(args.options)
|
|
24
|
+
.then((res) => {
|
|
25
|
+
logger.log(res);
|
|
26
|
+
cb();
|
|
27
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
28
|
+
}
|
|
29
|
+
getServiceHealth(options) {
|
|
30
|
+
const requestOptions = {
|
|
31
|
+
url: `${this.resource}/v1.0/admin/serviceAnnouncement/healthOverviews/${options.serviceName}${options.issues && (!options.output || options.output.toLocaleLowerCase() === 'json') ? '?$expand=issues' : ''}`,
|
|
32
|
+
headers: {
|
|
33
|
+
accept: 'application/json;odata.metadata=none'
|
|
34
|
+
},
|
|
35
|
+
responseType: 'json'
|
|
36
|
+
};
|
|
37
|
+
return request_1.default
|
|
38
|
+
.get(requestOptions)
|
|
39
|
+
.then(response => {
|
|
40
|
+
const serviceHealth = response;
|
|
41
|
+
if (!serviceHealth) {
|
|
42
|
+
return Promise.reject(`Error fetching service health`);
|
|
43
|
+
}
|
|
44
|
+
return Promise.resolve(serviceHealth);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
options() {
|
|
48
|
+
const options = [
|
|
49
|
+
{ option: '-s, --serviceName <serviceName>' },
|
|
50
|
+
{ option: '-i, --issues' }
|
|
51
|
+
];
|
|
52
|
+
const parentOptions = super.options();
|
|
53
|
+
return options.concat(parentOptions);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
module.exports = new TenantServiceAnnouncementHealthGetCommand();
|
|
57
|
+
//# sourceMappingURL=serviceannouncement-health-get.js.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
class TenantServiceAnnouncementHealthListCommand extends GraphCommand_1.default {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.SERVICEANNOUNCEMENT_HEALTH_LIST;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'This operation provides the health report of all subscribed services for a tenant';
|
|
12
|
+
}
|
|
13
|
+
getTelemetryProperties(args) {
|
|
14
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
15
|
+
telemetryProps.issues = typeof args.options.issues !== 'undefined';
|
|
16
|
+
return telemetryProps;
|
|
17
|
+
}
|
|
18
|
+
defaultProperties() {
|
|
19
|
+
return ['id', 'status', 'service'];
|
|
20
|
+
}
|
|
21
|
+
commandAction(logger, args, cb) {
|
|
22
|
+
this
|
|
23
|
+
.listServiceHealth(args.options)
|
|
24
|
+
.then((res) => {
|
|
25
|
+
logger.log(res);
|
|
26
|
+
cb();
|
|
27
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
28
|
+
}
|
|
29
|
+
listServiceHealth(options) {
|
|
30
|
+
const requestOptions = {
|
|
31
|
+
url: `${this.resource}/v1.0/admin/serviceAnnouncement/healthOverviews${options.issues && (!options.output || options.output.toLocaleLowerCase() === 'json') ? '?$expand=issues' : ''}`,
|
|
32
|
+
headers: {
|
|
33
|
+
accept: 'application/json;odata.metadata=none'
|
|
34
|
+
},
|
|
35
|
+
responseType: 'json'
|
|
36
|
+
};
|
|
37
|
+
return request_1.default
|
|
38
|
+
.get(requestOptions)
|
|
39
|
+
.then(response => {
|
|
40
|
+
const serviceHealthList = response.value;
|
|
41
|
+
if (!serviceHealthList) {
|
|
42
|
+
return Promise.reject(`Error fetching service health`);
|
|
43
|
+
}
|
|
44
|
+
return Promise.resolve(serviceHealthList);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
options() {
|
|
48
|
+
const options = [
|
|
49
|
+
{ option: '-i, --issues' }
|
|
50
|
+
];
|
|
51
|
+
const parentOptions = super.options();
|
|
52
|
+
return options.concat(parentOptions);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
module.exports = new TenantServiceAnnouncementHealthListCommand();
|
|
56
|
+
//# sourceMappingURL=serviceannouncement-health-list.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
class TenantServiceAnnouncementHealthIssueGetCommand extends GraphCommand_1.default {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.SERVICEANNOUNCEMENT_HEALTHISSUE_GET;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Gets a specified service health issue for tenant';
|
|
12
|
+
}
|
|
13
|
+
commandAction(logger, args, cb) {
|
|
14
|
+
const requestOptions = {
|
|
15
|
+
url: `${this.resource}/v1.0/admin/serviceAnnouncement/issues/${encodeURIComponent(args.options.id)}`,
|
|
16
|
+
headers: {
|
|
17
|
+
accept: 'application/json;odata.metadata=none'
|
|
18
|
+
},
|
|
19
|
+
responseType: 'json'
|
|
20
|
+
};
|
|
21
|
+
request_1.default
|
|
22
|
+
.get(requestOptions)
|
|
23
|
+
.then((res) => {
|
|
24
|
+
logger.log(res);
|
|
25
|
+
cb();
|
|
26
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
27
|
+
}
|
|
28
|
+
options() {
|
|
29
|
+
const options = [
|
|
30
|
+
{
|
|
31
|
+
option: '-i, --id <id>'
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
const parentOptions = super.options();
|
|
35
|
+
return options.concat(parentOptions);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
module.exports = new TenantServiceAnnouncementHealthIssueGetCommand();
|
|
39
|
+
//# sourceMappingURL=serviceannouncement-healthissue-get.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const GraphItemsListCommand_1 = require("../../../base/GraphItemsListCommand");
|
|
4
|
+
const commands_1 = require("../../commands");
|
|
5
|
+
class TenantServiceAnnouncementHealthIssueListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
6
|
+
get name() {
|
|
7
|
+
return commands_1.default.SERVICEANNOUNCEMENT_HEALTHISSUE_LIST;
|
|
8
|
+
}
|
|
9
|
+
get description() {
|
|
10
|
+
return 'Gets all service health issues for the tenant';
|
|
11
|
+
}
|
|
12
|
+
defaultProperties() {
|
|
13
|
+
return ['id', 'title'];
|
|
14
|
+
}
|
|
15
|
+
commandAction(logger, args, cb) {
|
|
16
|
+
let endpoint = `${this.resource}/v1.0/admin/serviceAnnouncement/issues`;
|
|
17
|
+
if (args.options.service) {
|
|
18
|
+
endpoint += `?$filter=service eq '${encodeURIComponent(args.options.service)}'`;
|
|
19
|
+
}
|
|
20
|
+
this
|
|
21
|
+
.getAllItems(endpoint, logger, true)
|
|
22
|
+
.then(() => {
|
|
23
|
+
logger.log(this.items);
|
|
24
|
+
cb();
|
|
25
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
26
|
+
}
|
|
27
|
+
options() {
|
|
28
|
+
const options = [
|
|
29
|
+
{
|
|
30
|
+
option: '-s, --service [service]'
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
const parentOptions = super.options();
|
|
34
|
+
return options.concat(parentOptions);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
module.exports = new TenantServiceAnnouncementHealthIssueListCommand();
|
|
38
|
+
//# sourceMappingURL=serviceannouncement-healthissue-list.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
class TenantServiceAnnouncementMessageGetCommand extends GraphCommand_1.default {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.SERVICEANNOUNCEMENT_MESSAGE_GET;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Retrieves a specified service update message for the tenant';
|
|
12
|
+
}
|
|
13
|
+
commandAction(logger, args, cb) {
|
|
14
|
+
if (this.verbose) {
|
|
15
|
+
logger.logToStderr(`Retrieving service update message ${args.options.id}`);
|
|
16
|
+
}
|
|
17
|
+
const requestOptions = {
|
|
18
|
+
url: `${this.resource}/v1.0/admin/serviceAnnouncement/messages/${args.options.id}`,
|
|
19
|
+
headers: {
|
|
20
|
+
accept: 'application/json;odata.metadata=none'
|
|
21
|
+
},
|
|
22
|
+
responseType: 'json'
|
|
23
|
+
};
|
|
24
|
+
request_1.default
|
|
25
|
+
.get(requestOptions)
|
|
26
|
+
.then((res) => {
|
|
27
|
+
logger.log(res);
|
|
28
|
+
cb();
|
|
29
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
30
|
+
}
|
|
31
|
+
options() {
|
|
32
|
+
const options = [
|
|
33
|
+
{
|
|
34
|
+
option: '-i, --id <id>'
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
const parentOptions = super.options();
|
|
38
|
+
return options.concat(parentOptions);
|
|
39
|
+
}
|
|
40
|
+
isValidId(id) {
|
|
41
|
+
return (/MC\d{6}/).test(id);
|
|
42
|
+
}
|
|
43
|
+
validate(args) {
|
|
44
|
+
if (!this.isValidId(args.options.id)) {
|
|
45
|
+
return `${args.options.id} is not a valid message ID`;
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
module.exports = new TenantServiceAnnouncementMessageGetCommand();
|
|
51
|
+
//# sourceMappingURL=serviceannouncement-message-get.js.map
|