Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6485584
[OperationalInsights] init.
LucasYao93 Jan 14, 2022
a0863cb
[OperationalInsights] rename parameter name.
LucasYao93 Jan 17, 2022
81a9f35
update Readme.md with swagger files needed for autorest: Operations, …
dabenhamMic Jan 24, 2022
15c43db
ran autorest, readme.md files updated
dabenhamMic Jan 24, 2022
fc8c7af
update .md files for Get deleted workspaces, get table, get workspace…
dabenhamMic Jan 24, 2022
c9a986c
added missing documentation for all new cmdlets
dabenhamMic Jan 26, 2022
e24506e
update examples folder with existing documentation under docs folder
dabenhamMic Jan 26, 2022
19f66c7
update main readme.md file with swagger specs
dabenhamMic Jan 26, 2022
23b8c51
get workspaces tests
dabenhamMic Jan 31, 2022
d789f2f
added tests and recordings for: Get-AzOperationalInsightsTable, Get-A…
dabenhamMic Jan 31, 2022
46542d2
added all missing tests and recordings
dabenhamMic Jan 31, 2022
e987cfb
add directive to readme.md to remove the option to set SearchLogs and…
dabenhamMic Feb 2, 2022
68b9d86
update directives for code gen
dabenhamMic Feb 7, 2022
5656664
update .md files after package build
dabenhamMic Feb 14, 2022
be0ff18
.md files update after build
dabenhamMic Feb 14, 2022
50bf4cf
re ran all tests in record mode, added Move-AzOperationalInsightsTable
dabenhamMic Mar 7, 2022
e32945d
update examples folder to contain only examples instead of full .md c…
dabenhamMic Mar 7, 2022
bd0958c
PR comment fix
dabenhamMic Mar 7, 2022
28a382a
Update src/OperationalInsights/OperationalInsights.Autorest/examples/…
BethanyZhou Mar 8, 2022
59226cc
Update src/OperationalInsights/OperationalInsights.Autorest/examples/…
BethanyZhou Mar 8, 2022
b031475
Update Get-AzOperationalInsightsDeletedWorkspace.md
BethanyZhou Mar 8, 2022
3ea167d
changed examples format
dabenhamMic Mar 8, 2022
426a3c2
pr comment fixes
dabenhamMic Mar 8, 2022
195727b
pr comments
dabenhamMic Mar 9, 2022
e7aeb4c
added description to New-AzOperationalInsightsWorkspace and Remove-Az…
dabenhamMic Mar 13, 2022
fce8a5e
pr comments
dabenhamMic Mar 13, 2022
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
16 changes: 16 additions & 0 deletions src/OperationalInsights/OperationalInsights.Autorest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
bin
obj
.vs
generated
internal
exports
tools
custom/*.psm1
custom/autogen-model-cmdlets
test/*-TestResults.xml
/*.ps1
/*.ps1xml
/*.psm1
/*.snk
/*.csproj
/*.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@{
GUID = 'c4733603-3414-41cb-b2f6-2e53c59925f4'
RootModule = './Az.OperationalInsights.psm1'
ModuleVersion = '0.1.0'
CompatiblePSEditions = 'Core', 'Desktop'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = 'Microsoft Corporation. All rights reserved.'
Description = 'Microsoft Azure PowerShell: OperationalInsights cmdlets'
PowerShellVersion = '5.1'
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.OperationalInsights.private.dll'
FormatsToProcess = './Az.OperationalInsights.format.ps1xml'
FunctionsToExport = 'Get-AzOperationalInsightsDeletedWorkspace', 'Get-AzOperationalInsightsTable', 'Get-AzOperationalInsightsWorkspace', 'New-AzOperationalInsightsTable', 'New-AzOperationalInsightsTableColumnObject', 'New-AzOperationalInsightsWorkspace', 'Remove-AzOperationalInsightsTable', 'Remove-AzOperationalInsightsWorkspace', 'Update-AzOperationalInsightsTable', 'Update-AzOperationalInsightsWorkspace', '*'
AliasesToExport = '*'
PrivateData = @{
PSData = @{
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'OperationalInsights'
LicenseUri = 'https://aka.ms/azps-license'
ProjectUri = 'https://github.com/Azure/azure-powershell'
ReleaseNotes = ''
}
}
}
122 changes: 122 additions & 0 deletions src/OperationalInsights/OperationalInsights.Autorest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<!-- region Generated -->
# Az.OperationalInsights
This directory contains the PowerShell module for the OperationalInsights service.

---
## Status
[![Az.OperationalInsights](https://img.shields.io/powershellgallery/v/Az.OperationalInsights.svg?style=flat-square&label=Az.OperationalInsights "Az.OperationalInsights")](https://www.powershellgallery.com/packages/Az.OperationalInsights/)

## Info
- Modifiable: yes
- Generated: all
- Committed: yes
- Packaged: yes

---
## Detail
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.

## Module Requirements
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.2.3 or greater

## Authentication
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.

## Development
For information on how to develop for `Az.OperationalInsights`, see [how-to.md](how-to.md).
<!-- endregion -->

### AutoRest Configuration
> see https://aka.ms/autorest

``` yaml
branch: main
require:
- $(this-folder)/../../readme.azure.noprofile.md
input-file:
- $(repo)/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/preview/2021-12-01-preview/Operations.json
- $(repo)/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/preview/2021-12-01-preview/Tables.json
- $(repo)/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/preview/2021-12-01-preview/Workspaces.json

title: OperationalInsights
module-version: 0.1.0
subject-prefix: $(service-name)

identity-correction-for-post: true
resourcegroup-append: true
nested-object-to-string: true

directive:
# Autorest only support enum for type string.
- from: swagger-document
where: $.definitions.WorkspaceSku.properties.capacityReservationLevel
transform: >-
return {
"type": "integer",
"format": "int32",
"description": "The capacity reservation level in GB for this workspace, when CapacityReservation sku is selected.",
"enum": [
100,
200,
300,
400,
500,
1000,
2000,
5000
]
}
# Following is two common directive which are normally required in all the RPs
# 1. Remove the unexpanded parameter set
# 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
- where:
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
remove: true
# Remove the set-* cmdlet
- where:
verb: Set
remove: true

- where:
verb: New|Update
subject: Workspace
parameter-name: SkuName
set:
parameter-name: Sku

- where:
verb: New|Update
subject: Table
parameter-name: RestoredLogs
hide: true

- where:
verb: New|Update
subject: Table
parameter-name: SearchResults
hide: true

- where:
verb: New|Update
subject: Workspace
parameter-name: SkuCapacityReservationLevel
set:
parameter-name: SkuCapacity

- where:
verb: New|Update
subject: Workspace
parameter-name: WorkspaceCappingDailyQuotaGb
set:
parameter-name: DailyQuotaGb

- where:
verb: Remove
subject: Workspace
parameter-name: Force
set:
parameter-name: ForceDelete
# For memory object that generate cmdlet.
#- model-cmdlet:
# - Column # Successfull generated after hide it for custom.
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

# ----------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
# is regenerated.
# ----------------------------------------------------------------------------------

<#
.Synopsis
Create an in-memory object for Column.
.Description
Create an in-memory object for Column.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.OperationalInsights.Models.Api20211201Preview.Column
.Link
https://docs.microsoft.com/powershell/module/az.OperationalInsights/new-AzOperationalInsightsTableColumnObject
#>
function New-AzOperationalInsightsTableColumnObject {
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.OperationalInsights.Models.Api20211201Preview.Column')]
[CmdletBinding(PositionalBinding=$false)]
Param(

[Parameter(HelpMessage="Column data type logical hint.")]
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.OperationalInsights.Support.ColumnDataTypeHintEnum])]
[Microsoft.Azure.PowerShell.Cmdlets.OperationalInsights.Support.ColumnDataTypeHintEnum]
$DataTypeHint,
[Parameter(HelpMessage="Column description.")]
[string]
$Description,
[Parameter(HelpMessage="Column display name.")]
[string]
$DisplayName,
[Parameter(HelpMessage="Column name.")]
[string]
$Name,
[Parameter(HelpMessage="Column data type.")]
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.OperationalInsights.Support.ColumnTypeEnum])]
[Microsoft.Azure.PowerShell.Cmdlets.OperationalInsights.Support.ColumnTypeEnum]
$Type
)

process {
$Object = [Microsoft.Azure.PowerShell.Cmdlets.OperationalInsights.Models.Api20211201Preview.Column]::New()

if ($PSBoundParameters.ContainsKey('DataTypeHint')) {
$Object.DataTypeHint = $DataTypeHint
}
if ($PSBoundParameters.ContainsKey('Description')) {
$Object.Description = $Description
}
if ($PSBoundParameters.ContainsKey('DisplayName')) {
$Object.DisplayName = $DisplayName
}
if ($PSBoundParameters.ContainsKey('Name')) {
$Object.Name = $Name
}
if ($PSBoundParameters.ContainsKey('Type')) {
$Object.Type = $Type
}
return $Object
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Custom
This directory contains custom implementation for non-generated cmdlets for the `Az.OperationalInsights` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `../exports` folder. The only generated file into this folder is the `Az.OperationalInsights.custom.psm1`. This file should not be modified.

## Info
- Modifiable: yes
- Generated: partial
- Committed: yes
- Packaged: yes

## Details
For `Az.OperationalInsights` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*.

For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.OperationalInsights.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder.

For script cmdlets, these are loaded via the `Az.OperationalInsights.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build.

## Purpose
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `../exports` folder.

## Usage
The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `../exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters:
- Break
- DefaultProfile
- HttpPipelineAppend
- HttpPipelinePrepend
- Proxy
- ProxyCredential
- ProxyUseDefaultCredentials

These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.OperationalInsights`. For C#, follow the usage seen in the `ProcessRecordAsync` method.

### Attributes
For processing the cmdlets, we've created some additional attributes:
- `Microsoft.Azure.PowerShell.Cmdlets.OperationalInsights.DescriptionAttribute`
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
- `Microsoft.Azure.PowerShell.Cmdlets.OperationalInsights.DoNotExportAttribute`
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.OperationalInsights`.
- `Microsoft.Azure.PowerShell.Cmdlets.OperationalInsights.InternalExportAttribute`
- Used in C# cmdlets to route exported cmdlets to the `../internal`, which are *not exposed* by `Az.OperationalInsights`. For more information, see [README.md](../internal/README.md) in the `../internal` folder.
- `Microsoft.Azure.PowerShell.Cmdlets.OperationalInsights.ProfileAttribute`
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
Module Name: Az.OperationalInsights
Module Guid: c4733603-3414-41cb-b2f6-2e53c59925f4
Download Help Link: https://docs.microsoft.com/powershell/module/az.operationalinsights
Help Version: 1.0.0.0
Locale: en-US
---

# Az.OperationalInsights Module
## Description
Microsoft Azure PowerShell: OperationalInsights cmdlets

## Az.OperationalInsights Cmdlets
### [Get-AzOperationalInsightsDeletedWorkspace](Get-AzOperationalInsightsDeletedWorkspace.md)
Gets recently deleted workspaces in a subscription, available for recovery.

### [Get-AzOperationalInsightsTable](Get-AzOperationalInsightsTable.md)
Gets a Log Analytics workspace table.

### [Get-AzOperationalInsightsWorkspace](Get-AzOperationalInsightsWorkspace.md)
Gets a workspace instance.

### [New-AzOperationalInsightsTable](New-AzOperationalInsightsTable.md)
Update or Create a Log Analytics workspace table.

### [New-AzOperationalInsightsTableColumnObject](New-AzOperationalInsightsTableColumnObject.md)
Create an in-memory object for Column.

### [New-AzOperationalInsightsWorkspace](New-AzOperationalInsightsWorkspace.md)
Create or update a workspace.

### [Remove-AzOperationalInsightsTable](Remove-AzOperationalInsightsTable.md)
Delete a Log Analytics workspace table.

### [Remove-AzOperationalInsightsWorkspace](Remove-AzOperationalInsightsWorkspace.md)
Deletes a workspace resource.
To recover the workspace, create it again with the same name, in the same subscription, resource group and location.
The name is kept for 14 days and cannot be used for another workspace.
To remove the workspace completely and release the name, use the force flag.

### [Update-AzOperationalInsightsTable](Update-AzOperationalInsightsTable.md)
Update a Log Analytics workspace table.

### [Update-AzOperationalInsightsWorkspace](Update-AzOperationalInsightsWorkspace.md)
Updates a workspace.

Loading