Skip to content

Commit

Permalink
[NetworkFunctions] bug fix and rename (#18966)
Browse files Browse the repository at this point in the history
* updated readme

* Added custom script for get traffic collector

* readme indentation

* resolving compile issues

* resolving compile issues

* removed extra file

* renamed file

* added new collector policy cmdlet

* solving compile issues

* solving compile issues

* solving compile issues

* added new ps script

* added new ps script

* New cmdlet csharp script

* New cmdlet csharp bug fix

* change operationId in readme

* Changed functions to export

* removing new cmdlet

* Updated swagger commit id

* added customization for location property

* Adding all files after running buildmodule

* updated docs and examples

* minor typo

* removed set cmdlet, simplified custom cmdlets

* removed set cmdlet

* Added update cmdlet

* updated examples

* updating docs folder
  • Loading branch information
kukulkarni1 authored Aug 15, 2022
1 parent 29069a4 commit 9a98bd5
Show file tree
Hide file tree
Showing 39 changed files with 2,028 additions and 1,338 deletions.
11 changes: 11 additions & 0 deletions src/NetworkFunction/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
bin
obj
.vs
generated
internal
exports
tools
custom/*.psm1
custom/autogen-model-cmdlets
test/*-TestResults.xml
/*.ps1
/*.ps1xml
/*.psm1
/*.snk
/*.csproj
/*.nuspec
2 changes: 1 addition & 1 deletion src/NetworkFunction/Az.NetworkFunction.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.NetworkFunction.private.dll'
FormatsToProcess = './Az.NetworkFunction.format.ps1xml'
FunctionsToExport = 'Get-AzNetworkFunctionOperation', 'Get-AzNetworkFunctionTrafficCollector', 'Get-AzNetworkFunctionTrafficCollectorPolicy', 'New-AzNetworkFunctionTrafficCollector', 'New-AzNetworkFunctionTrafficCollectorPolicy', 'Remove-AzNetworkFunctionTrafficCollector', 'Remove-AzNetworkFunctionTrafficCollectorPolicy', 'Set-AzNetworkFunctionTrafficCollector', 'Set-AzNetworkFunctionTrafficCollectorPolicy', 'Update-AzNetworkFunctionTrafficCollectorTag', '*'
FunctionsToExport = 'Get-AzNetworkFunctionCollectorPolicy', 'Get-AzNetworkFunctionTrafficCollector', 'New-AzNetworkFunctionCollectorPolicy', 'New-AzNetworkFunctionTrafficCollector', 'Remove-AzNetworkFunctionCollectorPolicy', 'Remove-AzNetworkFunctionTrafficCollector', 'Update-AzNetworkFunctionTrafficCollectorTag', '*'
AliasesToExport = '*'
PrivateData = @{
PSData = @{
Expand Down
24 changes: 20 additions & 4 deletions src/NetworkFunction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ This directory contains the PowerShell module for the Az.NetworkFunction service
## 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.NetworkFunction`, see [how-to.md](how-to.md).
<!-- endregion -->
Expand All @@ -24,11 +30,11 @@ For information on how to develop for `Az.NetworkFunction`, see [how-to.md](how-
> see https://aka.ms/autorest
``` yaml
branch: 2f47130d8fb333f55596ca9d149fbdceaff6f4be
branch: 1cefdabe75c75323c6d3def3f6c80850c624bdea
require:
- $(this-folder)/../readme.azure.noprofile.md
input-file:
- $(repo)/specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/AzureTrafficCollector.json
- $(repo)/specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-08-01/AzureTrafficCollector.json
module-version: 0.1.0
title: NetworkFunction
subject-prefix: $(service-name)
Expand All @@ -37,10 +43,20 @@ resourcegroup-append: true
nested-object-to-string: true

directive:
- where:
subject: ^AzureTrafficCollector(.*)
set:
subject: TrafficCollector$1
- where:
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
hide: true
- from: swagger-document
where: $.paths..operationId
transform: return $.replace(/^(AzureTrafficCollectors)(.+)(_List)$/, "$1$3$2")
- where:
subject: (.)*(Operation)$
hide: true
- where:
verb: Set
verb: New|Set
hide: true
```
```
178 changes: 178 additions & 0 deletions src/NetworkFunction/custom/New-AzNetworkFunctionCollectorPolicy.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@

# ----------------------------------------------------------------------------------
# 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
Creates or updates a Collector Policy resource
.Description
Creates or updates a Collector Policy resource
.Example
{{ Add code here }}
.Example
{{ Add code here }}
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Models.Api20220801.ICollectorPolicy
.Notes
COMPLEX PARAMETER PROPERTIES
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
EMISSIONPOLICY <IEmissionPoliciesPropertiesFormat[]>: Emission policies.
[EmissionDestination <IEmissionPolicyDestination[]>]: Emission policy destinations.
[DestinationType <DestinationType?>]: Emission destination type.
[EmissionType <EmissionType?>]: Emission format type.
INGESTIONPOLICYINGESTIONSOURCE <IIngestionSourcesPropertiesFormat[]>: Ingestion Sources.
[ResourceId <String>]: Resource ID.
[SourceType <SourceType?>]: Ingestion source type.
.Link
https://docs.microsoft.com/powershell/module/az.networkfunction/new-aznetworkfunctioncollectorpolicy
#>
function New-AzNetworkFunctionCollectorPolicy {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Models.Api20220801.ICollectorPolicy])]
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Path')]
[System.String]
# Azure Traffic Collector name
${AzureTrafficCollectorName},

[Parameter(Mandatory)]
[Alias('CollectorPolicyName')]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Path')]
[System.String]
# Collector Policy Name
${Name},

[Parameter(Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Path')]
[System.String]
# The name of the resource group.
${ResourceGroupName},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
[System.String]
# Azure Subscription ID.
${SubscriptionId},

[Parameter()]
[AllowEmptyCollection()]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Models.Api20220801.IEmissionPoliciesPropertiesFormat[]]
# Emission policies.
# To construct, see NOTES section for EMISSIONPOLICY properties and create a hash table.
${EmissionPolicy},

[Parameter()]
[AllowEmptyCollection()]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Models.Api20220801.IIngestionSourcesPropertiesFormat[]]
# Ingestion Sources.
# To construct, see NOTES section for INGESTIONPOLICYINGESTIONSOURCE properties and create a hash table.
${IngestionPolicyIngestionSource},

[Parameter()]
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Support.IngestionType])]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Support.IngestionType]
# The ingestion type.
${IngestionPolicyIngestionType},

[Parameter(Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Body')]
[System.String]
# Resource location.
${Location},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Models.Api20220801.ITrackedResourceTags]))]
[System.Collections.Hashtable]
# Resource tags.
${Tag},

[Parameter()]
[Alias('AzureRMContext', 'AzureCredential')]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Azure')]
[System.Management.Automation.PSObject]
# The credentials, account, tenant, and subscription used for communication with Azure.
${DefaultProfile},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Run the command as a job
${AsJob},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Wait for .NET debugger to attach
${Break},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be appended to the front of the pipeline
${HttpPipelineAppend},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
${HttpPipelinePrepend},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Run the command asynchronously
${NoWait},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Runtime')]
[System.Uri]
# The URI for the proxy server to use
${Proxy},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Runtime')]
[System.Management.Automation.PSCredential]
# Credentials for a proxy server to use for the remote call
${ProxyCredential},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.NetworkFunction.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Use the default credentials for the proxy
${ProxyUseDefaultCredentials}
)

process {
try {
Az.NetworkFunction.internal\New-AzNetworkFunctionCollectorPolicy @PSBoundParameters
} catch {
throw
}
}
}
Loading

0 comments on commit 9a98bd5

Please sign in to comment.