Skip to content

Commit

Permalink
Adds "aad administrativeunit add" command
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinM85 committed Oct 28, 2023
1 parent 276a3b3 commit 9086b91
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
16 changes: 8 additions & 8 deletions docs/docs/cmd/aad/administrativeunit/administrativeunit-add.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ m365 aad administrativeunit add --displayName 'Marketing Division' --hiddenMembe

```json
{
"id": "00b45a1b-7632-4e94-a3bd-f06aec976d31",
"deletedDateTime": null,
"displayName": "Marketing Division",
"description": "Marketing department administration",
"membershipRule": null,
"membershipType": null,
"membershipRuleProcessingState": null,
"visibility": null
"id": "00b45a1b-7632-4e94-a3bd-f06aec976d31",
"deletedDateTime": null,
"displayName": "Marketing Division",
"description": "Marketing department administration",
"membershipRule": null,
"membershipType": null,
"membershipRuleProcessingState": null,
"visibility": null
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe(commands.ADMINISTRATIVEUNIT_ADD, () => {
description: undefined,
visibility: null
});
assert(loggerLogSpy.calledOnceWith(administrativeUnitReponse));
assert(loggerLogSpy.calledOnceWithExactly(administrativeUnitReponse));
});

it('creates an administrative unit with a specific display name and description', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ interface CommandArgs {
interface Options extends GlobalOptions {
displayName: string;
description?: string;
hiddenMembership: boolean;
hiddenMembership?: boolean;
}

class AadAdministrativeUnitAddCommand extends GraphCommand {
public get name(): string {
return commands.ADMINISTRATIVEUNIT_ADD;
}

public get description(): string {
return 'Creates an administrative unit';
}
Expand All @@ -33,7 +34,7 @@ class AadAdministrativeUnitAddCommand extends GraphCommand {
#initTelemetry(): void {
this.telemetry.push((args: CommandArgs) => {
Object.assign(this.telemetryProperties, {
visibility: args.options.visibility
hiddenMembership: args.options.hiddenMembership
});
});
}
Expand All @@ -53,8 +54,6 @@ class AadAdministrativeUnitAddCommand extends GraphCommand {
}

public async commandAction(logger: Logger, args: CommandArgs): Promise<void> {
let administrativeUnit: AdministrativeUnit;

const requestOptions: CliRequestOptions = {
url: `${this.resource}/v1.0/directory/administrativeUnits`,
headers: {
Expand All @@ -69,7 +68,7 @@ class AadAdministrativeUnitAddCommand extends GraphCommand {
};

try {
administrativeUnit = await request.post<AdministrativeUnit>(requestOptions);
const administrativeUnit = await request.post<AdministrativeUnit>(requestOptions);

await logger.log(administrativeUnit);
}
Expand Down

0 comments on commit 9086b91

Please sign in to comment.