Skip to content

Adds parameter completer for -Period in Reports module #1956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Reports/Reports.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ require:

``` yaml
directive:
- where:
parameter-name: Period
set:
completer:
name: Period Completer
description: Gets the list of Period values.
script: "'D7', 'D30', 'D90', 'D180'"
# Remove invalid paths.
- remove-path-by-operation: auditLogs\.auditLogRoot.*|reports.reportRoot.*|(auditLogs|reports)_(Create|Delete|Update).*
# Remove cmdlets
Expand Down
29 changes: 29 additions & 0 deletions src/Reports/v1.0/test/Get-MgReportEmailActivityCount.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
# ------------------------------------------------------------------------------
Describe "Get-MgReportEmailActivityCount" {
BeforeAll {
$GetMgReportEmailActivityCount = Get-Command Get-MgReportEmailActivityCount
}

It "Should support minimum set of parameter sets" {
$GetMgReportEmailActivityCount.ParameterSets.Name | Should -BeIn @("Get", "GetViaIdentity")
$GetMgReportEmailActivityCount.Visibility | Should -Be "Public"
$GetMgReportEmailActivityCount.CommandType | Should -Be "Function"
}

It "Should return a list of applications by default" {
$GetMgReportEmailActivityCount.OutputType | Should -Be "System.Boolean"
$GetMgReportEmailActivityCount.DefaultParameterSet | Should -Be "Get"
}

It 'Should have Get parameterSet' {
$GetParameterSet = $GetMgReportEmailActivityCount.ParameterSets | Where-Object Name -eq "Get"
$GetParameterSet.Parameters.Name | Should -Contain OutFile
$GetParameterSet.Parameters.Name | Should -Contain Period
}

It '-Period parameter should have an argument completer' {
$GetMgReportEmailActivityCount.Parameters.Period.Attributes.ScriptBlock | Should -be "'D7', 'D30', 'D90', 'D180'"
}
}
5 changes: 5 additions & 0 deletions src/readme.graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,11 @@ directive:
- from: openapi-document
where: $..paths.*[?(/(.*_GetCount)/gmi.exec(@.operationId))]..parameters[?(@.name === "ConsistencyLevel")]
transform: $['required'] = true
# Fix binary response definition for AutoREST to generate -OutFile parameter.
- from: openapi-document
where: $..paths..responses['2XX'].content['application/octet-stream'].schema
transform: >-
if ($.type === 'object') { $['format'] = "binary" }
# Modify generated .json.cs model classes.
- from: source-file-csharp
where: $
Expand Down